Removed trailing whitespace.

This commit is contained in:
Vincent Béron 2002-05-31 23:06:46 +00:00 committed by Alexandre Julliard
parent 332d62ba10
commit 9a62491660
815 changed files with 22512 additions and 22512 deletions

View File

@ -225,7 +225,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED ); set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED );
} }
break; break;
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
if(style & BS_NOTIFY || if(style & BS_NOTIFY ||
btn_type == BS_RADIOBUTTON || btn_type == BS_RADIOBUTTON ||
@ -342,7 +342,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
if ((btn_type == BS_RADIOBUTTON || btn_type == BS_AUTORADIOBUTTON) && (GetCapture() != hWnd) && if ((btn_type == BS_RADIOBUTTON || btn_type == BS_AUTORADIOBUTTON) && (GetCapture() != hWnd) &&
!(SendMessageW(hWnd, BM_GETCHECK, 0, 0) & BST_CHECKED)) !(SendMessageW(hWnd, BM_GETCHECK, 0, 0) & BST_CHECKED))
{ {
/* The notification is sent when the button (BS_AUTORADIOBUTTON) /* The notification is sent when the button (BS_AUTORADIOBUTTON)
is unchecked and the focus was not given by a mouse click. */ is unchecked and the focus was not given by a mouse click. */
if (btn_type == BS_AUTORADIOBUTTON) if (btn_type == BS_AUTORADIOBUTTON)
SendMessageW( hWnd, BM_SETCHECK, BUTTON_CHECKED, 0 ); SendMessageW( hWnd, BM_SETCHECK, BUTTON_CHECKED, 0 );
@ -581,7 +581,7 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
break; break;
default: default:
empty_rect: empty_rect:
r.right = r.left; r.right = r.left;
r.bottom = r.top; r.bottom = r.top;
return (UINT)(LONG)-1; return (UINT)(LONG)-1;
@ -732,7 +732,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetPixel( hDC, rc.right-1, rc.bottom-1, clr_wnd); SetPixel( hDC, rc.right-1, rc.bottom-1, clr_wnd);
InflateRect( &rc, -1, -1 ); InflateRect( &rc, -1, -1 );
} }
if (get_button_type(style) == BS_DEFPUSHBUTTON) if (get_button_type(style) == BS_DEFPUSHBUTTON)
{ {
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
@ -845,14 +845,14 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
if (!hBrush) /* did the app forget to call defwindowproc ? */ if (!hBrush) /* did the app forget to call defwindowproc ? */
hBrush = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORSTATIC, hDC, (LPARAM)hwnd ); hBrush = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORSTATIC, hDC, (LPARAM)hwnd );
if (style & BS_LEFTTEXT) if (style & BS_LEFTTEXT)
{ {
/* magic +4 is what CTL3D expects */ /* magic +4 is what CTL3D expects */
rtext.right -= checkBoxWidth + 4; rtext.right -= checkBoxWidth + 4;
rbox.left = rbox.right - checkBoxWidth; rbox.left = rbox.right - checkBoxWidth;
} }
else else
{ {
rtext.left += checkBoxWidth + 4; rtext.left += checkBoxWidth + 4;
rbox.right = checkBoxWidth; rbox.right = checkBoxWidth;
@ -860,7 +860,7 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
/* Draw the check-box bitmap */ /* Draw the check-box bitmap */
if (action == ODA_DRAWENTIRE || action == ODA_SELECT) if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
{ {
/* Since WM_ERASEBKGND does nothing, first prepare background */ /* Since WM_ERASEBKGND does nothing, first prepare background */
if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush ); if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
else FillRect( hDC, &client, hBrush ); else FillRect( hDC, &client, hBrush );
@ -905,10 +905,10 @@ static void CB_Paint( HWND hwnd, HDC hDC, UINT action )
if (style & WS_DISABLED) flags |= DFCS_INACTIVE; if (style & WS_DISABLED) flags |= DFCS_INACTIVE;
/* rbox must have the correct height */ /* rbox must have the correct height */
delta = rbox.bottom - rbox.top - checkBoxHeight; delta = rbox.bottom - rbox.top - checkBoxHeight;
if (delta > 0) if (delta > 0)
{ {
int ofs = (abs(delta) / 2); int ofs = (abs(delta) / 2);
rbox.bottom -= ofs + 1; rbox.bottom -= ofs + 1;
rbox.top = rbox.bottom - checkBoxHeight; rbox.top = rbox.bottom - checkBoxHeight;

View File

@ -1,8 +1,8 @@
/* /*
* Combo controls * Combo controls
* *
* Copyright 1997 Alex Korobka * Copyright 1997 Alex Korobka
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
@ -97,7 +97,7 @@ const struct builtin_class_descr COMBO_builtin_class =
static BOOL COMBO_Init() static BOOL COMBO_Init()
{ {
HDC hDC; HDC hDC;
if( hComboBmp ) return TRUE; if( hComboBmp ) return TRUE;
if( (hDC = CreateCompatibleDC(0)) ) if( (hDC = CreateCompatibleDC(0)) )
{ {
@ -171,7 +171,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
{ {
TRACE("[%04x]: freeing storage\n", lphc->self); TRACE("[%04x]: freeing storage\n", lphc->self);
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox ) if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
DestroyWindow( lphc->hWndLBox ); DestroyWindow( lphc->hWndLBox );
SetWindowLongA( lphc->self, 0, 0 ); SetWindowLongA( lphc->self, 0, 0 );
@ -183,9 +183,9 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
/*********************************************************************** /***********************************************************************
* CBGetTextAreaHeight * CBGetTextAreaHeight
* *
* This method will calculate the height of the text area of the * This method will calculate the height of the text area of the
* combobox. * combobox.
* The height of the text area is set in two ways. * The height of the text area is set in two ways.
* It can be set explicitly through a combobox message or through a * It can be set explicitly through a combobox message or through a
* WM_MEASUREITEM callback. * WM_MEASUREITEM callback.
* If this is not the case, the height is set to 13 dialog units. * If this is not the case, the height is set to 13 dialog units.
@ -207,19 +207,19 @@ static INT CBGetTextAreaHeight(
HDC hDC = GetDC(hwnd); HDC hDC = GetDC(hwnd);
HFONT hPrevFont = 0; HFONT hPrevFont = 0;
INT baseUnitY; INT baseUnitY;
if (lphc->hFont) if (lphc->hFont)
hPrevFont = SelectObject( hDC, lphc->hFont ); hPrevFont = SelectObject( hDC, lphc->hFont );
GetTextMetricsW(hDC, &tm); GetTextMetricsW(hDC, &tm);
baseUnitY = tm.tmHeight; baseUnitY = tm.tmHeight;
if( hPrevFont ) if( hPrevFont )
SelectObject( hDC, hPrevFont ); SelectObject( hDC, hPrevFont );
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
iTextItemHeight = ((13 * baseUnitY) / 8); iTextItemHeight = ((13 * baseUnitY) / 8);
/* /*
@ -229,7 +229,7 @@ static INT CBGetTextAreaHeight(
*/ */
iTextItemHeight -= 2*COMBO_YBORDERSIZE(); iTextItemHeight -= 2*COMBO_YBORDERSIZE();
} }
/* /*
* Check the ownerdraw case if we haven't asked the parent the size * Check the ownerdraw case if we haven't asked the parent the size
* of the item yet. * of the item yet.
@ -246,9 +246,9 @@ static INT CBGetTextAreaHeight(
* We use the client rect for the width of the item. * We use the client rect for the width of the item.
*/ */
GetClientRect(hwnd, &clientRect); GetClientRect(hwnd, &clientRect);
lphc->wState &= ~CBF_MEASUREITEM; lphc->wState &= ~CBF_MEASUREITEM;
/* /*
* Send a first one to measure the size of the text area * Send a first one to measure the size of the text area
*/ */
@ -276,9 +276,9 @@ static INT CBGetTextAreaHeight(
SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem); SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
lphc->fixedOwnerDrawHeight = measureItem.itemHeight; lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
} }
/* /*
* Keep the size for the next time * Keep the size for the next time
*/ */
lphc->editHeight = iTextItemHeight; lphc->editHeight = iTextItemHeight;
} }
@ -300,7 +300,7 @@ static void CBForceDummyResize(
int newComboHeight; int newComboHeight;
newComboHeight = CBGetTextAreaHeight(lphc->self,lphc) + 2*COMBO_YBORDERSIZE(); newComboHeight = CBGetTextAreaHeight(lphc->self,lphc) + 2*COMBO_YBORDERSIZE();
GetWindowRect(lphc->self, &windowRect); GetWindowRect(lphc->self, &windowRect);
/* /*
@ -327,8 +327,8 @@ static void CBForceDummyResize(
static void CBCalcPlacement( static void CBCalcPlacement(
HWND hwnd, HWND hwnd,
LPHEADCOMBO lphc, LPHEADCOMBO lphc,
LPRECT lprEdit, LPRECT lprEdit,
LPRECT lprButton, LPRECT lprButton,
LPRECT lprLB) LPRECT lprLB)
{ {
/* /*
@ -354,7 +354,7 @@ static void CBCalcPlacement(
/* /*
* If the combobox is "simple" there is no button. * If the combobox is "simple" there is no button.
*/ */
if( CB_GETTYPE(lphc) == CBS_SIMPLE ) if( CB_GETTYPE(lphc) == CBS_SIMPLE )
lprButton->left = lprButton->right = lprButton->bottom = 0; lprButton->left = lprButton->right = lprButton->bottom = 0;
else else
{ {
@ -366,7 +366,7 @@ static void CBCalcPlacement(
lprButton->left = lprButton->right - GetSystemMetrics(SM_CXVSCROLL); lprButton->left = lprButton->right - GetSystemMetrics(SM_CXVSCROLL);
lprEdit->right = lprButton->left; lprEdit->right = lprButton->left;
} }
/* /*
* In the case of a dropdown, there is an additional spacing between the * In the case of a dropdown, there is an additional spacing between the
* text area and the button. * text area and the button.
@ -383,7 +383,7 @@ static void CBCalcPlacement(
{ {
InflateRect(lprEdit, -EDIT_CONTROL_PADDING(), -EDIT_CONTROL_PADDING()); InflateRect(lprEdit, -EDIT_CONTROL_PADDING(), -EDIT_CONTROL_PADDING());
} }
/* /*
* Adjust the size of the listbox popup. * Adjust the size of the listbox popup.
*/ */
@ -410,7 +410,7 @@ static void CBCalcPlacement(
/* /*
* In the case of a dropdown, the popup listbox is offset to the right. * In the case of a dropdown, the popup listbox is offset to the right.
* so, we want to make sure it's flush with the right side of the * so, we want to make sure it's flush with the right side of the
* combobox * combobox
*/ */
if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
@ -422,11 +422,11 @@ static void CBCalcPlacement(
TRACE("\ttext\t= (%i,%i-%i,%i)\n", TRACE("\ttext\t= (%i,%i-%i,%i)\n",
lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom); lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom);
TRACE("\tbutton\t= (%i,%i-%i,%i)\n", TRACE("\tbutton\t= (%i,%i-%i,%i)\n",
lprButton->left, lprButton->top, lprButton->right, lprButton->bottom); lprButton->left, lprButton->top, lprButton->right, lprButton->bottom);
TRACE("\tlbox\t= (%i,%i-%i,%i)\n", TRACE("\tlbox\t= (%i,%i-%i,%i)\n",
lprLB->left, lprLB->top, lprLB->right, lprLB->bottom ); lprLB->left, lprLB->top, lprLB->right, lprLB->bottom );
} }
@ -437,7 +437,7 @@ static void CBGetDroppedControlRect( LPHEADCOMBO lphc, LPRECT lpRect)
{ {
/* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner /* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
of the combo box and the lower right corner of the listbox */ of the combo box and the lower right corner of the listbox */
GetWindowRect(lphc->self, lpRect); GetWindowRect(lphc->self, lpRect);
lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left; lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
@ -446,7 +446,7 @@ static void CBGetDroppedControlRect( LPHEADCOMBO lphc, LPRECT lpRect)
} }
/*********************************************************************** /***********************************************************************
* COMBO_WindowPosChanging * COMBO_WindowPosChanging
*/ */
static LRESULT COMBO_WindowPosChanging( static LRESULT COMBO_WindowPosChanging(
HWND hwnd, HWND hwnd,
@ -459,7 +459,7 @@ static LRESULT COMBO_WindowPosChanging(
* always the same height. We have to make sure they are not resized * always the same height. We have to make sure they are not resized
* to another value. * to another value.
*/ */
if ( ( CB_GETTYPE(lphc) != CBS_SIMPLE ) && if ( ( CB_GETTYPE(lphc) != CBS_SIMPLE ) &&
((posChanging->flags & SWP_NOSIZE) == 0) ) ((posChanging->flags & SWP_NOSIZE) == 0) )
{ {
int newComboHeight; int newComboHeight;
@ -547,7 +547,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
/* create listbox popup */ /* create listbox popup */
lbeStyle = (LBS_NOTIFY | WS_BORDER | WS_CLIPSIBLINGS | WS_CHILD) | lbeStyle = (LBS_NOTIFY | WS_BORDER | WS_CLIPSIBLINGS | WS_CHILD) |
(style & (WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)); (style & (WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE));
if( lphc->dwStyle & CBS_SORT ) if( lphc->dwStyle & CBS_SORT )
@ -558,7 +558,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lbeStyle |= LBS_NOINTEGRALHEIGHT; lbeStyle |= LBS_NOINTEGRALHEIGHT;
if( lphc->dwStyle & CBS_DISABLENOSCROLL ) if( lphc->dwStyle & CBS_DISABLENOSCROLL )
lbeStyle |= LBS_DISABLENOSCROLL; lbeStyle |= LBS_DISABLENOSCROLL;
if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */ if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */
{ {
lbeStyle |= WS_VISIBLE; lbeStyle |= WS_VISIBLE;
@ -576,12 +576,12 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lphc->hWndLBox = CreateWindowExW(lbeExStyle, lphc->hWndLBox = CreateWindowExW(lbeExStyle,
clbName, clbName,
NULL, NULL,
lbeStyle, lbeStyle,
lphc->droppedRect.left, lphc->droppedRect.left,
lphc->droppedRect.top, lphc->droppedRect.top,
lphc->droppedRect.right - lphc->droppedRect.left, lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top, lphc->droppedRect.bottom - lphc->droppedRect.top,
hwnd, (HMENU)ID_CB_LISTBOX, hwnd, (HMENU)ID_CB_LISTBOX,
GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc ); GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
@ -591,13 +591,13 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO; lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO;
/* /*
* In Win95 look, the border fo the edit control is * In Win95 look, the border fo the edit control is
* provided by the combobox * provided by the combobox
*/ */
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
lbeStyle |= WS_BORDER; lbeStyle |= WS_BORDER;
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
{ {
if( lphc->dwStyle & CBS_OEMCONVERT ) if( lphc->dwStyle & CBS_OEMCONVERT )
lbeStyle |= ES_OEMCONVERT; lbeStyle |= ES_OEMCONVERT;
@ -611,18 +611,18 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED; if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
lphc->hWndEdit = CreateWindowExW(0, lphc->hWndEdit = CreateWindowExW(0,
editName, editName,
NULL, NULL,
lbeStyle, lbeStyle,
lphc->textRect.left, lphc->textRect.top, lphc->textRect.left, lphc->textRect.top,
lphc->textRect.right - lphc->textRect.left, lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top, lphc->textRect.bottom - lphc->textRect.top,
hwnd, (HMENU)ID_CB_EDIT, hwnd, (HMENU)ID_CB_EDIT,
GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL ); GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
if( !lphc->hWndEdit ) if( !lphc->hWndEdit )
bEdit = FALSE; bEdit = FALSE;
} }
if( bEdit ) if( bEdit )
{ {
@ -630,7 +630,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
{ {
/* Now do the trick with parent */ /* Now do the trick with parent */
SetParent(lphc->hWndLBox, HWND_DESKTOP); SetParent(lphc->hWndLBox, HWND_DESKTOP);
/* /*
* If the combo is a dropdown, we must resize the control * If the combo is a dropdown, we must resize the control
* to fit only the text area and button. To do this, * to fit only the text area and button. To do this,
* we send a dummy resize and the WM_WINDOWPOSCHANGING message * we send a dummy resize and the WM_WINDOWPOSCHANGING message
@ -657,11 +657,11 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
* Paint combo button (normal, pressed, and disabled states). * Paint combo button (normal, pressed, and disabled states).
*/ */
static void CBPaintButton( static void CBPaintButton(
LPHEADCOMBO lphc, LPHEADCOMBO lphc,
HDC hdc, HDC hdc,
RECT rectButton) RECT rectButton)
{ {
if( lphc->wState & CBF_NOREDRAW ) if( lphc->wState & CBF_NOREDRAW )
return; return;
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
@ -671,7 +671,7 @@ static void CBPaintButton(
HDC hMemDC; HDC hMemDC;
HBRUSH hPrevBrush; HBRUSH hPrevBrush;
COLORREF oldTextColor, oldBkColor; COLORREF oldTextColor, oldBkColor;
hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE)); hPrevBrush = SelectObject(hdc, GetSysColorBrush(COLOR_BTNFACE));
@ -684,26 +684,26 @@ static void CBPaintButton(
rectButton.right-rectButton.left, rectButton.right-rectButton.left,
rectButton.bottom-rectButton.top, rectButton.bottom-rectButton.top,
PATCOPY ); PATCOPY );
if( (bBool = lphc->wState & CBF_BUTTONDOWN) ) if( (bBool = lphc->wState & CBF_BUTTONDOWN) )
{ {
DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT ); DrawEdge( hdc, &rectButton, EDGE_SUNKEN, BF_RECT );
} }
else else
{ {
DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT ); DrawEdge( hdc, &rectButton, EDGE_RAISED, BF_RECT );
} }
/* /*
* Remove the edge of the button from the rectangle * Remove the edge of the button from the rectangle
* and calculate the position of the bitmap. * and calculate the position of the bitmap.
*/ */
InflateRect( &rectButton, -2, -2); InflateRect( &rectButton, -2, -2);
x = (rectButton.left + rectButton.right - CBitWidth) >> 1; x = (rectButton.left + rectButton.right - CBitWidth) >> 1;
y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1; y = (rectButton.top + rectButton.bottom - CBitHeight) >> 1;
hMemDC = CreateCompatibleDC( hdc ); hMemDC = CreateCompatibleDC( hdc );
SelectObject( hMemDC, hComboBmp ); SelectObject( hMemDC, hComboBmp );
oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) ); oldTextColor = SetTextColor( hdc, GetSysColor(COLOR_BTNFACE) );
@ -732,7 +732,7 @@ static void CBPaintButton(
DrawFrameControl(hdc, DrawFrameControl(hdc,
&rectButton, &rectButton,
DFC_SCROLL, DFC_SCROLL,
buttonState); buttonState);
} }
} }
@ -742,7 +742,7 @@ static void CBPaintButton(
* Paint CBS_DROPDOWNLIST text field / update edit control contents. * Paint CBS_DROPDOWNLIST text field / update edit control contents.
*/ */
static void CBPaintText( static void CBPaintText(
LPHEADCOMBO lphc, LPHEADCOMBO lphc,
HDC hdc, HDC hdc,
RECT rectEdit) RECT rectEdit)
{ {
@ -753,7 +753,7 @@ static void CBPaintText(
TRACE("\n"); TRACE("\n");
/* follow Windows combobox that sends a bunch of text /* follow Windows combobox that sends a bunch of text
* inquiries to its listbox while processing WM_PAINT. */ * inquiries to its listbox while processing WM_PAINT. */
if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR ) if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR )
@ -774,7 +774,7 @@ static void CBPaintText(
{ {
static const WCHAR empty_stringW[] = { 0 }; static const WCHAR empty_stringW[] = { 0 };
if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW ); if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW );
if( lphc->wState & CBF_FOCUSED ) if( lphc->wState & CBF_FOCUSED )
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
} }
else /* paint text field ourselves */ else /* paint text field ourselves */
@ -786,7 +786,7 @@ static void CBPaintText(
* Give ourselves some space. * Give ourselves some space.
*/ */
InflateRect( &rectEdit, -1, -1 ); InflateRect( &rectEdit, -1, -1 );
if( CB_OWNERDRAWN(lphc) ) if( CB_OWNERDRAWN(lphc) )
{ {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
@ -794,7 +794,7 @@ static void CBPaintText(
UINT ctlid = GetWindowLongA( lphc->self, GWL_ID ); UINT ctlid = GetWindowLongA( lphc->self, GWL_ID );
/* setup state for DRAWITEM message. Owner will highlight */ /* setup state for DRAWITEM message. Owner will highlight */
if ( (lphc->wState & CBF_FOCUSED) && if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) ) !(lphc->wState & CBF_DROPPED) )
itemState |= ODS_SELECTED | ODS_FOCUS; itemState |= ODS_SELECTED | ODS_FOCUS;
@ -804,7 +804,7 @@ static void CBPaintText(
* clip region. * clip region.
*/ */
clipRegion = CreateRectRgnIndirect(&rectEdit); clipRegion = CreateRectRgnIndirect(&rectEdit);
if (GetClipRgn(hdc, clipRegion)!=1) if (GetClipRgn(hdc, clipRegion)!=1)
{ {
DeleteObject(clipRegion); DeleteObject(clipRegion);
@ -821,9 +821,9 @@ static void CBPaintText(
dis.itemState = itemState; dis.itemState = itemState;
dis.hDC = hdc; dis.hDC = hdc;
dis.rcItem = rectEdit; dis.rcItem = rectEdit;
dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA,
(WPARAM)id, 0 ); (WPARAM)id, 0 );
/* /*
* Clip the DC and have the parent draw the item. * Clip the DC and have the parent draw the item.
*/ */
@ -836,33 +836,33 @@ static void CBPaintText(
/* /*
* Reset the clipping region. * Reset the clipping region.
*/ */
SelectClipRgn(hdc, clipRegion); SelectClipRgn(hdc, clipRegion);
} }
else else
{ {
static const WCHAR empty_stringW[] = { 0 }; static const WCHAR empty_stringW[] = { 0 };
if ( (lphc->wState & CBF_FOCUSED) && if ( (lphc->wState & CBF_FOCUSED) &&
!(lphc->wState & CBF_DROPPED) ) { !(lphc->wState & CBF_DROPPED) ) {
/* highlight */ /* highlight */
FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) ); FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) ); SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) ); SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
} }
ExtTextOutW( hdc, ExtTextOutW( hdc,
rectEdit.left + 1, rectEdit.left + 1,
rectEdit.top + 1, rectEdit.top + 1,
ETO_OPAQUE | ETO_CLIPPED, ETO_OPAQUE | ETO_CLIPPED,
&rectEdit, &rectEdit,
pText ? pText : empty_stringW , size, NULL ); pText ? pText : empty_stringW , size, NULL );
if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED)) if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
DrawFocusRect( hdc, &rectEdit ); DrawFocusRect( hdc, &rectEdit );
} }
if( hPrevFont ) if( hPrevFont )
SelectObject(hdc, hPrevFont ); SelectObject(hdc, hPrevFont );
} }
if (pText) if (pText)
@ -874,7 +874,7 @@ static void CBPaintText(
*/ */
static void CBPaintBorder( static void CBPaintBorder(
HWND hwnd, HWND hwnd,
LPHEADCOMBO lphc, LPHEADCOMBO lphc,
HDC hdc) HDC hdc)
{ {
RECT clientRect; RECT clientRect;
@ -937,7 +937,7 @@ static HBRUSH COMBO_PrepareColors(
/* /*
* Catch errors. * Catch errors.
*/ */
if( !hBkgBrush ) if( !hBkgBrush )
hBkgBrush = GetSysColorBrush(COLOR_WINDOW); hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
return hBkgBrush; return hBkgBrush;
@ -947,7 +947,7 @@ static HBRUSH COMBO_PrepareColors(
* COMBO_EraseBackground * COMBO_EraseBackground
*/ */
static LRESULT COMBO_EraseBackground( static LRESULT COMBO_EraseBackground(
HWND hwnd, HWND hwnd,
LPHEADCOMBO lphc, LPHEADCOMBO lphc,
HDC hParamDC) HDC hParamDC)
{ {
@ -956,14 +956,14 @@ static LRESULT COMBO_EraseBackground(
if(lphc->wState & CBF_EDIT) if(lphc->wState & CBF_EDIT)
return TRUE; return TRUE;
hDC = (hParamDC) ? hParamDC hDC = (hParamDC) ? hParamDC
: GetDC(hwnd); : GetDC(hwnd);
/* /*
* Retrieve the background brush * Retrieve the background brush
*/ */
hBkgBrush = COMBO_PrepareColors(lphc, hDC); hBkgBrush = COMBO_PrepareColors(lphc, hDC);
FillRect(hDC, &lphc->textRect, hBkgBrush); FillRect(hDC, &lphc->textRect, hBkgBrush);
if (!hParamDC) if (!hParamDC)
@ -979,7 +979,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hDC; HDC hDC;
hDC = (hParamDC) ? hParamDC hDC = (hParamDC) ? hParamDC
: BeginPaint( lphc->self, &ps); : BeginPaint( lphc->self, &ps);
@ -1019,7 +1019,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
FrameRect( hDC, &rPadEdit, GetSysColorBrush(COLOR_WINDOW) ); FrameRect( hDC, &rPadEdit, GetSysColorBrush(COLOR_WINDOW) );
} }
if( !(lphc->wState & CBF_EDIT) ) if( !(lphc->wState & CBF_EDIT) )
{ {
/* /*
@ -1028,8 +1028,8 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
{ {
HPEN hPrevPen = SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); HPEN hPrevPen = SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
Rectangle( hDC, Rectangle( hDC,
lphc->textRect.left, lphc->textRect.top, lphc->textRect.left, lphc->textRect.top,
lphc->textRect.right - 1, lphc->textRect.bottom - 1); lphc->textRect.right - 1, lphc->textRect.bottom - 1);
@ -1043,7 +1043,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
SelectObject( hDC, hPrevBrush ); SelectObject( hDC, hPrevBrush );
} }
if( !hParamDC ) if( !hParamDC )
EndPaint(lphc->self, &ps); EndPaint(lphc->self, &ps);
return 0; return 0;
@ -1058,11 +1058,11 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
{ {
INT length, idx; INT length, idx;
LPWSTR pText = NULL; LPWSTR pText = NULL;
idx = LB_ERR; idx = LB_ERR;
length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 ); length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
if( length > 0 ) if( length > 0 )
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR)); pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
TRACE("\t edit text length %i\n", length ); TRACE("\t edit text length %i\n", length );
@ -1124,7 +1124,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
/*********************************************************************** /***********************************************************************
* CBDropDown * CBDropDown
* *
* Show listbox popup. * Show listbox popup.
*/ */
static void CBDropDown( LPHEADCOMBO lphc ) static void CBDropDown( LPHEADCOMBO lphc )
@ -1159,7 +1159,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
/* now set popup position */ /* now set popup position */
GetWindowRect( lphc->self, &rect ); GetWindowRect( lphc->self, &rect );
/* /*
* If it's a dropdown, the listbox is offset * If it's a dropdown, the listbox is offset
*/ */
@ -1193,14 +1193,14 @@ static void CBDropDown( LPHEADCOMBO lphc )
if( (rect.bottom + nDroppedHeight) >= GetSystemMetrics( SM_CYSCREEN ) ) if( (rect.bottom + nDroppedHeight) >= GetSystemMetrics( SM_CYSCREEN ) )
rect.bottom = rect.top - nDroppedHeight; rect.bottom = rect.top - nDroppedHeight;
SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom, SetWindowPos( lphc->hWndLBox, HWND_TOP, rect.left, rect.bottom,
lphc->droppedRect.right - lphc->droppedRect.left, lphc->droppedRect.right - lphc->droppedRect.left,
nDroppedHeight, nDroppedHeight,
SWP_NOACTIVATE | SWP_SHOWWINDOW); SWP_NOACTIVATE | SWP_SHOWWINDOW);
if( !(lphc->wState & CBF_NOREDRAW) ) if( !(lphc->wState & CBF_NOREDRAW) )
RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE | RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN ); RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
EnableWindow( lphc->hWndLBox, TRUE ); EnableWindow( lphc->hWndLBox, TRUE );
@ -1217,7 +1217,7 @@ static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
{ {
HWND hWnd = lphc->self; HWND hWnd = lphc->self;
TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n", TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED)); lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL ); CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
@ -1225,7 +1225,7 @@ static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE ) if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
{ {
if( lphc->wState & CBF_DROPPED ) if( lphc->wState & CBF_DROPPED )
{ {
RECT rect; RECT rect;
@ -1241,7 +1241,7 @@ static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
{ {
rect = lphc->buttonRect; rect = lphc->buttonRect;
} }
else else
{ {
if( bButton ) if( bButton )
{ {
@ -1256,7 +1256,7 @@ static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
} }
if( bButton && !(lphc->wState & CBF_NOREDRAW) ) if( bButton && !(lphc->wState & CBF_NOREDRAW) )
RedrawWindow( hWnd, &rect, 0, RDW_INVALIDATE | RedrawWindow( hWnd, &rect, 0, RDW_INVALIDATE |
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN ); RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
CB_NOTIFY( lphc, CBN_CLOSEUP ); CB_NOTIFY( lphc, CBN_CLOSEUP );
} }
@ -1347,10 +1347,10 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
/* ">> 8" makes gcc generate jump-table instead of cmp ladder */ /* ">> 8" makes gcc generate jump-table instead of cmp ladder */
switch( HIWORD(wParam) >> 8 ) switch( HIWORD(wParam) >> 8 )
{ {
case (EN_SETFOCUS >> 8): case (EN_SETFOCUS >> 8):
TRACE("[%04x]: edit [%04x] got focus\n", TRACE("[%04x]: edit [%04x] got focus\n",
lphc->self, lphc->hWndEdit ); lphc->self, lphc->hWndEdit );
COMBO_SetFocus( lphc ); COMBO_SetFocus( lphc );
@ -1363,7 +1363,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
/* NOTE: it seems that Windows' edit control sends an /* NOTE: it seems that Windows' edit control sends an
* undocumented message WM_USER + 0x1B instead of this * undocumented message WM_USER + 0x1B instead of this
* notification (only when it happens to be a part of * notification (only when it happens to be a part of
* the combo). ?? - AK. * the combo). ?? - AK.
*/ */
@ -1376,7 +1376,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
* In some circumstances (when the selection of the combobox * In some circumstances (when the selection of the combobox
* is changed for example) we don't wans the EN_CHANGE notification * is changed for example) we don't wans the EN_CHANGE notification
* to be forwarded to the parent of the combobox. This code * to be forwarded to the parent of the combobox. This code
* checks a flag that is set in these occasions and ignores the * checks a flag that is set in these occasions and ignores the
* notification. * notification.
*/ */
if (lphc->wState & CBF_NOLBSELECT) if (lphc->wState & CBF_NOLBSELECT)
@ -1416,7 +1416,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
case LBN_SELCHANGE: case LBN_SELCHANGE:
case LBN_SELCANCEL: case LBN_SELCANCEL:
TRACE("[%04x]: lbox selection change [%04x]\n", TRACE("[%04x]: lbox selection change [%04x]\n",
lphc->self, lphc->wState ); lphc->self, lphc->wState );
if( HIWORD(wParam) == LBN_SELCHANGE) if( HIWORD(wParam) == LBN_SELCHANGE)
@ -1433,7 +1433,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
InvalidateRect(lphc->self, &lphc->textRect, TRUE); InvalidateRect(lphc->self, &lphc->textRect, TRUE);
} }
/* do not roll up if selection is being tracked /* do not roll up if selection is being tracked
* by arrowkeys in the dropdown listbox */ * by arrowkeys in the dropdown listbox */
if( ((lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP)) ) if( ((lphc->wState & CBF_DROPPED) && !(lphc->wState & CBF_NOROLLUP)) )
{ {
@ -1595,11 +1595,11 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, INT N, LPARAM lParam, BOOL unico
/*********************************************************************** /***********************************************************************
* CBResetPos * CBResetPos
* *
* This function sets window positions according to the updated * This function sets window positions according to the updated
* component placement struct. * component placement struct.
*/ */
static void CBResetPos( static void CBResetPos(
LPHEADCOMBO lphc, LPHEADCOMBO lphc,
LPRECT rectEdit, LPRECT rectEdit,
LPRECT rectLB, LPRECT rectLB,
BOOL bRedraw) BOOL bRedraw)
@ -1610,7 +1610,7 @@ static void CBResetPos(
* sizing messages */ * sizing messages */
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
SetWindowPos( lphc->hWndEdit, 0, SetWindowPos( lphc->hWndEdit, 0,
rectEdit->left, rectEdit->top, rectEdit->left, rectEdit->top,
rectEdit->right - rectEdit->left, rectEdit->right - rectEdit->left,
rectEdit->bottom - rectEdit->top, rectEdit->bottom - rectEdit->top,
@ -1618,8 +1618,8 @@ static void CBResetPos(
SetWindowPos( lphc->hWndLBox, 0, SetWindowPos( lphc->hWndLBox, 0,
rectLB->left, rectLB->top, rectLB->left, rectLB->top,
rectLB->right - rectLB->left, rectLB->right - rectLB->left,
rectLB->bottom - rectLB->top, rectLB->bottom - rectLB->top,
SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) ); SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) );
if( bDrop ) if( bDrop )
@ -1643,9 +1643,9 @@ static void CBResetPos(
static void COMBO_Size( LPHEADCOMBO lphc ) static void COMBO_Size( LPHEADCOMBO lphc )
{ {
CBCalcPlacement(lphc->self, CBCalcPlacement(lphc->self,
lphc, lphc,
&lphc->textRect, &lphc->textRect,
&lphc->buttonRect, &lphc->buttonRect,
&lphc->droppedRect); &lphc->droppedRect);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
@ -1675,11 +1675,11 @@ static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
if ( CB_GETTYPE(lphc) == CBS_SIMPLE) if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
{ {
CBCalcPlacement(lphc->self, CBCalcPlacement(lphc->self,
lphc, lphc,
&lphc->textRect, &lphc->textRect,
&lphc->buttonRect, &lphc->buttonRect,
&lphc->droppedRect); &lphc->droppedRect);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
} }
else else
@ -1708,23 +1708,23 @@ static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height )
if ( CB_GETTYPE(lphc) == CBS_SIMPLE) if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
{ {
CBCalcPlacement(lphc->self, CBCalcPlacement(lphc->self,
lphc, lphc,
&lphc->textRect, &lphc->textRect,
&lphc->buttonRect, &lphc->buttonRect,
&lphc->droppedRect); &lphc->droppedRect);
CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE ); CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
} }
else else
{ {
CBForceDummyResize(lphc); CBForceDummyResize(lphc);
} }
lRet = height; lRet = height;
} }
} }
else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */ else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */
lRet = SendMessageW(lphc->hWndLBox, LB_SETITEMHEIGHT, lRet = SendMessageW(lphc->hWndLBox, LB_SETITEMHEIGHT,
(WPARAM)index, (LPARAM)height ); (WPARAM)index, (LPARAM)height );
return lRet; return lRet;
} }
@ -1833,10 +1833,10 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
{ {
POINT pt; POINT pt;
RECT lbRect; RECT lbRect;
pt.x = LOWORD(lParam); pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam); pt.y = HIWORD(lParam);
if( lphc->wState & CBF_BUTTONDOWN ) if( lphc->wState & CBF_BUTTONDOWN )
{ {
BOOL bButton; BOOL bButton;
@ -1878,23 +1878,23 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam ); hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
if( lphc || message == WM_NCCREATE ) if( lphc || message == WM_NCCREATE )
switch(message) switch(message)
{ {
/* System messages */ /* System messages */
case WM_NCCREATE: case WM_NCCREATE:
{ {
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style : LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
((LPCREATESTRUCTA)lParam)->style; ((LPCREATESTRUCTA)lParam)->style;
return COMBO_NCCreate(hwnd, style); return COMBO_NCCreate(hwnd, style);
} }
case WM_NCDESTROY: case WM_NCDESTROY:
COMBO_NCDestroy(lphc); COMBO_NCDestroy(lphc);
break;/* -> DefWindowProc */ break;/* -> DefWindowProc */
case WM_CREATE: case WM_CREATE:
{ {
HWND hwndParent; HWND hwndParent;
LONG style; LONG style;
if(unicode) if(unicode)
@ -1942,7 +1942,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
*/ */
/* fall through */ /* fall through */
case WM_SIZE: case WM_SIZE:
if( lphc->hWndLBox && if( lphc->hWndLBox &&
!(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc ); !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
return TRUE; return TRUE;
case WM_SETFONT: case WM_SETFONT:
@ -1977,7 +1977,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
if (j == -1) return 0; if (j == -1) return 0;
return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0); return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
} }
else if( lphc->wState & CBF_EDIT ) else if( lphc->wState & CBF_EDIT )
{ {
LRESULT ret; LRESULT ret;
lphc->wState |= CBF_NOEDITNOTIFY; lphc->wState |= CBF_NOEDITNOTIFY;
@ -1990,7 +1990,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
case WM_CUT: case WM_CUT:
case WM_PASTE: case WM_PASTE:
case WM_COPY: case WM_COPY:
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
{ {
return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) : return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
SendMessageA(lphc->hWndEdit, message, wParam, lParam); SendMessageA(lphc->hWndEdit, message, wParam, lParam);
@ -2004,7 +2004,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
return COMBO_ItemOp(lphc, message, lParam); return COMBO_ItemOp(lphc, message, lParam);
case WM_ENABLE: case WM_ENABLE:
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
EnableWindow( lphc->hWndEdit, (BOOL)wParam ); EnableWindow( lphc->hWndEdit, (BOOL)wParam );
EnableWindow( lphc->hWndLBox, (BOOL)wParam ); EnableWindow( lphc->hWndLBox, (BOOL)wParam );
/* Force the control to repaint when the enabled state changes. */ /* Force the control to repaint when the enabled state changes. */
@ -2046,15 +2046,15 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) : return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
SendMessageA(hwndTarget, message, wParam, lParam); SendMessageA(hwndTarget, message, wParam, lParam);
} }
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self ); if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam ); if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
return TRUE; return TRUE;
case WM_LBUTTONUP: case WM_LBUTTONUP:
COMBO_LButtonUp( lphc ); COMBO_LButtonUp( lphc );
return TRUE; return TRUE;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if( lphc->wState & CBF_CAPTURE ) if( lphc->wState & CBF_CAPTURE )
COMBO_MouseMove( lphc, wParam, lParam ); COMBO_MouseMove( lphc, wParam, lParam );
return TRUE; return TRUE;
@ -2117,7 +2117,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
if( (INT)wParam >= 0 ) /* listbox item */ if( (INT)wParam >= 0 ) /* listbox item */
return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0); return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
return CBGetTextAreaHeight(hwnd, lphc); return CBGetTextAreaHeight(hwnd, lphc);
case CB_RESETCONTENT16: case CB_RESETCONTENT16:
case CB_RESETCONTENT: case CB_RESETCONTENT:
SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0); SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) ) if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) )
@ -2150,7 +2150,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
return CB_ERR; return CB_ERR;
case CB_GETDROPPEDCONTROLRECT16: case CB_GETDROPPEDCONTROLRECT16:
lParam = (LPARAM)MapSL(lParam); lParam = (LPARAM)MapSL(lParam);
if( lParam ) if( lParam )
{ {
RECT r; RECT r;
CBGetDroppedControlRect( lphc, &r ); CBGetDroppedControlRect( lphc, &r );
@ -2163,7 +2163,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
case CB_GETDROPPEDSTATE16: case CB_GETDROPPEDSTATE16:
case CB_GETDROPPEDSTATE: case CB_GETDROPPEDSTATE:
return (lphc->wState & CBF_DROPPED) ? TRUE : FALSE; return (lphc->wState & CBF_DROPPED) ? TRUE : FALSE;
case CB_DIR16: case CB_DIR16:
lParam = (LPARAM)MapSL(lParam); lParam = (LPARAM)MapSL(lParam);
message = LB_DIR16; message = LB_DIR16;
/* fall through */ /* fall through */
@ -2181,15 +2181,15 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
if( !(lphc->wState & CBF_DROPPED) ) if( !(lphc->wState & CBF_DROPPED) )
CBDropDown( lphc ); CBDropDown( lphc );
} }
else else
if( lphc->wState & CBF_DROPPED ) if( lphc->wState & CBF_DROPPED )
CBRollUp( lphc, FALSE, TRUE ); CBRollUp( lphc, FALSE, TRUE );
} }
return TRUE; return TRUE;
case CB_GETCOUNT16: case CB_GETCOUNT16:
case CB_GETCOUNT: case CB_GETCOUNT:
return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0); return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
case CB_GETCURSEL16: case CB_GETCURSEL16:
case CB_GETCURSEL: case CB_GETCURSEL:
return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0); return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
case CB_SETCURSEL16: case CB_SETCURSEL16:
@ -2207,14 +2207,14 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
InvalidateRect(lphc->self, &lphc->textRect, TRUE); InvalidateRect(lphc->self, &lphc->textRect, TRUE);
lphc->wState &= ~CBF_SELCHANGE; lphc->wState &= ~CBF_SELCHANGE;
return lParam; return lParam;
case CB_GETLBTEXT16: case CB_GETLBTEXT16:
wParam = (INT)(INT16)wParam; wParam = (INT)(INT16)wParam;
lParam = (LPARAM)MapSL(lParam); lParam = (LPARAM)MapSL(lParam);
/* fall through */ /* fall through */
case CB_GETLBTEXT: case CB_GETLBTEXT:
return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) : return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam); SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
case CB_GETLBTEXTLEN16: case CB_GETLBTEXTLEN16:
wParam = (INT)(INT16)wParam; wParam = (INT)(INT16)wParam;
/* fall through */ /* fall through */
case CB_GETLBTEXTLEN: case CB_GETLBTEXTLEN:
@ -2229,7 +2229,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
/* fall through */ /* fall through */
case CB_SETITEMDATA: case CB_SETITEMDATA:
return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam); return SendMessageW(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam);
case CB_GETEDITSEL16: case CB_GETEDITSEL16:
wParam = lParam = 0; /* just in case */ wParam = lParam = 0; /* just in case */
/* fall through */ /* fall through */
case CB_GETEDITSEL: case CB_GETEDITSEL:
@ -2237,9 +2237,9 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam); return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
return CB_ERR; return CB_ERR;
case CB_SETEDITSEL16: case CB_SETEDITSEL16:
case CB_SETEDITSEL: case CB_SETEDITSEL:
if( lphc->wState & CBF_EDIT ) if( lphc->wState & CBF_EDIT )
return SendMessageW(lphc->hWndEdit, EM_SETSEL, return SendMessageW(lphc->hWndEdit, EM_SETSEL,
(INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) ); (INT)(INT16)LOWORD(lParam), (INT)(INT16)HIWORD(lParam) );
return CB_ERR; return CB_ERR;

View File

@ -91,7 +91,7 @@ static HBITMAP DESKTOP_LoadBitmap( HDC hdc, const char *filename )
_lclose( file ); _lclose( file );
fileHeader = (BITMAPFILEHEADER *)buffer; fileHeader = (BITMAPFILEHEADER *)buffer;
bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER)); bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER));
/* Check header content */ /* Check header content */
if ((fileHeader->bfType != 0x4d42) || (size < fileHeader->bfSize)) if ((fileHeader->bfType != 0x4d42) || (size < fileHeader->bfSize))
{ {

View File

@ -214,7 +214,7 @@ static void EDIT_MoveWordBackward(HWND hwnd, EDITSTATE *es, BOOL extend);
static void EDIT_MoveWordForward(HWND hwnd, EDITSTATE *es, BOOL extend); static void EDIT_MoveWordForward(HWND hwnd, EDITSTATE *es, BOOL extend);
static void EDIT_PaintLine(HWND hwnd, EDITSTATE *es, HDC hdc, INT line, BOOL rev); static void EDIT_PaintLine(HWND hwnd, EDITSTATE *es, HDC hdc, INT line, BOOL rev);
static INT EDIT_PaintText(EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev); static INT EDIT_PaintText(EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);
static void EDIT_SetCaretPos(HWND hwnd, EDITSTATE *es, INT pos, BOOL after_wrap); static void EDIT_SetCaretPos(HWND hwnd, EDITSTATE *es, INT pos, BOOL after_wrap);
static void EDIT_SetRectNP(HWND hwnd, EDITSTATE *es, LPRECT lprc); static void EDIT_SetRectNP(HWND hwnd, EDITSTATE *es, LPRECT lprc);
static void EDIT_UnlockBuffer(HWND hwnd, EDITSTATE *es, BOOL force); static void EDIT_UnlockBuffer(HWND hwnd, EDITSTATE *es, BOOL force);
static void EDIT_UpdateScrollInfo(HWND hwnd, EDITSTATE *es); static void EDIT_UpdateScrollInfo(HWND hwnd, EDITSTATE *es);
@ -357,16 +357,16 @@ static inline void EDIT_WM_Cut(HWND hwnd, EDITSTATE *es)
* *
* Returns the window version in case Wine emulates a later version * Returns the window version in case Wine emulates a later version
* of windows then the application expects. * of windows then the application expects.
* *
* In a number of cases when windows runs an application that was * In a number of cases when windows runs an application that was
* designed for an earlier windows version, windows reverts * designed for an earlier windows version, windows reverts
* to "old" behaviour of that earlier version. * to "old" behaviour of that earlier version.
* *
* An example is a disabled edit control that needs to be painted. * An example is a disabled edit control that needs to be painted.
* Old style behaviour is to send a WM_CTLCOLOREDIT message. This was * Old style behaviour is to send a WM_CTLCOLOREDIT message. This was
* changed in Win95, NT4.0 by a WM_CTLCOLORSTATIC message _only_ for * changed in Win95, NT4.0 by a WM_CTLCOLORSTATIC message _only_ for
* applications with an expected version 0f 4.0 or higher. * applications with an expected version 0f 4.0 or higher.
* *
*/ */
static DWORD get_app_version(void) static DWORD get_app_version(void)
{ {
@ -382,7 +382,7 @@ static DWORD get_app_version(void)
dwEmulatedVersion = MAKELONG( info.dwMinorVersion, info.dwMajorVersion ); dwEmulatedVersion = MAKELONG( info.dwMinorVersion, info.dwMajorVersion );
/* FIXME: this may not be 100% correct; see discussion on the /* FIXME: this may not be 100% correct; see discussion on the
* wine developer list in Nov 1999 */ * wine developer list in Nov 1999 */
version = dwProcVersion < dwEmulatedVersion ? dwProcVersion : dwEmulatedVersion; version = dwProcVersion < dwEmulatedVersion ? dwProcVersion : dwEmulatedVersion;
} }
return version; return version;
} }
@ -1002,8 +1002,8 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
result = EDIT_WM_LButtonUp(hwnd, es); result = EDIT_WM_LButtonUp(hwnd, es);
break; break;
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
DPRINTF_EDIT_MSG32("WM_MBUTTONDOWN"); DPRINTF_EDIT_MSG32("WM_MBUTTONDOWN");
result = EDIT_WM_MButtonDown(hwnd); result = EDIT_WM_MButtonDown(hwnd);
break; break;
@ -1065,7 +1065,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
DPRINTF_EDIT_MSG32("WM_STYLECHANGED"); DPRINTF_EDIT_MSG32("WM_STYLECHANGED");
result = EDIT_WM_StyleChanged (hwnd, es, wParam, (const STYLESTRUCT *)lParam); result = EDIT_WM_StyleChanged (hwnd, es, wParam, (const STYLESTRUCT *)lParam);
break; break;
case WM_STYLECHANGING: case WM_STYLECHANGING:
DPRINTF_EDIT_MSG32("WM_STYLECHANGING"); DPRINTF_EDIT_MSG32("WM_STYLECHANGING");
result = 0; /* See EDIT_WM_StyleChanged */ result = 0; /* See EDIT_WM_StyleChanged */
@ -1173,11 +1173,11 @@ static void EDIT_BuildLineDefs_ML(HWND hwnd, EDITSTATE *es, INT istart, INT iend
/* Find starting line. istart must lie inside an existing line or /* Find starting line. istart must lie inside an existing line or
* at the end of buffer */ * at the end of buffer */
do { do {
if (istart < current_line->index + current_line->length || if (istart < current_line->index + current_line->length ||
current_line->ending == END_0) current_line->ending == END_0)
break; break;
previous_line = current_line; previous_line = current_line;
current_line = current_line->next; current_line = current_line->next;
line_index++; line_index++;
} while (current_line); } while (current_line);
@ -1208,7 +1208,7 @@ static void EDIT_BuildLineDefs_ML(HWND hwnd, EDITSTATE *es, INT istart, INT iend
{ {
if (!current_line || current_line->index + delta > current_position - es->text) if (!current_line || current_line->index + delta > current_position - es->text)
{ {
/* The buffer has been expanded, create a new line and /* The buffer has been expanded, create a new line and
insert it into the link list */ insert it into the link list */
LINEDEF *new_line = HeapAlloc(GetProcessHeap(), 0, sizeof(LINEDEF)); LINEDEF *new_line = HeapAlloc(GetProcessHeap(), 0, sizeof(LINEDEF));
new_line->next = previous_line->next; new_line->next = previous_line->next;
@ -1288,15 +1288,15 @@ static void EDIT_BuildLineDefs_ML(HWND hwnd, EDITSTATE *es, INT istart, INT iend
prev = 1; prev = 1;
} }
/* If the first line we are calculating, wrapped before istart, we must /* If the first line we are calculating, wrapped before istart, we must
* adjust istart in order for this to be reflected in the update region. */ * adjust istart in order for this to be reflected in the update region. */
if (current_line->index == nstart_index && istart > current_line->index + prev) if (current_line->index == nstart_index && istart > current_line->index + prev)
istart = current_line->index + prev; istart = current_line->index + prev;
/* else if we are updating the previous line before the first line we /* else if we are updating the previous line before the first line we
* are re-calculating and it expanded */ * are re-calculating and it expanded */
else if (current_line == start_line && else if (current_line == start_line &&
current_line->index != nstart_index && orig_net_length < prev) current_line->index != nstart_index && orig_net_length < prev)
{ {
/* Line expanded due to an upwards line wrap so we must partially include /* Line expanded due to an upwards line wrap so we must partially include
* previous line in update region */ * previous line in update region */
nstart_line = line_index; nstart_line = line_index;
@ -1361,16 +1361,16 @@ static void EDIT_BuildLineDefs_ML(HWND hwnd, EDITSTATE *es, INT istart, INT iend
if (hrgn) if (hrgn)
{ {
HRGN tmphrgn; HRGN tmphrgn;
/* /*
* We calculate two rectangles. One for the first line which may have * We calculate two rectangles. One for the first line which may have
* an indent with respect to the format rect. The other is a format-width * an indent with respect to the format rect. The other is a format-width
* rectangle that spans the rest of the lines that changed or moved. * rectangle that spans the rest of the lines that changed or moved.
*/ */
rc.top = es->format_rect.top + nstart_line * es->line_height - rc.top = es->format_rect.top + nstart_line * es->line_height -
(es->y_offset * es->line_height); /* Adjust for vertical scrollbar */ (es->y_offset * es->line_height); /* Adjust for vertical scrollbar */
rc.bottom = rc.top + es->line_height; rc.bottom = rc.top + es->line_height;
rc.left = es->format_rect.left + (INT)LOWORD(GetTabbedTextExtentW(dc, rc.left = es->format_rect.left + (INT)LOWORD(GetTabbedTextExtentW(dc,
es->text + nstart_index, istart - nstart_index, es->text + nstart_index, istart - nstart_index,
es->tabs_count, es->tabs)) - es->x_offset; /* Adjust for horz scroll */ es->tabs_count, es->tabs)) - es->x_offset; /* Adjust for horz scroll */
rc.right = es->format_rect.right; rc.right = es->format_rect.right;
SetRectRgn(hrgn, rc.left, rc.top, rc.right, rc.bottom); SetRectRgn(hrgn, rc.left, rc.top, rc.right, rc.bottom);
@ -1378,9 +1378,9 @@ static void EDIT_BuildLineDefs_ML(HWND hwnd, EDITSTATE *es, INT istart, INT iend
rc.top = rc.bottom; rc.top = rc.bottom;
rc.left = es->format_rect.left; rc.left = es->format_rect.left;
rc.right = es->format_rect.right; rc.right = es->format_rect.right;
/* /*
* If lines were added or removed we must re-paint the remainder of the * If lines were added or removed we must re-paint the remainder of the
* lines since the remaining lines were either shifted up or down. * lines since the remaining lines were either shifted up or down.
*/ */
if (line_count < es->line_count) /* We added lines */ if (line_count < es->line_count) /* We added lines */
rc.bottom = es->line_count * es->line_height; rc.bottom = es->line_count * es->line_height;
@ -2083,7 +2083,7 @@ static void EDIT_MovePageUp_ML(HWND hwnd, EDITSTATE *es, BOOL extend)
* Move the caret one line up, on a column with the nearest * Move the caret one line up, on a column with the nearest
* x coordinate on the screen (might be a different column). * x coordinate on the screen (might be a different column).
* *
*/ */
static void EDIT_MoveUp_ML(HWND hwnd, EDITSTATE *es, BOOL extend) static void EDIT_MoveUp_ML(HWND hwnd, EDITSTATE *es, BOOL extend)
{ {
INT s = es->selection_start; INT s = es->selection_start;
@ -2533,7 +2533,7 @@ static INT CALLBACK EDIT_WordBreakProc(LPWSTR s, INT index, INT count, INT actio
* EM_CHARFROMPOS * EM_CHARFROMPOS
* *
* returns line number (not index) in high-order word of result. * returns line number (not index) in high-order word of result.
* NB : Q137805 is unclear about this. POINT * pointer in lParam apply * NB : Q137805 is unclear about this. POINT * pointer in lParam apply
* to Richedit, not to the edit control. Original documentation is valid. * to Richedit, not to the edit control. Original documentation is valid.
* FIXME: do the specs mean to return -1 if outside client area or * FIXME: do the specs mean to return -1 if outside client area or
* if outside formatting rectangle ??? * if outside formatting rectangle ???
@ -3104,7 +3104,7 @@ static void EDIT_EM_ReplaceSel(HWND hwnd, EDITSTATE *es, BOOL can_undo, LPCWSTR
INT s = min(es->selection_start, es->selection_end); INT s = min(es->selection_start, es->selection_end);
hrgn = CreateRectRgn(0, 0, 0, 0); hrgn = CreateRectRgn(0, 0, 0, 0);
EDIT_BuildLineDefs_ML(hwnd, es, s, s + strl, EDIT_BuildLineDefs_ML(hwnd, es, s, s + strl,
strl - abs(es->selection_end - es->selection_start), hrgn); strl - abs(es->selection_end - es->selection_start), hrgn);
} }
else else
@ -3114,7 +3114,7 @@ static void EDIT_EM_ReplaceSel(HWND hwnd, EDITSTATE *es, BOOL can_undo, LPCWSTR
es->flags |= EF_MODIFIED; es->flags |= EF_MODIFIED;
if (send_update) es->flags |= EF_UPDATE; if (send_update) es->flags |= EF_UPDATE;
EDIT_EM_ScrollCaret(hwnd, es); EDIT_EM_ScrollCaret(hwnd, es);
/* force scroll info update */ /* force scroll info update */
EDIT_UpdateScrollInfo(hwnd, es); EDIT_UpdateScrollInfo(hwnd, es);
@ -3431,7 +3431,7 @@ static void EDIT_EM_SetLimitText(EDITSTATE *es, INT limit)
/********************************************************************* /*********************************************************************
* *
* EM_SETMARGINS * EM_SETMARGINS
* *
* EC_USEFONTINFO is used as a left or right value i.e. lParam and not as an * EC_USEFONTINFO is used as a left or right value i.e. lParam and not as an
* action wParam despite what the docs say. EC_USEFONTINFO means one third * action wParam despite what the docs say. EC_USEFONTINFO means one third
* of the char's width, according to the new docs. * of the char's width, according to the new docs.
@ -3521,11 +3521,11 @@ static void EDIT_EM_SetSel(HWND hwnd, EDITSTATE *es, UINT start, UINT end, BOOL
if (end != old_start) if (end != old_start)
{ {
/* /*
* One can also do * One can also do
* ORDER_UINT32(end, old_start); * ORDER_UINT32(end, old_start);
* EDIT_InvalidateText(hwnd, es, start, end); * EDIT_InvalidateText(hwnd, es, start, end);
* EDIT_InvalidateText(hwnd, es, old_start, old_end); * EDIT_InvalidateText(hwnd, es, old_start, old_end);
* in place of the following if statement. * in place of the following if statement.
*/ */
if (old_start > end ) if (old_start > end )
{ {
@ -3723,7 +3723,7 @@ static void EDIT_WM_Char(HWND hwnd, EDITSTATE *es, WCHAR c)
case 0x18: /* ^X */ case 0x18: /* ^X */
SendMessageW(hwnd, WM_CUT, 0, 0); SendMessageW(hwnd, WM_CUT, 0, 0);
break; break;
default: default:
if (!(es->style & ES_READONLY) && (c >= ' ') && (c != 127)) { if (!(es->style & ES_READONLY) && (c >= ' ') && (c != 127)) {
WCHAR str[2]; WCHAR str[2];
@ -4273,7 +4273,7 @@ static LRESULT EDIT_WM_KeyDown(HWND hwnd, EDITSTATE *es, INT key)
DWORD dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 ); DWORD dw = SendMessageW( hwndParent, DM_GETDEFID, 0, 0 );
if (HIWORD(dw) == DC_HASDEFID) if (HIWORD(dw) == DC_HASDEFID)
{ {
SendMessageW( hwndParent, WM_COMMAND, SendMessageW( hwndParent, WM_COMMAND,
MAKEWPARAM( LOWORD(dw), BN_CLICKED ), MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
(LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) ); (LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
} }
@ -4376,8 +4376,8 @@ static LRESULT EDIT_WM_LButtonUp(HWND hwndSelf, EDITSTATE *es)
* *
*/ */
static LRESULT EDIT_WM_MButtonDown(HWND hwnd) static LRESULT EDIT_WM_MButtonDown(HWND hwnd)
{ {
SendMessageW(hwnd,WM_PASTE,0,0); SendMessageW(hwnd,WM_PASTE,0,0);
return 0; return 0;
} }
@ -4507,10 +4507,10 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, DWORD style, HWND hwndParent, BOOL un
es->line_count = 1; es->line_count = 1;
/* /*
* In Win95 look and feel, the WS_BORDER style is replaced by the * In Win95 look and feel, the WS_BORDER style is replaced by the
* WS_EX_CLIENTEDGE style for the edit control. This gives the edit * WS_EX_CLIENTEDGE style for the edit control. This gives the edit
* control a non client area. Not always. This coordinates in some * control a non client area. Not always. This coordinates in some
* way with the window creation code in dialog.c When making * way with the window creation code in dialog.c When making
* modifications please ensure that the code still works for edit * modifications please ensure that the code still works for edit
* controls created directly with style 0x50800000, exStyle 0 ( * controls created directly with style 0x50800000, exStyle 0 (
* which should have a single pixel border) * which should have a single pixel border)
@ -4643,7 +4643,7 @@ static void EDIT_WM_SetFocus(HWND hwnd, EDITSTATE *es)
* *
* WM_SETFONT * WM_SETFONT
* *
* With Win95 look the margins are set to default font value unless * With Win95 look the margins are set to default font value unless
* the system font (font == 0) is being set, in which case they are left * the system font (font == 0) is being set, in which case they are left
* unchanged. * unchanged.
* *
@ -4773,7 +4773,7 @@ static void EDIT_WM_Size(HWND hwnd, EDITSTATE *es, UINT action, INT width, INT h
* *
* It appears that the Windows version of the edit control allows the style * It appears that the Windows version of the edit control allows the style
* (as retrieved by GetWindowLong) to be any value and maintains an internal * (as retrieved by GetWindowLong) to be any value and maintains an internal
* style variable which will generally be different. In this function we * style variable which will generally be different. In this function we
* update the internal style based on what changed in the externally visible * update the internal style based on what changed in the externally visible
* style. * style.
* *
@ -4795,7 +4795,7 @@ static LRESULT EDIT_WM_StyleChanged (HWND hwnd,
*/ */
style_change_mask = ES_UPPERCASE | ES_LOWERCASE | style_change_mask = ES_UPPERCASE | ES_LOWERCASE |
ES_NUMBER; ES_NUMBER;
if (es->style & ES_MULTILINE) if (es->style & ES_MULTILINE)
style_change_mask |= ES_WANTRETURN; style_change_mask |= ES_WANTRETURN;
new_style = style->styleNew & style_change_mask; new_style = style->styleNew & style_change_mask;
@ -4809,7 +4809,7 @@ static LRESULT EDIT_WM_StyleChanged (HWND hwnd,
} else if (new_style & ES_LOWERCASE) { } else if (new_style & ES_LOWERCASE) {
new_style &= ~ES_UPPERCASE; new_style &= ~ES_UPPERCASE;
} }
es->style = (es->style & ~style_change_mask) | new_style; es->style = (es->style & ~style_change_mask) | new_style;
} else if (GWL_EXSTYLE == which) { } else if (GWL_EXSTYLE == which) {
; /* FIXME - what is needed here */ ; /* FIXME - what is needed here */

View File

@ -142,10 +142,10 @@ static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
hBrush = GetSysColorBrush(COLOR_ACTIVECAPTION); hBrush = GetSysColorBrush(COLOR_ACTIVECAPTION);
textColor = GetSysColor(COLOR_CAPTIONTEXT); textColor = GetSysColor(COLOR_CAPTIONTEXT);
} }
else else
{ {
if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD ) if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD )
{ {
hBrush = (HBRUSH) GetClassLongA(hwnd, GCL_HBRBACKGROUND); hBrush = (HBRUSH) GetClassLongA(hwnd, GCL_HBRBACKGROUND);
if( hBrush ) if( hBrush )
{ {
@ -164,7 +164,7 @@ static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
else else
{ {
hBrush = GetStockObject( BLACK_BRUSH ); hBrush = GetStockObject( BLACK_BRUSH );
textColor = RGB( 0xFF, 0xFF, 0xFF ); textColor = RGB( 0xFF, 0xFF, 0xFF );
} }
} }

View File

@ -253,12 +253,12 @@ static void LISTBOX_UpdateScroll( HWND hwnd, LB_DESCR *descr )
if (!(descr->style & WS_VSCROLL)) return; if (!(descr->style & WS_VSCROLL)) return;
*/ */
/* It is important that we check descr->style, and not wnd->dwStyle, /* It is important that we check descr->style, and not wnd->dwStyle,
for WS_VSCROLL, as the former is exactly the one passed in for WS_VSCROLL, as the former is exactly the one passed in
argument to CreateWindow. argument to CreateWindow.
In Windows (and from now on in Wine :) a listbox created In Windows (and from now on in Wine :) a listbox created
with such a style (no WS_SCROLL) does not update with such a style (no WS_SCROLL) does not update
the scrollbar with listbox-related data, thus letting the scrollbar with listbox-related data, thus letting
the programmer use it for his/her own purposes. */ the programmer use it for his/her own purposes. */
if (descr->style & LBS_NOREDRAW) return; if (descr->style & LBS_NOREDRAW) return;
@ -1416,7 +1416,7 @@ static void LISTBOX_MoveCaret( HWND hwnd, LB_DESCR *descr, INT index,
/* Important, repaint needs to be done in this order if /* Important, repaint needs to be done in this order if
you want to mimic Windows behavior: you want to mimic Windows behavior:
1. Remove the focus and paint the item 1. Remove the focus and paint the item
2. Remove the selection and paint the item(s) 2. Remove the selection and paint the item(s)
3. Set the selection and repaint the item(s) 3. Set the selection and repaint the item(s)
4. Set the focus to 'index' and repaint the item */ 4. Set the focus to 'index' and repaint the item */
@ -2089,7 +2089,7 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( HWND hwnd, LB_DESCR *pDescr,
nHitTestType = HTHSCROLL; nHitTestType = HTHSCROLL;
} }
} }
/* Windows sends this message when a scrollbar is clicked /* Windows sends this message when a scrollbar is clicked
*/ */
if(nHitTestType != 0) if(nHitTestType != 0)
@ -2097,7 +2097,7 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( HWND hwnd, LB_DESCR *pDescr,
SendMessageW(hwnd, WM_NCLBUTTONDOWN, nHitTestType, SendMessageW(hwnd, WM_NCLBUTTONDOWN, nHitTestType,
MAKELONG(screenMousePos.x, screenMousePos.y)); MAKELONG(screenMousePos.x, screenMousePos.y));
} }
/* Resume the Capture after scrolling is complete /* Resume the Capture after scrolling is complete
*/ */
if(hWndOldCapture != 0) if(hWndOldCapture != 0)
{ {
@ -3196,7 +3196,7 @@ static LRESULT WINAPI ComboLBWndProc_common( HWND hwnd, UINT msg,
/*********************************************************************** /***********************************************************************
* ComboLBWndProcA * ComboLBWndProcA
* *
* NOTE: in Windows, winproc address of the ComboLBox is the same * NOTE: in Windows, winproc address of the ComboLBox is the same
* as that of the Listbox. * as that of the Listbox.
*/ */
LRESULT WINAPI ComboLBWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) LRESULT WINAPI ComboLBWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )

View File

@ -169,7 +169,7 @@ static HFONT hMenuFontBold = 0;
static HMENU MENU_DefSysPopup = 0; /* Default system menu popup */ static HMENU MENU_DefSysPopup = 0; /* Default system menu popup */
/* Use global popup window because there's no way 2 menus can /* Use global popup window because there's no way 2 menus can
* be tracked at the same time. */ * be tracked at the same time. */
static HWND top_popup; static HWND top_popup;
/* Flag set by EndMenu() to force an exit from menu tracking */ /* Flag set by EndMenu() to force an exit from menu tracking */
@ -210,7 +210,7 @@ const struct builtin_class_descr MENU_builtin_class =
if (flags & (bit)) { flags &= ~(bit); MENUOUT ((text)); } \ if (flags & (bit)) { flags &= ~(bit); MENUOUT ((text)); } \
} while (0) } while (0)
static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp, static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
const char *postfix) const char *postfix)
{ {
TRACE("%s ", prefix); TRACE("%s ", prefix);
@ -298,7 +298,7 @@ static POPUPMENU *MENU_GetMenu(HMENU hMenu)
POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu); POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu);
if (!menu || menu->wMagic != MENU_MAGIC) if (!menu || menu->wMagic != MENU_MAGIC)
{ {
WARN("invalid menu handle=%x, ptr=%p, magic=%x\n", hMenu, menu, menu? menu->wMagic:0); WARN("invalid menu handle=%x, ptr=%p, magic=%x\n", hMenu, menu, menu? menu->wMagic:0);
menu = NULL; menu = NULL;
} }
return menu; return menu;
@ -349,8 +349,8 @@ static HMENU MENU_CopySysPopup(void)
* *
* Create a copy of the system menu. System menu in Windows is * Create a copy of the system menu. System menu in Windows is
* a special menu bar with the single entry - system menu popup. * a special menu bar with the single entry - system menu popup.
* This popup is presented to the outside world as a "system menu". * This popup is presented to the outside world as a "system menu".
* However, the real system menu handle is sometimes seen in the * However, the real system menu handle is sometimes seen in the
* WM_MENUSELECT parameters (and Word 6 likes it this way). * WM_MENUSELECT parameters (and Word 6 likes it this way).
*/ */
HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu ) HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu )
@ -365,7 +365,7 @@ HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu )
if (hPopupMenu == (HMENU)(-1)) if (hPopupMenu == (HMENU)(-1))
hPopupMenu = MENU_CopySysPopup(); hPopupMenu = MENU_CopySysPopup();
else if( !hPopupMenu ) hPopupMenu = MENU_DefSysPopup; else if( !hPopupMenu ) hPopupMenu = MENU_DefSysPopup;
if (hPopupMenu) if (hPopupMenu)
{ {
@ -414,12 +414,12 @@ BOOL MENU_Init()
} else } else
return FALSE; return FALSE;
if (! (hBitmap = CreateBitmap( 8, 8, 1, 1, shade_bits))) if (! (hBitmap = CreateBitmap( 8, 8, 1, 1, shade_bits)))
return FALSE; return FALSE;
if(!(hShadeBrush = CreatePatternBrush( hBitmap ))) if(!(hShadeBrush = CreatePatternBrush( hBitmap )))
return FALSE; return FALSE;
DeleteObject( hBitmap ); DeleteObject( hBitmap );
if (!(MENU_DefSysPopup = MENU_CopySysPopup())) if (!(MENU_DefSysPopup = MENU_CopySysPopup()))
return FALSE; return FALSE;
@ -427,7 +427,7 @@ BOOL MENU_Init()
ncm.cbSize = sizeof (NONCLIENTMETRICSA); ncm.cbSize = sizeof (NONCLIENTMETRICSA);
if (!(SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &ncm, 0))) if (!(SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &ncm, 0)))
return FALSE; return FALSE;
if (!(hMenuFont = CreateFontIndirectA( &ncm.lfMenuFont ))) if (!(hMenuFont = CreateFontIndirectA( &ncm.lfMenuFont )))
return FALSE; return FALSE;
@ -582,7 +582,7 @@ static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags )
/*********************************************************************** /***********************************************************************
* MENU_FindSubMenu * MENU_FindSubMenu
* *
* Find a Sub menu. Return the position of the submenu, and modifies * Find a Sub menu. Return the position of the submenu, and modifies
* *hmenu in case it is found in another sub-menu. * *hmenu in case it is found in another sub-menu.
* If the submenu cannot be found, NO_SELECTED_ITEM is returned. * If the submenu cannot be found, NO_SELECTED_ITEM is returned.
*/ */
@ -591,8 +591,8 @@ UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget )
POPUPMENU *menu; POPUPMENU *menu;
UINT i; UINT i;
MENUITEM *item; MENUITEM *item;
if (((*hmenu)==0xffff) || if (((*hmenu)==0xffff) ||
(!(menu = MENU_GetMenu(*hmenu)))) (!(menu = MENU_GetMenu(*hmenu))))
return NO_SELECTED_ITEM; return NO_SELECTED_ITEM;
item = menu->items; item = menu->items;
for (i = 0; i < menu->nItems; i++, item++) { for (i = 0; i < menu->nItems; i++, item++) {
@ -625,11 +625,11 @@ static void MENU_FreeItemData( MENUITEM* item )
/*********************************************************************** /***********************************************************************
* MENU_FindItemByCoords * MENU_FindItemByCoords
* *
* Find the item at the specified coordinates (screen coords). Does * Find the item at the specified coordinates (screen coords). Does
* not work for child windows and therefore should not be called for * not work for child windows and therefore should not be called for
* an arbitrary system menu. * an arbitrary system menu.
*/ */
static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu, static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu,
POINT pt, UINT *pos ) POINT pt, UINT *pos )
{ {
MENUITEM *item; MENUITEM *item;
@ -658,7 +658,7 @@ static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu,
* Find the menu item selected by a key press. * Find the menu item selected by a key press.
* Return item id, -1 if none, -2 if we should close the menu. * Return item id, -1 if none, -2 if we should close the menu.
*/ */
static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu, static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
UINT key, BOOL forceMenuChar ) UINT key, BOOL forceMenuChar )
{ {
TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu ); TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
@ -690,7 +690,7 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
} }
} }
} }
menuchar = SendMessageA( hwndOwner, WM_MENUCHAR, menuchar = SendMessageA( hwndOwner, WM_MENUCHAR,
MAKEWPARAM( key, menu->wFlags ), hmenu ); MAKEWPARAM( key, menu->wFlags ), hmenu );
if (HIWORD(menuchar) == 2) return LOWORD(menuchar); if (HIWORD(menuchar) == 2) return LOWORD(menuchar);
if (HIWORD(menuchar) == 1) return (UINT)(-2); if (HIWORD(menuchar) == 1) return (UINT)(-2);
@ -853,7 +853,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
UINT check_bitmap_width = GetSystemMetrics( SM_CXMENUCHECK ); UINT check_bitmap_width = GetSystemMetrics( SM_CXMENUCHECK );
TRACE("dc=0x%04x owner=0x%04x (%d,%d)\n", hdc, hwndOwner, orgX, orgY); TRACE("dc=0x%04x owner=0x%04x (%d,%d)\n", hdc, hwndOwner, orgX, orgY);
debug_print_menuitem("MENU_CalcItemSize: menuitem:", lpitem, debug_print_menuitem("MENU_CalcItemSize: menuitem:", lpitem,
(menuBar ? " (MenuBar)" : "")); (menuBar ? " (MenuBar)" : ""));
SetRect( &lpitem->rect, orgX, orgY, orgX, orgY ); SetRect( &lpitem->rect, orgX, orgY, orgX, orgY );
@ -880,7 +880,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
if (menuBar) if (menuBar)
{ {
lpitem->rect.right += MENU_BAR_ITEMS_SPACE; lpitem->rect.right += MENU_BAR_ITEMS_SPACE;
/* under at least win95 you seem to be given a standard /* under at least win95 you seem to be given a standard
height for the menu and the height value is ignored */ height for the menu and the height value is ignored */
@ -892,11 +892,11 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
} }
else else
lpitem->rect.bottom += mis.itemHeight; lpitem->rect.bottom += mis.itemHeight;
TRACE("id=%04x size=%dx%d\n", TRACE("id=%04x size=%dx%d\n",
lpitem->wID, mis.itemWidth, mis.itemHeight); lpitem->wID, mis.itemWidth, mis.itemHeight);
/* Fall through to get check/arrow width calculation. */ /* Fall through to get check/arrow width calculation. */
} }
if (lpitem->fType & MF_SEPARATOR) if (lpitem->fType & MF_SEPARATOR)
{ {
@ -928,14 +928,14 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
lpitem->rect.bottom += 2; lpitem->rect.bottom += 2;
} }
} }
/* it must be a text item - unless it's the system menu */ /* it must be a text item - unless it's the system menu */
if (!(lpitem->fType & MF_SYSMENU) && IS_STRING_ITEM( lpitem->fType )) if (!(lpitem->fType & MF_SYSMENU) && IS_STRING_ITEM( lpitem->fType ))
{ SIZE size; { SIZE size;
GetTextExtentPoint32W(hdc, lpitem->text, strlenW(lpitem->text), &size); GetTextExtentPoint32W(hdc, lpitem->text, strlenW(lpitem->text), &size);
lpitem->rect.right += size.cx; lpitem->rect.right += size.cx;
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
lpitem->rect.bottom += max( size.cy, GetSystemMetrics(SM_CYMENU) ); lpitem->rect.bottom += max( size.cy, GetSystemMetrics(SM_CYMENU) );
@ -958,7 +958,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
{ {
if (strchrW( lpitem->text, '\b' )) if (strchrW( lpitem->text, '\b' ))
lpitem->rect.right += MENU_TAB_SPACE; lpitem->rect.right += MENU_TAB_SPACE;
lpitem->xTab = lpitem->rect.right - check_bitmap_width lpitem->xTab = lpitem->rect.right - check_bitmap_width
- arrow_bitmap_width; - arrow_bitmap_width;
} }
} }
@ -983,7 +983,7 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND hwndOwner )
hdc = GetDC( 0 ); hdc = GetDC( 0 );
SelectObject( hdc, hMenuFont); SelectObject( hdc, hMenuFont);
start = 0; start = 0;
maxX = (TWEAK_WineLook == WIN31_LOOK) ? GetSystemMetrics(SM_CXBORDER) : 2+1 ; maxX = (TWEAK_WineLook == WIN31_LOOK) ? GetSystemMetrics(SM_CXBORDER) : 2+1 ;
@ -1020,7 +1020,7 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND hwndOwner )
lpitem->rect.right = maxX; lpitem->rect.right = maxX;
if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab) if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab)
lpitem->xTab = maxTab; lpitem->xTab = maxTab;
} }
lppop->Height = max( lppop->Height, orgY ); lppop->Height = max( lppop->Height, orgY );
} }
@ -1055,7 +1055,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
if ((lprect == NULL) || (lppop == NULL)) return; if ((lprect == NULL) || (lppop == NULL)) return;
if (lppop->nItems == 0) return; if (lppop->nItems == 0) return;
TRACE("left=%d top=%d right=%d bottom=%d\n", TRACE("left=%d top=%d right=%d bottom=%d\n",
lprect->left, lprect->top, lprect->right, lprect->bottom); lprect->left, lprect->top, lprect->right, lprect->bottom);
lppop->Width = lprect->right - lprect->left; lppop->Width = lprect->right - lprect->left;
lppop->Height = 0; lppop->Height = 0;
@ -1075,7 +1075,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
if ((i != start) && if ((i != start) &&
(lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break; (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
TRACE("calling MENU_CalcItemSize org=(%d, %d)\n", TRACE("calling MENU_CalcItemSize org=(%d, %d)\n",
orgX, orgY ); orgX, orgY );
debug_print_menuitem (" item: ", lpitem, ""); debug_print_menuitem (" item: ", lpitem, "");
MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE ); MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE );
@ -1132,7 +1132,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
lpitem->fState & lpitem->fState &
(MF_HILITE | MF_MOUSESELECT) ); (MF_HILITE | MF_MOUSESELECT) );
else else
NC_DrawSysButton( hwnd, hdc, NC_DrawSysButton( hwnd, hdc,
lpitem->fState & lpitem->fState &
(MF_HILITE | MF_MOUSESELECT) ); (MF_HILITE | MF_MOUSESELECT) );
} }
@ -1167,7 +1167,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
dis.rcItem = lpitem->rect; dis.rcItem = lpitem->rect;
TRACE("Ownerdraw: owner=%04x itemID=%d, itemState=%d, itemAction=%d, " TRACE("Ownerdraw: owner=%04x itemID=%d, itemState=%d, itemAction=%d, "
"hwndItem=%04x, hdc=%04x, rcItem={%d,%d,%d,%d}\n", hwndOwner, "hwndItem=%04x, hdc=%04x, rcItem={%d,%d,%d,%d}\n", hwndOwner,
dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem, dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem,
dis.hDC, dis.rcItem.left, dis.rcItem.top, dis.rcItem.right, dis.hDC, dis.rcItem.left, dis.rcItem.top, dis.rcItem.right,
dis.rcItem.bottom); dis.rcItem.bottom);
SendMessageA( hwndOwner, WM_DRAWITEM, 0, (LPARAM)&dis ); SendMessageA( hwndOwner, WM_DRAWITEM, 0, (LPARAM)&dis );
@ -1209,14 +1209,14 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* vertical separator */ /* vertical separator */
if (!menuBar && (lpitem->fType & MF_MENUBARBREAK)) if (!menuBar && (lpitem->fType & MF_MENUBARBREAK))
{ {
if (TWEAK_WineLook > WIN31_LOOK) if (TWEAK_WineLook > WIN31_LOOK)
{ {
RECT rc = rect; RECT rc = rect;
rc.top = 3; rc.top = 3;
rc.bottom = height - 3; rc.bottom = height - 3;
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_LEFT); DrawEdge (hdc, &rc, EDGE_ETCHED, BF_LEFT);
} }
else else
{ {
SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hdc, rect.left, 0, NULL ); MoveToEx( hdc, rect.left, 0, NULL );
@ -1227,7 +1227,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* horizontal separator */ /* horizontal separator */
if (lpitem->fType & MF_SEPARATOR) if (lpitem->fType & MF_SEPARATOR)
{ {
if (TWEAK_WineLook > WIN31_LOOK) if (TWEAK_WineLook > WIN31_LOOK)
{ {
RECT rc = rect; RECT rc = rect;
rc.left++; rc.left++;
@ -1235,7 +1235,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
rc.top += SEPARATOR_HEIGHT / 2; rc.top += SEPARATOR_HEIGHT / 2;
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_TOP); DrawEdge (hdc, &rc, EDGE_ETCHED, BF_TOP);
} }
else else
{ {
SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2, NULL ); MoveToEx( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2, NULL );
@ -1296,7 +1296,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* Draw the check mark /* Draw the check mark
* *
* FIXME: * FIXME:
* Custom checkmark bitmaps are monochrome but not always 1bpp. * Custom checkmark bitmaps are monochrome but not always 1bpp.
*/ */
HBITMAP bm = (lpitem->fState & MF_CHECKED) ? lpitem->hCheckBit : lpitem->hUnCheckBit; HBITMAP bm = (lpitem->fState & MF_CHECKED) ? lpitem->hCheckBit : lpitem->hUnCheckBit;
if (bm) /* we have a custom bitmap */ if (bm) /* we have a custom bitmap */
@ -1324,7 +1324,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
DeleteObject( bm ); DeleteObject( bm );
} }
} }
/* Draw the popup-menu arrow */ /* Draw the popup-menu arrow */
if (lpitem->fType & MF_POPUP) if (lpitem->fType & MF_POPUP)
{ {
@ -1360,7 +1360,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
{ {
register int i; register int i;
HFONT hfontOld = 0; HFONT hfontOld = 0;
UINT uFormat = (menuBar) ? UINT uFormat = (menuBar) ?
DT_CENTER | DT_VCENTER | DT_SINGLELINE : DT_CENTER | DT_VCENTER | DT_SINGLELINE :
DT_LEFT | DT_VCENTER | DT_SINGLELINE; DT_LEFT | DT_VCENTER | DT_SINGLELINE;
@ -1394,7 +1394,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
} }
SetTextColor(hdc, RGB(0x80, 0x80, 0x80)); SetTextColor(hdc, RGB(0x80, 0x80, 0x80));
} }
DrawTextW( hdc, lpitem->text, i, &rect, uFormat); DrawTextW( hdc, lpitem->text, i, &rect, uFormat);
/* paint the shortcut text */ /* paint the shortcut text */
@ -1405,7 +1405,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
rect.left = lpitem->xTab; rect.left = lpitem->xTab;
uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE; uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE;
} }
else else
{ {
uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE; uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE;
} }
@ -1424,7 +1424,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
DrawTextW( hdc, lpitem->text + i + 1, -1, &rect, uFormat ); DrawTextW( hdc, lpitem->text + i + 1, -1, &rect, uFormat );
} }
if (hfontOld) if (hfontOld)
SelectObject (hdc, hfontOld); SelectObject (hdc, hfontOld);
} }
} }
@ -1444,17 +1444,17 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
GetClientRect( hwnd, &rect ); GetClientRect( hwnd, &rect );
if(TWEAK_WineLook == WIN31_LOOK) if(TWEAK_WineLook == WIN31_LOOK)
{ {
rect.bottom -= POPUP_YSHADE * GetSystemMetrics(SM_CYBORDER); rect.bottom -= POPUP_YSHADE * GetSystemMetrics(SM_CYBORDER);
rect.right -= POPUP_XSHADE * GetSystemMetrics(SM_CXBORDER); rect.right -= POPUP_XSHADE * GetSystemMetrics(SM_CXBORDER);
} }
if((hPrevBrush = SelectObject( hdc, GetSysColorBrush(COLOR_MENU) )) if((hPrevBrush = SelectObject( hdc, GetSysColorBrush(COLOR_MENU) ))
&& (SelectObject( hdc, hMenuFont))) && (SelectObject( hdc, hMenuFont)))
{ {
HPEN hPrevPen; HPEN hPrevPen;
Rectangle( hdc, rect.left, rect.top, rect.right, rect.bottom ); Rectangle( hdc, rect.left, rect.top, rect.right, rect.bottom );
hPrevPen = SelectObject( hdc, GetStockObject( NULL_PEN ) ); hPrevPen = SelectObject( hdc, GetStockObject( NULL_PEN ) );
@ -1494,11 +1494,11 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
UINT u; UINT u;
for (u = menu->nItems, item = menu->items; u > 0; u--, item++) for (u = menu->nItems, item = menu->items; u > 0; u--, item++)
MENU_DrawMenuItem( hwnd, hmenu, menu->hwndOwner, hdc, item, MENU_DrawMenuItem( hwnd, hmenu, menu->hwndOwner, hdc, item,
menu->Height, FALSE, ODA_DRAWENTIRE ); menu->Height, FALSE, ODA_DRAWENTIRE );
} }
} else } else
{ {
SelectObject( hdc, hPrevBrush ); SelectObject( hdc, hPrevBrush );
} }
@ -1543,13 +1543,13 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) ); FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
if (TWEAK_WineLook == WIN31_LOOK) if (TWEAK_WineLook == WIN31_LOOK)
{ {
SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); SelectObject( hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
MoveToEx( hDC, lprect->left, lprect->bottom, NULL ); MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
LineTo( hDC, lprect->right, lprect->bottom ); LineTo( hDC, lprect->right, lprect->bottom );
} }
else else
{ {
SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE)); SelectObject( hDC, SYSCOLOR_GetPen(COLOR_3DFACE));
MoveToEx( hDC, lprect->left, lprect->bottom, NULL ); MoveToEx( hDC, lprect->left, lprect->bottom, NULL );
@ -1605,7 +1605,7 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
/* adjust popup menu pos so that it fits within the desktop */ /* adjust popup menu pos so that it fits within the desktop */
width = menu->Width + GetSystemMetrics(SM_CXBORDER); width = menu->Width + GetSystemMetrics(SM_CXBORDER);
height = menu->Height + GetSystemMetrics(SM_CYBORDER); height = menu->Height + GetSystemMetrics(SM_CYBORDER);
if( x + width > GetSystemMetrics(SM_CXSCREEN )) if( x + width > GetSystemMetrics(SM_CXSCREEN ))
{ {
@ -1670,7 +1670,7 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
SelectObject( hdc, hMenuFont); SelectObject( hdc, hMenuFont);
/* Clear previous highlighted item */ /* Clear previous highlighted item */
if (lppop->FocusedItem != NO_SELECTED_ITEM) if (lppop->FocusedItem != NO_SELECTED_ITEM)
{ {
lppop->items[lppop->FocusedItem].fState &= ~(MF_HILITE|MF_MOUSESELECT); lppop->items[lppop->FocusedItem].fState &= ~(MF_HILITE|MF_MOUSESELECT);
MENU_DrawMenuItem(lppop->hWnd, hmenu, hwndOwner, hdc,&lppop->items[lppop->FocusedItem], MENU_DrawMenuItem(lppop->hWnd, hmenu, hwndOwner, hdc,&lppop->items[lppop->FocusedItem],
@ -1680,18 +1680,18 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
/* Highlight new item (if any) */ /* Highlight new item (if any) */
lppop->FocusedItem = wIndex; lppop->FocusedItem = wIndex;
if (lppop->FocusedItem != NO_SELECTED_ITEM) if (lppop->FocusedItem != NO_SELECTED_ITEM)
{ {
if(!(lppop->items[wIndex].fType & MF_SEPARATOR)) { if(!(lppop->items[wIndex].fType & MF_SEPARATOR)) {
lppop->items[wIndex].fState |= MF_HILITE; lppop->items[wIndex].fState |= MF_HILITE;
MENU_DrawMenuItem( lppop->hWnd, hmenu, hwndOwner, hdc, MENU_DrawMenuItem( lppop->hWnd, hmenu, hwndOwner, hdc,
&lppop->items[wIndex], lppop->Height, &lppop->items[wIndex], lppop->Height,
!(lppop->wFlags & MF_POPUP), ODA_SELECT ); !(lppop->wFlags & MF_POPUP), ODA_SELECT );
} }
if (sendMenuSelect) if (sendMenuSelect)
{ {
MENUITEM *ip = &lppop->items[lppop->FocusedItem]; MENUITEM *ip = &lppop->items[lppop->FocusedItem];
SendMessageA( hwndOwner, WM_MENUSELECT, SendMessageA( hwndOwner, WM_MENUSELECT,
MAKELONG(ip->fType & MF_POPUP ? wIndex: ip->wID, MAKELONG(ip->fType & MF_POPUP ? wIndex: ip->wID,
ip->fType | ip->fState | MF_MOUSESELECT | ip->fType | ip->fState | MF_MOUSESELECT |
(lppop->wFlags & MF_SYSMENU)), hmenu); (lppop->wFlags & MF_SYSMENU)), hmenu);
@ -1703,7 +1703,7 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
if((pos=MENU_FindSubMenu(&topmenu, hmenu))!=NO_SELECTED_ITEM){ if((pos=MENU_FindSubMenu(&topmenu, hmenu))!=NO_SELECTED_ITEM){
POPUPMENU *ptm = MENU_GetMenu( topmenu ); POPUPMENU *ptm = MENU_GetMenu( topmenu );
MENUITEM *ip = &ptm->items[pos]; MENUITEM *ip = &ptm->items[pos];
SendMessageA( hwndOwner, WM_MENUSELECT, MAKELONG(pos, SendMessageA( hwndOwner, WM_MENUSELECT, MAKELONG(pos,
ip->fType | ip->fState | MF_MOUSESELECT | ip->fType | ip->fState | MF_MOUSESELECT |
(ptm->wFlags & MF_SYSMENU)), topmenu); (ptm->wFlags & MF_SYSMENU)), topmenu);
} }
@ -1733,7 +1733,7 @@ static void MENU_MoveSelection( HWND hwndOwner, HMENU hmenu, INT offset )
if ( menu->FocusedItem != NO_SELECTED_ITEM ) if ( menu->FocusedItem != NO_SELECTED_ITEM )
{ {
if( menu->nItems == 1 ) return; else if( menu->nItems == 1 ) return; else
for (i = menu->FocusedItem + offset ; i >= 0 && i < menu->nItems for (i = menu->FocusedItem + offset ; i >= 0 && i < menu->nItems
; i += offset) ; i += offset)
if (!(menu->items[i].fType & MF_SEPARATOR)) if (!(menu->items[i].fType & MF_SEPARATOR))
{ {
@ -1742,7 +1742,7 @@ static void MENU_MoveSelection( HWND hwndOwner, HMENU hmenu, INT offset )
} }
} }
for ( i = (offset > 0) ? 0 : menu->nItems - 1; for ( i = (offset > 0) ? 0 : menu->nItems - 1;
i >= 0 && i < menu->nItems ; i += offset) i >= 0 && i < menu->nItems ; i += offset)
if (!(menu->items[i].fType & MF_SEPARATOR)) if (!(menu->items[i].fType & MF_SEPARATOR))
{ {
@ -1792,7 +1792,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id,
item->text = (LPWSTR)(HBITMAP)LOWORD(str); item->text = (LPWSTR)(HBITMAP)LOWORD(str);
else item->text = NULL; else item->text = NULL;
if (flags & MF_OWNERDRAW) if (flags & MF_OWNERDRAW)
item->dwItemData = (DWORD)str; item->dwItemData = (DWORD)str;
else else
item->dwItemData = 0; item->dwItemData = 0;
@ -1812,7 +1812,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id,
item->fState = 0; item->fState = 0;
return FALSE; return FALSE;
} }
} }
item->wID = id; item->wID = id;
if (flags & MF_POPUP) if (flags & MF_POPUP)
@ -1846,16 +1846,16 @@ static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags )
MENUITEM *newItems; MENUITEM *newItems;
POPUPMENU *menu; POPUPMENU *menu;
if (!(menu = MENU_GetMenu(hMenu))) if (!(menu = MENU_GetMenu(hMenu)))
return NULL; return NULL;
/* Find where to insert new item */ /* Find where to insert new item */
if (flags & MF_BYPOSITION) { if (flags & MF_BYPOSITION) {
if (pos > menu->nItems) if (pos > menu->nItems)
pos = menu->nItems; pos = menu->nItems;
} else { } else {
if (!MENU_FindItem( &hMenu, &pos, flags )) if (!MENU_FindItem( &hMenu, &pos, flags ))
pos = menu->nItems; pos = menu->nItems;
else { else {
if (!(menu = MENU_GetMenu( hMenu ))) if (!(menu = MENU_GetMenu( hMenu )))
@ -2082,7 +2082,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
rect = item->rect; rect = item->rect;
/* correct item if modified as a reaction to WM_INITMENUPOPUP message */ /* correct item if modified as a reaction to WM_INITMENUPOPUP message */
if (!(item->fState & MF_HILITE)) if (!(item->fState & MF_HILITE))
{ {
if (menu->wFlags & MF_POPUP) hdc = GetDC( menu->hWnd ); if (menu->wFlags & MF_POPUP) hdc = GetDC( menu->hWnd );
else hdc = GetDCEx( menu->hWnd, 0, DCX_CACHE | DCX_WINDOW); else hdc = GetDCEx( menu->hWnd, 0, DCX_CACHE | DCX_WINDOW);
@ -2090,7 +2090,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
SelectObject( hdc, hMenuFont); SelectObject( hdc, hMenuFont);
item->fState |= MF_HILITE; item->fState |= MF_HILITE;
MENU_DrawMenuItem( menu->hWnd, hmenu, hwndOwner, hdc, item, menu->Height, !(menu->wFlags & MF_POPUP), ODA_DRAWENTIRE ); MENU_DrawMenuItem( menu->hWnd, hmenu, hwndOwner, hdc, item, menu->Height, !(menu->wFlags & MF_POPUP), ODA_DRAWENTIRE );
ReleaseDC( menu->hWnd, hdc ); ReleaseDC( menu->hWnd, hdc );
} }
if (!item->rect.top && !item->rect.left && !item->rect.bottom && !item->rect.right) if (!item->rect.top && !item->rect.left && !item->rect.bottom && !item->rect.right)
@ -2194,7 +2194,7 @@ static INT MENU_ExecFocusedItem( MTRACKER* pmt, HMENU hMenu, UINT wFlags )
TRACE("%p hmenu=0x%04x\n", pmt, hMenu); TRACE("%p hmenu=0x%04x\n", pmt, hMenu);
if (!menu || !menu->nItems || if (!menu || !menu->nItems ||
(menu->FocusedItem == NO_SELECTED_ITEM)) return -1; (menu->FocusedItem == NO_SELECTED_ITEM)) return -1;
item = &menu->items[menu->FocusedItem]; item = &menu->items[menu->FocusedItem];
@ -2206,8 +2206,8 @@ static INT MENU_ExecFocusedItem( MTRACKER* pmt, HMENU hMenu, UINT wFlags )
{ {
if (!(item->fState & (MF_GRAYED | MF_DISABLED)) && !(item->fType & MF_SEPARATOR)) if (!(item->fState & (MF_GRAYED | MF_DISABLED)) && !(item->fType & MF_SEPARATOR))
{ {
/* If TPM_RETURNCMD is set you return the id, but /* If TPM_RETURNCMD is set you return the id, but
do not send a message to the owner */ do not send a message to the owner */
if(!(wFlags & TPM_RETURNCMD)) if(!(wFlags & TPM_RETURNCMD))
{ {
if( menu->wFlags & MF_SYSMENU ) if( menu->wFlags & MF_SYSMENU )
@ -2282,11 +2282,11 @@ static BOOL MENU_ButtonDown( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags )
/* In win31, a newly popped menu always remains opened for the next buttonup */ /* In win31, a newly popped menu always remains opened for the next buttonup */
if(TWEAK_WineLook == WIN31_LOOK) if(TWEAK_WineLook == WIN31_LOOK)
ptmenu->bTimeToHide = FALSE; ptmenu->bTimeToHide = FALSE;
} }
return TRUE; return TRUE;
} }
/* Else the click was on the menu bar, finish the tracking */ /* Else the click was on the menu bar, finish the tracking */
} }
return FALSE; return FALSE;
@ -2349,13 +2349,13 @@ static BOOL MENU_MouseMove( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags )
id = 0; id = 0;
else else
MENU_FindItemByCoords( ptmenu, pmt->pt, &id ); MENU_FindItemByCoords( ptmenu, pmt->pt, &id );
} }
if( id == NO_SELECTED_ITEM ) if( id == NO_SELECTED_ITEM )
{ {
MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu, MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
NO_SELECTED_ITEM, TRUE, pmt->hTopMenu); NO_SELECTED_ITEM, TRUE, pmt->hTopMenu);
} }
else if( ptmenu->FocusedItem != id ) else if( ptmenu->FocusedItem != id )
{ {
@ -2443,21 +2443,21 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
if( hNewMenu != pmt->hTopMenu ) if( hNewMenu != pmt->hTopMenu )
{ {
MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, NO_SELECTED_ITEM, MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, NO_SELECTED_ITEM,
FALSE, 0 ); FALSE, 0 );
if( pmt->hCurrentMenu != pmt->hTopMenu ) if( pmt->hCurrentMenu != pmt->hTopMenu )
MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE ); MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE );
} }
if( hNewWnd != pmt->hOwnerWnd ) if( hNewWnd != pmt->hOwnerWnd )
{ {
ReleaseCapture(); ReleaseCapture();
pmt->hOwnerWnd = hNewWnd; pmt->hOwnerWnd = hNewWnd;
EVENT_Capture( pmt->hOwnerWnd, HTMENU ); EVENT_Capture( pmt->hOwnerWnd, HTMENU );
} }
pmt->hTopMenu = pmt->hCurrentMenu = hNewMenu; /* all subpopups are hidden */ pmt->hTopMenu = pmt->hCurrentMenu = hNewMenu; /* all subpopups are hidden */
MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, id, TRUE, 0 ); MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, id, TRUE, 0 );
return TRUE; return TRUE;
} }
@ -2505,7 +2505,7 @@ static BOOL MENU_SuspendPopup( MTRACKER* pmt, UINT16 uMsg )
/*********************************************************************** /***********************************************************************
* MENU_KeyEscape * MENU_KeyEscape
* *
* Handle a VK_ESCAPE key event in a menu. * Handle a VK_ESCAPE key event in a menu.
*/ */
static BOOL MENU_KeyEscape(MTRACKER* pmt, UINT wFlags) static BOOL MENU_KeyEscape(MTRACKER* pmt, UINT wFlags)
{ {
@ -2540,7 +2540,7 @@ static BOOL MENU_KeyEscape(MTRACKER* pmt, UINT wFlags)
/*********************************************************************** /***********************************************************************
* MENU_KeyLeft * MENU_KeyLeft
* *
* Handle a VK_LEFT key event in a menu. * Handle a VK_LEFT key event in a menu.
*/ */
static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags ) static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags )
{ {
@ -2552,9 +2552,9 @@ static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags )
menu = MENU_GetMenu( hmenutmp ); menu = MENU_GetMenu( hmenutmp );
/* Try to move 1 column left (if possible) */ /* Try to move 1 column left (if possible) */
if( (prevcol = MENU_GetStartOfPrevColumn( pmt->hCurrentMenu )) != if( (prevcol = MENU_GetStartOfPrevColumn( pmt->hCurrentMenu )) !=
NO_SELECTED_ITEM ) { NO_SELECTED_ITEM ) {
MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu, MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
prevcol, TRUE, 0 ); prevcol, TRUE, 0 );
return; return;
@ -2568,7 +2568,7 @@ static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags )
} }
MENU_HideSubPopups( pmt->hOwnerWnd, hmenuprev, TRUE ); MENU_HideSubPopups( pmt->hOwnerWnd, hmenuprev, TRUE );
pmt->hCurrentMenu = hmenuprev; pmt->hCurrentMenu = hmenuprev;
if ( (hmenuprev == pmt->hTopMenu) && !(menu->wFlags & MF_POPUP) ) if ( (hmenuprev == pmt->hTopMenu) && !(menu->wFlags & MF_POPUP) )
{ {
@ -2619,7 +2619,7 @@ static void MENU_KeyRight( MTRACKER* pmt, UINT wFlags )
} }
/* Check to see if there's another column */ /* Check to see if there's another column */
if( (nextcol = MENU_GetStartOfNextColumn( pmt->hCurrentMenu )) != if( (nextcol = MENU_GetStartOfNextColumn( pmt->hCurrentMenu )) !=
NO_SELECTED_ITEM ) { NO_SELECTED_ITEM ) {
TRACE("Going to %d.\n", nextcol ); TRACE("Going to %d.\n", nextcol );
MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu, MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
@ -2641,7 +2641,7 @@ static void MENU_KeyRight( MTRACKER* pmt, UINT wFlags )
if( hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP ) if( hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP )
if( !MENU_SuspendPopup(pmt, WM_KEYDOWN) ) if( !MENU_SuspendPopup(pmt, WM_KEYDOWN) )
pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
pmt->hTopMenu, TRUE, wFlags); pmt->hTopMenu, TRUE, wFlags);
} }
} }
@ -2675,11 +2675,11 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
fEndMenu = FALSE; fEndMenu = FALSE;
if (!(menu = MENU_GetMenu( hmenu ))) return FALSE; if (!(menu = MENU_GetMenu( hmenu ))) return FALSE;
if (wFlags & TPM_BUTTONDOWN) if (wFlags & TPM_BUTTONDOWN)
{ {
/* Get the result in order to start the tracking or not */ /* Get the result in order to start the tracking or not */
fRemove = MENU_ButtonDown( &mt, hmenu, wFlags ); fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
fEndMenu = !fRemove; fEndMenu = !fRemove;
} }
EVENT_Capture( mt.hOwnerWnd, HTMENU ); EVENT_Capture( mt.hOwnerWnd, HTMENU );
@ -2714,14 +2714,14 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
} }
/* check if EndMenu() tried to cancel us, by posting this message */ /* check if EndMenu() tried to cancel us, by posting this message */
if(msg.message == WM_CANCELMODE) if(msg.message == WM_CANCELMODE)
{ {
/* we are now out of the loop */ /* we are now out of the loop */
fEndMenu = TRUE; fEndMenu = TRUE;
/* remove the message from the queue */ /* remove the message from the queue */
PeekMessageA( &msg, 0, msg.message, msg.message, PM_REMOVE ); PeekMessageA( &msg, 0, msg.message, msg.message, PM_REMOVE );
/* break out of internal loop, ala ESCAPE */ /* break out of internal loop, ala ESCAPE */
break; break;
} }
@ -2735,9 +2735,9 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
fRemove = FALSE; fRemove = FALSE;
if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
{ {
/* /*
* use the mouse coordinates in lParam instead of those in the MSG * use the mouse coordinates in lParam instead of those in the MSG
* struct to properly handle synthetic messages. lParam coords are * struct to properly handle synthetic messages. lParam coords are
* relative to client area, so they must be converted; since they can * relative to client area, so they must be converted; since they can
* be negative, we must use SLOWORD/SHIWORD instead of LOWORD/HIWORD. * be negative, we must use SLOWORD/SHIWORD instead of LOWORD/HIWORD.
*/ */
@ -2763,7 +2763,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
fRemove = MENU_ButtonDown( &mt, hmenu, wFlags ); fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
fEndMenu = !fRemove; fEndMenu = !fRemove;
break; break;
case WM_RBUTTONUP: case WM_RBUTTONUP:
if (!(wFlags & TPM_RIGHTBUTTON)) break; if (!(wFlags & TPM_RIGHTBUTTON)) break;
/* fall through */ /* fall through */
@ -2782,13 +2782,13 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
with the menu tracking. If not, stop it */ with the menu tracking. If not, stop it */
else else
fEndMenu = ((wFlags & TPM_POPUPMENU) ? FALSE : TRUE); fEndMenu = ((wFlags & TPM_POPUPMENU) ? FALSE : TRUE);
break; break;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
/* In win95 winelook, the selected menu item must be changed every time the /* In win95 winelook, the selected menu item must be changed every time the
mouse moves. In Win31 winelook, the mouse button has to be held down */ mouse moves. In Win31 winelook, the mouse button has to be held down */
if ( hmenu && ((TWEAK_WineLook > WIN31_LOOK) || if ( hmenu && ((TWEAK_WineLook > WIN31_LOOK) ||
( (msg.wParam & MK_LBUTTON) || ( (msg.wParam & MK_LBUTTON) ||
((wFlags & TPM_RIGHTBUTTON) && (msg.wParam & MK_RBUTTON)))) ) ((wFlags & TPM_RIGHTBUTTON) && (msg.wParam & MK_RBUTTON)))) )
@ -2807,11 +2807,11 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
{ {
case VK_HOME: case VK_HOME:
case VK_END: case VK_END:
MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu, MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu,
NO_SELECTED_ITEM, FALSE, 0 ); NO_SELECTED_ITEM, FALSE, 0 );
/* fall through */ /* fall through */
case VK_UP: case VK_UP:
MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu, MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu,
(msg.wParam == VK_HOME)? ITEM_NEXT : ITEM_PREV ); (msg.wParam == VK_HOME)? ITEM_NEXT : ITEM_PREV );
break; break;
@ -2827,11 +2827,11 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
case VK_LEFT: case VK_LEFT:
MENU_KeyLeft( &mt, wFlags ); MENU_KeyLeft( &mt, wFlags );
break; break;
case VK_RIGHT: case VK_RIGHT:
MENU_KeyRight( &mt, wFlags ); MENU_KeyRight( &mt, wFlags );
break; break;
case VK_ESCAPE: case VK_ESCAPE:
fEndMenu = MENU_KeyEscape(&mt, wFlags); fEndMenu = MENU_KeyEscape(&mt, wFlags);
break; break;
@ -2841,10 +2841,10 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
HELPINFO hi; HELPINFO hi;
hi.cbSize = sizeof(HELPINFO); hi.cbSize = sizeof(HELPINFO);
hi.iContextType = HELPINFO_MENUITEM; hi.iContextType = HELPINFO_MENUITEM;
if (menu->FocusedItem == NO_SELECTED_ITEM) if (menu->FocusedItem == NO_SELECTED_ITEM)
hi.iCtrlId = 0; hi.iCtrlId = 0;
else else
hi.iCtrlId = menu->items[menu->FocusedItem].wID; hi.iCtrlId = menu->items[menu->FocusedItem].wID;
hi.hItemHandle = hmenu; hi.hItemHandle = hmenu;
hi.dwContextId = menu->dwContextHelpID; hi.dwContextId = menu->dwContextHelpID;
hi.MousePos = msg.pt; hi.MousePos = msg.pt;
@ -2863,7 +2863,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
case VK_MENU: case VK_MENU:
fEndMenu = TRUE; fEndMenu = TRUE;
break; break;
} }
break; /* WM_SYSKEYDOWN */ break; /* WM_SYSKEYDOWN */
@ -2883,7 +2883,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
/* We will find a better way real soon... */ /* We will find a better way real soon... */
if ((msg.wParam <= 32) || (msg.wParam >= 127)) break; if ((msg.wParam <= 32) || (msg.wParam >= 127)) break;
pos = MENU_FindItemByKey( mt.hOwnerWnd, mt.hCurrentMenu, pos = MENU_FindItemByKey( mt.hOwnerWnd, mt.hCurrentMenu,
LOWORD(msg.wParam), FALSE ); LOWORD(msg.wParam), FALSE );
if (pos == (UINT)-2) fEndMenu = TRUE; if (pos == (UINT)-2) fEndMenu = TRUE;
else if (pos == (UINT)-1) MessageBeep(0); else if (pos == (UINT)-1) MessageBeep(0);
@ -2894,7 +2894,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
executedMenuId = MENU_ExecFocusedItem(&mt,mt.hCurrentMenu, wFlags); executedMenuId = MENU_ExecFocusedItem(&mt,mt.hCurrentMenu, wFlags);
fEndMenu = (executedMenuId != -1); fEndMenu = (executedMenuId != -1);
} }
} }
break; break;
} /* switch(msg.message) - kbd */ } /* switch(msg.message) - kbd */
} }
@ -2926,7 +2926,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
{ {
MENU_HideSubPopups( mt.hOwnerWnd, mt.hTopMenu, FALSE ); MENU_HideSubPopups( mt.hOwnerWnd, mt.hTopMenu, FALSE );
if (menu && menu->wFlags & MF_POPUP) if (menu && menu->wFlags & MF_POPUP)
{ {
DestroyWindow( menu->hWnd ); DestroyWindow( menu->hWnd );
menu->hWnd = 0; menu->hWnd = 0;
@ -2967,7 +2967,7 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
Recalculate menu sizes else clicks will not work */ Recalculate menu sizes else clicks will not work */
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
} }
} }
return TRUE; return TRUE;
@ -3185,9 +3185,9 @@ UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
if (!(lppop = MENU_GetMenu( GetMenu(hwnd) ))) return 0; if (!(lppop = MENU_GetMenu( GetMenu(hwnd) ))) return 0;
hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW ); hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
SelectObject( hdc, hMenuFont); SelectObject( hdc, hMenuFont);
SetRect(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+GetSystemMetrics(SM_CYMENU)); SetRect(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+GetSystemMetrics(SM_CYMENU));
MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd ); MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd );
ReleaseDC( hwnd, hdc ); ReleaseDC( hwnd, hdc );
return lppop->Height; return lppop->Height;
} }
@ -3305,11 +3305,11 @@ UINT WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
MENUITEM *item; MENUITEM *item;
POPUPMENU *menu; POPUPMENU *menu;
TRACE("(%04x, %04X, %04X) !\n", TRACE("(%04x, %04X, %04X) !\n",
hMenu, wItemID, wFlags); hMenu, wItemID, wFlags);
/* Get the Popupmenu to access the owner menu */ /* Get the Popupmenu to access the owner menu */
if (!(menu = MENU_GetMenu(hMenu))) if (!(menu = MENU_GetMenu(hMenu)))
return (UINT)-1; return (UINT)-1;
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags )))
@ -3319,7 +3319,7 @@ UINT WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
item->fState ^= (oldflags ^ wFlags) & (MF_GRAYED | MF_DISABLED); item->fState ^= (oldflags ^ wFlags) & (MF_GRAYED | MF_DISABLED);
/* In win95 if the close item in the system menu change update the close button */ /* In win95 if the close item in the system menu change update the close button */
if (TWEAK_WineLook == WIN95_LOOK) if (TWEAK_WineLook == WIN95_LOOK)
if((item->wID == SC_CLOSE) && (oldflags != wFlags)) if((item->wID == SC_CLOSE) && (oldflags != wFlags))
{ {
if (menu->hSysMenuOwner != 0) if (menu->hSysMenuOwner != 0)
@ -3327,7 +3327,7 @@ UINT WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
POPUPMENU* parentMenu; POPUPMENU* parentMenu;
/* Get the parent menu to access*/ /* Get the parent menu to access*/
if (!(parentMenu = MENU_GetMenu(menu->hSysMenuOwner))) if (!(parentMenu = MENU_GetMenu(menu->hSysMenuOwner)))
return (UINT)-1; return (UINT)-1;
/* Refresh the frame to reflect the change*/ /* Refresh the frame to reflect the change*/
@ -3335,7 +3335,7 @@ UINT WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
} }
} }
return oldflags; return oldflags;
} }
@ -3353,12 +3353,12 @@ INT16 WINAPI GetMenuString16( HMENU16 hMenu, UINT16 wItemID,
/******************************************************************* /*******************************************************************
* GetMenuStringA (USER32.@) * GetMenuStringA (USER32.@)
*/ */
INT WINAPI GetMenuStringA( INT WINAPI GetMenuStringA(
HMENU hMenu, /* [in] menuhandle */ HMENU hMenu, /* [in] menuhandle */
UINT wItemID, /* [in] menu item (dep. on wFlags) */ UINT wItemID, /* [in] menu item (dep. on wFlags) */
LPSTR str, /* [out] outbuffer. If NULL, func returns entry length*/ LPSTR str, /* [out] outbuffer. If NULL, func returns entry length*/
INT nMaxSiz, /* [in] length of buffer. if 0, func returns entry len*/ INT nMaxSiz, /* [in] length of buffer. if 0, func returns entry len*/
UINT wFlags /* [in] MF_ flags */ UINT wFlags /* [in] MF_ flags */
) { ) {
MENUITEM *item; MENUITEM *item;
@ -3401,7 +3401,7 @@ BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID,
UINT wHilite ) UINT wHilite )
{ {
LPPOPUPMENU menu; LPPOPUPMENU menu;
TRACE("(%04x, %04x, %04x, %04x);\n", TRACE("(%04x, %04x, %04x, %04x);\n",
hWnd, hMenu, wItemID, wHilite); hWnd, hMenu, wItemID, wHilite);
if (!MENU_FindItem( &hMenu, &wItemID, wHilite )) return FALSE; if (!MENU_FindItem( &hMenu, &wItemID, wHilite )) return FALSE;
if (!(menu = MENU_GetMenu(hMenu))) return FALSE; if (!(menu = MENU_GetMenu(hMenu))) return FALSE;
@ -3427,7 +3427,7 @@ UINT16 WINAPI GetMenuState16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags )
UINT WINAPI GetMenuState( HMENU hMenu, UINT wItemID, UINT wFlags ) UINT WINAPI GetMenuState( HMENU hMenu, UINT wItemID, UINT wFlags )
{ {
MENUITEM *item; MENUITEM *item;
TRACE("(menu=%04x, id=%04x, flags=%04x);\n", TRACE("(menu=%04x, id=%04x, flags=%04x);\n",
hMenu, wItemID, wFlags); hMenu, wItemID, wFlags);
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1; if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
debug_print_menuitem (" item: ", item, ""); debug_print_menuitem (" item: ", item, "");
@ -3454,7 +3454,7 @@ INT16 WINAPI GetMenuItemCount16( HMENU16 hMenu )
{ {
LPPOPUPMENU menu = MENU_GetMenu(hMenu); LPPOPUPMENU menu = MENU_GetMenu(hMenu);
if (!menu) return -1; if (!menu) return -1;
TRACE("(%04x) returning %d\n", TRACE("(%04x) returning %d\n",
hMenu, menu->nItems ); hMenu, menu->nItems );
return menu->nItems; return menu->nItems;
} }
@ -3467,7 +3467,7 @@ INT WINAPI GetMenuItemCount( HMENU hMenu )
{ {
LPPOPUPMENU menu = MENU_GetMenu(hMenu); LPPOPUPMENU menu = MENU_GetMenu(hMenu);
if (!menu) return -1; if (!menu) return -1;
TRACE("(%04x) returning %d\n", TRACE("(%04x) returning %d\n",
hMenu, menu->nItems ); hMenu, menu->nItems );
return menu->nItems; return menu->nItems;
} }
@ -3612,7 +3612,7 @@ BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags )
TRACE("(menu=%04x pos=%04x flags=%04x)\n",hMenu, nPos, wFlags); TRACE("(menu=%04x pos=%04x flags=%04x)\n",hMenu, nPos, wFlags);
if (!(item = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE; if (!(item = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
if (!(menu = MENU_GetMenu(hMenu))) return FALSE; if (!(menu = MENU_GetMenu(hMenu))) return FALSE;
/* Remove item */ /* Remove item */
MENU_FreeItemData( item ); MENU_FreeItemData( item );
@ -3884,20 +3884,20 @@ HMENU WINAPI GetSystemMenu( HWND hWnd, BOOL bRevert )
{ {
if( bRevert ) if( bRevert )
{ {
DestroyMenu(wndPtr->hSysMenu); DestroyMenu(wndPtr->hSysMenu);
wndPtr->hSysMenu = 0; wndPtr->hSysMenu = 0;
} }
else else
{ {
POPUPMENU *menu = MENU_GetMenu( wndPtr->hSysMenu ); POPUPMENU *menu = MENU_GetMenu( wndPtr->hSysMenu );
if( menu ) if( menu )
{ {
if( menu->nItems > 0 && menu->items[0].hSubMenu == MENU_DefSysPopup ) if( menu->nItems > 0 && menu->items[0].hSubMenu == MENU_DefSysPopup )
menu->items[0].hSubMenu = MENU_CopySysPopup(); menu->items[0].hSubMenu = MENU_CopySysPopup();
} }
else else
{ {
WARN("Current sys-menu (%04x) of wnd %04x is broken\n", WARN("Current sys-menu (%04x) of wnd %04x is broken\n",
wndPtr->hSysMenu, hWnd); wndPtr->hSysMenu, hWnd);
wndPtr->hSysMenu = 0; wndPtr->hSysMenu = 0;
} }
@ -3945,7 +3945,7 @@ BOOL WINAPI SetSystemMenu( HWND hwnd, HMENU hMenu )
/********************************************************************** /**********************************************************************
* GetMenu (USER32.@) * GetMenu (USER32.@)
*/ */
HMENU WINAPI GetMenu( HWND hWnd ) HMENU WINAPI GetMenu( HWND hWnd )
{ {
HMENU retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID ); HMENU retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID );
TRACE("for %04x returning %04x\n", hWnd, retvalue); TRACE("for %04x returning %04x\n", hWnd, retvalue);
@ -4033,7 +4033,7 @@ BOOL WINAPI DrawMenuBar( HWND hWnd )
* DrawMenuBarTemp (USER32.@) * DrawMenuBarTemp (USER32.@)
* *
* UNDOCUMENTED !! * UNDOCUMENTED !!
* *
* called by W98SE desk.cpl Control Panel Applet * called by W98SE desk.cpl Control Panel Applet
* *
* Not 100% sure about the param names, but close. * Not 100% sure about the param names, but close.
@ -4314,7 +4314,7 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
BOOL WINAPI GetMenuItemInfoA( HMENU hmenu, UINT item, BOOL bypos, BOOL WINAPI GetMenuItemInfoA( HMENU hmenu, UINT item, BOOL bypos,
LPMENUITEMINFOA lpmii) LPMENUITEMINFOA lpmii)
{ {
return GetMenuItemInfo_common (hmenu, item, bypos, return GetMenuItemInfo_common (hmenu, item, bypos,
(LPMENUITEMINFOW)lpmii, FALSE); (LPMENUITEMINFOW)lpmii, FALSE);
} }
@ -4371,7 +4371,7 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
menu->text = NULL; menu->text = NULL;
} }
/* make only MENU_ITEM_TYPE bits in menu->fType equal lpmii->fType */ /* make only MENU_ITEM_TYPE bits in menu->fType equal lpmii->fType */
menu->fType &= ~MENU_ITEM_TYPE(menu->fType); menu->fType &= ~MENU_ITEM_TYPE(menu->fType);
menu->fType |= MENU_ITEM_TYPE(lpmii->fType); menu->fType |= MENU_ITEM_TYPE(lpmii->fType);
@ -4445,10 +4445,10 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
* SetMenuItemInfoA (USER32.@) * SetMenuItemInfoA (USER32.@)
*/ */
BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos, BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos,
const MENUITEMINFOA *lpmii) const MENUITEMINFOA *lpmii)
{ {
if ((lpmii->fType & (MF_HILITE|MF_POPUP)) || (lpmii->fState)) { if ((lpmii->fType & (MF_HILITE|MF_POPUP)) || (lpmii->fState)) {
/* QuickTime does pass invalid data into SetMenuItemInfo. /* QuickTime does pass invalid data into SetMenuItemInfo.
* do some of the checks Windows does. * do some of the checks Windows does.
*/ */
WARN("Bad masks for type (0x%08x) or state (0x%08x)\n", WARN("Bad masks for type (0x%08x) or state (0x%08x)\n",
@ -4479,7 +4479,7 @@ BOOL WINAPI SetMenuDefaultItem(HMENU hmenu, UINT uItem, UINT bypos)
UINT i; UINT i;
POPUPMENU *menu; POPUPMENU *menu;
MENUITEM *item; MENUITEM *item;
TRACE("(0x%x,%d,%d)\n", hmenu, uItem, bypos); TRACE("(0x%x,%d,%d)\n", hmenu, uItem, bypos);
if (!(menu = MENU_GetMenu(hmenu))) return FALSE; if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
@ -4490,7 +4490,7 @@ BOOL WINAPI SetMenuDefaultItem(HMENU hmenu, UINT uItem, UINT bypos)
{ {
item->fState &= ~MFS_DEFAULT; item->fState &= ~MFS_DEFAULT;
} }
/* no default item */ /* no default item */
if ( -1 == uItem) if ( -1 == uItem)
{ {
@ -4514,7 +4514,7 @@ BOOL WINAPI SetMenuDefaultItem(HMENU hmenu, UINT uItem, UINT bypos)
return TRUE; return TRUE;
} }
} }
} }
return FALSE; return FALSE;
} }
@ -4534,16 +4534,16 @@ UINT WINAPI GetMenuDefaultItem(HMENU hmenu, UINT bypos, UINT flags)
/* find default item */ /* find default item */
item = menu->items; item = menu->items;
/* empty menu */ /* empty menu */
if (! item) return -1; if (! item) return -1;
while ( !( item->fState & MFS_DEFAULT ) ) while ( !( item->fState & MFS_DEFAULT ) )
{ {
i++; item++; i++; item++;
if (i >= menu->nItems ) return -1; if (i >= menu->nItems ) return -1;
} }
/* default: don't return disabled items */ /* default: don't return disabled items */
if ( (!(GMDI_USEDISABLED & flags)) && (item->fState & MFS_DISABLED )) return -1; if ( (!(GMDI_USEDISABLED & flags)) && (item->fState & MFS_DISABLED )) return -1;
@ -4660,10 +4660,10 @@ BOOL16 WINAPI CheckMenuRadioItem16(HMENU16 hMenu,
/********************************************************************** /**********************************************************************
* GetMenuItemRect (USER32.@) * GetMenuItemRect (USER32.@)
* *
* ATTENTION: Here, the returned values in rect are the screen * ATTENTION: Here, the returned values in rect are the screen
* coordinates of the item just like if the menu was * coordinates of the item just like if the menu was
* always on the upper left side of the application. * always on the upper left side of the application.
* *
*/ */
BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem, BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem,
LPRECT rect) LPRECT rect)
@ -4680,7 +4680,7 @@ BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem,
if(!hwnd) if(!hwnd)
{ {
itemMenu = MENU_GetMenu(hMenu); itemMenu = MENU_GetMenu(hMenu);
if (itemMenu == NULL) if (itemMenu == NULL)
return FALSE; return FALSE;
if(itemMenu->hWnd == 0) if(itemMenu->hWnd == 0)
@ -4688,7 +4688,7 @@ BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem,
referenceHwnd = itemMenu->hWnd; referenceHwnd = itemMenu->hWnd;
} }
if ((rect == NULL) || (item == NULL)) if ((rect == NULL) || (item == NULL))
return FALSE; return FALSE;
*rect = item->rect; *rect = item->rect;
@ -4803,7 +4803,7 @@ DWORD WINAPI GetMenuContextHelpId16( HMENU16 hMenu )
{ {
return GetMenuContextHelpId( hMenu ); return GetMenuContextHelpId( hMenu );
} }
/********************************************************************** /**********************************************************************
* GetMenuContextHelpId (USER32.@) * GetMenuContextHelpId (USER32.@)
*/ */
@ -4966,11 +4966,11 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
} }
else else
{ {
/* some reasons for NOT sending the WM_{SYS}COMMAND message: /* some reasons for NOT sending the WM_{SYS}COMMAND message:
* #0: unknown (please report!) * #0: unknown (please report!)
* #1: for WM_KEYUP,WM_SYSKEYUP * #1: for WM_KEYUP,WM_SYSKEYUP
* #2: mouse is captured * #2: mouse is captured
* #3: window is disabled * #3: window is disabled
* #4: it's a disabled system menu option * #4: it's a disabled system menu option
* #5: it's a menu option, but window is iconic * #5: it's a menu option, but window is iconic
* #6: it's a menu option, but disabled * #6: it's a menu option, but disabled

View File

@ -111,9 +111,9 @@ static BOOL SCROLL_trackVertical;
static BOOL SCROLL_MovingThumb = FALSE; static BOOL SCROLL_MovingThumb = FALSE;
/* Local functions */ /* Local functions */
static BOOL SCROLL_ShowScrollBar( HWND hwnd, INT nBar, static BOOL SCROLL_ShowScrollBar( HWND hwnd, INT nBar,
BOOL fShowH, BOOL fShowV ); BOOL fShowH, BOOL fShowV );
static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
const SCROLLINFO *info, INT *action ); const SCROLLINFO *info, INT *action );
static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar, static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar,
RECT *rect, INT arrowSize, RECT *rect, INT arrowSize,
@ -519,7 +519,7 @@ static void SCROLL_DrawMovingThumb_31( HDC hdc, RECT *rect, BOOL vertical,
r.left = rect->left + arrowSize - SCROLL_ARROW_THUMB_OVERLAP; r.left = rect->left + arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
if (r.left + thumbSize > if (r.left + thumbSize >
rect->right - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP)) rect->right - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP))
r.left = rect->right - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP) r.left = rect->right - (arrowSize - SCROLL_ARROW_THUMB_OVERLAP)
- thumbSize; - thumbSize;
r.right = r.left + thumbSize; r.right = r.left + thumbSize;
} }
@ -549,7 +549,7 @@ static void SCROLL_DrawMovingThumb_9x( HDC hdc, RECT *rect, BOOL vertical,
SCROLL_DrawInterior_9x( SCROLL_TrackingWin, hdc, SCROLL_TrackingBar, SCROLL_DrawInterior_9x( SCROLL_TrackingWin, hdc, SCROLL_TrackingBar,
rect, arrowSize, thumbSize, pos, rect, arrowSize, thumbSize, pos,
0, vertical, FALSE, FALSE ); 0, vertical, FALSE, FALSE );
SCROLL_MovingThumb = !SCROLL_MovingThumb; SCROLL_MovingThumb = !SCROLL_MovingThumb;
} }
@ -567,7 +567,7 @@ static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical,
* *
* Draw the scroll bar interior (everything except the arrows). * Draw the scroll bar interior (everything except the arrows).
*/ */
static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar, static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar,
RECT *rect, INT arrowSize, RECT *rect, INT arrowSize,
INT thumbSize, INT thumbPos, INT thumbSize, INT thumbPos,
UINT flags, BOOL vertical, UINT flags, BOOL vertical,
@ -582,7 +582,7 @@ static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar,
* to correctly setup default scrollbar colors * to correctly setup default scrollbar colors
*/ */
if (nBar == SB_CTL) if (nBar == SB_CTL)
{ {
hBrush = (HBRUSH)SendMessageA( GetParent(hwnd), WM_CTLCOLORSCROLLBAR, hBrush = (HBRUSH)SendMessageA( GetParent(hwnd), WM_CTLCOLORSCROLLBAR,
(WPARAM)hdc,(LPARAM)hwnd); (WPARAM)hdc,(LPARAM)hwnd);
} }
@ -656,7 +656,7 @@ static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar,
} }
static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar, static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar,
RECT *rect, INT arrowSize, RECT *rect, INT arrowSize,
INT thumbSize, INT thumbPos, INT thumbSize, INT thumbPos,
UINT flags, BOOL vertical, UINT flags, BOOL vertical,
@ -685,11 +685,11 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar,
* The window-owned scrollbars need to call DEFWND_ControlColor * The window-owned scrollbars need to call DEFWND_ControlColor
* to correctly setup default scrollbar colors * to correctly setup default scrollbar colors
*/ */
if (nBar == SB_CTL) { if (nBar == SB_CTL) {
hBrush = (HBRUSH)SendMessageA( GetParent(hwnd), WM_CTLCOLORSCROLLBAR, hBrush = (HBRUSH)SendMessageA( GetParent(hwnd), WM_CTLCOLORSCROLLBAR,
(WPARAM)hdc,(LPARAM)hwnd); (WPARAM)hdc,(LPARAM)hwnd);
} else { } else {
hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR ); hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR );
} }
} }
hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) ); hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
@ -792,7 +792,7 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar,
* *
* Redraw the whole scrollbar. * Redraw the whole scrollbar.
*/ */
void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
BOOL arrows, BOOL interior ) BOOL arrows, BOOL interior )
{ {
INT arrowSize, thumbSize, thumbPos; INT arrowSize, thumbSize, thumbPos;
@ -829,7 +829,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
(SCROLL_trackHitTest == SCROLL_TOP_ARROW), (SCROLL_trackHitTest == SCROLL_TOP_ARROW),
(SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW) ); (SCROLL_trackHitTest == SCROLL_BOTTOM_ARROW) );
else else
SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical, SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize, vertical,
FALSE, FALSE ); FALSE, FALSE );
} }
if( interior ) if( interior )
@ -865,7 +865,7 @@ END:
* Repaint the scroll bar interior after a SetScrollRange() or * Repaint the scroll bar interior after a SetScrollRange() or
* SetScrollPos() call. * SetScrollPos() call.
*/ */
static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar, static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar,
BOOL arrows, BOOL interior ) BOOL arrows, BOOL interior )
{ {
HDC hdc = GetDCEx( hwnd, 0, HDC hdc = GetDCEx( hwnd, 0,
@ -929,7 +929,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ); SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
if (!infoPtr) return; if (!infoPtr) return;
if ((SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN)) if ((SCROLL_trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN))
return; return;
hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW)); hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
@ -991,7 +991,7 @@ static void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt)
SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_LINEUP, (LPARAM)hwndCtl ); SB_LINEUP, (LPARAM)hwndCtl );
} }
SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ?
SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY,
(TIMERPROC)0 ); (TIMERPROC)0 );
@ -1207,7 +1207,7 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
MoveWindow( hwnd, lpCreat->x, lpCreat->y, MoveWindow( hwnd, lpCreat->x, lpCreat->y,
GetSystemMetrics(SM_CXVSCROLL)+1, lpCreat->cy, FALSE ); GetSystemMetrics(SM_CXVSCROLL)+1, lpCreat->cy, FALSE );
else if (lpCreat->style & SBS_RIGHTALIGN) else if (lpCreat->style & SBS_RIGHTALIGN)
MoveWindow( hwnd, MoveWindow( hwnd,
lpCreat->x+lpCreat->cx-GetSystemMetrics(SM_CXVSCROLL)-1, lpCreat->x+lpCreat->cx-GetSystemMetrics(SM_CXVSCROLL)-1,
lpCreat->y, lpCreat->y,
GetSystemMetrics(SM_CXVSCROLL)+1, lpCreat->cy, FALSE ); GetSystemMetrics(SM_CXVSCROLL)+1, lpCreat->cy, FALSE );
@ -1218,7 +1218,7 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
MoveWindow( hwnd, lpCreat->x, lpCreat->y, MoveWindow( hwnd, lpCreat->x, lpCreat->y,
lpCreat->cx, GetSystemMetrics(SM_CYHSCROLL)+1, FALSE ); lpCreat->cx, GetSystemMetrics(SM_CYHSCROLL)+1, FALSE );
else if (lpCreat->style & SBS_BOTTOMALIGN) else if (lpCreat->style & SBS_BOTTOMALIGN)
MoveWindow( hwnd, MoveWindow( hwnd,
lpCreat->x, lpCreat->x,
lpCreat->y+lpCreat->cy-GetSystemMetrics(SM_CYHSCROLL)-1, lpCreat->y+lpCreat->cy-GetSystemMetrics(SM_CYHSCROLL)-1,
lpCreat->cx, GetSystemMetrics(SM_CYHSCROLL)+1, FALSE ); lpCreat->cx, GetSystemMetrics(SM_CYHSCROLL)+1, FALSE );
@ -1397,7 +1397,7 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
/************************************************************************* /*************************************************************************
* SetScrollInfo (USER32.@) * SetScrollInfo (USER32.@)
* SetScrollInfo can be used to set the position, upper bound, * SetScrollInfo can be used to set the position, upper bound,
* lower bound, and page size of a scrollbar control. * lower bound, and page size of a scrollbar control.
* *
* RETURNS * RETURNS
@ -1409,9 +1409,9 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam,
* (corresponding to the 76 different positions of the window on * (corresponding to the 76 different positions of the window on
* the text), and info->nPage=25. * the text), and info->nPage=25.
*/ */
INT WINAPI SetScrollInfo( INT WINAPI SetScrollInfo(
HWND hwnd /* [in] Handle of window whose scrollbar will be affected */, HWND hwnd /* [in] Handle of window whose scrollbar will be affected */,
INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */, INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */,
const SCROLLINFO *info /* [in] Specifies what to change and new values */, const SCROLLINFO *info /* [in] Specifies what to change and new values */,
BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */) BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
{ {
@ -1434,10 +1434,10 @@ BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
return retVal; return retVal;
} }
INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
const SCROLLINFO *info, INT *action ) const SCROLLINFO *info, INT *action )
{ {
/* Update the scrollbar state and set action flags according to /* Update the scrollbar state and set action flags according to
* what has to be done graphics wise. */ * what has to be done graphics wise. */
SCROLLBAR_INFO *infoPtr; SCROLLBAR_INFO *infoPtr;
@ -1468,7 +1468,7 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
{ {
infoPtr->Page = info->nPage; infoPtr->Page = info->nPage;
*action |= SA_SSI_REFRESH; *action |= SA_SSI_REFRESH;
bChangeParams = TRUE; bChangeParams = TRUE;
} }
} }
@ -1500,7 +1500,7 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
if( infoPtr->MinVal != info->nMin || if( infoPtr->MinVal != info->nMin ||
infoPtr->MaxVal != info->nMax ) infoPtr->MaxVal != info->nMax )
{ {
*action |= SA_SSI_REFRESH; *action |= SA_SSI_REFRESH;
infoPtr->MinVal = info->nMin; infoPtr->MinVal = info->nMin;
infoPtr->MaxVal = info->nMax; infoPtr->MaxVal = info->nMax;
bChangeParams = TRUE; bChangeParams = TRUE;
@ -1525,7 +1525,7 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
infoPtr->Page, infoPtr->CurVal, infoPtr->Page, infoPtr->CurVal,
infoPtr->MinVal, infoPtr->MaxVal ); infoPtr->MinVal, infoPtr->MaxVal );
/* don't change the scrollbar state if SetScrollInfo /* don't change the scrollbar state if SetScrollInfo
* is just called with SIF_DISABLENOSCROLL * is just called with SIF_DISABLENOSCROLL
*/ */
if(!(info->fMask & SIF_ALL)) goto done; if(!(info->fMask & SIF_ALL)) goto done;
@ -1572,14 +1572,14 @@ done:
/************************************************************************* /*************************************************************************
* GetScrollInfo (USER32.@) * GetScrollInfo (USER32.@)
* GetScrollInfo can be used to retrieve the position, upper bound, * GetScrollInfo can be used to retrieve the position, upper bound,
* lower bound, and page size of a scrollbar control. * lower bound, and page size of a scrollbar control.
* *
* RETURNS STD * RETURNS STD
*/ */
BOOL WINAPI GetScrollInfo( BOOL WINAPI GetScrollInfo(
HWND hwnd /* [in] Handle of window */ , HWND hwnd /* [in] Handle of window */ ,
INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */, INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */,
LPSCROLLINFO info /* [in/out] (info.fMask [in] specifies which values are to retrieve) */) LPSCROLLINFO info /* [in/out] (info.fMask [in] specifies which values are to retrieve) */)
{ {
SCROLLBAR_INFO *infoPtr; SCROLLBAR_INFO *infoPtr;
@ -1613,7 +1613,7 @@ BOOL WINAPI GetScrollInfo(
* Note the ambiguity when 0 is returned. Use GetLastError * Note the ambiguity when 0 is returned. Use GetLastError
* to make sure there was an error (and to know which one). * to make sure there was an error (and to know which one).
*/ */
INT WINAPI SetScrollPos( INT WINAPI SetScrollPos(
HWND hwnd /* [in] Handle of window whose scrollbar will be affected */, HWND hwnd /* [in] Handle of window whose scrollbar will be affected */,
INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */, INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */,
INT nPos /* [in] New value */, INT nPos /* [in] New value */,
@ -1638,13 +1638,13 @@ BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */ )
* *
* RETURNS * RETURNS
* Success: Current position * Success: Current position
* Failure: 0 * Failure: 0
* *
* REMARKS * REMARKS
* Note the ambiguity when 0 is returned. Use GetLastError * Note the ambiguity when 0 is returned. Use GetLastError
* to make sure there was an error (and to know which one). * to make sure there was an error (and to know which one).
*/ */
INT WINAPI GetScrollPos( INT WINAPI GetScrollPos(
HWND hwnd, /* [in] Handle of window */ HWND hwnd, /* [in] Handle of window */
INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */) INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */)
{ {
@ -1660,7 +1660,7 @@ INT nBar /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */)
* *
* RETURNS STD * RETURNS STD
*/ */
BOOL WINAPI SetScrollRange( BOOL WINAPI SetScrollRange(
HWND hwnd, /* [in] Handle of window whose scrollbar will be affected */ HWND hwnd, /* [in] Handle of window whose scrollbar will be affected */
INT nBar, /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */ INT nBar, /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */
INT MinVal, /* [in] New minimum value */ INT MinVal, /* [in] New minimum value */
@ -1720,7 +1720,7 @@ INT SCROLL_SetNCSbState(HWND hwnd, int vMin, int vMax, int vPos,
* *
* RETURNS STD * RETURNS STD
*/ */
BOOL WINAPI GetScrollRange( BOOL WINAPI GetScrollRange(
HWND hwnd, /* [in] Handle of window */ HWND hwnd, /* [in] Handle of window */
INT nBar, /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */ INT nBar, /* [in] One of SB_HORZ, SB_VERT, or SB_CTL */
LPINT lpMin, /* [out] Where to store minimum value */ LPINT lpMin, /* [out] Where to store minimum value */
@ -1745,7 +1745,7 @@ LPINT lpMax /* [out] Where to store maximum value */)
* *
* Back-end for ShowScrollBar(). Returns FALSE if no action was taken. * Back-end for ShowScrollBar(). Returns FALSE if no action was taken.
*/ */
BOOL SCROLL_ShowScrollBar( HWND hwnd, INT nBar, BOOL SCROLL_ShowScrollBar( HWND hwnd, INT nBar,
BOOL fShowH, BOOL fShowV ) BOOL fShowH, BOOL fShowV )
{ {
LONG style = GetWindowLongW( hwnd, GWL_STYLE ); LONG style = GetWindowLongW( hwnd, GWL_STYLE );
@ -1847,7 +1847,7 @@ BOOL WINAPI EnableScrollBar( HWND hwnd, INT nBar, UINT flags )
} }
else else
bFineWithMe = TRUE; bFineWithMe = TRUE;
if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE; if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
if (bFineWithMe && infoPtr->flags == flags) return FALSE; if (bFineWithMe && infoPtr->flags == flags) return FALSE;
infoPtr->flags = flags; infoPtr->flags = flags;

View File

@ -238,7 +238,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
/* /*
* FIXME * FIXME
* DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) ); * DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) );
* *
* We don't want to do this yet because DestroyIcon32 is broken. If the icon * We don't want to do this yet because DestroyIcon32 is broken. If the icon
* had already been loaded by the application the last thing we want to do is * had already been loaded by the application the last thing we want to do is
* GlobalFree16 the handle. * GlobalFree16 the handle.
@ -292,7 +292,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
STATIC_SetIcon(hwnd, hIcon, style); STATIC_SetIcon(hwnd, hIcon, style);
break; break;
} }
case SS_BITMAP: case SS_BITMAP:
{ {
HBITMAP hBitmap; HBITMAP hBitmap;
if(unicode) if(unicode)
@ -485,7 +485,7 @@ static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
HBRUSH hBrush; HBRUSH hBrush;
GetClientRect( hwnd, &rc); GetClientRect( hwnd, &rc);
switch (style & SS_TYPEMASK) switch (style & SS_TYPEMASK)
{ {
case SS_BLACKRECT: case SS_BLACKRECT:

View File

@ -103,9 +103,9 @@ static const signed char LTRBOuterFlat[] = {
static const signed char LTRBInnerFlat[] = { static const signed char LTRBInnerFlat[] = {
-1, -1, -1, -1, -1, -1, -1, -1,
-1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE,
-1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE,
-1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE, -1, COLOR_BTNFACE, COLOR_BTNFACE, COLOR_BTNFACE,
}; };
/*********************************************************************** /***********************************************************************
@ -117,7 +117,7 @@ static const signed char LTRBInnerFlat[] = {
* *
* See also comments with UITOOLS_DrawRectEdge() * See also comments with UITOOLS_DrawRectEdge()
*/ */
static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc, static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
UINT uType, UINT uFlags) UINT uType, UINT uFlags)
{ {
POINT Points[4]; POINT Points[4];
@ -140,7 +140,7 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN); OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, InnerPen); SavePen = (HPEN)SelectObject(hdc, InnerPen);
spx = spy = epx = epy = 0; /* Satisfy the compiler... */ spx = spy = epx = epy = 0; /* Satisfy the compiler... */
/* Determine the colors of the edges */ /* Determine the colors of the edges */
if(uFlags & BF_MONO) if(uFlags & BF_MONO)
{ {
@ -430,7 +430,7 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
*/ */
static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc, static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
UINT uType, UINT uFlags) UINT uType, UINT uFlags)
{ {
signed char LTInnerI, LTOuterI; signed char LTInnerI, LTOuterI;
@ -447,7 +447,7 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER
|| (uType & BDR_OUTER) == BDR_OUTER) || (uType & BDR_OUTER) == BDR_OUTER)
&& !(uFlags & (BF_FLAT|BF_MONO)) ); && !(uFlags & (BF_FLAT|BF_MONO)) );
/* Init some vars */ /* Init some vars */
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN); LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, LTInnerPen); SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
@ -470,7 +470,7 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
* otherwise. * otherwise.
* Dennis Björklund, 10 June, 99 * Dennis Björklund, 10 June, 99
*/ */
if( TWEAK_WineLook == WIN98_LOOK && LTInnerI != -1 ) if( TWEAK_WineLook == WIN98_LOOK && LTInnerI != -1 )
LTInnerI = RBInnerI = COLOR_BTNFACE; LTInnerI = RBInnerI = COLOR_BTNFACE;
} }
else if(uFlags & BF_SOFT) else if(uFlags & BF_SOFT)
@ -559,8 +559,8 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
if(uFlags & BF_BOTTOM) InnerRect.bottom -= add; if(uFlags & BF_BOTTOM) InnerRect.bottom -= add;
if((uFlags & BF_MIDDLE) && retval) if((uFlags & BF_MIDDLE) && retval)
{ {
FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ? FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
COLOR_WINDOW : COLOR_BTNFACE)); COLOR_WINDOW : COLOR_BTNFACE));
} }
@ -944,8 +944,8 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
{ {
case DFCS_CAPTIONCLOSE: case DFCS_CAPTIONCLOSE:
{ {
/* The "X" is made by drawing a series of lines. /* The "X" is made by drawing a series of lines.
* The number of lines drawn depends on the size * The number of lines drawn depends on the size
* of the bounding rect. e.g. For a 6x5 inside rect, * of the bounding rect. e.g. For a 6x5 inside rect,
* two lines are drawn from top-left to bottom-right, * two lines are drawn from top-left to bottom-right,
* and two lines from top-right to bottom-left. * and two lines from top-right to bottom-left.
@ -1145,7 +1145,7 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
/* /*
* This fixes a problem with really tiny "scroll" buttons. In particular * This fixes a problem with really tiny "scroll" buttons. In particular
* with the updown control. * with the updown control.
* Making sure that the arrow is as least 3 pixels wide (or high). * Making sure that the arrow is as least 3 pixels wide (or high).
*/ */
if (tri == 0) if (tri == 0)
@ -1405,7 +1405,7 @@ BOOL WINAPI DrawFrameControl( HDC hdc, LPRECT rc, UINT uType,
/* Win95 doesn't support drawing in other mapping modes */ /* Win95 doesn't support drawing in other mapping modes */
if(GetMapMode(hdc) != MM_TEXT) if(GetMapMode(hdc) != MM_TEXT)
return FALSE; return FALSE;
switch(uType) switch(uType)
{ {
case DFC_BUTTON: case DFC_BUTTON:

View File

@ -178,23 +178,23 @@ BOOL DEBUG_IsFctReturn(void)
void DEBUG_SetBreakpoints( BOOL set ) void DEBUG_SetBreakpoints( BOOL set )
{ {
int i; int i;
#ifdef __i386__ #ifdef __i386__
DEBUG_context.Dr7 &= ~DR7_LOCAL_ENABLE_MASK; DEBUG_context.Dr7 &= ~DR7_LOCAL_ENABLE_MASK;
#endif #endif
for (i = 0; i < next_bp; i++) for (i = 0; i < next_bp; i++)
{ {
if (!(breakpoints[i].refcount && breakpoints[i].enabled)) if (!(breakpoints[i].refcount && breakpoints[i].enabled))
continue; continue;
switch (breakpoints[i].type) { switch (breakpoints[i].type) {
case DBG_BREAK: case DBG_BREAK:
{ {
#ifdef __i386__ #ifdef __i386__
char ch = set ? INT3 : breakpoints[i].u.b.opcode; char ch = set ? INT3 : breakpoints[i].u.b.opcode;
if (!DEBUG_WRITE_MEM( (void*)DEBUG_ToLinear(&breakpoints[i].addr), if (!DEBUG_WRITE_MEM( (void*)DEBUG_ToLinear(&breakpoints[i].addr),
&ch, sizeof(ch) )) &ch, sizeof(ch) ))
{ {
DEBUG_Printf(DBG_CHN_MESG, "Invalid address for breakpoint %d, disabling it\n", i); DEBUG_Printf(DBG_CHN_MESG, "Invalid address for breakpoint %d, disabling it\n", i);
@ -204,14 +204,14 @@ void DEBUG_SetBreakpoints( BOOL set )
} }
break; break;
case DBG_WATCH: case DBG_WATCH:
if (set) if (set)
{ {
#ifdef __i386__ #ifdef __i386__
DWORD bits; DWORD bits;
int reg = breakpoints[i].u.w.reg; int reg = breakpoints[i].u.w.reg;
LPDWORD lpdr = NULL; LPDWORD lpdr = NULL;
switch (reg) switch (reg)
{ {
case 0: lpdr = &DEBUG_context.Dr0; break; case 0: lpdr = &DEBUG_context.Dr0; break;
case 1: lpdr = &DEBUG_context.Dr1; break; case 1: lpdr = &DEBUG_context.Dr1; break;
@ -219,7 +219,7 @@ void DEBUG_SetBreakpoints( BOOL set )
case 3: lpdr = &DEBUG_context.Dr3; break; case 3: lpdr = &DEBUG_context.Dr3; break;
default: RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); default: RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
} }
*lpdr = DEBUG_ToLinear(&breakpoints[i].addr); *lpdr = DEBUG_ToLinear(&breakpoints[i].addr);
bits = (breakpoints[i].u.w.rw) ? DR7_RW_WRITE : DR7_RW_READ; bits = (breakpoints[i].u.w.rw) ? DR7_RW_WRITE : DR7_RW_READ;
switch (breakpoints[i].u.w.len + 1) switch (breakpoints[i].u.w.len + 1)
@ -229,7 +229,7 @@ void DEBUG_SetBreakpoints( BOOL set )
case 1: bits |= DR7_LEN_1; break; case 1: bits |= DR7_LEN_1; break;
default: RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); default: RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
} }
DEBUG_context.Dr7 &= ~(0x0F << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg)); DEBUG_context.Dr7 &= ~(0x0F << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg));
DEBUG_context.Dr7 |= bits << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg); DEBUG_context.Dr7 |= bits << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg);
DEBUG_context.Dr7 |= DR7_ENABLE_MASK(reg) | DR7_LOCAL_SLOWDOWN; DEBUG_context.Dr7 |= DR7_ENABLE_MASK(reg) | DR7_LOCAL_SLOWDOWN;
@ -246,22 +246,22 @@ void DEBUG_SetBreakpoints( BOOL set )
* Find the breakpoint for a given address. Return the breakpoint * Find the breakpoint for a given address. Return the breakpoint
* number or -1 if none. * number or -1 if none.
* If type is DBG_BREAKPOINT, addr is a complete addr * If type is DBG_BREAKPOINT, addr is a complete addr
* If type is DBG_WATCHPOINT, only addr.off is meaningful and contains * If type is DBG_WATCHPOINT, only addr.off is meaningful and contains
* linear address * linear address
*/ */
static int DEBUG_FindBreakpoint( const DBG_ADDR *addr, int type ) static int DEBUG_FindBreakpoint( const DBG_ADDR *addr, int type )
{ {
int i; int i;
for (i = 0; i < next_bp; i++) for (i = 0; i < next_bp; i++)
{ {
if (breakpoints[i].refcount && breakpoints[i].enabled && if (breakpoints[i].refcount && breakpoints[i].enabled &&
breakpoints[i].type == type ) breakpoints[i].type == type )
{ {
if ((type == DBG_BREAK && if ((type == DBG_BREAK &&
breakpoints[i].addr.seg == addr->seg && breakpoints[i].addr.seg == addr->seg &&
breakpoints[i].addr.off == addr->off) || breakpoints[i].addr.off == addr->off) ||
(type == DBG_WATCH && (type == DBG_WATCH &&
DEBUG_ToLinear(&breakpoints[i].addr) == addr->off)) DEBUG_ToLinear(&breakpoints[i].addr) == addr->off))
return i; return i;
} }
@ -277,11 +277,11 @@ static int DEBUG_FindBreakpoint( const DBG_ADDR *addr, int type )
static int DEBUG_InitXPoint(int type, DBG_ADDR* addr) static int DEBUG_InitXPoint(int type, DBG_ADDR* addr)
{ {
int num; int num;
for (num = (next_bp < MAX_BREAKPOINTS) ? next_bp++ : 1; for (num = (next_bp < MAX_BREAKPOINTS) ? next_bp++ : 1;
num < MAX_BREAKPOINTS; num++) num < MAX_BREAKPOINTS; num++)
{ {
if (breakpoints[num].refcount == 0) if (breakpoints[num].refcount == 0)
{ {
breakpoints[num].refcount = 1; breakpoints[num].refcount = 1;
breakpoints[num].enabled = TRUE; breakpoints[num].enabled = TRUE;
@ -316,12 +316,12 @@ static int DEBUG_InitXPoint(int type, DBG_ADDR* addr)
static BOOL DEBUG_GetWatchedValue( int num, LPDWORD val ) static BOOL DEBUG_GetWatchedValue( int num, LPDWORD val )
{ {
BYTE buf[4]; BYTE buf[4];
if (!DEBUG_READ_MEM((void*)DEBUG_ToLinear(&breakpoints[num].addr), if (!DEBUG_READ_MEM((void*)DEBUG_ToLinear(&breakpoints[num].addr),
buf, breakpoints[num].u.w.len + 1)) buf, breakpoints[num].u.w.len + 1))
return FALSE; return FALSE;
switch (breakpoints[num].u.w.len + 1) switch (breakpoints[num].u.w.len + 1)
{ {
case 4: *val = *(DWORD*)buf; break; case 4: *val = *(DWORD*)buf; break;
case 2: *val = *(WORD*)buf; break; case 2: *val = *(WORD*)buf; break;
@ -355,7 +355,7 @@ void DEBUG_AddBreakpoint( const DBG_VALUE *_value, BOOL (*func)(void) )
value.addr.seg = seg2; value.addr.seg = seg2;
} }
if ((num = DEBUG_FindBreakpoint(&value.addr, DBG_BREAK)) >= 1) if ((num = DEBUG_FindBreakpoint(&value.addr, DBG_BREAK)) >= 1)
{ {
breakpoints[num].refcount++; breakpoints[num].refcount++;
return; return;
@ -401,7 +401,7 @@ void DEBUG_AddBreakpointFromId(const char *name, int lineno)
return; return;
} }
} }
DEBUG_CurrProcess->delayed_bp = DBG_realloc(DEBUG_CurrProcess->delayed_bp, DEBUG_CurrProcess->delayed_bp = DBG_realloc(DEBUG_CurrProcess->delayed_bp,
sizeof(DBG_DELAYED_BP) * ++DEBUG_CurrProcess->num_delayed_bp); sizeof(DBG_DELAYED_BP) * ++DEBUG_CurrProcess->num_delayed_bp);
DEBUG_CurrProcess->delayed_bp[DEBUG_CurrProcess->num_delayed_bp - 1].name = strcpy(DBG_alloc(strlen(name) + 1), name); DEBUG_CurrProcess->delayed_bp[DEBUG_CurrProcess->num_delayed_bp - 1].name = strcpy(DBG_alloc(strlen(name) + 1), name);
@ -416,12 +416,12 @@ void DEBUG_AddBreakpointFromId(const char *name, int lineno)
void DEBUG_AddBreakpointFromLineno(int lineno) void DEBUG_AddBreakpointFromLineno(int lineno)
{ {
DBG_VALUE value; DBG_VALUE value;
DEBUG_GetCurrentAddress(&value.addr); DEBUG_GetCurrentAddress(&value.addr);
if (lineno != -1) { if (lineno != -1) {
struct name_hash* nh; struct name_hash* nh;
DEBUG_FindNearestSymbol(&value.addr, TRUE, &nh, 0, NULL); DEBUG_FindNearestSymbol(&value.addr, TRUE, &nh, 0, NULL);
if (nh == NULL) { if (nh == NULL) {
DEBUG_Printf(DBG_CHN_MESG, "Unable to add breakpoint\n"); DEBUG_Printf(DBG_CHN_MESG, "Unable to add breakpoint\n");
@ -429,7 +429,7 @@ void DEBUG_AddBreakpointFromLineno(int lineno)
} }
DEBUG_GetLineNumberAddr(nh, lineno, &value.addr, TRUE); DEBUG_GetLineNumberAddr(nh, lineno, &value.addr, TRUE);
} }
value.type = NULL; value.type = NULL;
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
DEBUG_AddBreakpoint( &value, NULL ); DEBUG_AddBreakpoint( &value, NULL );
@ -467,13 +467,13 @@ void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
int num, reg = -1; int num, reg = -1;
unsigned seg2; unsigned seg2;
DWORD mask = 0; DWORD mask = 0;
assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST); assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST);
#ifdef __i386__ #ifdef __i386__
DEBUG_FixAddress( &value.addr, DEBUG_context.SegCs ); DEBUG_FixAddress( &value.addr, DEBUG_context.SegCs );
#endif #endif
if ( value.type != NULL && value.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) ) if ( value.type != NULL && value.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) )
{ {
/* /*
@ -486,10 +486,10 @@ void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
value.addr.off = DEBUG_GetExprValue(&value, NULL); value.addr.off = DEBUG_GetExprValue(&value, NULL);
value.addr.seg = seg2; value.addr.seg = seg2;
} }
for (num = 1; num < next_bp; num++) for (num = 1; num < next_bp; num++)
{ {
if (breakpoints[num].refcount && breakpoints[num].enabled && if (breakpoints[num].refcount && breakpoints[num].enabled &&
breakpoints[num].type == DBG_WATCH) { breakpoints[num].type == DBG_WATCH) {
mask |= (1 << breakpoints[num].u.w.reg); mask |= (1 << breakpoints[num].u.w.reg);
} }
@ -505,12 +505,12 @@ void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
if ((num = DEBUG_InitXPoint(DBG_WATCH, &value.addr)) == -1) if ((num = DEBUG_InitXPoint(DBG_WATCH, &value.addr)) == -1)
return; return;
breakpoints[num].u.w.len = 4 - 1; breakpoints[num].u.w.len = 4 - 1;
if (_value->type && DEBUG_GetObjectSize(_value->type) < 4) if (_value->type && DEBUG_GetObjectSize(_value->type) < 4)
breakpoints[num].u.w.len = 2 - 1; breakpoints[num].u.w.len = 2 - 1;
if (!DEBUG_GetWatchedValue( num, &breakpoints[num].u.w.oldval)) if (!DEBUG_GetWatchedValue( num, &breakpoints[num].u.w.oldval))
{ {
DEBUG_Printf(DBG_CHN_MESG, "Bad address. Watchpoint not set\n"); DEBUG_Printf(DBG_CHN_MESG, "Bad address. Watchpoint not set\n");
breakpoints[num].refcount = 0; breakpoints[num].refcount = 0;
@ -519,7 +519,7 @@ void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
{ {
breakpoints[num].u.w.rw = (is_write) ? TRUE : FALSE; breakpoints[num].u.w.rw = (is_write) ? TRUE : FALSE;
breakpoints[reg].u.w.reg = reg; breakpoints[reg].u.w.reg = reg;
DEBUG_Printf( DBG_CHN_MESG, "Watchpoint %d at ", num ); DEBUG_Printf( DBG_CHN_MESG, "Watchpoint %d at ", num );
DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16, TRUE ); DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16, TRUE );
DEBUG_Printf( DBG_CHN_MESG, "\n" ); DEBUG_Printf( DBG_CHN_MESG, "\n" );
@ -534,7 +534,7 @@ void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
void DEBUG_AddWatchpointFromId(const char *name) void DEBUG_AddWatchpointFromId(const char *name)
{ {
DBG_VALUE value; DBG_VALUE value;
if( DEBUG_GetSymbolValue(name, -1, &value, TRUE) ) if( DEBUG_GetSymbolValue(name, -1, &value, TRUE) )
DEBUG_AddWatchpoint( &value, 1 ); DEBUG_AddWatchpoint( &value, 1 );
else else
@ -593,7 +593,7 @@ void DEBUG_EnableBreakpoint( int num, BOOL enable )
* the value watched before the TRAP * the value watched before the TRAP
* Return -1 if none found (*oldval is undetermined) * Return -1 if none found (*oldval is undetermined)
* *
* Unfortunately, Linux does *NOT* (A REAL PITA) report with ptrace * Unfortunately, Linux does *NOT* (A REAL PITA) report with ptrace
* the DR6 register value, so we have to look with our own need the * the DR6 register value, so we have to look with our own need the
* cause of the TRAP. * cause of the TRAP.
* -EP * -EP
@ -603,20 +603,20 @@ static int DEBUG_FindTriggeredWatchpoint(LPDWORD oldval)
int found = -1; int found = -1;
#ifdef __i386__ #ifdef __i386__
int i; int i;
/* Method 1 => get triggered watchpoint from context (doesn't work on Linux /* Method 1 => get triggered watchpoint from context (doesn't work on Linux
* 2.2.x). This should be fixed in >= 2.2.16 * 2.2.x). This should be fixed in >= 2.2.16
*/ */
for (i = 0; i < next_bp; i++) for (i = 0; i < next_bp; i++)
{ {
DWORD val = 0; DWORD val = 0;
if (breakpoints[i].refcount && breakpoints[i].enabled && if (breakpoints[i].refcount && breakpoints[i].enabled &&
breakpoints[i].type == DBG_WATCH && breakpoints[i].type == DBG_WATCH &&
(DEBUG_context.Dr6 & (1 << breakpoints[i].u.w.reg))) (DEBUG_context.Dr6 & (1 << breakpoints[i].u.w.reg)))
{ {
DEBUG_context.Dr6 &= ~(1 << breakpoints[i].u.w.reg); DEBUG_context.Dr6 &= ~(1 << breakpoints[i].u.w.reg);
*oldval = breakpoints[i].u.w.oldval; *oldval = breakpoints[i].u.w.oldval;
if (DEBUG_GetWatchedValue(i, &val)) { if (DEBUG_GetWatchedValue(i, &val)) {
breakpoints[i].u.w.oldval = val; breakpoints[i].u.w.oldval = val;
@ -624,23 +624,23 @@ static int DEBUG_FindTriggeredWatchpoint(LPDWORD oldval)
} }
} }
} }
/* Method 1 failed, trying method 2 */ /* Method 1 failed, trying method 2 */
/* Method 2 => check if value has changed among registered watchpoints /* Method 2 => check if value has changed among registered watchpoints
* this really sucks, but this is how gdb 4.18 works on my linux box * this really sucks, but this is how gdb 4.18 works on my linux box
* -EP * -EP
*/ */
for (i = 0; i < next_bp; i++) for (i = 0; i < next_bp; i++)
{ {
DWORD val = 0; DWORD val = 0;
if (breakpoints[i].refcount && breakpoints[i].enabled && if (breakpoints[i].refcount && breakpoints[i].enabled &&
breakpoints[i].type == DBG_WATCH && breakpoints[i].type == DBG_WATCH &&
DEBUG_GetWatchedValue(i, &val)) DEBUG_GetWatchedValue(i, &val))
{ {
*oldval = breakpoints[i].u.w.oldval; *oldval = breakpoints[i].u.w.oldval;
if (val != *oldval) if (val != *oldval)
{ {
DEBUG_context.Dr6 &= ~(1 << breakpoints[i].u.w.reg); DEBUG_context.Dr6 &= ~(1 << breakpoints[i].u.w.reg);
breakpoints[i].u.w.oldval = val; breakpoints[i].u.w.oldval = val;
@ -671,7 +671,7 @@ void DEBUG_InfoBreakpoints(void)
if (breakpoints[i].refcount && breakpoints[i].type == DBG_BREAK) if (breakpoints[i].refcount && breakpoints[i].type == DBG_BREAK)
{ {
DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n'); DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
DEBUG_PrintAddress( &breakpoints[i].addr, DEBUG_PrintAddress( &breakpoints[i].addr,
breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE); breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE);
DEBUG_Printf( DBG_CHN_MESG, " (%u)\n", breakpoints[i].refcount ); DEBUG_Printf( DBG_CHN_MESG, " (%u)\n", breakpoints[i].refcount );
if( breakpoints[i].condition != NULL ) if( breakpoints[i].condition != NULL )
@ -688,10 +688,10 @@ void DEBUG_InfoBreakpoints(void)
if (breakpoints[i].refcount && breakpoints[i].type == DBG_WATCH) if (breakpoints[i].refcount && breakpoints[i].type == DBG_WATCH)
{ {
DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n'); DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
DEBUG_PrintAddress( &breakpoints[i].addr, DEBUG_PrintAddress( &breakpoints[i].addr,
breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE); breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE);
DEBUG_Printf( DBG_CHN_MESG, " on %d byte%s (%c)\n", DEBUG_Printf( DBG_CHN_MESG, " on %d byte%s (%c)\n",
breakpoints[i].u.w.len + 1, breakpoints[i].u.w.len + 1,
breakpoints[i].u.w.len > 0 ? "s" : "", breakpoints[i].u.w.len > 0 ? "s" : "",
breakpoints[i].u.w.rw ? 'W' : 'R'); breakpoints[i].u.w.rw ? 'W' : 'R');
if( breakpoints[i].condition != NULL ) if( breakpoints[i].condition != NULL )
@ -731,7 +731,7 @@ static BOOL DEBUG_ShallBreak( int bpnum )
return FALSE; return FALSE;
} }
} }
if ( breakpoints[bpnum].skipcount > 0 && --breakpoints[bpnum].skipcount > 0 ) if ( breakpoints[bpnum].skipcount > 0 && --breakpoints[bpnum].skipcount > 0 )
return FALSE; return FALSE;
@ -775,7 +775,7 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
syminfo = DEBUG_PrintAddress( &breakpoints[bpnum].addr, syminfo = DEBUG_PrintAddress( &breakpoints[bpnum].addr,
breakpoints[bpnum].is32 ? MODE_32 : MODE_16, TRUE ); breakpoints[bpnum].is32 ? MODE_32 : MODE_16, TRUE );
DEBUG_Printf( DBG_CHN_MESG, "\n" ); DEBUG_Printf( DBG_CHN_MESG, "\n" );
if( syminfo.list.sourcefile != NULL ) if( syminfo.list.sourcefile != NULL )
DEBUG_List(&syminfo.list, NULL, 0); DEBUG_List(&syminfo.list, NULL, 0);
return FALSE; return FALSE;
@ -785,7 +785,7 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
if ((wpnum != 0) && (wpnum != -1)) if ((wpnum != 0) && (wpnum != -1))
{ {
/* If not single-stepping, do not back up over the int3 instruction */ /* If not single-stepping, do not back up over the int3 instruction */
if (code == EXCEPTION_BREAKPOINT) if (code == EXCEPTION_BREAKPOINT)
{ {
#ifdef __i386__ #ifdef __i386__
DEBUG_context.Eip++; DEBUG_context.Eip++;
@ -793,12 +793,12 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
#endif #endif
} }
if (!DEBUG_ShallBreak(wpnum)) return TRUE; if (!DEBUG_ShallBreak(wpnum)) return TRUE;
addr_mode = DEBUG_GetSelectorType( addr->seg ); addr_mode = DEBUG_GetSelectorType( addr->seg );
DEBUG_Printf(DBG_CHN_MESG, "Stopped on watchpoint %d at ", wpnum); DEBUG_Printf(DBG_CHN_MESG, "Stopped on watchpoint %d at ", wpnum);
syminfo = DEBUG_PrintAddress( addr, addr_mode, TRUE ); syminfo = DEBUG_PrintAddress( addr, addr_mode, TRUE );
DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n", DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n",
oldval, breakpoints[wpnum].u.w.oldval); oldval, breakpoints[wpnum].u.w.oldval);
if (syminfo.list.sourcefile != NULL) if (syminfo.list.sourcefile != NULL)
DEBUG_List(&syminfo.list, NULL, 0); DEBUG_List(&syminfo.list, NULL, 0);
@ -829,7 +829,7 @@ BOOL DEBUG_ShouldContinue( DBG_ADDR *addr, DWORD code, int * count )
*/ */
return TRUE; return TRUE;
} }
/* /*
* If we are about to stop, then print out the source line if we * If we are about to stop, then print out the source line if we
* have it. * have it.
@ -893,7 +893,7 @@ void DEBUG_RestartExecution( int count )
*/ */
ret_mode = mode = DEBUG_CurrThread->exec_mode; ret_mode = mode = DEBUG_CurrThread->exec_mode;
bp = DEBUG_FindBreakpoint( &addr, DBG_BREAK ); bp = DEBUG_FindBreakpoint( &addr, DBG_BREAK );
if ( bp != -1 && bp != 0) if ( bp != -1 && bp != 0)
{ {
/* /*
@ -912,7 +912,7 @@ void DEBUG_RestartExecution( int count )
DEBUG_Printf(DBG_CHN_MESG, "Not stopped at any breakpoint; argument ignored.\n"); DEBUG_Printf(DBG_CHN_MESG, "Not stopped at any breakpoint; argument ignored.\n");
} }
} }
if( mode == EXEC_FINISH && DEBUG_IsFctReturn() ) if( mode == EXEC_FINISH && DEBUG_IsFctReturn() )
{ {
mode = ret_mode = EXEC_STEPI_INSTR; mode = ret_mode = EXEC_STEPI_INSTR;
@ -932,7 +932,7 @@ void DEBUG_RestartExecution( int count )
addr2 = addr; addr2 = addr;
DEBUG_Disasm(&addr2, FALSE); DEBUG_Disasm(&addr2, FALSE);
addr2.off += delta; addr2.off += delta;
status = DEBUG_CheckLinenoStatus(&addr2); status = DEBUG_CheckLinenoStatus(&addr2);
/* /*
* Anytime we have a trampoline, step over it. * Anytime we have a trampoline, step over it.
@ -946,7 +946,7 @@ void DEBUG_RestartExecution( int count )
#endif #endif
mode = EXEC_STEP_OVER_TRAMPOLINE; mode = EXEC_STEP_OVER_TRAMPOLINE;
} }
if( mode == EXEC_STEP_INSTR && status == FUNC_HAS_NO_LINES ) if( mode == EXEC_STEP_INSTR && status == FUNC_HAS_NO_LINES )
{ {
#if 0 #if 0
@ -964,7 +964,7 @@ void DEBUG_RestartExecution( int count )
{ {
DEBUG_Printf(DBG_CHN_MESG, "Single stepping until exit from function, \n"); DEBUG_Printf(DBG_CHN_MESG, "Single stepping until exit from function, \n");
DEBUG_Printf(DBG_CHN_MESG, "which has no line number information.\n"); DEBUG_Printf(DBG_CHN_MESG, "which has no line number information.\n");
ret_mode = mode = EXEC_FINISH; ret_mode = mode = EXEC_FINISH;
} }
} }
@ -986,8 +986,8 @@ void DEBUG_RestartExecution( int count )
* address just after the call. * address just after the call.
*/ */
#ifdef __i386__ #ifdef __i386__
DEBUG_READ_MEM((void*)(DEBUG_context.Esp + DEBUG_READ_MEM((void*)(DEBUG_context.Esp +
2 * sizeof(unsigned int)), 2 * sizeof(unsigned int)),
&addr.off, sizeof(addr.off)); &addr.off, sizeof(addr.off));
DEBUG_context.EFlags &= ~STEP_FLAG; DEBUG_context.EFlags &= ~STEP_FLAG;
#endif #endif
@ -995,7 +995,7 @@ void DEBUG_RestartExecution( int count )
breakpoints[0].enabled = TRUE; breakpoints[0].enabled = TRUE;
breakpoints[0].refcount = 1; breakpoints[0].refcount = 1;
breakpoints[0].skipcount = 0; breakpoints[0].skipcount = 0;
DEBUG_READ_MEM((void*)DEBUG_ToLinear( &addr ), &breakpoints[0].u.b.opcode, DEBUG_READ_MEM((void*)DEBUG_ToLinear( &addr ), &breakpoints[0].u.b.opcode,
sizeof(char)); sizeof(char));
DEBUG_SetBreakpoints( TRUE ); DEBUG_SetBreakpoints( TRUE );
break; break;

View File

@ -1,25 +1,25 @@
/* /*
* Mach Operating System * Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University * Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved. * All Rights Reserved.
* *
* Permission to use, copy, modify and distribute this software and its * Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright * documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the * notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions * software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation. * thereof, and that both notices appear in supporting documentation.
* *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
* *
* Carnegie Mellon requests users of this software to return to * Carnegie Mellon requests users of this software to return to
* *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science * School of Computer Science
* Carnegie Mellon University * Carnegie Mellon University
* Pittsburgh PA 15213-3890 * Pittsburgh PA 15213-3890
* *
* any improvements or extensions that they make and grant Carnegie Mellon * any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes. * the rights to redistribute these changes.
*/ */
@ -30,23 +30,23 @@
* Add a switch to disassemble 16-bit code. * Add a switch to disassemble 16-bit code.
* Fix spelling of 'lods' opcodes. * Fix spelling of 'lods' opcodes.
* [91/10/30 dbg] * [91/10/30 dbg]
* *
* Revision 2.5 91/10/09 16:05:58 af * Revision 2.5 91/10/09 16:05:58 af
* Supported disassemble of non current task by passing task parameter. * Supported disassemble of non current task by passing task parameter.
* [91/08/29 tak] * [91/08/29 tak]
* *
* Revision 2.4 91/05/14 16:05:04 mrt * Revision 2.4 91/05/14 16:05:04 mrt
* Correcting copyright * Correcting copyright
* *
* Revision 2.3 91/02/05 17:11:03 mrt * Revision 2.3 91/02/05 17:11:03 mrt
* Changed to new Mach copyright * Changed to new Mach copyright
* [91/02/01 17:31:03 mrt] * [91/02/01 17:31:03 mrt]
* *
* Revision 2.2 90/08/27 21:55:56 dbg * Revision 2.2 90/08/27 21:55:56 dbg
* Fix register operand for move to/from control/test/debug * Fix register operand for move to/from control/test/debug
* register instructions. Add i486 instructions. * register instructions. Add i486 instructions.
* [90/08/27 dbg] * [90/08/27 dbg]
* *
* Import db_sym.h. Print instruction displacements in * Import db_sym.h. Print instruction displacements in
* current radix (signed). Change calling sequence of * current radix (signed). Change calling sequence of
* db_disasm. * db_disasm.
@ -55,7 +55,7 @@
* [90/08/08 dbg] * [90/08/08 dbg]
* Created. * Created.
* [90/07/25 dbg] * [90/07/25 dbg]
* *
*/ */
/* /*
@ -280,23 +280,23 @@ static const struct inst db_inst_0f3x[] = {
}; };
static const struct inst db_inst_0f4x[] = { static const struct inst db_inst_0f4x[] = {
/*40*/ { "cmovo", TRUE, NONE, op2(E, R), 0 }, /*40*/ { "cmovo", TRUE, NONE, op2(E, R), 0 },
/*41*/ { "cmovno", TRUE, NONE, op2(E, R), 0 }, /*41*/ { "cmovno", TRUE, NONE, op2(E, R), 0 },
/*42*/ { "cmovnae",TRUE, NONE, op2(E, R), 0 }, /*42*/ { "cmovnae",TRUE, NONE, op2(E, R), 0 },
/*43*/ { "cmovnb", TRUE, NONE, op2(E, R), 0 }, /*43*/ { "cmovnb", TRUE, NONE, op2(E, R), 0 },
/*44*/ { "cmove", TRUE, NONE, op2(E, R), 0 }, /*44*/ { "cmove", TRUE, NONE, op2(E, R), 0 },
/*45*/ { "cmovne", TRUE, NONE, op2(E, R), 0 }, /*45*/ { "cmovne", TRUE, NONE, op2(E, R), 0 },
/*46*/ { "cmovna", TRUE, NONE, op2(E, R), 0 }, /*46*/ { "cmovna", TRUE, NONE, op2(E, R), 0 },
/*47*/ { "cmova", TRUE, NONE, op2(E, R), 0 }, /*47*/ { "cmova", TRUE, NONE, op2(E, R), 0 },
/*48*/ { "cmovs", TRUE, NONE, op2(E, R), 0 }, /*48*/ { "cmovs", TRUE, NONE, op2(E, R), 0 },
/*49*/ { "cmovns", TRUE, NONE, op2(E, R), 0 }, /*49*/ { "cmovns", TRUE, NONE, op2(E, R), 0 },
/*4a*/ { "cmovpe", TRUE, NONE, op2(E, R), 0 }, /*4a*/ { "cmovpe", TRUE, NONE, op2(E, R), 0 },
/*4b*/ { "cmovpo", TRUE, NONE, op2(E, R), 0 }, /*4b*/ { "cmovpo", TRUE, NONE, op2(E, R), 0 },
/*4c*/ { "cmovl", TRUE, NONE, op2(E, R), 0 }, /*4c*/ { "cmovl", TRUE, NONE, op2(E, R), 0 },
/*4d*/ { "cmovge", TRUE, NONE, op2(E, R), 0 }, /*4d*/ { "cmovge", TRUE, NONE, op2(E, R), 0 },
/*4e*/ { "cmovle", TRUE, NONE, op2(E, R), 0 }, /*4e*/ { "cmovle", TRUE, NONE, op2(E, R), 0 },
/*4f*/ { "cmovnle",TRUE, NONE, op2(E, R), 0 }, /*4f*/ { "cmovnle",TRUE, NONE, op2(E, R), 0 },
}; };
static const struct inst db_inst_0f5x[] = { static const struct inst db_inst_0f5x[] = {
@ -320,43 +320,43 @@ static const struct inst db_inst_0f5x[] = {
}; };
static const struct inst db_inst_0f6x[] = { static const struct inst db_inst_0f6x[] = {
/*60*/ { "punpcklbw", TRUE, NONE, op2(E, MX), 0 }, /*60*/ { "punpcklbw", TRUE, NONE, op2(E, MX), 0 },
/*61*/ { "punpcklwd", TRUE, NONE, op2(E, MX), 0 }, /*61*/ { "punpcklwd", TRUE, NONE, op2(E, MX), 0 },
/*62*/ { "punpckldq", TRUE, NONE, op2(E, MX), 0 }, /*62*/ { "punpckldq", TRUE, NONE, op2(E, MX), 0 },
/*63*/ { "packsswb", TRUE, NONE, op2(E, MX), 0 }, /*63*/ { "packsswb", TRUE, NONE, op2(E, MX), 0 },
/*64*/ { "pcmpgtb", TRUE, NONE, op2(E, MX), 0 }, /*64*/ { "pcmpgtb", TRUE, NONE, op2(E, MX), 0 },
/*65*/ { "pcmpgtw", TRUE, NONE, op2(E, MX), 0 }, /*65*/ { "pcmpgtw", TRUE, NONE, op2(E, MX), 0 },
/*66*/ { "pcmpgtd", TRUE, NONE, op2(E, MX), 0 }, /*66*/ { "pcmpgtd", TRUE, NONE, op2(E, MX), 0 },
/*67*/ { "packuswb", TRUE, NONE, op2(E, MX), 0 }, /*67*/ { "packuswb", TRUE, NONE, op2(E, MX), 0 },
/*68*/ { "punpckhbw", TRUE, NONE, op2(E, MX), 0 }, /*68*/ { "punpckhbw", TRUE, NONE, op2(E, MX), 0 },
/*69*/ { "punpckhwd", TRUE, NONE, op2(E, MX), 0 }, /*69*/ { "punpckhwd", TRUE, NONE, op2(E, MX), 0 },
/*6a*/ { "punpckhdq", TRUE, NONE, op2(E, MX), 0 }, /*6a*/ { "punpckhdq", TRUE, NONE, op2(E, MX), 0 },
/*6b*/ { "packssdw", TRUE, NONE, op2(E, MX), 0 }, /*6b*/ { "packssdw", TRUE, NONE, op2(E, MX), 0 },
/*6c*/ { "(bad)", TRUE, NONE, 0, 0 }, /*6c*/ { "(bad)", TRUE, NONE, 0, 0 },
/*6d*/ { "(bad)", TRUE, NONE, 0, 0 }, /*6d*/ { "(bad)", TRUE, NONE, 0, 0 },
/*6e*/ { "movd", TRUE, NONE, op2(E, MX), 0 }, /*6e*/ { "movd", TRUE, NONE, op2(E, MX), 0 },
/*6f*/ { "movq", TRUE, NONE, op2(E, MX), 0 }, /*6f*/ { "movq", TRUE, NONE, op2(E, MX), 0 },
}; };
static const struct inst db_inst_0f7x[] = { static const struct inst db_inst_0f7x[] = {
/*70*/ { "pshufw", TRUE, NONE, op2(MX, EMX), 0 }, /*70*/ { "pshufw", TRUE, NONE, op2(MX, EMX), 0 },
/*71*/ { "(grp10)", TRUE, BYTE, op2(EMX, I), (char*)db_Grp10 }, /*71*/ { "(grp10)", TRUE, BYTE, op2(EMX, I), (char*)db_Grp10 },
/*72*/ { "(grp11)", TRUE, BYTE, op2(EMX, I), (char*)db_Grp11 }, /*72*/ { "(grp11)", TRUE, BYTE, op2(EMX, I), (char*)db_Grp11 },
/*73*/ { "(grp12)", TRUE, BYTE, op2(EMX, I), (char*)db_Grp12 }, /*73*/ { "(grp12)", TRUE, BYTE, op2(EMX, I), (char*)db_Grp12 },
/*74*/ { "pcmpeqb", TRUE, NONE, op2(E, MX), 0 }, /*74*/ { "pcmpeqb", TRUE, NONE, op2(E, MX), 0 },
/*75*/ { "pcmpeqw", TRUE, NONE, op2(E, MX), 0 }, /*75*/ { "pcmpeqw", TRUE, NONE, op2(E, MX), 0 },
/*76*/ { "pcmpeqd", TRUE, NONE, op2(E, MX), 0 }, /*76*/ { "pcmpeqd", TRUE, NONE, op2(E, MX), 0 },
/*77*/ { "emms", FALSE,NONE, 0, 0 }, /*77*/ { "emms", FALSE,NONE, 0, 0 },
/*78*/ { "(bad)", TRUE, NONE, 0, 0 }, /*78*/ { "(bad)", TRUE, NONE, 0, 0 },
/*79*/ { "(bad)", TRUE, NONE, 0, 0 }, /*79*/ { "(bad)", TRUE, NONE, 0, 0 },
/*7a*/ { "(bad)", TRUE, NONE, 0, 0 }, /*7a*/ { "(bad)", TRUE, NONE, 0, 0 },
/*7b*/ { "(bad)", TRUE, NONE, 0, 0 }, /*7b*/ { "(bad)", TRUE, NONE, 0, 0 },
/*7c*/ { "(bad)", TRUE, NONE, 0, 0 }, /*7c*/ { "(bad)", TRUE, NONE, 0, 0 },
/*7d*/ { "(bad)", TRUE, NONE, 0, 0 }, /*7d*/ { "(bad)", TRUE, NONE, 0, 0 },
/*7e*/ { "movd", TRUE, NONE, op2(E, MX), 0 }, /*7e*/ { "movd", TRUE, NONE, op2(E, MX), 0 },
/*7f*/ { "movq", TRUE, NONE, op2(EMX, MX), 0 }, /*7f*/ { "movq", TRUE, NONE, op2(EMX, MX), 0 },
}; };
static const struct inst db_inst_0f8x[] = { static const struct inst db_inst_0f8x[] = {
@ -1209,11 +1209,11 @@ void db_print_address(char *seg, int size, struct i_addr *addrp, int byref)
if (addrp->index) if (addrp->index)
DEBUG_Printf(DBG_CHN_MESG,",%s,%d", addrp->index, 1<<addrp->ss); DEBUG_Printf(DBG_CHN_MESG,",%s,%d", addrp->index, 1<<addrp->ss);
DEBUG_Printf(DBG_CHN_MESG,")"); DEBUG_Printf(DBG_CHN_MESG,")");
} }
else { else {
/* try to get destination of indirect call /* try to get destination of indirect call
does not work for segmented adresses */ does not work for segmented adresses */
if (!seg && byref) { if (!seg && byref) {
void* a1; void* a1;
void* a2; void* a2;
@ -1812,7 +1812,7 @@ void DEBUG_Disasm( DBG_ADDR *addr, int display )
{ {
DEBUG_PrintAddress( &address, short_addr ? MODE_16 : MODE_32, TRUE ); DEBUG_PrintAddress( &address, short_addr ? MODE_16 : MODE_32, TRUE );
} }
} }
break; break;
} }

View File

@ -40,22 +40,22 @@
#define SYM_TRAMPOLINE 0x10 #define SYM_TRAMPOLINE 0x10
#define SYM_STEP_THROUGH 0x20 #define SYM_STEP_THROUGH 0x20
enum debug_type {DT_BASIC, DT_POINTER, DT_ARRAY, DT_STRUCT, DT_ENUM, enum debug_type {DT_BASIC, DT_POINTER, DT_ARRAY, DT_STRUCT, DT_ENUM,
DT_FUNC, DT_BITFIELD}; DT_FUNC, DT_BITFIELD};
enum debug_type_basic {DT_BASIC_INT = 1, DT_BASIC_CHAR, DT_BASIC_LONGINT, DT_BASIC_UINT, enum debug_type_basic {DT_BASIC_INT = 1, DT_BASIC_CHAR, DT_BASIC_LONGINT, DT_BASIC_UINT,
DT_BASIC_ULONGINT, DT_BASIC_LONGLONGINT, DT_BASIC_ULONGLONGINT, DT_BASIC_ULONGINT, DT_BASIC_LONGLONGINT, DT_BASIC_ULONGLONGINT,
DT_BASIC_SHORTINT, DT_BASIC_USHORTINT, DT_BASIC_SCHAR, DT_BASIC_UCHAR, DT_BASIC_SHORTINT, DT_BASIC_USHORTINT, DT_BASIC_SCHAR, DT_BASIC_UCHAR,
DT_BASIC_FLOAT, DT_BASIC_LONGDOUBLE, DT_BASIC_DOUBLE, DT_BASIC_FLOAT, DT_BASIC_LONGDOUBLE, DT_BASIC_DOUBLE,
DT_BASIC_CMPLX_INT, DT_BASIC_CMPLX_FLOAT, DT_BASIC_CMPLX_DOUBLE, DT_BASIC_CMPLX_INT, DT_BASIC_CMPLX_FLOAT, DT_BASIC_CMPLX_DOUBLE,
DT_BASIC_CMPLX_LONGDOUBLE, DT_BASIC_VOID, DT_BASIC_CMPLX_LONGDOUBLE, DT_BASIC_VOID,
/* modifier on size isn't possible on current types definitions /* modifier on size isn't possible on current types definitions
* so we need to add more types... */ * so we need to add more types... */
DT_BASIC_BOOL1, DT_BASIC_BOOL2, DT_BASIC_BOOL4, DT_BASIC_BOOL1, DT_BASIC_BOOL2, DT_BASIC_BOOL4,
/* this is not really a basic type... */ /* this is not really a basic type... */
DT_BASIC_STRING, DT_BASIC_STRING,
/* this is for historical reasons... should take care of it RSN */ /* this is for historical reasons... should take care of it RSN */
DT_BASIC_CONST_INT, DT_BASIC_CONST_INT,
/* to be kept as last... sentinel entry... do not use */ /* to be kept as last... sentinel entry... do not use */
DT_BASIC_LAST}; DT_BASIC_LAST};
@ -85,7 +85,7 @@ typedef struct
# define DV_HOST 0x50DA # define DV_HOST 0x50DA
# define DV_INVALID 0x0000 # define DV_INVALID 0x0000
DBG_ADDR addr; DBG_ADDR addr;
} DBG_VALUE; } DBG_VALUE;
struct list_id struct list_id
@ -157,7 +157,7 @@ enum exit_mode /* of exception handling */
typedef struct typedef struct
{ {
DBG_ADDR addr; DBG_ADDR addr;
WORD enabled : 1, WORD enabled : 1,
type : 1, type : 1,
is32 : 1, is32 : 1,
refcount : 13; refcount : 13;
@ -347,7 +347,7 @@ extern int DEBUG_FreeExpr(struct expr * exp);
extern int DEBUG_DisplayExpr(const struct expr * exp); extern int DEBUG_DisplayExpr(const struct expr * exp);
/* debugger/hash.c */ /* debugger/hash.c */
extern struct name_hash * DEBUG_AddSymbol( const char *name, extern struct name_hash * DEBUG_AddSymbol( const char *name,
const DBG_VALUE *addr, const DBG_VALUE *addr,
const char *sourcefile, const char *sourcefile,
int flags); int flags);
@ -359,37 +359,37 @@ extern const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
unsigned int ebp, unsigned int ebp,
struct list_id * source); struct list_id * source);
extern void DEBUG_ReadSymbolTable( const char * filename ); extern void DEBUG_ReadSymbolTable( const char * filename );
extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num, extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num,
unsigned long offset ); unsigned long offset );
extern struct wine_locals * extern struct wine_locals *
DEBUG_AddLocal( struct name_hash * func, int regno, DEBUG_AddLocal( struct name_hash * func, int regno,
int offset, int offset,
int pc_start, int pc_start,
int pc_end, int pc_end,
char * name); char * name);
extern int DEBUG_CheckLinenoStatus(const DBG_ADDR *addr); extern int DEBUG_CheckLinenoStatus(const DBG_ADDR *addr);
extern void DEBUG_GetFuncInfo(struct list_id * ret, const char * file, extern void DEBUG_GetFuncInfo(struct list_id * ret, const char * file,
const char * func); const char * func);
extern int DEBUG_SetSymbolSize(struct name_hash * sym, unsigned int len); extern int DEBUG_SetSymbolSize(struct name_hash * sym, unsigned int len);
extern int DEBUG_SetSymbolBPOff(struct name_hash * sym, unsigned int len); extern int DEBUG_SetSymbolBPOff(struct name_hash * sym, unsigned int len);
extern int DEBUG_GetSymbolAddr(struct name_hash * sym, DBG_ADDR * addr); extern int DEBUG_GetSymbolAddr(struct name_hash * sym, DBG_ADDR * addr);
extern int DEBUG_cmp_sym(const void * p1, const void * p2); extern int DEBUG_cmp_sym(const void * p1, const void * p2);
extern BOOL DEBUG_GetLineNumberAddr( const struct name_hash *, const int lineno, extern BOOL DEBUG_GetLineNumberAddr( const struct name_hash *, const int lineno,
DBG_ADDR *addr, int bp_flag ); DBG_ADDR *addr, int bp_flag );
extern int DEBUG_SetLocalSymbolType(struct wine_locals * sym, extern int DEBUG_SetLocalSymbolType(struct wine_locals * sym,
struct datatype * type); struct datatype * type);
extern BOOL DEBUG_Normalize(struct name_hash * nh ); extern BOOL DEBUG_Normalize(struct name_hash * nh );
/* debugger/info.c */ /* debugger/info.c */
extern void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format ); extern void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format );
extern struct symbol_info DEBUG_PrintAddress( const DBG_ADDR *addr, extern struct symbol_info DEBUG_PrintAddress( const DBG_ADDR *addr,
enum dbg_mode mode, int flag ); enum dbg_mode mode, int flag );
extern void DEBUG_Help(void); extern void DEBUG_Help(void);
extern void DEBUG_HelpInfo(void); extern void DEBUG_HelpInfo(void);
extern struct symbol_info DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr, extern struct symbol_info DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr,
enum dbg_mode mode, enum dbg_mode mode,
unsigned int ebp, unsigned int ebp,
int flag ); int flag );
extern void DEBUG_InfoClass(const char* clsName); extern void DEBUG_InfoClass(const char* clsName);
extern void DEBUG_WalkClasses(void); extern void DEBUG_WalkClasses(void);
@ -425,27 +425,27 @@ extern int DEBUG_PrintStringW( int chnl, const DBG_ADDR* address, int len );
/* debugger/module.c */ /* debugger/module.c */
extern int DEBUG_LoadEntryPoints( const char * prefix ); extern int DEBUG_LoadEntryPoints( const char * prefix );
extern void DEBUG_LoadModule32( const char* name, HANDLE hFile, DWORD base ); extern void DEBUG_LoadModule32( const char* name, HANDLE hFile, DWORD base );
extern DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type, extern DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
void* mod_addr, u_long size, HMODULE hmod); void* mod_addr, u_long size, HMODULE hmod);
extern DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type); extern DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type);
extern DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type); extern DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type);
extern DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type); extern DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type);
extern DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process); extern DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process);
extern DBG_MODULE* DEBUG_RegisterPEModule(HMODULE, u_long load_addr, u_long size, extern DBG_MODULE* DEBUG_RegisterPEModule(HMODULE, u_long load_addr, u_long size,
const char* name); const char* name);
extern DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size, extern DBG_MODULE* DEBUG_RegisterELFModule(u_long load_addr, u_long size,
const char* name); const char* name);
extern enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile, extern enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
void* _nth, unsigned long nth_ofs); void* _nth, unsigned long nth_ofs);
extern void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx, extern void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx,
const char* filename, DWORD load_addr); const char* filename, DWORD load_addr);
extern void DEBUG_InfoShare(void); extern void DEBUG_InfoShare(void);
/* debugger/msc.c */ /* debugger/msc.c */
extern enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo(DBG_MODULE* module, HANDLE hFile, extern enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo(DBG_MODULE* module, HANDLE hFile,
void* nth, unsigned long nth_ofs); void* nth, unsigned long nth_ofs);
extern enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, extern enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module,
HANDLE hFile, void* nth, HANDLE hFile, void* nth,
unsigned long nth_ofs); unsigned long nth_ofs);
extern void DEBUG_InitCVDataTypes(void); extern void DEBUG_InitCVDataTypes(void);
@ -456,7 +456,7 @@ extern BOOL DEBUG_ValidateRegisters(void);
/* debugger/source.c */ /* debugger/source.c */
extern void DEBUG_ShowDir(void); extern void DEBUG_ShowDir(void);
extern void DEBUG_AddPath(const char * path); extern void DEBUG_AddPath(const char * path);
extern void DEBUG_List(struct list_id * line1, struct list_id * line2, extern void DEBUG_List(struct list_id * line1, struct list_id * line2,
int delta); int delta);
extern void DEBUG_NukePath(void); extern void DEBUG_NukePath(void);
extern void DEBUG_Disassemble(const DBG_VALUE *, const DBG_VALUE*, int offset); extern void DEBUG_Disassemble(const DBG_VALUE *, const DBG_VALUE*, int offset);
@ -467,40 +467,40 @@ extern void DEBUG_InfoStack(void);
extern void DEBUG_BackTrace(DWORD threadID, BOOL noisy); extern void DEBUG_BackTrace(DWORD threadID, BOOL noisy);
extern int DEBUG_InfoLocals(void); extern int DEBUG_InfoLocals(void);
extern int DEBUG_SetFrame(int newframe); extern int DEBUG_SetFrame(int newframe);
extern int DEBUG_GetCurrentFrame(struct name_hash ** name, extern int DEBUG_GetCurrentFrame(struct name_hash ** name,
unsigned int * eip, unsigned int * eip,
unsigned int * ebp); unsigned int * ebp);
/* debugger/stabs.c */ /* debugger/stabs.c */
extern enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name); extern enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name);
extern enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset, extern enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
unsigned int staboff, int stablen, unsigned int staboff, int stablen,
unsigned int strtaboff, int strtablen); unsigned int strtaboff, int strtablen);
/* debugger/types.c */ /* debugger/types.c */
extern int DEBUG_nchar; extern int DEBUG_nchar;
extern void DEBUG_InitTypes(void); extern void DEBUG_InitTypes(void);
extern struct datatype * DEBUG_NewDataType(enum debug_type xtype, extern struct datatype * DEBUG_NewDataType(enum debug_type xtype,
const char * typename); const char * typename);
extern unsigned int DEBUG_TypeDerefPointer(const DBG_VALUE *value, extern unsigned int DEBUG_TypeDerefPointer(const DBG_VALUE *value,
struct datatype ** newtype); struct datatype ** newtype);
extern int DEBUG_AddStructElement(struct datatype * dt, extern int DEBUG_AddStructElement(struct datatype * dt,
char * name, struct datatype * type, char * name, struct datatype * type,
int offset, int size); int offset, int size);
extern int DEBUG_SetStructSize(struct datatype * dt, int size); extern int DEBUG_SetStructSize(struct datatype * dt, int size);
extern int DEBUG_SetPointerType(struct datatype * dt, struct datatype * dt2); extern int DEBUG_SetPointerType(struct datatype * dt, struct datatype * dt2);
extern int DEBUG_SetArrayParams(struct datatype * dt, int min, int max, extern int DEBUG_SetArrayParams(struct datatype * dt, int min, int max,
struct datatype * dt2); struct datatype * dt2);
extern void DEBUG_Print( const DBG_VALUE *addr, int count, char format, int level ); extern void DEBUG_Print( const DBG_VALUE *addr, int count, char format, int level );
extern unsigned int DEBUG_FindStructElement(DBG_VALUE * addr, extern unsigned int DEBUG_FindStructElement(DBG_VALUE * addr,
const char * ele_name, int * tmpbuf); const char * ele_name, int * tmpbuf);
extern struct datatype * DEBUG_GetPointerType(struct datatype * dt); extern struct datatype * DEBUG_GetPointerType(struct datatype * dt);
extern int DEBUG_GetObjectSize(struct datatype * dt); extern int DEBUG_GetObjectSize(struct datatype * dt);
extern unsigned int DEBUG_ArrayIndex(const DBG_VALUE * addr, DBG_VALUE * result, extern unsigned int DEBUG_ArrayIndex(const DBG_VALUE * addr, DBG_VALUE * result,
int index); int index);
extern struct datatype * DEBUG_FindOrMakePointerType(struct datatype * reftype); extern struct datatype * DEBUG_FindOrMakePointerType(struct datatype * reftype);
extern long long int DEBUG_GetExprValue(const DBG_VALUE * addr, char ** format); extern long long int DEBUG_GetExprValue(const DBG_VALUE * addr, char ** format);
extern int DEBUG_SetBitfieldParams(struct datatype * dt, int offset, extern int DEBUG_SetBitfieldParams(struct datatype * dt, int offset,
int nbits, struct datatype * dt2); int nbits, struct datatype * dt2);
extern int DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2); extern int DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2);
extern enum debug_type DEBUG_GetType(struct datatype * dt); extern enum debug_type DEBUG_GetType(struct datatype * dt);
@ -518,7 +518,7 @@ extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic);
extern void DEBUG_OutputA(int chn, const char* buffer, int len); extern void DEBUG_OutputA(int chn, const char* buffer, int len);
extern void DEBUG_OutputW(int chn, const WCHAR* buffer, int len); extern void DEBUG_OutputW(int chn, const WCHAR* buffer, int len);
#ifdef __GNUC__ #ifdef __GNUC__
extern int DEBUG_Printf(int chn, const char* format, ...) __attribute__((format (printf,2,3))); extern int DEBUG_Printf(int chn, const char* format, ...) __attribute__((format (printf,2,3)));
#else #else
extern int DEBUG_Printf(int chn, const char* format, ...); extern int DEBUG_Printf(int chn, const char* format, ...);
#endif #endif

View File

@ -109,14 +109,14 @@ DEBUG_DoDisplay(void)
DEBUG_Printf(DBG_CHN_MESG, " = "); DEBUG_Printf(DBG_CHN_MESG, " = ");
if( displaypoints[i].format == 'i' ) if( displaypoints[i].format == 'i' )
{ {
DEBUG_ExamineMemory( &value, DEBUG_ExamineMemory( &value,
displaypoints[i].count, displaypoints[i].count,
displaypoints[i].format); displaypoints[i].format);
} }
else else
{ {
DEBUG_Print( &value, DEBUG_Print( &value,
displaypoints[i].count, displaypoints[i].count,
displaypoints[i].format, 0); displaypoints[i].format, 0);
} }
} }
@ -130,7 +130,7 @@ int
DEBUG_DelDisplay(int displaynum) DEBUG_DelDisplay(int displaynum)
{ {
int i; int i;
if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 ) if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 )
{ {
DEBUG_Printf(DBG_CHN_MESG, "Invalid display number\n"); DEBUG_Printf(DBG_CHN_MESG, "Invalid display number\n");

View File

@ -351,7 +351,7 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
break; break;
case EXPR_TYPE_SYMBOL: case EXPR_TYPE_SYMBOL:
if( !DEBUG_GetSymbolValue(exp->un.symbol.name, -1, &rtn, FALSE) ) if( !DEBUG_GetSymbolValue(exp->un.symbol.name, -1, &rtn, FALSE) )
{ {
DEBUG_Printf(DBG_CHN_MESG, "%s\n", exp->un.symbol.name); DEBUG_Printf(DBG_CHN_MESG, "%s\n", exp->un.symbol.name);
RaiseException(DEBUG_STATUS_NO_SYMBOL, 0, 0, NULL); RaiseException(DEBUG_STATUS_NO_SYMBOL, 0, 0, NULL);
} }
@ -474,7 +474,7 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
{ {
RaiseException(DEBUG_STATUS_BAD_TYPE, 0, 0, NULL); RaiseException(DEBUG_STATUS_BAD_TYPE, 0, 0, NULL);
} }
if( exp1.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) && if( exp1.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) &&
exp2.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) ) exp2.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) )
{ {
rtn.type = exp1.type; rtn.type = exp1.type;
@ -643,11 +643,11 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
* => exp1 is host, result is target * => exp1 is host, result is target
* x is a pointer to internal variable x * x is a pointer to internal variable x
* => exp1 is host, result is host * => exp1 is host, result is host
* so we force DV_TARGET, because dereferencing pointers to * so we force DV_TARGET, because dereferencing pointers to
* internal variables is very unlikely. a correct fix would be * internal variables is very unlikely. a correct fix would be
* rather large. * rather large.
*/ */
rtn.cookie = DV_TARGET; rtn.cookie = DV_TARGET;
rtn.addr.off = (unsigned int) DEBUG_TypeDerefPointer(&exp1, &rtn.type); rtn.addr.off = (unsigned int) DEBUG_TypeDerefPointer(&exp1, &rtn.type);
if (!rtn.type) if (!rtn.type)
{ {
@ -707,7 +707,7 @@ DEBUG_DisplayExpr(const struct expr * exp)
DEBUG_Printf(DBG_CHN_MESG, "%d", exp->un.u_const.value); DEBUG_Printf(DBG_CHN_MESG, "%d", exp->un.u_const.value);
break; break;
case EXPR_TYPE_STRING: case EXPR_TYPE_STRING:
DEBUG_Printf(DBG_CHN_MESG, "\"%s\"", exp->un.string.str); DEBUG_Printf(DBG_CHN_MESG, "\"%s\"", exp->un.string.str);
break; break;
case EXPR_TYPE_SYMBOL: case EXPR_TYPE_SYMBOL:
DEBUG_Printf(DBG_CHN_MESG, "%s" , exp->un.symbol.name); DEBUG_Printf(DBG_CHN_MESG, "%s" , exp->un.symbol.name);

View File

@ -1,4 +1,4 @@
/* /*
* Convenience functions to handle use of external debugger. * Convenience functions to handle use of external debugger.
* *
* Copyright 1999 Kevin Holbrook * Copyright 1999 Kevin Holbrook
@ -104,7 +104,7 @@ void DEBUG_ExternalDebugger(void)
const char *dbg_external; const char *dbg_external;
const char *dbg_wine_location; const char *dbg_wine_location;
const char *dbg_no_xterm; const char *dbg_no_xterm;
char pid_string[DBG_BUFF_SIZE]; char pid_string[DBG_BUFF_SIZE];
/* check settings in environment for debugger to use */ /* check settings in environment for debugger to use */
@ -134,15 +134,15 @@ void DEBUG_ExternalDebugger(void)
if (dbg_no_xterm) if (dbg_no_xterm)
status = execlp(dbg_external, dbg_external, dbg_wine_location, pid_string, NULL); status = execlp(dbg_external, dbg_external, dbg_wine_location, pid_string, NULL);
else else
status = execlp("xterm", "xterm", "-e", dbg_external, dbg_wine_location, pid_string, NULL); status = execlp("xterm", "xterm", "-e", dbg_external, dbg_wine_location, pid_string, NULL);
if (status == -1) if (status == -1)
{ {
if (dbg_no_xterm) if (dbg_no_xterm)
fprintf(stderr, "DEBUG_ExternalDebugger failed to execute \"%s %s %s\" (%s)\n", fprintf(stderr, "DEBUG_ExternalDebugger failed to execute \"%s %s %s\" (%s)\n",
dbg_external, dbg_wine_location, pid_string, strerror(errno)); dbg_external, dbg_wine_location, pid_string, strerror(errno));
else else
fprintf(stderr, "DEBUG_ExternalDebugger failed to execute \"xterm -e %s %s %s\" (%s)\n", fprintf(stderr, "DEBUG_ExternalDebugger failed to execute \"xterm -e %s %s %s\" (%s)\n",
dbg_external, dbg_wine_location, pid_string, strerror(errno)); dbg_external, dbg_wine_location, pid_string, strerror(errno));
} }
@ -154,7 +154,7 @@ void DEBUG_ExternalDebugger(void)
} }
else else
fprintf(stderr, "DEBUG_ExternalDebugger failed.\n"); fprintf(stderr, "DEBUG_ExternalDebugger failed.\n");
} }

View File

@ -60,7 +60,7 @@ struct name_hash
int n_locals; int n_locals;
int locals_alloc; int locals_alloc;
WineLocals * local_vars; WineLocals * local_vars;
int n_lines; int n_lines;
int lines_alloc; int lines_alloc;
WineLineNo * linetab; WineLineNo * linetab;
@ -88,7 +88,7 @@ static unsigned int name_hash( const char * name )
p = name; p = name;
while (*p) while (*p)
{ {
hash = (hash << 4) + *p++; hash = (hash << 4) + *p++;
@ -170,7 +170,7 @@ DEBUG_ResortSymbols(void)
return; return;
} }
addr_sorttab = (struct name_hash **) DBG_realloc(addr_sorttab, addr_sorttab = (struct name_hash **) DBG_realloc(addr_sorttab,
nsym * sizeof(struct name_hash *)); nsym * sizeof(struct name_hash *));
nsym = 0; nsym = 0;
@ -195,7 +195,7 @@ DEBUG_ResortSymbols(void)
* Add a symbol to the table. * Add a symbol to the table.
*/ */
struct name_hash * struct name_hash *
DEBUG_AddSymbol( const char * name, const DBG_VALUE *value, DEBUG_AddSymbol( const char * name, const DBG_VALUE *value,
const char * source, int flags) const char * source, int flags)
{ {
struct name_hash * new; struct name_hash * new;
@ -248,7 +248,7 @@ DEBUG_AddSymbol( const char * name, const DBG_VALUE *value,
* First see if we already have an entry for this symbol. If so * First see if we already have an entry for this symbol. If so
* return it, so we don't end up with duplicates. * return it, so we don't end up with duplicates.
*/ */
new = (struct name_hash *) DBG_alloc(sizeof(struct name_hash)); new = (struct name_hash *) DBG_alloc(sizeof(struct name_hash));
new->value = *value; new->value = *value;
new->name = DBG_strdup(name); new->name = DBG_strdup(name);
@ -347,7 +347,7 @@ BOOL DEBUG_Normalize(struct name_hash * nh )
* *
* Get the address of a named symbol. * Get the address of a named symbol.
*/ */
static int DEBUG_GSV_Helper(const char* name, const int lineno, static int DEBUG_GSV_Helper(const char* name, const int lineno,
DBG_VALUE* value, int num, int bp_flag) DBG_VALUE* value, int num, int bp_flag)
{ {
struct name_hash* nh; struct name_hash* nh;
@ -369,7 +369,7 @@ static int DEBUG_GSV_Helper(const char* name, const int lineno,
return i; return i;
} }
BOOL DEBUG_GetSymbolValue( const char * name, const int lineno, BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
DBG_VALUE *rtn, int bp_flag ) DBG_VALUE *rtn, int bp_flag )
{ {
#define NUMDBGV 10 #define NUMDBGV 10
@ -382,7 +382,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
if (!num && (name[0] != '_')) if (!num && (name[0] != '_'))
{ {
char buffer[512]; char buffer[512];
assert(strlen(name) < sizeof(buffer) - 2); /* one for '_', one for '\0' */ assert(strlen(name) < sizeof(buffer) - 2); /* one for '_', one for '\0' */
buffer[0] = '_'; buffer[0] = '_';
strcpy(buffer + 1, name); strcpy(buffer + 1, name);
@ -390,7 +390,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
} }
/* now get the local symbols if any */ /* now get the local symbols if any */
if (DEBUG_GetStackSymbolValue(name, &vtmp) && num < NUMDBGV) if (DEBUG_GetStackSymbolValue(name, &vtmp) && num < NUMDBGV)
{ {
value[num] = vtmp; value[num] = vtmp;
local = num; local = num;
@ -447,7 +447,7 @@ BOOL DEBUG_GetSymbolValue( const char * name, const int lineno,
* *
* Get the address of a named symbol. * Get the address of a named symbol.
*/ */
BOOL DEBUG_GetLineNumberAddr( const struct name_hash * nh, const int lineno, BOOL DEBUG_GetLineNumberAddr( const struct name_hash * nh, const int lineno,
DBG_ADDR *addr, int bp_flag ) DBG_ADDR *addr, int bp_flag )
{ {
int i; int i;
@ -584,13 +584,13 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
low = 0; low = 0;
high = sorttab_nsym; high = sorttab_nsym;
if( addr_sorttab[0]->value.addr.seg > addr->seg if( addr_sorttab[0]->value.addr.seg > addr->seg
|| ( addr_sorttab[0]->value.addr.seg == addr->seg || ( addr_sorttab[0]->value.addr.seg == addr->seg
&& addr_sorttab[0]->value.addr.off > addr->off) ) && addr_sorttab[0]->value.addr.off > addr->off) )
{ {
nearest = NULL; nearest = NULL;
} }
else if( addr_sorttab[high - 1]->value.addr.seg < addr->seg else if( addr_sorttab[high - 1]->value.addr.seg < addr->seg
|| ( addr_sorttab[high - 1]->value.addr.seg == addr->seg || ( addr_sorttab[high - 1]->value.addr.seg == addr->seg
&& addr_sorttab[high - 1]->value.addr.off < addr->off) ) && addr_sorttab[high - 1]->value.addr.off < addr->off) )
{ {
nearest = addr_sorttab[high - 1]; nearest = addr_sorttab[high - 1];
@ -602,10 +602,10 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
mid = (high + low)/2; mid = (high + low)/2;
if( mid == low ) if( mid == low )
{ {
/* /*
* See if there are any other entries that might also * See if there are any other entries that might also
* have the same address, and would also have a line * have the same address, and would also have a line
* number table. * number table.
*/ */
if( mid > 0 && addr_sorttab[mid]->linetab == NULL ) if( mid > 0 && addr_sorttab[mid]->linetab == NULL )
{ {
@ -643,7 +643,7 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
break; break;
} }
if( (addr_sorttab[mid]->value.addr.seg < addr->seg) if( (addr_sorttab[mid]->value.addr.seg < addr->seg)
|| ( addr_sorttab[mid]->value.addr.seg == addr->seg || ( addr_sorttab[mid]->value.addr.seg == addr->seg
&& addr_sorttab[mid]->value.addr.off <= addr->off) ) && addr_sorttab[mid]->value.addr.off <= addr->off) )
{ {
low = mid; low = mid;
@ -724,7 +724,7 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
module = DEBUG_FindModuleByAddr((void*)DEBUG_ToLinear(addr), DMT_UNKNOWN); module = DEBUG_FindModuleByAddr((void*)DEBUG_ToLinear(addr), DMT_UNKNOWN);
if (module) { if (module) {
char* ptr = strrchr(module->module_name, '/'); char* ptr = strrchr(module->module_name, '/');
if (!ptr++) ptr = module->module_name; if (!ptr++) ptr = module->module_name;
sprintf( modbuf, " in %s", ptr); sprintf( modbuf, " in %s", ptr);
} }
@ -767,13 +767,13 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
sourcefile = strrchr( nearest->sourcefile, '/' ); sourcefile = strrchr( nearest->sourcefile, '/' );
if (!sourcefile) sourcefile = nearest->sourcefile; if (!sourcefile) sourcefile = nearest->sourcefile;
else sourcefile++; else sourcefile++;
if (addr->off == nearest->value.addr.off) if (addr->off == nearest->value.addr.off)
sprintf( name_buffer, "%s%s [%s%s]%s", nearest->name, sprintf( name_buffer, "%s%s [%s%s]%s", nearest->name,
arglist, sourcefile, lineinfo, modbuf); arglist, sourcefile, lineinfo, modbuf);
else else
sprintf( name_buffer, "%s+0x%lx%s [%s%s]%s", nearest->name, sprintf( name_buffer, "%s+0x%lx%s [%s%s]%s", nearest->name,
addr->off - nearest->value.addr.off, addr->off - nearest->value.addr.off,
arglist, sourcefile, lineinfo, modbuf ); arglist, sourcefile, lineinfo, modbuf );
} }
else else
@ -818,17 +818,17 @@ void DEBUG_ReadSymbolTable( const char* filename )
value.addr.seg = 0; value.addr.seg = 0;
value.addr.off = 0; value.addr.off = 0;
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
while (1) while (1)
{ {
fgets( buffer, sizeof(buffer), symbolfile ); fgets( buffer, sizeof(buffer), symbolfile );
if (feof(symbolfile)) break; if (feof(symbolfile)) break;
/* Strip any text after a # sign (i.e. comments) */ /* Strip any text after a # sign (i.e. comments) */
cpnt = buffer; cpnt = buffer;
while (*cpnt) while (*cpnt)
if(*cpnt++ == '#') { *cpnt = 0; break; } if(*cpnt++ == '#') { *cpnt = 0; break; }
/* Quietly ignore any lines that have just whitespace */ /* Quietly ignore any lines that have just whitespace */
cpnt = buffer; cpnt = buffer;
while(*cpnt) while(*cpnt)
@ -837,7 +837,7 @@ void DEBUG_ReadSymbolTable( const char* filename )
cpnt++; cpnt++;
} }
if (!(*cpnt) || *cpnt == '\n') continue; if (!(*cpnt) || *cpnt == '\n') continue;
if (sscanf(buffer, "%lx %c %s", &value.addr.off, &type, name) == 3) if (sscanf(buffer, "%lx %c %s", &value.addr.off, &type, name) == 3)
DEBUG_AddSymbol( name, &value, NULL, SYM_WINE ); DEBUG_AddSymbol( name, &value, NULL, SYM_WINE );
} }
@ -846,7 +846,7 @@ void DEBUG_ReadSymbolTable( const char* filename )
void void
DEBUG_AddLineNumber( struct name_hash * func, int line_num, DEBUG_AddLineNumber( struct name_hash * func, int line_num,
unsigned long offset ) unsigned long offset )
{ {
if( func == NULL ) if( func == NULL )
@ -869,7 +869,7 @@ DEBUG_AddLineNumber( struct name_hash * func, int line_num,
struct wine_locals * struct wine_locals *
DEBUG_AddLocal( struct name_hash * func, int regno, DEBUG_AddLocal( struct name_hash * func, int regno,
int offset, int offset,
int pc_start, int pc_start,
int pc_end, int pc_end,
@ -942,13 +942,13 @@ int DEBUG_CheckLinenoStatus( const DBG_ADDR *addr)
low = 0; low = 0;
high = sorttab_nsym; high = sorttab_nsym;
if( addr_sorttab[0]->value.addr.seg > addr->seg if( addr_sorttab[0]->value.addr.seg > addr->seg
|| ( addr_sorttab[0]->value.addr.seg == addr->seg || ( addr_sorttab[0]->value.addr.seg == addr->seg
&& addr_sorttab[0]->value.addr.off > addr->off) ) && addr_sorttab[0]->value.addr.off > addr->off) )
{ {
nearest = NULL; nearest = NULL;
} }
else if( addr_sorttab[high - 1]->value.addr.seg < addr->seg else if( addr_sorttab[high - 1]->value.addr.seg < addr->seg
|| ( addr_sorttab[high - 1]->value.addr.seg == addr->seg || ( addr_sorttab[high - 1]->value.addr.seg == addr->seg
&& addr_sorttab[high - 1]->value.addr.off < addr->off) ) && addr_sorttab[high - 1]->value.addr.off < addr->off) )
{ {
nearest = addr_sorttab[high - 1]; nearest = addr_sorttab[high - 1];
@ -960,10 +960,10 @@ int DEBUG_CheckLinenoStatus( const DBG_ADDR *addr)
mid = (high + low)/2; mid = (high + low)/2;
if( mid == low ) if( mid == low )
{ {
/* /*
* See if there are any other entries that might also * See if there are any other entries that might also
* have the same address, and would also have a line * have the same address, and would also have a line
* number table. * number table.
*/ */
if( mid > 0 && addr_sorttab[mid]->linetab == NULL ) if( mid > 0 && addr_sorttab[mid]->linetab == NULL )
{ {
@ -1001,7 +1001,7 @@ int DEBUG_CheckLinenoStatus( const DBG_ADDR *addr)
break; break;
} }
if( (addr_sorttab[mid]->value.addr.seg < addr->seg) if( (addr_sorttab[mid]->value.addr.seg < addr->seg)
|| ( addr_sorttab[mid]->value.addr.seg == addr->seg || ( addr_sorttab[mid]->value.addr.seg == addr->seg
&& addr_sorttab[mid]->value.addr.off <= addr->off) ) && addr_sorttab[mid]->value.addr.off <= addr->off) )
{ {
low = mid; low = mid;
@ -1078,7 +1078,7 @@ int DEBUG_CheckLinenoStatus( const DBG_ADDR *addr)
* handler can deal with. * handler can deal with.
*/ */
void void
DEBUG_GetFuncInfo( struct list_id * ret, const char * filename, DEBUG_GetFuncInfo( struct list_id * ret, const char * filename,
const char * name) const char * name)
{ {
char buffer[256]; char buffer[256];
@ -1185,14 +1185,14 @@ BOOL DEBUG_GetStackSymbolValue( const char * name, DBG_VALUE *value )
* comes up with RBRAC/LBRAC stabs in particular. * comes up with RBRAC/LBRAC stabs in particular.
*/ */
if( (curr_func->local_vars[i].pc_start != 0) if( (curr_func->local_vars[i].pc_start != 0)
&& ((eip - curr_func->value.addr.off) && ((eip - curr_func->value.addr.off)
< curr_func->local_vars[i].pc_start) ) < curr_func->local_vars[i].pc_start) )
{ {
continue; continue;
} }
if( (curr_func->local_vars[i].pc_end != 0) if( (curr_func->local_vars[i].pc_end != 0)
&& ((eip - curr_func->value.addr.off) && ((eip - curr_func->value.addr.off)
> curr_func->local_vars[i].pc_end) ) > curr_func->local_vars[i].pc_end) )
{ {
continue; continue;
@ -1209,11 +1209,11 @@ BOOL DEBUG_GetStackSymbolValue( const char * name, DBG_VALUE *value )
* Register variable. Point to DEBUG_context field. * Register variable. Point to DEBUG_context field.
*/ */
assert(curr_func->local_vars[i].regno - 1 < sizeof(reg_ofs)/sizeof(reg_ofs[0])); assert(curr_func->local_vars[i].regno - 1 < sizeof(reg_ofs)/sizeof(reg_ofs[0]));
value->addr.off = ((DWORD)&DEBUG_context) + value->addr.off = ((DWORD)&DEBUG_context) +
reg_ofs[curr_func->local_vars[i].regno - 1]; reg_ofs[curr_func->local_vars[i].regno - 1];
value->cookie = DV_HOST; value->cookie = DV_HOST;
} }
else else
{ {
value->addr.off = ebp + curr_func->local_vars[i].offset; value->addr.off = ebp + curr_func->local_vars[i].offset;
value->cookie = DV_TARGET; value->cookie = DV_TARGET;
@ -1252,19 +1252,19 @@ DEBUG_InfoLocals(void)
* comes up with RBRAC/LBRAC stabs in particular. * comes up with RBRAC/LBRAC stabs in particular.
*/ */
if( (curr_func->local_vars[i].pc_start != 0) if( (curr_func->local_vars[i].pc_start != 0)
&& ((eip - curr_func->value.addr.off) && ((eip - curr_func->value.addr.off)
< curr_func->local_vars[i].pc_start) ) < curr_func->local_vars[i].pc_start) )
{ {
continue; continue;
} }
if( (curr_func->local_vars[i].pc_end != 0) if( (curr_func->local_vars[i].pc_end != 0)
&& ((eip - curr_func->value.addr.off) && ((eip - curr_func->value.addr.off)
> curr_func->local_vars[i].pc_end) ) > curr_func->local_vars[i].pc_end) )
{ {
continue; continue;
} }
DEBUG_PrintTypeCast(curr_func->local_vars[i].type); DEBUG_PrintTypeCast(curr_func->local_vars[i].type);
if( curr_func->local_vars[i].regno != 0 ) if( curr_func->local_vars[i].regno != 0 )
@ -1278,7 +1278,7 @@ DEBUG_InfoLocals(void)
} }
else else
{ {
DEBUG_READ_MEM_VERBOSE((void*)(ebp + curr_func->local_vars[i].offset), DEBUG_READ_MEM_VERBOSE((void*)(ebp + curr_func->local_vars[i].offset),
&val, sizeof(val)); &val, sizeof(val));
DEBUG_Printf(DBG_CHN_MESG, " %s == 0x%8.8x\n", DEBUG_Printf(DBG_CHN_MESG, " %s == 0x%8.8x\n",
curr_func->local_vars[i].name, val); curr_func->local_vars[i].name, val);

View File

@ -38,39 +38,39 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
{ {
char * default_format; char * default_format;
long long int res; long long int res;
assert(value->cookie == DV_TARGET || value->cookie == DV_HOST); assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
if (value->type == NULL) if (value->type == NULL)
{ {
DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression\n"); DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression\n");
return; return;
} }
default_format = NULL; default_format = NULL;
res = DEBUG_GetExprValue(value, &default_format); res = DEBUG_GetExprValue(value, &default_format);
switch (format) switch (format)
{ {
case 'x': case 'x':
if (value->addr.seg) if (value->addr.seg)
{ {
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "0x%04lx", (long unsigned int)res); DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "0x%04lx", (long unsigned int)res);
} }
else else
{ {
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "0x%08lx", (long unsigned int)res); DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "0x%08lx", (long unsigned int)res);
} }
break; break;
case 'd': case 'd':
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%ld\n", (long int)res); DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%ld\n", (long int)res);
break; break;
case 'c': case 'c':
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%d = '%c'", DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%d = '%c'",
(char)(res & 0xff), (char)(res & 0xff)); (char)(res & 0xff), (char)(res & 0xff));
break; break;
case 'u': case 'u':
{ {
WCHAR wch = (WCHAR)(res & 0xFFFF); WCHAR wch = (WCHAR)(res & 0xFFFF);
@ -79,7 +79,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
DEBUG_Printf(DBG_CHN_MESG, "'"); DEBUG_Printf(DBG_CHN_MESG, "'");
} }
break; break;
case 'i': case 'i':
case 's': case 's':
case 'w': case 'w':
@ -92,27 +92,27 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
{ {
char* ptr; char* ptr;
int state = 0; int state = 0;
/* FIXME: simplistic implementation for default_format being /* FIXME: simplistic implementation for default_format being
* foo%Sbar => will print foo, then string then bar * foo%Sbar => will print foo, then string then bar
*/ */
for (ptr = default_format; *ptr; ptr++) for (ptr = default_format; *ptr; ptr++)
{ {
if (*ptr == '%') if (*ptr == '%')
{ {
state++; state++;
} }
else if (state == 1) else if (state == 1)
{ {
if (*ptr == 'S') if (*ptr == 'S')
{ {
DBG_ADDR addr; DBG_ADDR addr;
addr.seg = 0; addr.seg = 0;
addr.off = (long)res; addr.off = (long)res;
DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &addr, -1); DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &addr, -1);
} }
else else
{ {
/* shouldn't happen */ /* shouldn't happen */
DEBUG_Printf(DBG_CHN_MESG, "%%%c", *ptr); DEBUG_Printf(DBG_CHN_MESG, "%%%c", *ptr);
@ -126,7 +126,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
DEBUG_nchar++; DEBUG_nchar++;
} }
} }
} }
else if (strcmp(default_format, "%B") == 0) else if (strcmp(default_format, "%B") == 0)
{ {
DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%s", res ? "true" : "false"); DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%s", res ? "true" : "false");
@ -151,7 +151,7 @@ DEBUG_PrintAddress( const DBG_ADDR *addr, enum dbg_mode mode, int flag )
{ {
struct symbol_info rtn; struct symbol_info rtn;
const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, 0, const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, 0,
&rtn.list ); &rtn.list );
if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg&0xFFFF ); if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg&0xFFFF );
@ -173,7 +173,7 @@ DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr, enum dbg_mode mode,
{ {
struct symbol_info rtn; struct symbol_info rtn;
const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, ebp, const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, ebp,
&rtn.list ); &rtn.list );
if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg ); if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg );
@ -274,7 +274,7 @@ void DEBUG_InfoClass(const char* name)
} }
DEBUG_Printf(DBG_CHN_MESG, "Class '%s':\n", name); DEBUG_Printf(DBG_CHN_MESG, "Class '%s':\n", name);
DEBUG_Printf(DBG_CHN_MESG, DEBUG_Printf(DBG_CHN_MESG,
"style=%08x wndProc=%08lx\n" "style=%08x wndProc=%08lx\n"
"inst=%p icon=%p cursor=%p bkgnd=%p\n" "inst=%p icon=%p cursor=%p bkgnd=%p\n"
"clsExtra=%d winExtra=%d\n", "clsExtra=%d winExtra=%d\n",
@ -282,7 +282,7 @@ void DEBUG_InfoClass(const char* name)
wca.hIcon, wca.hCursor, wca.hbrBackground, wca.hIcon, wca.hCursor, wca.hbrBackground,
wca.cbClsExtra, wca.cbWndExtra); wca.cbClsExtra, wca.cbWndExtra);
/* FIXME: /* FIXME:
* + print #windows (or even list of windows...) * + print #windows (or even list of windows...)
* + print extra bytes => this requires a window handle on this very class... * + print extra bytes => this requires a window handle on this very class...
*/ */
@ -298,7 +298,7 @@ static void DEBUG_InfoClass2(HWND hWnd, const char* name)
} }
DEBUG_Printf(DBG_CHN_MESG, "Class '%s':\n", name); DEBUG_Printf(DBG_CHN_MESG, "Class '%s':\n", name);
DEBUG_Printf(DBG_CHN_MESG, DEBUG_Printf(DBG_CHN_MESG,
"style=%08x wndProc=%08lx\n" "style=%08x wndProc=%08lx\n"
"inst=%p icon=%p cursor=%p bkgnd=%p\n" "inst=%p icon=%p cursor=%p bkgnd=%p\n"
"clsExtra=%d winExtra=%d\n", "clsExtra=%d winExtra=%d\n",
@ -402,20 +402,20 @@ void DEBUG_InfoWindow(HWND hWnd)
"inst=%p active=%p idmenu=%08lx\n" "inst=%p active=%p idmenu=%08lx\n"
"style=%08lx exstyle=%08lx wndproc=%08lx text='%s'\n" "style=%08lx exstyle=%08lx wndproc=%08lx text='%s'\n"
"client=%d,%d-%d,%d window=%d,%d-%d,%d sysmenu=%p\n", "client=%d,%d-%d,%d window=%d,%d-%d,%d sysmenu=%p\n",
GetWindow(hWnd, GW_HWNDNEXT), GetWindow(hWnd, GW_HWNDNEXT),
GetWindow(hWnd, GW_CHILD), GetWindow(hWnd, GW_CHILD),
GetParent(hWnd), GetParent(hWnd),
GetWindow(hWnd, GW_OWNER), GetWindow(hWnd, GW_OWNER),
clsName, clsName,
(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
GetLastActivePopup(hWnd), GetLastActivePopup(hWnd),
GetWindowLong(hWnd, GWL_ID), GetWindowLong(hWnd, GWL_ID),
GetWindowLong(hWnd, GWL_STYLE), GetWindowLong(hWnd, GWL_STYLE),
GetWindowLong(hWnd, GWL_EXSTYLE), GetWindowLong(hWnd, GWL_EXSTYLE),
GetWindowLong(hWnd, GWL_WNDPROC), GetWindowLong(hWnd, GWL_WNDPROC),
wndName, wndName,
clientRect.left, clientRect.top, clientRect.right, clientRect.bottom, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom,
windowRect.left, windowRect.top, windowRect.right, windowRect.bottom, windowRect.left, windowRect.top, windowRect.right, windowRect.bottom,
GetSystemMenu(hWnd, FALSE)); GetSystemMenu(hWnd, FALSE));
if (GetClassLong(hWnd, GCL_CBWNDEXTRA)) { if (GetClassLong(hWnd, GCL_CBWNDEXTRA)) {
@ -441,7 +441,7 @@ void DEBUG_WalkWindows(HWND hWnd, int indent)
hWnd = GetDesktopWindow(); hWnd = GetDesktopWindow();
if (!indent) /* first time around */ if (!indent) /* first time around */
DEBUG_Printf(DBG_CHN_MESG, DEBUG_Printf(DBG_CHN_MESG,
"%-16.16s %-17.17s %-8.8s %s\n", "%-16.16s %-17.17s %-8.8s %s\n",
"hwnd", "Class Name", " Style", " WndProc Text"); "hwnd", "Class Name", " Style", " WndProc Text");
@ -450,7 +450,7 @@ void DEBUG_WalkWindows(HWND hWnd, int indent)
strcpy(clsName, "-- Unknown --"); strcpy(clsName, "-- Unknown --");
if (!GetWindowText(hWnd, wndName, sizeof(wndName))) if (!GetWindowText(hWnd, wndName, sizeof(wndName)))
strcpy(wndName, "-- Empty --"); strcpy(wndName, "-- Empty --");
/* FIXME: missing hmemTaskQ */ /* FIXME: missing hmemTaskQ */
DEBUG_Printf(DBG_CHN_MESG, "%*s%04x%*s", indent, "", (UINT)hWnd, 13-indent,""); DEBUG_Printf(DBG_CHN_MESG, "%*s%04x%*s", indent, "", (UINT)hWnd, 13-indent,"");
DEBUG_Printf(DBG_CHN_MESG, "%-17.17s %08lx %08lx %.14s\n", DEBUG_Printf(DBG_CHN_MESG, "%-17.17s %08lx %08lx %.14s\n",
@ -515,12 +515,12 @@ void DEBUG_WalkThreads(void)
{ {
DBG_PROCESS* p = DEBUG_GetProcess(entry.th32OwnerProcessID); DBG_PROCESS* p = DEBUG_GetProcess(entry.th32OwnerProcessID);
DEBUG_Printf(DBG_CHN_MESG, "%08lx%s %s\n", DEBUG_Printf(DBG_CHN_MESG, "%08lx%s %s\n",
entry.th32OwnerProcessID, p ? " (D)" : "", p ? p->imageName : ""); entry.th32OwnerProcessID, p ? " (D)" : "", p ? p->imageName : "");
lastProcessId = entry.th32OwnerProcessID; lastProcessId = entry.th32OwnerProcessID;
} }
DEBUG_Printf(DBG_CHN_MESG, "\t%08lx %4ld%s\n", DEBUG_Printf(DBG_CHN_MESG, "\t%08lx %4ld%s\n",
entry.th32ThreadID, entry.tpBasePri, entry.th32ThreadID, entry.tpBasePri,
(entry.th32ThreadID == current) ? " <==" : ""); (entry.th32ThreadID == current) ? " <==" : "");
} }
@ -549,7 +549,7 @@ void DEBUG_InfoSegments(DWORD start, int length)
if (!GetThreadSelectorEntry(DEBUG_CurrThread->handle, (i << 3)|7, &le)) if (!GetThreadSelectorEntry(DEBUG_CurrThread->handle, (i << 3)|7, &le))
continue; continue;
if (le.HighWord.Bits.Type & 0x08) if (le.HighWord.Bits.Type & 0x08)
{ {
flags[0] = (le.HighWord.Bits.Type & 0x2) ? 'r' : '-'; flags[0] = (le.HighWord.Bits.Type & 0x2) ? 'r' : '-';
flags[1] = '-'; flags[1] = '-';
@ -561,12 +561,12 @@ void DEBUG_InfoSegments(DWORD start, int length)
flags[1] = (le.HighWord.Bits.Type & 0x2) ? 'w' : '-'; flags[1] = (le.HighWord.Bits.Type & 0x2) ? 'w' : '-';
flags[2] = '-'; flags[2] = '-';
} }
DEBUG_Printf(DBG_CHN_MESG, DEBUG_Printf(DBG_CHN_MESG,
"%04lx: sel=%04lx base=%08x limit=%08x %d-bit %c%c%c\n", "%04lx: sel=%04lx base=%08x limit=%08x %d-bit %c%c%c\n",
i, (i<<3)|7, i, (i<<3)|7,
(le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseHi << 24) +
(le.HighWord.Bits.BaseMid << 16) + le.BaseLow, (le.HighWord.Bits.BaseMid << 16) + le.BaseLow,
((le.HighWord.Bits.LimitHi << 8) + le.LimitLow) << ((le.HighWord.Bits.LimitHi << 8) + le.LimitLow) <<
(le.HighWord.Bits.Granularity ? 12 : 0), (le.HighWord.Bits.Granularity ? 12 : 0),
le.HighWord.Bits.Default_Big ? 32 : 16, le.HighWord.Bits.Default_Big ? 32 : 16,
flags[0], flags[1], flags[2] ); flags[0], flags[1], flags[2] );

View File

@ -71,7 +71,7 @@ enum dbg_mode DEBUG_GetSelectorType( WORD sel )
if (IS_VM86_MODE()) return MODE_VM86; if (IS_VM86_MODE()) return MODE_VM86;
if (sel == 0) return MODE_32; if (sel == 0) return MODE_32;
if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, sel, &le)) if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, sel, &le))
return le.HighWord.Bits.Default_Big ? MODE_32 : MODE_16; return le.HighWord.Bits.Default_Big ? MODE_32 : MODE_16;
/* selector doesn't exist */ /* selector doesn't exist */
return MODE_INVALID; return MODE_INVALID;
@ -80,7 +80,7 @@ enum dbg_mode DEBUG_GetSelectorType( WORD sel )
#endif #endif
} }
#ifdef __i386__ #ifdef __i386__
void DEBUG_FixAddress( DBG_ADDR *addr, DWORD def) void DEBUG_FixAddress( DBG_ADDR *addr, DWORD def)
{ {
if (addr->seg == 0xffffffff) addr->seg = def; if (addr->seg == 0xffffffff) addr->seg = def;
if (DEBUG_IsSelectorSystem(addr->seg)) addr->seg = 0; if (DEBUG_IsSelectorSystem(addr->seg)) addr->seg = 0;
@ -98,12 +98,12 @@ DWORD DEBUG_ToLinear( const DBG_ADDR *addr )
{ {
#ifdef __i386__ #ifdef __i386__
LDT_ENTRY le; LDT_ENTRY le;
if (IS_VM86_MODE()) return (DWORD)(LOWORD(addr->seg) << 4) + addr->off; if (IS_VM86_MODE()) return (DWORD)(LOWORD(addr->seg) << 4) + addr->off;
if (DEBUG_IsSelectorSystem(addr->seg)) if (DEBUG_IsSelectorSystem(addr->seg))
return addr->off; return addr->off;
if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, addr->seg, &le)) { if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, addr->seg, &le)) {
return (le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow + addr->off; return (le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow + addr->off;
} }
@ -151,7 +151,7 @@ void DEBUG_InvalLinAddr( void* addr )
* *
* Read a memory value. * Read a memory value.
*/ */
/* FIXME: this function is now getting closer and closer to /* FIXME: this function is now getting closer and closer to
* DEBUG_ExprGetValue. They should be merged... * DEBUG_ExprGetValue. They should be merged...
*/ */
int DEBUG_ReadMemory( const DBG_VALUE* val ) int DEBUG_ReadMemory( const DBG_VALUE* val )
@ -171,7 +171,7 @@ int DEBUG_ReadMemory( const DBG_VALUE* val )
DEBUG_FixAddress( &addr, DEBUG_context.SegDs ); DEBUG_FixAddress( &addr, DEBUG_context.SegDs );
#endif #endif
lin = (void*)DEBUG_ToLinear( &addr ); lin = (void*)DEBUG_ToLinear( &addr );
DEBUG_READ_MEM_VERBOSE(lin, &value, os); DEBUG_READ_MEM_VERBOSE(lin, &value, os);
} else { } else {
if (val->addr.off) if (val->addr.off)
@ -218,7 +218,7 @@ BOOL DEBUG_GrabAddress( DBG_VALUE* value, BOOL fromCode )
assert(value->cookie == DV_TARGET || value->cookie == DV_HOST); assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
#ifdef __i386__ #ifdef __i386__
DEBUG_FixAddress( &value->addr, DEBUG_FixAddress( &value->addr,
(fromCode) ? DEBUG_context.SegCs : DEBUG_context.SegDs); (fromCode) ? DEBUG_context.SegCs : DEBUG_context.SegDs);
#endif #endif
@ -303,10 +303,10 @@ void DEBUG_ExamineMemory( const DBG_VALUE *_value, int count, char format )
DEBUG_Printf(DBG_CHN_MESG,"\n"); \ DEBUG_Printf(DBG_CHN_MESG,"\n"); \
} \ } \
return return
#define DO_DUMP(_t,_l,_f) DO_DUMP2(_t,_l,_f,_v) #define DO_DUMP(_t,_l,_f) DO_DUMP2(_t,_l,_f,_v)
case 'x': DO_DUMP(int, 4, " %8.8x"); case 'x': DO_DUMP(int, 4, " %8.8x");
case 'd': DO_DUMP(unsigned int, 4, " %10d"); case 'd': DO_DUMP(unsigned int, 4, " %10d");
case 'w': DO_DUMP(unsigned short, 8, " %04x"); case 'w': DO_DUMP(unsigned short, 8, " %04x");
case 'c': DO_DUMP2(char, 32, " %c", (_v < 0x20) ? ' ' : _v); case 'c': DO_DUMP2(char, 32, " %c", (_v < 0x20) ? ' ' : _v);
case 'b': DO_DUMP2(char, 16, " %02x", (_v) & 0xff); case 'b': DO_DUMP2(char, 16, " %02x", (_v) & 0xff);

View File

@ -28,10 +28,10 @@
#include "winuser.h" #include "winuser.h"
/*********************************************************************** /***********************************************************************
* Creates and links a new module to the current process * Creates and links a new module to the current process
* *
*/ */
DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type, DBG_MODULE* DEBUG_AddModule(const char* name, enum DbgModuleType type,
void* mod_addr, u_long size, HMODULE hmodule) void* mod_addr, u_long size, HMODULE hmodule)
{ {
DBG_MODULE* wmod; DBG_MODULE* wmod;
@ -65,10 +65,10 @@ DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type)
{ {
int i; int i;
DBG_MODULE** amod = DEBUG_CurrProcess->modules; DBG_MODULE** amod = DEBUG_CurrProcess->modules;
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) { for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
if ((type == DMT_UNKNOWN || type == amod[i]->type) && if ((type == DMT_UNKNOWN || type == amod[i]->type) &&
!strcasecmp(name, amod[i]->module_name)) !strcasecmp(name, amod[i]->module_name))
return amod[i]; return amod[i];
} }
return NULL; return NULL;
@ -77,7 +77,7 @@ DBG_MODULE* DEBUG_FindModuleByName(const char* name, enum DbgModuleType type)
/*********************************************************************** /***********************************************************************
* DEBUG_FindModuleByAddr * DEBUG_FindModuleByAddr
* *
* either the addr where module is loaded, or any address inside the * either the addr where module is loaded, or any address inside the
* module * module
*/ */
DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type) DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type)
@ -85,7 +85,7 @@ DBG_MODULE* DEBUG_FindModuleByAddr(void* addr, enum DbgModuleType type)
int i; int i;
DBG_MODULE** amod = DEBUG_CurrProcess->modules; DBG_MODULE** amod = DEBUG_CurrProcess->modules;
DBG_MODULE* res = NULL; DBG_MODULE* res = NULL;
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) { for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
if ((type == DMT_UNKNOWN || type == amod[i]->type) && if ((type == DMT_UNKNOWN || type == amod[i]->type) &&
(u_long)addr >= (u_long)amod[i]->load_addr && (u_long)addr >= (u_long)amod[i]->load_addr &&
@ -105,10 +105,10 @@ DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type)
{ {
int i; int i;
DBG_MODULE** amod = DEBUG_CurrProcess->modules; DBG_MODULE** amod = DEBUG_CurrProcess->modules;
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) { for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
if ((type == DMT_UNKNOWN || type == amod[i]->type) && if ((type == DMT_UNKNOWN || type == amod[i]->type) &&
handle == amod[i]->handle) handle == amod[i]->handle)
return amod[i]; return amod[i];
} }
return NULL; return NULL;
@ -120,7 +120,7 @@ DBG_MODULE* DEBUG_FindModuleByHandle(HANDLE handle, enum DbgModuleType type)
DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process) DBG_MODULE* DEBUG_GetProcessMainModule(DBG_PROCESS* process)
{ {
if (!process || !process->num_modules) return NULL; if (!process || !process->num_modules) return NULL;
/* main module is the first to be loaded on a given process, so it's the first /* main module is the first to be loaded on a given process, so it's the first
* in the array */ * in the array */
assert(process->modules[0]->main); assert(process->modules[0]->main);
@ -180,7 +180,7 @@ DBG_MODULE* DEBUG_RegisterNEModule(HMODULE hModule, void* load_addr, u_long size
* Helper function fo DEBUG_LoadModuleEPs16: * Helper function fo DEBUG_LoadModuleEPs16:
* finds the address of a given entry point from a given module * finds the address of a given entry point from a given module
*/ */
static BOOL DEBUG_GetEP16(char* moduleAddr, const NE_MODULE* module, static BOOL DEBUG_GetEP16(char* moduleAddr, const NE_MODULE* module,
WORD ordinal, DBG_ADDR* addr) WORD ordinal, DBG_ADDR* addr)
{ {
void* idx; void* idx;
@ -196,18 +196,18 @@ static BOOL DEBUG_GetEP16(char* moduleAddr, const NE_MODULE* module,
if (!DEBUG_READ_MEM_VERBOSE(idx, &bundle, sizeof(bundle))) if (!DEBUG_READ_MEM_VERBOSE(idx, &bundle, sizeof(bundle)))
return FALSE; return FALSE;
} while ((ordinal < bundle.first + 1) || (ordinal > bundle.last)); } while ((ordinal < bundle.first + 1) || (ordinal > bundle.last));
if (!DEBUG_READ_MEM_VERBOSE((char*)idx + sizeof(ET_BUNDLE) + if (!DEBUG_READ_MEM_VERBOSE((char*)idx + sizeof(ET_BUNDLE) +
(ordinal - bundle.first - 1) * sizeof(ET_ENTRY), (ordinal - bundle.first - 1) * sizeof(ET_ENTRY),
&entry, sizeof(ET_ENTRY))) &entry, sizeof(ET_ENTRY)))
return FALSE; return FALSE;
addr->seg = entry.segnum; addr->seg = entry.segnum;
addr->off = entry.offs; addr->off = entry.offs;
if (addr->seg == 0xfe) addr->seg = 0xffff; /* constant entry */ if (addr->seg == 0xfe) addr->seg = 0xffff; /* constant entry */
else { else {
if (!DEBUG_READ_MEM_VERBOSE(moduleAddr + module->seg_table + if (!DEBUG_READ_MEM_VERBOSE(moduleAddr + module->seg_table +
sizeof(ste) * (addr->seg - 1), sizeof(ste) * (addr->seg - 1),
&ste, sizeof(ste))) &ste, sizeof(ste)))
return FALSE; return FALSE;
@ -235,16 +235,16 @@ static void DEBUG_LoadModule16(HMODULE hModule, NE_MODULE* module, char* moduleA
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
value.addr.seg = 0; value.addr.seg = 0;
value.addr.off = 0; value.addr.off = 0;
cpnt = moduleAddr + module->name_table; cpnt = moduleAddr + module->name_table;
/* First search the resident names */ /* First search the resident names */
/* skip module name */ /* skip module name */
if (!DEBUG_READ_MEM_VERBOSE(cpnt, buf, sizeof(buf)) || !buf[0]) if (!DEBUG_READ_MEM_VERBOSE(cpnt, buf, sizeof(buf)) || !buf[0])
return; return;
cpnt += 1 + buf[0] + sizeof(WORD); cpnt += 1 + buf[0] + sizeof(WORD);
while (DEBUG_READ_MEM_VERBOSE(cpnt, buf, sizeof(buf)) && buf[0]) { while (DEBUG_READ_MEM_VERBOSE(cpnt, buf, sizeof(buf)) && buf[0]) {
sprintf(epname, "%s.%.*s", name, buf[0], &buf[1]); sprintf(epname, "%s.%.*s", name, buf[0], &buf[1]);
if (DEBUG_GetEP16(moduleAddr, module, *(WORD*)&buf[1 + buf[0]], &value.addr)) { if (DEBUG_GetEP16(moduleAddr, module, *(WORD*)&buf[1 + buf[0]], &value.addr)) {
@ -252,7 +252,7 @@ static void DEBUG_LoadModule16(HMODULE hModule, NE_MODULE* module, char* moduleA
} }
cpnt += buf[0] + 1 + sizeof(WORD); cpnt += buf[0] + 1 + sizeof(WORD);
} }
/* Now search the non-resident names table */ /* Now search the non-resident names table */
if (!module->nrname_handle) return; /* No non-resident table */ if (!module->nrname_handle) return; /* No non-resident table */
cpnt = (char *)GlobalLock16(module->nrname_handle); cpnt = (char *)GlobalLock16(module->nrname_handle);
@ -286,10 +286,10 @@ void DEBUG_LoadModule32(const char* name, HANDLE hFile, DWORD base)
&nth_ofs, sizeof(nth_ofs)) || &nth_ofs, sizeof(nth_ofs)) ||
!DEBUG_READ_MEM_VERBOSE((void*)(base + nth_ofs), &pe_header, sizeof(pe_header))) !DEBUG_READ_MEM_VERBOSE((void*)(base + nth_ofs), &pe_header, sizeof(pe_header)))
return; return;
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) + pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
pe_header.FileHeader.SizeOfOptionalHeader; pe_header.FileHeader.SizeOfOptionalHeader;
for (i = 0; i < pe_header.FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) { for (i = 0; i < pe_header.FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg))) if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg)))
continue; continue;
@ -304,7 +304,7 @@ void DEBUG_LoadModule32(const char* name, HANDLE hFile, DWORD base)
if (dil != DIL_LOADED) if (dil != DIL_LOADED)
dil = DEBUG_RegisterMSCDebugInfo(wmod, hFile, &pe_header, nth_ofs); dil = DEBUG_RegisterMSCDebugInfo(wmod, hFile, &pe_header, nth_ofs);
if (dil != DIL_LOADED) if (dil != DIL_LOADED)
dil = DEBUG_RegisterPEDebugInfo(wmod, hFile, &pe_header, nth_ofs); dil = DEBUG_RegisterPEDebugInfo(wmod, hFile, &pe_header, nth_ofs);
wmod->dil = dil; wmod->dil = dil;
} }
@ -333,14 +333,14 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
value.addr.seg = 0; value.addr.seg = 0;
value.addr.off = 0; value.addr.off = 0;
/* Add start of DLL */ /* Add start of DLL */
value.addr.off = base; value.addr.off = base;
if ((prefix = strrchr(wmod->module_name, '\\' ))) prefix++; if ((prefix = strrchr(wmod->module_name, '\\' ))) prefix++;
else prefix = wmod->module_name; else prefix = wmod->module_name;
DEBUG_AddSymbol(prefix, &value, NULL, SYM_WIN32 | SYM_FUNC); DEBUG_AddSymbol(prefix, &value, NULL, SYM_WIN32 | SYM_FUNC);
/* Add entry point */ /* Add entry point */
snprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix); snprintf(buffer, sizeof(buffer), "%s.EntryPoint", prefix);
value.addr.off = base + nth->OptionalHeader.AddressOfEntryPoint; value.addr.off = base + nth->OptionalHeader.AddressOfEntryPoint;
@ -349,7 +349,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
/* Add start of sections */ /* Add start of sections */
pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) + pe_seg_ofs = nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
nth->FileHeader.SizeOfOptionalHeader; nth->FileHeader.SizeOfOptionalHeader;
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) { for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg))) if (!DEBUG_READ_MEM_VERBOSE((void*)(base + pe_seg_ofs), &pe_seg, sizeof(pe_seg)))
continue; continue;
@ -357,10 +357,10 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
value.addr.off = base + pe_seg.VirtualAddress; value.addr.off = base + pe_seg.VirtualAddress;
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC); DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
} }
/* Add exported functions */ /* Add exported functions */
dir_ofs = nth_ofs + dir_ofs = nth_ofs +
OFFSET_OF(IMAGE_NT_HEADERS, OFFSET_OF(IMAGE_NT_HEADERS,
OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]); OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]);
if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir_ofs), &dir, sizeof(dir)) && dir.Size) { if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir_ofs), &dir, sizeof(dir)) && dir.Size) {
IMAGE_EXPORT_DIRECTORY exports; IMAGE_EXPORT_DIRECTORY exports;
@ -368,18 +368,18 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
void** functions = NULL; void** functions = NULL;
DWORD* names = NULL; DWORD* names = NULL;
unsigned int j; unsigned int j;
if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir.VirtualAddress), if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir.VirtualAddress),
&exports, sizeof(exports)) && &exports, sizeof(exports)) &&
((functions = DBG_alloc(sizeof(functions[0]) * exports.NumberOfFunctions))) && ((functions = DBG_alloc(sizeof(functions[0]) * exports.NumberOfFunctions))) &&
DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfFunctions), DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfFunctions),
functions, sizeof(functions[0]) * exports.NumberOfFunctions) && functions, sizeof(functions[0]) * exports.NumberOfFunctions) &&
((ordinals = DBG_alloc(sizeof(ordinals[0]) * exports.NumberOfNames))) && ((ordinals = DBG_alloc(sizeof(ordinals[0]) * exports.NumberOfNames))) &&
DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfNameOrdinals), DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfNameOrdinals),
ordinals, sizeof(ordinals[0]) * exports.NumberOfNames) && ordinals, sizeof(ordinals[0]) * exports.NumberOfNames) &&
((names = DBG_alloc(sizeof(names[0]) * exports.NumberOfNames))) && ((names = DBG_alloc(sizeof(names[0]) * exports.NumberOfNames))) &&
DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfNames), DEBUG_READ_MEM_VERBOSE((void*)(base + (DWORD)exports.AddressOfNames),
names, sizeof(names[0]) * exports.NumberOfNames)) { names, sizeof(names[0]) * exports.NumberOfNames)) {
@ -393,7 +393,7 @@ enum DbgInfoLoad DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
value.addr.off = base + (DWORD)functions[ordinals[i]]; value.addr.off = base + (DWORD)functions[ordinals[i]];
DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC); DEBUG_AddSymbol(buffer, &value, NULL, SYM_WIN32 | SYM_FUNC);
} }
for (i = 0; i < exports.NumberOfFunctions; i++) { for (i = 0; i < exports.NumberOfFunctions; i++) {
if (!functions[i]) continue; if (!functions[i]) continue;
/* Check if we already added it with a name */ /* Check if we already added it with a name */
@ -448,7 +448,7 @@ int DEBUG_LoadEntryPoints(const char* pfx)
rowcount = 3 + (pfx ? strlen(pfx) : 0); rowcount = 3 + (pfx ? strlen(pfx) : 0);
first = 1; first = 1;
} }
len = strlen(entry.szModule); len = strlen(entry.szModule);
if ((rowcount + len) > 76) { if ((rowcount + len) > 76) {
DEBUG_Printf(DBG_CHN_MESG, "\n "); DEBUG_Printf(DBG_CHN_MESG, "\n ");
@ -456,12 +456,12 @@ int DEBUG_LoadEntryPoints(const char* pfx)
} }
DEBUG_Printf(DBG_CHN_MESG, " %s", entry.szModule); DEBUG_Printf(DBG_CHN_MESG, " %s", entry.szModule);
rowcount += len + 1; rowcount += len + 1;
DEBUG_LoadModule16(entry.hModule, &module, moduleAddr, entry.szModule); DEBUG_LoadModule16(entry.hModule, &module, moduleAddr, entry.szModule);
} while (ModuleNext16(&entry)); } while (ModuleNext16(&entry));
#endif #endif
if (first) DEBUG_Printf(DBG_CHN_MESG, "\n"); if (first) DEBUG_Printf(DBG_CHN_MESG, "\n");
return first; return first;
} }
@ -470,23 +470,23 @@ void DEBUG_ReportDIL(enum DbgInfoLoad dil, const char* pfx, const char* filename
const char* fmt; const char* fmt;
switch (dil) { switch (dil) {
case DIL_DEFERRED: case DIL_DEFERRED:
fmt = "Deferring debug information loading for %s '%s' (0x%08x)\n"; fmt = "Deferring debug information loading for %s '%s' (0x%08x)\n";
break; break;
case DIL_LOADED: case DIL_LOADED:
fmt = "Loaded debug information from %s '%s' (0x%08x)\n"; fmt = "Loaded debug information from %s '%s' (0x%08x)\n";
break; break;
case DIL_NOINFO: case DIL_NOINFO:
fmt = "No debug information in %s '%s' (0x%08x)\n"; fmt = "No debug information in %s '%s' (0x%08x)\n";
break; break;
case DIL_ERROR: case DIL_ERROR:
fmt = "Can't find file for %s '%s' (0x%08x)\n"; fmt = "Can't find file for %s '%s' (0x%08x)\n";
break; break;
default: default:
DEBUG_Printf(DBG_CHN_ERR, "Oooocch (%d)\n", dil); DEBUG_Printf(DBG_CHN_ERR, "Oooocch (%d)\n", dil);
return; return;
} }
DEBUG_Printf(DBG_CHN_MESG, fmt, pfx, filename, load_addr); DEBUG_Printf(DBG_CHN_MESG, fmt, pfx, filename, load_addr);
} }
@ -496,7 +496,7 @@ static const char* DEBUG_GetModuleType(enum DbgModuleType type)
case DMT_NE: return "NE"; case DMT_NE: return "NE";
case DMT_PE: return "PE"; case DMT_PE: return "PE";
case DMT_ELF: return "ELF"; case DMT_ELF: return "ELF";
default: return "???";; default: return "???";
} }
} }
@ -519,7 +519,7 @@ static const char* DEBUG_GetDbgInfo(enum DbgInfoLoad dil)
*/ */
static int DEBUG_ModuleCompare(const void* p1, const void* p2) static int DEBUG_ModuleCompare(const void* p1, const void* p2)
{ {
return (*((const DBG_MODULE**)p1))->load_addr - return (*((const DBG_MODULE**)p1))->load_addr -
(*((const DBG_MODULE**)p2))->load_addr; (*((const DBG_MODULE**)p2))->load_addr;
} }
@ -528,22 +528,22 @@ static int DEBUG_ModuleCompare(const void* p1, const void* p2)
* *
* returns TRUE is wmod_child is contained (inside bounds) of wmod_cntnr * returns TRUE is wmod_child is contained (inside bounds) of wmod_cntnr
*/ */
static inline BOOL DEBUG_IsContainer(const DBG_MODULE* wmod_cntnr, static inline BOOL DEBUG_IsContainer(const DBG_MODULE* wmod_cntnr,
const DBG_MODULE* wmod_child) const DBG_MODULE* wmod_child)
{ {
return wmod_cntnr->load_addr < wmod_child->load_addr && return wmod_cntnr->load_addr < wmod_child->load_addr &&
(DWORD)wmod_cntnr->load_addr + wmod_cntnr->size > (DWORD)wmod_cntnr->load_addr + wmod_cntnr->size >
(DWORD)wmod_child->load_addr + wmod_child->size; (DWORD)wmod_child->load_addr + wmod_child->size;
} }
static void DEBUG_InfoShareModule(const DBG_MODULE* module, int ident) static void DEBUG_InfoShareModule(const DBG_MODULE* module, int ident)
{ {
if (ident) DEBUG_Printf(DBG_CHN_MESG, " \\-"); if (ident) DEBUG_Printf(DBG_CHN_MESG, " \\-");
DEBUG_Printf(DBG_CHN_MESG, "%s\t0x%08lx-%08lx\t%s\n", DEBUG_Printf(DBG_CHN_MESG, "%s\t0x%08lx-%08lx\t%s\n",
DEBUG_GetModuleType(module->type), DEBUG_GetModuleType(module->type),
(DWORD)module->load_addr, (DWORD)module->load_addr + module->size, (DWORD)module->load_addr, (DWORD)module->load_addr + module->size,
module->module_name); module->module_name);
} }
/*********************************************************************** /***********************************************************************
* DEBUG_InfoShare * DEBUG_InfoShare
@ -554,16 +554,16 @@ void DEBUG_InfoShare(void)
{ {
DBG_MODULE** ref; DBG_MODULE** ref;
int i, j; int i, j;
ref = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules); ref = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
if (!ref) return; if (!ref) return;
DEBUG_Printf(DBG_CHN_MESG, "Module\tAddress\t\t\tName\t%d modules\n", DEBUG_Printf(DBG_CHN_MESG, "Module\tAddress\t\t\tName\t%d modules\n",
DEBUG_CurrProcess->num_modules); DEBUG_CurrProcess->num_modules);
memcpy(ref, DEBUG_CurrProcess->modules, memcpy(ref, DEBUG_CurrProcess->modules,
sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules); sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
qsort(ref, DEBUG_CurrProcess->num_modules, sizeof(DBG_MODULE*), qsort(ref, DEBUG_CurrProcess->num_modules, sizeof(DBG_MODULE*),
DEBUG_ModuleCompare); DEBUG_ModuleCompare);
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) { for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
switch (ref[i]->type) { switch (ref[i]->type) {
@ -582,7 +582,7 @@ void DEBUG_InfoShare(void)
DEBUG_IsContainer(ref[j], ref[i])) DEBUG_IsContainer(ref[j], ref[i]))
break; break;
} }
if (j >= DEBUG_CurrProcess->num_modules) if (j >= DEBUG_CurrProcess->num_modules)
DEBUG_InfoShareModule(ref[i], 0); DEBUG_InfoShareModule(ref[i], 0);
break; break;
default: default:
@ -621,21 +621,21 @@ void DEBUG_WalkModules(void)
{ {
DBG_MODULE** amod; DBG_MODULE** amod;
int i; int i;
DEBUG_Printf(DBG_CHN_MESG, "Address\t\t\tModule\tName\n"); DEBUG_Printf(DBG_CHN_MESG, "Address\t\t\tModule\tName\n");
amod = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules); amod = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
if (!amod) return; if (!amod) return;
memcpy(amod, DEBUG_CurrProcess->modules, memcpy(amod, DEBUG_CurrProcess->modules,
sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules); sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
qsort(amod, DEBUG_CurrProcess->num_modules, sizeof(DBG_MODULE*), qsort(amod, DEBUG_CurrProcess->num_modules, sizeof(DBG_MODULE*),
DEBUG_ModuleCompare); DEBUG_ModuleCompare);
for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) { for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
if (amod[i]->type == DMT_ELF) continue; if (amod[i]->type == DMT_ELF) continue;
DEBUG_Printf(DBG_CHN_MESG, "0x%08lx-%08lx\t(%s)\t%s\n", DEBUG_Printf(DBG_CHN_MESG, "0x%08lx-%08lx\t(%s)\t%s\n",
(DWORD)amod[i]->load_addr, (DWORD)amod[i]->load_addr,
(DWORD)amod[i]->load_addr + amod[i]->size, (DWORD)amod[i]->load_addr + amod[i]->size,
DEBUG_GetModuleType(amod[i]->type), amod[i]->module_name); DEBUG_GetModuleType(amod[i]->type), amod[i]->module_name);
} }

View File

@ -74,7 +74,7 @@ static void DEBUG_LocateDebugInfoFile(const char *filename, char *dbg_filename)
char *str2 = DBG_alloc(MAX_PATHNAME_LEN*10); char *str2 = DBG_alloc(MAX_PATHNAME_LEN*10);
const char *file; const char *file;
char *name_part; char *name_part;
file = strrchr(filename, '\\'); file = strrchr(filename, '\\');
if( file == NULL ) file = filename; else file++; if( file == NULL ) file = filename; else file++;
@ -121,7 +121,7 @@ static void* DEBUG_MapDebugInfoFile(const char* name, DWORD offset, DWORD size,
if ((*hMap = CreateFileMapping(*hFile, NULL, PAGE_READONLY, 0, 0, NULL)) == 0) if ((*hMap = CreateFileMapping(*hFile, NULL, PAGE_READONLY, 0, 0, NULL)) == 0)
return NULL; return NULL;
if ((ret = MapViewOfFile(*hMap, FILE_MAP_READ, 0, g_offset, g_size)) != NULL) if ((ret = MapViewOfFile(*hMap, FILE_MAP_READ, 0, g_offset, g_size)) != NULL)
ret += offset - g_offset; ret += offset - g_offset;
@ -178,7 +178,7 @@ static const char* DEBUG_GetCoffName( PIMAGE_SYMBOL coff_sym, const char* coff_s
{ {
nampnt = coff_strtab + coff_sym->N.Name.Long; nampnt = coff_strtab + coff_sym->N.Name.Long;
} }
if( nampnt[0] == '_' ) if( nampnt[0] == '_' )
nampnt++; nampnt++;
return nampnt; return nampnt;
@ -193,7 +193,7 @@ static int DEBUG_AddCoffFile( struct CoffFileSet* coff_files, const char* filena
coff_files->nfiles_alloc += 10; coff_files->nfiles_alloc += 10;
coff_files->files = (struct CoffFile *) DBG_realloc(coff_files->files, coff_files->files = (struct CoffFile *) DBG_realloc(coff_files->files,
coff_files->nfiles_alloc * sizeof(struct CoffFile)); coff_files->nfiles_alloc * sizeof(struct CoffFile));
} }
file = coff_files->files + coff_files->nfiles; file = coff_files->files + coff_files->nfiles;
file->startaddr = 0xffffffff; file->startaddr = 0xffffffff;
file->endaddr = 0; file->endaddr = 0;
@ -202,7 +202,7 @@ static int DEBUG_AddCoffFile( struct CoffFileSet* coff_files, const char* filena
file->linecnt = 0; file->linecnt = 0;
file->entries = NULL; file->entries = NULL;
file->neps = file->neps_alloc = 0; file->neps = file->neps_alloc = 0;
return coff_files->nfiles++; return coff_files->nfiles++;
} }
@ -211,8 +211,8 @@ static void DEBUG_AddCoffSymbol( struct CoffFile* coff_file, struct name_hash* s
if( coff_file->neps + 1 >= coff_file->neps_alloc ) if( coff_file->neps + 1 >= coff_file->neps_alloc )
{ {
coff_file->neps_alloc += 10; coff_file->neps_alloc += 10;
coff_file->entries = (struct name_hash **) coff_file->entries = (struct name_hash **)
DBG_realloc(coff_file->entries, DBG_realloc(coff_file->entries,
coff_file->neps_alloc * sizeof(struct name_hash *)); coff_file->neps_alloc * sizeof(struct name_hash *));
} }
coff_file->entries[coff_file->neps++] = sym; coff_file->entries[coff_file->neps++] = sym;
@ -246,7 +246,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
coff_files.files = NULL; coff_files.files = NULL;
coff_files.nfiles = coff_files.nfiles_alloc = 0; coff_files.nfiles = coff_files.nfiles_alloc = 0;
coff = (PIMAGE_COFF_SYMBOLS_HEADER) root; coff = (PIMAGE_COFF_SYMBOLS_HEADER) root;
coff_symbols = (PIMAGE_SYMBOL) ((unsigned int) coff + coff->LvaToFirstSymbol); coff_symbols = (PIMAGE_SYMBOL) ((unsigned int) coff + coff->LvaToFirstSymbol);
@ -305,7 +305,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
aux->Section.NumberOfLinenumbers, aux->Section.NumberOfLinenumbers,
aux->Section.Number, aux->Section.Number,
aux->Section.Selection); aux->Section.Selection);
DEBUG_Printf(DBG_CHN_TRACE, "More sect %d %s %08lx %d %d %d\n", DEBUG_Printf(DBG_CHN_TRACE, "More sect %d %s %08lx %d %d %d\n",
coff_sym->SectionNumber, coff_sym->SectionNumber,
DEBUG_GetCoffName( coff_sym, coff_strtab ), DEBUG_GetCoffName( coff_sym, coff_strtab ),
coff_sym->Value, coff_sym->Value,
@ -337,12 +337,12 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
{ {
coff_files.files[curr_file_idx].startaddr = coff_sym->Value; coff_files.files[curr_file_idx].startaddr = coff_sym->Value;
} }
if( coff_files.files[curr_file_idx].endaddr < coff_sym->Value + aux->Section.Length ) if( coff_files.files[curr_file_idx].endaddr < coff_sym->Value + aux->Section.Length )
{ {
coff_files.files[curr_file_idx].endaddr = coff_sym->Value + aux->Section.Length; coff_files.files[curr_file_idx].endaddr = coff_sym->Value + aux->Section.Length;
} }
coff_files.files[curr_file_idx].linetab_offset = linetab_indx; coff_files.files[curr_file_idx].linetab_offset = linetab_indx;
coff_files.files[curr_file_idx].linecnt = aux->Section.NumberOfLinenumbers; coff_files.files[curr_file_idx].linecnt = aux->Section.NumberOfLinenumbers;
linetab_indx += aux->Section.NumberOfLinenumbers; linetab_indx += aux->Section.NumberOfLinenumbers;
@ -370,9 +370,9 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
#endif #endif
/* FIXME: was adding symbol to this_file ??? */ /* FIXME: was adding symbol to this_file ??? */
DEBUG_AddCoffSymbol( &coff_files.files[curr_file_idx], DEBUG_AddCoffSymbol( &coff_files.files[curr_file_idx],
DEBUG_AddSymbol( nampnt, &new_value, DEBUG_AddSymbol( nampnt, &new_value,
coff_files.files[curr_file_idx].filename, coff_files.files[curr_file_idx].filename,
SYM_WIN32 | SYM_FUNC ) ); SYM_WIN32 | SYM_FUNC ) );
i += naux; i += naux;
continue; continue;
@ -392,7 +392,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
#ifdef MORE_DBG #ifdef MORE_DBG
DEBUG_Printf(DBG_CHN_TRACE, "%d: %lx %s\n", i, new_value.addr.off, nampnt); DEBUG_Printf(DBG_CHN_TRACE, "%d: %lx %s\n", i, new_value.addr.off, nampnt);
DEBUG_Printf(DBG_CHN_TRACE,"\tAdding global symbol %s (sect=%s)\n", DEBUG_Printf(DBG_CHN_TRACE,"\tAdding global symbol %s (sect=%s)\n",
nampnt, MSC_INFO(module)->sectp[coff_sym->SectionNumber - 1].Name); nampnt, MSC_INFO(module)->sectp[coff_sym->SectionNumber - 1].Name);
#endif #endif
@ -409,7 +409,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
} }
} }
if (j < coff_files.nfiles) { if (j < coff_files.nfiles) {
DEBUG_AddCoffSymbol( &coff_files.files[j], DEBUG_AddCoffSymbol( &coff_files.files[j],
DEBUG_AddSymbol( nampnt, &new_value, this_file, SYM_WIN32 | SYM_FUNC ) ); DEBUG_AddSymbol( nampnt, &new_value, this_file, SYM_WIN32 | SYM_FUNC ) );
} else { } else {
DEBUG_AddSymbol( nampnt, &new_value, NULL, SYM_WIN32 | SYM_FUNC ); DEBUG_AddSymbol( nampnt, &new_value, NULL, SYM_WIN32 | SYM_FUNC );
@ -444,7 +444,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
i += naux; i += naux;
continue; continue;
} }
if( (coff_sym->StorageClass == IMAGE_SYM_CLASS_STATIC) if( (coff_sym->StorageClass == IMAGE_SYM_CLASS_STATIC)
&& (naux == 0) ) && (naux == 0) )
{ {
@ -457,7 +457,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
} }
#ifdef MORE_DBG #ifdef MORE_DBG
DEBUG_Printf(DBG_CHN_TRACE,"Skipping unknown entry '%s' %d %d %d\n", DEBUG_Printf(DBG_CHN_TRACE,"Skipping unknown entry '%s' %d %d %d\n",
DEBUG_GetCoffName( coff_sym, coff_strtab ), DEBUG_GetCoffName( coff_sym, coff_strtab ),
coff_sym->StorageClass, coff_sym->SectionNumber, naux); coff_sym->StorageClass, coff_sym->SectionNumber, naux);
#endif #endif
@ -466,9 +466,9 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
* For now, skip past the aux entries. * For now, skip past the aux entries.
*/ */
i += naux; i += naux;
} }
/* /*
* OK, we now should have a list of files, and we should have a list * OK, we now should have a list of files, and we should have a list
* of entrypoints. We need to sort the entrypoints so that we are * of entrypoints. We need to sort the entrypoints so that we are
@ -518,10 +518,10 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
* first. * first.
*/ */
DEBUG_GetSymbolAddr(coff_files.files[j].entries[l], &new_value.addr); DEBUG_GetSymbolAddr(coff_files.files[j].entries[l], &new_value.addr);
DEBUG_AddLineNumber(coff_files.files[j].entries[l], DEBUG_AddLineNumber(coff_files.files[j].entries[l],
linepnt->Linenumber, linepnt->Linenumber,
(unsigned int) module->load_addr (unsigned int) module->load_addr
+ linepnt->Type.VirtualAddress + linepnt->Type.VirtualAddress
- new_value.addr.off); - new_value.addr.off);
} }
} }
@ -1164,7 +1164,7 @@ numeric_leaf( int *value, unsigned short int *leaf )
*value = type; *value = type;
} }
else else
{ {
switch ( type ) switch ( type )
{ {
case LF_CHAR: case LF_CHAR:
@ -1275,7 +1275,7 @@ terminate_string( unsigned char *name )
return symname; return symname;
} }
static static
struct datatype * DEBUG_GetCVType(unsigned int typeno) struct datatype * DEBUG_GetCVType(unsigned int typeno)
{ {
struct datatype * dt = NULL; struct datatype * dt = NULL;
@ -1305,7 +1305,7 @@ DEBUG_AddCVType( unsigned int typeno, struct datatype *dt )
while ( typeno - 0x1000 >= num_cv_defined_types ) while ( typeno - 0x1000 >= num_cv_defined_types )
{ {
num_cv_defined_types += 0x100; num_cv_defined_types += 0x100;
cv_defined_types = (struct datatype **) cv_defined_types = (struct datatype **)
DBG_realloc( cv_defined_types, DBG_realloc( cv_defined_types,
num_cv_defined_types * sizeof(struct datatype *) ); num_cv_defined_types * sizeof(struct datatype *) );
@ -1334,12 +1334,12 @@ DEBUG_ClearTypeTable( void )
static int static int
DEBUG_AddCVType_Pointer( unsigned int typeno, unsigned int datatype ) DEBUG_AddCVType_Pointer( unsigned int typeno, unsigned int datatype )
{ {
struct datatype *dt = struct datatype *dt =
DEBUG_FindOrMakePointerType( DEBUG_GetCVType( datatype ) ); DEBUG_FindOrMakePointerType( DEBUG_GetCVType( datatype ) );
return DEBUG_AddCVType( typeno, dt ); return DEBUG_AddCVType( typeno, dt );
} }
static int static int
DEBUG_AddCVType_Array( unsigned int typeno, char *name, DEBUG_AddCVType_Array( unsigned int typeno, char *name,
unsigned int elemtype, unsigned int arr_len ) unsigned int elemtype, unsigned int arr_len )
@ -1351,10 +1351,10 @@ DEBUG_AddCVType_Array( unsigned int typeno, char *name,
DEBUG_SetArrayParams( dt, 0, arr_max, elem ); DEBUG_SetArrayParams( dt, 0, arr_max, elem );
return DEBUG_AddCVType( typeno, dt ); return DEBUG_AddCVType( typeno, dt );
} }
static int static int
DEBUG_AddCVType_Bitfield( unsigned int typeno, DEBUG_AddCVType_Bitfield( unsigned int typeno,
unsigned int bitoff, unsigned int nbits, unsigned int bitoff, unsigned int nbits,
unsigned int basetype ) unsigned int basetype )
{ {
@ -1364,7 +1364,7 @@ DEBUG_AddCVType_Bitfield( unsigned int typeno,
DEBUG_SetBitfieldParams( dt, bitoff, nbits, base ); DEBUG_SetBitfieldParams( dt, bitoff, nbits, base );
return DEBUG_AddCVType( typeno, dt ); return DEBUG_AddCVType( typeno, dt );
} }
static int static int
DEBUG_AddCVType_EnumFieldList( unsigned int typeno, unsigned char *list, int len ) DEBUG_AddCVType_EnumFieldList( unsigned int typeno, unsigned char *list, int len )
{ {
@ -1388,7 +1388,7 @@ DEBUG_AddCVType_EnumFieldList( unsigned int typeno, unsigned char *list, int len
int value, vlen = numeric_leaf( &value, &type->enumerate.value ); int value, vlen = numeric_leaf( &value, &type->enumerate.value );
unsigned char *name = (unsigned char *)&type->enumerate.value + vlen; unsigned char *name = (unsigned char *)&type->enumerate.value + vlen;
DEBUG_AddStructElement( dt, terminate_string( name ), DEBUG_AddStructElement( dt, terminate_string( name ),
NULL, value, 0 ); NULL, value, 0 );
ptr += 2 + 2 + vlen + (1 + name[0]); ptr += 2 + 2 + vlen + (1 + name[0]);
@ -1404,7 +1404,7 @@ DEBUG_AddCVType_EnumFieldList( unsigned int typeno, unsigned char *list, int len
return DEBUG_AddCVType( typeno, dt ); return DEBUG_AddCVType( typeno, dt );
} }
static int static int
DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int len ) DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int len )
{ {
@ -1477,7 +1477,7 @@ DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int l
struct datatype *subtype = DEBUG_GetCVType( type->member.type ); struct datatype *subtype = DEBUG_GetCVType( type->member.type );
int elem_size = subtype? DEBUG_GetObjectSize( subtype ) : 0; int elem_size = subtype? DEBUG_GetObjectSize( subtype ) : 0;
DEBUG_AddStructElement( dt, terminate_string( name ), DEBUG_AddStructElement( dt, terminate_string( name ),
subtype, offset << 3, elem_size << 3 ); subtype, offset << 3, elem_size << 3 );
ptr += 2 + 2 + 2 + olen + (1 + name[0]); ptr += 2 + 2 + 2 + olen + (1 + name[0]);
@ -1492,7 +1492,7 @@ DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int l
struct datatype *subtype = DEBUG_GetCVType( type->member32.type ); struct datatype *subtype = DEBUG_GetCVType( type->member32.type );
int elem_size = subtype? DEBUG_GetObjectSize( subtype ) : 0; int elem_size = subtype? DEBUG_GetObjectSize( subtype ) : 0;
DEBUG_AddStructElement( dt, terminate_string( name ), DEBUG_AddStructElement( dt, terminate_string( name ),
subtype, offset << 3, elem_size << 3 ); subtype, offset << 3, elem_size << 3 );
ptr += 2 + 2 + 4 + olen + (1 + name[0]); ptr += 2 + 2 + 4 + olen + (1 + name[0]);
@ -1533,7 +1533,7 @@ DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int l
/* FIXME: ignored for now */ /* FIXME: ignored for now */
ptr += 2 + 2; ptr += 2 + 2;
break; break;
case LF_VFUNCTAB_32: case LF_VFUNCTAB_32:
/* FIXME: ignored for now */ /* FIXME: ignored for now */
ptr += 2 + 2 + 4; ptr += 2 + 2 + 4;
@ -1560,7 +1560,7 @@ DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int l
case 4: case 6: /* (pure) introducing virtual method */ case 4: case 6: /* (pure) introducing virtual method */
ptr += 2 + 2 + 4 + 4 + (1 + type->onemethod32_virt.name[0]); ptr += 2 + 2 + 4 + 4 + (1 + type->onemethod32_virt.name[0]);
break; break;
default: default:
ptr += 2 + 2 + 4 + (1 + type->onemethod32.name[0]); ptr += 2 + 2 + 4 + (1 + type->onemethod32.name[0]);
break; break;
@ -1576,7 +1576,7 @@ DEBUG_AddCVType_StructFieldList( unsigned int typeno, unsigned char *list, int l
return DEBUG_AddCVType( typeno, dt ); return DEBUG_AddCVType( typeno, dt );
} }
static int static int
DEBUG_AddCVType_Enum( unsigned int typeno, char *name, unsigned int fieldlist ) DEBUG_AddCVType_Enum( unsigned int typeno, char *name, unsigned int fieldlist )
{ {
@ -1646,12 +1646,12 @@ DEBUG_ParseTypeTable( char *table, int len )
} }
case LF_BITFIELD: case LF_BITFIELD:
retv = DEBUG_AddCVType_Bitfield( curr_type, type->bitfield.bitoff, retv = DEBUG_AddCVType_Bitfield( curr_type, type->bitfield.bitoff,
type->bitfield.nbits, type->bitfield.nbits,
type->bitfield.type ); type->bitfield.type );
break; break;
case LF_BITFIELD_32: case LF_BITFIELD_32:
retv = DEBUG_AddCVType_Bitfield( curr_type, type->bitfield32.bitoff, retv = DEBUG_AddCVType_Bitfield( curr_type, type->bitfield32.bitoff,
type->bitfield32.nbits, type->bitfield32.nbits,
type->bitfield32.type ); type->bitfield32.type );
break; break;
@ -1742,7 +1742,7 @@ DEBUG_ParseTypeTable( char *table, int len )
curr_type++; curr_type++;
ptr += type->generic.len + 2; ptr += type->generic.len + 2;
} }
return TRUE; return TRUE;
} }
@ -1819,7 +1819,7 @@ DEBUG_SnarfLinetab(char * linetab,
* There is one header for each segment, so that we can reach in * There is one header for each segment, so that we can reach in
* and pull bits as required. * and pull bits as required.
*/ */
lt_hdr = (struct codeview_linetab_hdr *) lt_hdr = (struct codeview_linetab_hdr *)
DBG_alloc((nseg + 1) * sizeof(*lt_hdr)); DBG_alloc((nseg + 1) * sizeof(*lt_hdr));
if( lt_hdr == NULL ) if( lt_hdr == NULL )
{ {
@ -1865,7 +1865,7 @@ DEBUG_SnarfLinetab(char * linetab,
lt_hdr[this_seg].segno = *pnt2.s++; lt_hdr[this_seg].segno = *pnt2.s++;
lt_hdr[this_seg].nline = *pnt2.s++; lt_hdr[this_seg].nline = *pnt2.s++;
lt_hdr[this_seg].offtab = pnt2.ui; lt_hdr[this_seg].offtab = pnt2.ui;
lt_hdr[this_seg].linetab = (unsigned short *) lt_hdr[this_seg].linetab = (unsigned short *)
(pnt2.ui + lt_hdr[this_seg].nline); (pnt2.ui + lt_hdr[this_seg].nline);
} }
} }
@ -2039,7 +2039,7 @@ union codeview_symbol
static unsigned int static unsigned int
DEBUG_MapCVOffset( DBG_MODULE *module, unsigned int offset ) DEBUG_MapCVOffset( DBG_MODULE *module, unsigned int offset )
{ {
int nomap = module->msc_info->nomap; int nomap = module->msc_info->nomap;
@ -2060,7 +2060,7 @@ DEBUG_MapCVOffset( DBG_MODULE *module, unsigned int offset )
static struct name_hash * static struct name_hash *
DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen, DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen,
int type, unsigned int seg, unsigned int offset, int type, unsigned int seg, unsigned int offset,
int size, int cookie, int flags, int size, int cookie, int flags,
struct codeview_linetab_hdr *linetab ) struct codeview_linetab_hdr *linetab )
{ {
int nsect = module->msc_info->nsect; int nsect = module->msc_info->nsect;
@ -2074,7 +2074,7 @@ DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen,
* Some sanity checks * Some sanity checks
*/ */
if ( !name || !namelen ) if ( !name || !namelen )
return NULL; return NULL;
if ( !seg || seg > nsect ) if ( !seg || seg > nsect )
@ -2087,7 +2087,7 @@ DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen,
value.cookie = cookie; value.cookie = cookie;
value.addr.seg = 0; value.addr.seg = 0;
value.addr.off = (unsigned int) module->load_addr + value.addr.off = (unsigned int) module->load_addr +
DEBUG_MapCVOffset( module, sectp[seg-1].VirtualAddress + offset ); DEBUG_MapCVOffset( module, sectp[seg-1].VirtualAddress + offset );
memcpy( symname, name, namelen ); memcpy( symname, name, namelen );
@ -2112,8 +2112,8 @@ DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen,
/* /*
* Create Wine symbol record * Create Wine symbol record
*/ */
symbol = DEBUG_AddSymbol( symname, &value, symbol = DEBUG_AddSymbol( symname, &value,
linetab? linetab->sourcefile : NULL, flags ); linetab? linetab->sourcefile : NULL, flags );
if ( size ) if ( size )
@ -2181,7 +2181,7 @@ DEBUG_SnarfCodeView( DBG_MODULE *module, LPBYTE root, int offset, int size,
case S_LDATA: case S_LDATA:
case S_PUB: case S_PUB:
DEBUG_AddCVSymbol( module, sym->data.name, sym->data.namelen, DEBUG_AddCVSymbol( module, sym->data.name, sym->data.namelen,
sym->data.symtype, sym->data.seg, sym->data.symtype, sym->data.seg,
sym->data.offset, 0, sym->data.offset, 0,
DV_TARGET, SYM_WIN32 | SYM_DATA, NULL ); DV_TARGET, SYM_WIN32 | SYM_DATA, NULL );
break; break;
@ -2189,7 +2189,7 @@ DEBUG_SnarfCodeView( DBG_MODULE *module, LPBYTE root, int offset, int size,
case S_LDATA_32: case S_LDATA_32:
case S_PUB_32: case S_PUB_32:
DEBUG_AddCVSymbol( module, sym->data32.name, sym->data32.namelen, DEBUG_AddCVSymbol( module, sym->data32.name, sym->data32.namelen,
sym->data32.symtype, sym->data32.seg, sym->data32.symtype, sym->data32.seg,
sym->data32.offset, 0, sym->data32.offset, 0,
DV_TARGET, SYM_WIN32 | SYM_DATA, NULL ); DV_TARGET, SYM_WIN32 | SYM_DATA, NULL );
break; break;
@ -2201,7 +2201,7 @@ DEBUG_SnarfCodeView( DBG_MODULE *module, LPBYTE root, int offset, int size,
*/ */
case S_THUNK: case S_THUNK:
DEBUG_AddCVSymbol( module, sym->thunk.name, sym->thunk.namelen, DEBUG_AddCVSymbol( module, sym->thunk.name, sym->thunk.namelen,
0, sym->thunk.segment, 0, sym->thunk.segment,
sym->thunk.offset, sym->thunk.thunk_len, sym->thunk.offset, sym->thunk.thunk_len,
DV_TARGET, SYM_WIN32 | SYM_FUNC, NULL ); DV_TARGET, SYM_WIN32 | SYM_FUNC, NULL );
break; break;
@ -2214,7 +2214,7 @@ DEBUG_SnarfCodeView( DBG_MODULE *module, LPBYTE root, int offset, int size,
DEBUG_Normalize( curr_func ); DEBUG_Normalize( curr_func );
curr_func = DEBUG_AddCVSymbol( module, sym->proc.name, sym->proc.namelen, curr_func = DEBUG_AddCVSymbol( module, sym->proc.name, sym->proc.namelen,
sym->proc.proctype, sym->proc.segment, sym->proc.proctype, sym->proc.segment,
sym->proc.offset, sym->proc.proc_len, sym->proc.offset, sym->proc.proc_len,
DV_TARGET, SYM_WIN32 | SYM_FUNC, linetab ); DV_TARGET, SYM_WIN32 | SYM_FUNC, linetab );
@ -2225,7 +2225,7 @@ DEBUG_SnarfCodeView( DBG_MODULE *module, LPBYTE root, int offset, int size,
DEBUG_Normalize( curr_func ); DEBUG_Normalize( curr_func );
curr_func = DEBUG_AddCVSymbol( module, sym->proc32.name, sym->proc32.namelen, curr_func = DEBUG_AddCVSymbol( module, sym->proc32.name, sym->proc32.namelen,
sym->proc32.proctype, sym->proc32.segment, sym->proc32.proctype, sym->proc32.segment,
sym->proc32.offset, sym->proc32.proc_len, sym->proc32.offset, sym->proc32.proc_len,
DV_TARGET, SYM_WIN32 | SYM_FUNC, linetab ); DV_TARGET, SYM_WIN32 | SYM_FUNC, linetab );
@ -2250,7 +2250,7 @@ DEBUG_SnarfCodeView( DBG_MODULE *module, LPBYTE root, int offset, int size,
* These are special, in that they are always followed by an * These are special, in that they are always followed by an
* additional length-prefixed string which is *not* included * additional length-prefixed string which is *not* included
* into the symbol length count. We need to skip it. * into the symbol length count. We need to skip it.
*/ */
case S_PROCREF: case S_PROCREF:
case S_DATAREF: case S_DATAREF:
case S_LPROCREF: case S_LPROCREF:
@ -2511,7 +2511,7 @@ static void pdb_convert_types_header( PDB_TYPES *types, char *image )
} }
} }
static void pdb_convert_symbols_header( PDB_SYMBOLS *symbols, static void pdb_convert_symbols_header( PDB_SYMBOLS *symbols,
int *header_size, char *image ) int *header_size, char *image )
{ {
memset( symbols, 0, sizeof(PDB_SYMBOLS) ); memset( symbols, 0, sizeof(PDB_SYMBOLS) );
@ -2542,7 +2542,7 @@ static void pdb_convert_symbols_header( PDB_SYMBOLS *symbols,
} }
} }
static enum DbgInfoLoad DEBUG_ProcessPDBFile( DBG_MODULE *module, static enum DbgInfoLoad DEBUG_ProcessPDBFile( DBG_MODULE *module,
const char *filename, DWORD timestamp ) const char *filename, DWORD timestamp )
{ {
enum DbgInfoLoad dil = DIL_ERROR; enum DbgInfoLoad dil = DIL_ERROR;
@ -2619,7 +2619,7 @@ static enum DbgInfoLoad DEBUG_ProcessPDBFile( DBG_MODULE *module,
} }
/* /*
* Check .PDB time stamp * Check .PDB time stamp
*/ */
@ -2629,23 +2629,23 @@ static enum DbgInfoLoad DEBUG_ProcessPDBFile( DBG_MODULE *module,
filename, root->TimeDateStamp, timestamp ); filename, root->TimeDateStamp, timestamp );
} }
/* /*
* Read type table * Read type table
*/ */
DEBUG_ParseTypeTable( types_image + types.type_offset, types.type_size ); DEBUG_ParseTypeTable( types_image + types.type_offset, types.type_size );
/* /*
* Read type-server .PDB imports * Read type-server .PDB imports
*/ */
if ( symbols.pdbimport_size ) if ( symbols.pdbimport_size )
{ {
/* FIXME */ /* FIXME */
DEBUG_Printf(DBG_CHN_ERR, "-Type server .PDB imports ignored!\n" ); DEBUG_Printf(DBG_CHN_ERR, "-Type server .PDB imports ignored!\n" );
} }
/* /*
* Read global symbol table * Read global symbol table
*/ */
@ -2704,10 +2704,10 @@ static enum DbgInfoLoad DEBUG_ProcessPDBFile( DBG_MODULE *module,
file_name += strlen(file_name) + 1; file_name += strlen(file_name) + 1;
file = (char *)( (DWORD)(file_name + strlen(file_name) + 1 + 3) & ~3 ); file = (char *)( (DWORD)(file_name + strlen(file_name) + 1 + 3) & ~3 );
} }
dil = DIL_LOADED; dil = DIL_LOADED;
leave: leave:
/* /*
* Cleanup * Cleanup
@ -2735,22 +2735,22 @@ static enum DbgInfoLoad DEBUG_ProcessPDBFile( DBG_MODULE *module,
#define CODEVIEW_NB09_SIG ( 'N' | ('B' << 8) | ('0' << 16) | ('9' << 24) ) #define CODEVIEW_NB09_SIG ( 'N' | ('B' << 8) | ('0' << 16) | ('9' << 24) )
#define CODEVIEW_NB10_SIG ( 'N' | ('B' << 8) | ('1' << 16) | ('0' << 24) ) #define CODEVIEW_NB10_SIG ( 'N' | ('B' << 8) | ('1' << 16) | ('0' << 24) )
#define CODEVIEW_NB11_SIG ( 'N' | ('B' << 8) | ('1' << 16) | ('1' << 24) ) #define CODEVIEW_NB11_SIG ( 'N' | ('B' << 8) | ('1' << 16) | ('1' << 24) )
typedef struct _CODEVIEW_HEADER typedef struct _CODEVIEW_HEADER
{ {
DWORD dwSignature; DWORD dwSignature;
DWORD lfoDirectory; DWORD lfoDirectory;
} CODEVIEW_HEADER, *PCODEVIEW_HEADER; } CODEVIEW_HEADER, *PCODEVIEW_HEADER;
typedef struct _CODEVIEW_PDB_DATA typedef struct _CODEVIEW_PDB_DATA
{ {
DWORD timestamp; DWORD timestamp;
DWORD unknown; DWORD unknown;
CHAR name[ 1 ]; CHAR name[ 1 ];
} CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA; } CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA;
typedef struct _CV_DIRECTORY_HEADER typedef struct _CV_DIRECTORY_HEADER
{ {
WORD cbDirHeader; WORD cbDirHeader;
@ -2758,16 +2758,16 @@ typedef struct _CV_DIRECTORY_HEADER
DWORD cDir; DWORD cDir;
DWORD lfoNextDir; DWORD lfoNextDir;
DWORD flags; DWORD flags;
} CV_DIRECTORY_HEADER, *PCV_DIRECTORY_HEADER; } CV_DIRECTORY_HEADER, *PCV_DIRECTORY_HEADER;
typedef struct _CV_DIRECTORY_ENTRY typedef struct _CV_DIRECTORY_ENTRY
{ {
WORD subsection; WORD subsection;
WORD iMod; WORD iMod;
DWORD lfo; DWORD lfo;
DWORD cb; DWORD cb;
} CV_DIRECTORY_ENTRY, *PCV_DIRECTORY_ENTRY; } CV_DIRECTORY_ENTRY, *PCV_DIRECTORY_ENTRY;
@ -2779,7 +2779,7 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
{ {
PCODEVIEW_HEADER cv = (PCODEVIEW_HEADER)root; PCODEVIEW_HEADER cv = (PCODEVIEW_HEADER)root;
enum DbgInfoLoad dil = DIL_ERROR; enum DbgInfoLoad dil = DIL_ERROR;
switch ( cv->dwSignature ) switch ( cv->dwSignature )
{ {
case CODEVIEW_NB09_SIG: case CODEVIEW_NB09_SIG:
@ -2792,16 +2792,16 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
ent = (PCV_DIRECTORY_ENTRY)((LPBYTE)hdr + hdr->cbDirHeader); ent = (PCV_DIRECTORY_ENTRY)((LPBYTE)hdr + hdr->cbDirHeader);
for ( i = 0; i < hdr->cDir; i++, ent = next ) for ( i = 0; i < hdr->cDir; i++, ent = next )
{ {
next = (i == hdr->cDir-1)? NULL : next = (i == hdr->cDir-1)? NULL :
(PCV_DIRECTORY_ENTRY)((LPBYTE)ent + hdr->cbDirEntry); (PCV_DIRECTORY_ENTRY)((LPBYTE)ent + hdr->cbDirEntry);
prev = (i == 0)? NULL : prev = (i == 0)? NULL :
(PCV_DIRECTORY_ENTRY)((LPBYTE)ent - hdr->cbDirEntry); (PCV_DIRECTORY_ENTRY)((LPBYTE)ent - hdr->cbDirEntry);
if ( ent->subsection == sstAlignSym ) if ( ent->subsection == sstAlignSym )
{ {
/* /*
* Check the next and previous entry. If either is a * Check the next and previous entry. If either is a
* sstSrcModule, it contains the line number info for * sstSrcModule, it contains the line number info for
* this file. * this file.
* *
* FIXME: This is not a general solution! * FIXME: This is not a general solution!
@ -2815,7 +2815,7 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
if ( prev && prev->iMod == ent->iMod if ( prev && prev->iMod == ent->iMod
&& prev->subsection == sstSrcModule ) && prev->subsection == sstSrcModule )
linetab = DEBUG_SnarfLinetab( root + prev->lfo, prev->cb ); linetab = DEBUG_SnarfLinetab( root + prev->lfo, prev->cb );
DEBUG_SnarfCodeView( module, root + ent->lfo, sizeof(DWORD), DEBUG_SnarfCodeView( module, root + ent->lfo, sizeof(DWORD),
ent->cb, linetab ); ent->cb, linetab );
@ -2825,7 +2825,7 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
dil = DIL_LOADED; dil = DIL_LOADED;
break; break;
} }
case CODEVIEW_NB10_SIG: case CODEVIEW_NB10_SIG:
{ {
PCODEVIEW_PDB_DATA pdb = (PCODEVIEW_PDB_DATA)(cv + 1); PCODEVIEW_PDB_DATA pdb = (PCODEVIEW_PDB_DATA)(cv + 1);
@ -2833,9 +2833,9 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
dil = DEBUG_ProcessPDBFile( module, pdb->name, pdb->timestamp ); dil = DEBUG_ProcessPDBFile( module, pdb->name, pdb->timestamp );
break; break;
} }
default: default:
DEBUG_Printf( DBG_CHN_ERR, "Unknown CODEVIEW signature %08lX in module %s\n", DEBUG_Printf( DBG_CHN_ERR, "Unknown CODEVIEW signature %08lX in module %s\n",
cv->dwSignature, module->module_name ); cv->dwSignature, module->module_name );
break; break;
} }
@ -2847,9 +2847,9 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
/*======================================================================== /*========================================================================
* Process debug directory. * Process debug directory.
*/ */
static enum DbgInfoLoad DEBUG_ProcessDebugDirectory( DBG_MODULE *module, static enum DbgInfoLoad DEBUG_ProcessDebugDirectory( DBG_MODULE *module,
LPBYTE file_map, LPBYTE file_map,
PIMAGE_DEBUG_DIRECTORY dbg, PIMAGE_DEBUG_DIRECTORY dbg,
int nDbg ) int nDbg )
{ {
enum DbgInfoLoad dil = DIL_ERROR; enum DbgInfoLoad dil = DIL_ERROR;
@ -2916,14 +2916,14 @@ typedef struct _FPO_DATA {
/*======================================================================== /*========================================================================
* Process DBG file. * Process DBG file.
*/ */
static enum DbgInfoLoad DEBUG_ProcessDBGFile( DBG_MODULE *module, static enum DbgInfoLoad DEBUG_ProcessDBGFile( DBG_MODULE *module,
const char *filename, DWORD timestamp ) const char *filename, DWORD timestamp )
{ {
enum DbgInfoLoad dil = DIL_ERROR; enum DbgInfoLoad dil = DIL_ERROR;
HANDLE hFile = INVALID_HANDLE_VALUE, hMap = 0; HANDLE hFile = INVALID_HANDLE_VALUE, hMap = 0;
LPBYTE file_map = NULL; LPBYTE file_map = NULL;
PIMAGE_SEPARATE_DEBUG_HEADER hdr; PIMAGE_SEPARATE_DEBUG_HEADER hdr;
PIMAGE_DEBUG_DIRECTORY dbg; PIMAGE_DEBUG_DIRECTORY dbg;
int nDbg; int nDbg;
@ -2950,8 +2950,8 @@ static enum DbgInfoLoad DEBUG_ProcessDBGFile( DBG_MODULE *module,
} }
dbg = (PIMAGE_DEBUG_DIRECTORY) ( file_map + sizeof(*hdr) dbg = (PIMAGE_DEBUG_DIRECTORY) ( file_map + sizeof(*hdr)
+ hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) + hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER)
+ hdr->ExportedNamesSize ); + hdr->ExportedNamesSize );
nDbg = hdr->DebugDirectorySize / sizeof(*dbg); nDbg = hdr->DebugDirectorySize / sizeof(*dbg);
@ -2968,7 +2968,7 @@ static enum DbgInfoLoad DEBUG_ProcessDBGFile( DBG_MODULE *module,
/*======================================================================== /*========================================================================
* Process MSC debug information in PE file. * Process MSC debug information in PE file.
*/ */
enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile, enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
void *_nth, unsigned long nth_ofs ) void *_nth, unsigned long nth_ofs )
{ {
enum DbgInfoLoad dil = DIL_ERROR; enum DbgInfoLoad dil = DIL_ERROR;
@ -2989,7 +2989,7 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
if ( !extra_info.sectp ) if ( !extra_info.sectp )
goto leave; goto leave;
if ( !DEBUG_READ_MEM_VERBOSE( (char *)module->load_addr + if ( !DEBUG_READ_MEM_VERBOSE( (char *)module->load_addr +
nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) + nth_ofs + OFFSET_OF(IMAGE_NT_HEADERS, OptionalHeader) +
nth->FileHeader.SizeOfOptionalHeader, nth->FileHeader.SizeOfOptionalHeader,
extra_info.sectp, extra_info.sectp,
@ -2999,14 +2999,14 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
/* Read in debug directory */ /* Read in debug directory */
nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY); nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY);
if ( !nDbg ) if ( !nDbg )
goto leave; goto leave;
dbg = (PIMAGE_DEBUG_DIRECTORY) DBG_alloc( nDbg * sizeof(IMAGE_DEBUG_DIRECTORY) ); dbg = (PIMAGE_DEBUG_DIRECTORY) DBG_alloc( nDbg * sizeof(IMAGE_DEBUG_DIRECTORY) );
if ( !dbg ) if ( !dbg )
goto leave; goto leave;
if ( !DEBUG_READ_MEM_VERBOSE( (char *)module->load_addr + dir->VirtualAddress, if ( !DEBUG_READ_MEM_VERBOSE( (char *)module->load_addr + dir->VirtualAddress,
dbg, nDbg * sizeof(IMAGE_DEBUG_DIRECTORY) ) ) dbg, nDbg * sizeof(IMAGE_DEBUG_DIRECTORY) ) )
goto leave; goto leave;
@ -3025,10 +3025,10 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
PIMAGE_DEBUG_MISC misc = (PIMAGE_DEBUG_MISC)(file_map + dbg->PointerToRawData); PIMAGE_DEBUG_MISC misc = (PIMAGE_DEBUG_MISC)(file_map + dbg->PointerToRawData);
if ( nDbg != 1 || dbg->Type != IMAGE_DEBUG_TYPE_MISC if ( nDbg != 1 || dbg->Type != IMAGE_DEBUG_TYPE_MISC
|| misc->DataType != IMAGE_DEBUG_MISC_EXENAME ) || misc->DataType != IMAGE_DEBUG_MISC_EXENAME )
{ {
DEBUG_Printf( DBG_CHN_ERR, "-Debug info stripped, but no .DBG file in module %s\n", DEBUG_Printf( DBG_CHN_ERR, "-Debug info stripped, but no .DBG file in module %s\n",
module->module_name ); module->module_name );
goto leave; goto leave;
} }
@ -3048,14 +3048,14 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
PIMAGE_NT_HEADERS mpd_nth = (PIMAGE_NT_HEADERS)(file_map + nth_ofs); PIMAGE_NT_HEADERS mpd_nth = (PIMAGE_NT_HEADERS)(file_map + nth_ofs);
PIMAGE_DATA_DIRECTORY mpd_dir; PIMAGE_DATA_DIRECTORY mpd_dir;
PIMAGE_DEBUG_DIRECTORY mpd_dbg = NULL; PIMAGE_DEBUG_DIRECTORY mpd_dbg = NULL;
/* sanity checks */ /* sanity checks */
if ( mpd_nth->Signature != IMAGE_NT_SIGNATURE || if ( mpd_nth->Signature != IMAGE_NT_SIGNATURE ||
mpd_nth->FileHeader.NumberOfSections != nth->FileHeader.NumberOfSections || mpd_nth->FileHeader.NumberOfSections != nth->FileHeader.NumberOfSections ||
!(mpd_nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED )) !(mpd_nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED ))
goto leave; goto leave;
mpd_dir = mpd_nth->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_DEBUG; mpd_dir = mpd_nth->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_DEBUG;
if ((mpd_dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY)) != nDbg) if ((mpd_dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY)) != nDbg)
goto leave; goto leave;
@ -3079,7 +3079,7 @@ enum DbgInfoLoad DEBUG_RegisterMSCDebugInfo( DBG_MODULE *module, HANDLE hFile,
* look for stabs information in PE header (it's how mingw compiler provides its * look for stabs information in PE header (it's how mingw compiler provides its
* debugging information), and also wine PE <-> ELF linking through .wsolnk sections * debugging information), and also wine PE <-> ELF linking through .wsolnk sections
*/ */
enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile, enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile,
void* _nth, unsigned long nth_ofs) void* _nth, unsigned long nth_ofs)
{ {
IMAGE_SECTION_HEADER pe_seg; IMAGE_SECTION_HEADER pe_seg;
@ -3093,7 +3093,7 @@ enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile,
nth->FileHeader.SizeOfOptionalHeader; nth->FileHeader.SizeOfOptionalHeader;
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) { for (i = 0; i < nth->FileHeader.NumberOfSections; i++, pe_seg_ofs += sizeof(pe_seg)) {
if (!DEBUG_READ_MEM_VERBOSE((void*)((char *)module->load_addr + pe_seg_ofs), if (!DEBUG_READ_MEM_VERBOSE((void*)((char *)module->load_addr + pe_seg_ofs),
&pe_seg, sizeof(pe_seg))) &pe_seg, sizeof(pe_seg)))
continue; continue;
@ -3111,7 +3111,7 @@ enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile,
if (s1) { if (s1) {
if (DEBUG_READ_MEM_VERBOSE((char*)module->load_addr + stabs, s1, stabsize) && if (DEBUG_READ_MEM_VERBOSE((char*)module->load_addr + stabs, s1, stabsize) &&
DEBUG_READ_MEM_VERBOSE((char*)module->load_addr + stabstr, DEBUG_READ_MEM_VERBOSE((char*)module->load_addr + stabstr,
s1 + stabsize, stabstrsize)) { s1 + stabsize, stabstrsize)) {
dil = DEBUG_ParseStabs(s1, 0, 0, stabsize, stabsize, stabstrsize); dil = DEBUG_ParseStabs(s1, 0, 0, stabsize, stabsize, stabstrsize);
} else { } else {
@ -3119,7 +3119,7 @@ enum DbgInfoLoad DEBUG_RegisterStabsDebugInfo(DBG_MODULE* module, HANDLE hFile,
} }
DBG_free(s1); DBG_free(s1);
} else { } else {
DEBUG_Printf(DBG_CHN_MESG, "couldn't alloc %d bytes\n", DEBUG_Printf(DBG_CHN_MESG, "couldn't alloc %d bytes\n",
stabsize + stabstrsize); stabsize + stabstrsize);
} }
} else { } else {

View File

@ -84,7 +84,7 @@ char *DEBUG_Flags( DWORD flag, char *buf )
/*********************************************************************** /***********************************************************************
* DEBUG_InfoRegisters * DEBUG_InfoRegisters
* *
* Display registers information. * Display registers information.
*/ */
void DEBUG_InfoRegisters(void) void DEBUG_InfoRegisters(void)
{ {
@ -113,11 +113,11 @@ void DEBUG_InfoRegisters(void)
{ {
char flag[33]; char flag[33];
DEBUG_Printf( DBG_CHN_MESG, "\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx(%s)\n", DEBUG_Printf( DBG_CHN_MESG, "\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx(%s)\n",
DEBUG_context.Eip, DEBUG_context.Esp, DEBUG_context.Eip, DEBUG_context.Esp,
DEBUG_context.Ebp, DEBUG_context.EFlags, DEBUG_context.Ebp, DEBUG_context.EFlags,
DEBUG_Flags(DEBUG_context.EFlags, flag)); DEBUG_Flags(DEBUG_context.EFlags, flag));
DEBUG_Printf( DBG_CHN_MESG, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n", DEBUG_Printf( DBG_CHN_MESG, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n",
DEBUG_context.Eax, DEBUG_context.Ebx, DEBUG_context.Eax, DEBUG_context.Ebx,
DEBUG_context.Ecx, DEBUG_context.Edx ); DEBUG_context.Ecx, DEBUG_context.Edx );
DEBUG_Printf( DBG_CHN_MESG, " ESI:%08lx EDI:%08lx\n", DEBUG_Printf( DBG_CHN_MESG, " ESI:%08lx EDI:%08lx\n",

View File

@ -156,7 +156,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
break; break;
} }
} }
} }
if( ol == NULL ) if( ol == NULL )
@ -186,14 +186,14 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* Now append the base file name. * Now append the base file name.
*/ */
strcat(tmppath, basename); strcat(tmppath, basename);
status = stat(tmppath, &statbuf); status = stat(tmppath, &statbuf);
if( status != -1 ) if( status != -1 )
{ {
break; break;
} }
} }
if( sl == NULL ) if( sl == NULL )
{ {
char zbuf[256]; char zbuf[256];
@ -202,12 +202,12 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
*/ */
sprintf(zbuf, "Enter path to file '%s': ", sourcefile); sprintf(zbuf, "Enter path to file '%s': ", sourcefile);
DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath), FALSE, FALSE); DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath), FALSE, FALSE);
if( tmppath[strlen(tmppath)-1] == '\n' ) if( tmppath[strlen(tmppath)-1] == '\n' )
{ {
tmppath[strlen(tmppath)-1] = '\0'; tmppath[strlen(tmppath)-1] = '\0';
} }
if( tmppath[strlen(tmppath)-1] != '/' ) if( tmppath[strlen(tmppath)-1] != '/' )
{ {
strcat(tmppath, "/"); strcat(tmppath, "/");
@ -216,7 +216,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
* Now append the base file name. * Now append the base file name.
*/ */
strcat(tmppath, basename); strcat(tmppath, basename);
status = stat(tmppath, &statbuf); status = stat(tmppath, &statbuf);
if( status == -1 ) if( status == -1 )
{ {
@ -302,14 +302,14 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
{ {
return FALSE; return FALSE;
} }
addr = mmap(0, ol->size, PROT_READ, MAP_PRIVATE, fd, 0); addr = mmap(0, ol->size, PROT_READ, MAP_PRIVATE, fd, 0);
if( addr == (char *) -1 ) if( addr == (char *) -1 )
{ {
return FALSE; return FALSE;
} }
} }
/* /*
* All we need to do is to display the source lines here. * All we need to do is to display the source lines here.
*/ */
@ -325,7 +325,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
memset(&buffer, 0, sizeof(buffer)); memset(&buffer, 0, sizeof(buffer));
if( ol->linelist[i+1] != ol->linelist[i] ) if( ol->linelist[i+1] != ol->linelist[i] )
{ {
memcpy(&buffer, addr + ol->linelist[i], memcpy(&buffer, addr + ol->linelist[i],
(ol->linelist[i+1] - ol->linelist[i]) - 1); (ol->linelist[i+1] - ol->linelist[i]) - 1);
} }
DEBUG_Printf(DBG_CHN_MESG,"%d\t%s\n", i + 1, buffer); DEBUG_Printf(DBG_CHN_MESG,"%d\t%s\n", i + 1, buffer);
@ -351,10 +351,10 @@ DEBUG_List(struct list_id * source1, struct list_id * source2,
* We need to see what source file we need. Hopefully we only have * We need to see what source file we need. Hopefully we only have
* one specified, otherwise we might as well punt. * one specified, otherwise we might as well punt.
*/ */
if( source1 != NULL if( source1 != NULL
&& source2 != NULL && source2 != NULL
&& source1->sourcefile != NULL && source1->sourcefile != NULL
&& source2->sourcefile != NULL && source2->sourcefile != NULL
&& strcmp(source1->sourcefile, source2->sourcefile) != 0 ) && strcmp(source1->sourcefile, source2->sourcefile) != 0 )
{ {
DEBUG_Printf(DBG_CHN_MESG, "Ambiguous source file specification.\n"); DEBUG_Printf(DBG_CHN_MESG, "Ambiguous source file specification.\n");
@ -367,8 +367,8 @@ DEBUG_List(struct list_id * source1, struct list_id * source2,
sourcefile = source1->sourcefile; sourcefile = source1->sourcefile;
} }
if( sourcefile == NULL if( sourcefile == NULL
&& source2 != NULL && source2 != NULL
&& source2->sourcefile != NULL ) && source2->sourcefile != NULL )
{ {
sourcefile = source2->sourcefile; sourcefile = source2->sourcefile;

View File

@ -129,11 +129,11 @@ static int cu_include_stk_idx = 0;
static struct datatype** cu_vector = NULL; static struct datatype** cu_vector = NULL;
static int cu_nrofentries = 0; static int cu_nrofentries = 0;
static static
int int
DEBUG_CreateInclude(const char* file, unsigned long val) DEBUG_CreateInclude(const char* file, unsigned long val)
{ {
if (num_include_def == num_alloc_include_def) if (num_include_def == num_alloc_include_def)
{ {
num_alloc_include_def += 256; num_alloc_include_def += 256;
include_defs = DBG_realloc(include_defs, sizeof(include_defs[0])*num_alloc_include_def); include_defs = DBG_realloc(include_defs, sizeof(include_defs[0])*num_alloc_include_def);
@ -143,35 +143,35 @@ DEBUG_CreateInclude(const char* file, unsigned long val)
include_defs[num_include_def].value = val; include_defs[num_include_def].value = val;
include_defs[num_include_def].vector = NULL; include_defs[num_include_def].vector = NULL;
include_defs[num_include_def].nrofentries = 0; include_defs[num_include_def].nrofentries = 0;
return num_include_def++; return num_include_def++;
} }
static static
int int
DEBUG_FindInclude(const char* file, unsigned long val) DEBUG_FindInclude(const char* file, unsigned long val)
{ {
int i; int i;
for (i = 0; i < num_include_def; i++) for (i = 0; i < num_include_def; i++)
{ {
if (val == include_defs[i].value && if (val == include_defs[i].value &&
strcmp(file, include_defs[i].name) == 0) strcmp(file, include_defs[i].name) == 0)
return i; return i;
} }
return -1; return -1;
} }
static static
int int
DEBUG_AddInclude(int idx) DEBUG_AddInclude(int idx)
{ {
++cu_include_stk_idx; ++cu_include_stk_idx;
/* is this happen, just bump MAX_INCLUDES */ /* is this happen, just bump MAX_INCLUDES */
/* we could also handle this as another dynarray */ /* we could also handle this as another dynarray */
assert(cu_include_stk_idx < MAX_INCLUDES); assert(cu_include_stk_idx < MAX_INCLUDES);
cu_include_stack[cu_include_stk_idx] = idx; cu_include_stack[cu_include_stk_idx] = idx;
return cu_include_stk_idx; return cu_include_stk_idx;
} }
@ -193,10 +193,10 @@ void
DEBUG_FreeIncludes(void) DEBUG_FreeIncludes(void)
{ {
int i; int i;
DEBUG_ResetIncludes(); DEBUG_ResetIncludes();
for (i = 0; i < num_include_def; i++) for (i = 0; i < num_include_def; i++)
{ {
DBG_free(include_defs[i].name); DBG_free(include_defs[i].name);
DBG_free(include_defs[i].vector); DBG_free(include_defs[i].vector);
@ -212,18 +212,18 @@ DEBUG_FreeIncludes(void)
static static
struct datatype** struct datatype**
DEBUG_FileSubNr2StabEnum(int filenr, int subnr) DEBUG_FileSubNr2StabEnum(int filenr, int subnr)
{ {
struct datatype** ret; struct datatype** ret;
/* DEBUG_Printf(DBG_CHN_MESG, "creating type id for (%d,%d)\n", filenr, subnr); */ /* DEBUG_Printf(DBG_CHN_MESG, "creating type id for (%d,%d)\n", filenr, subnr); */
/* FIXME: I could perhaps create a dummy include_def for each compilation /* FIXME: I could perhaps create a dummy include_def for each compilation
* unit which would allow not to handle those two cases separately * unit which would allow not to handle those two cases separately
*/ */
if (filenr == 0) if (filenr == 0)
{ {
if (cu_nrofentries <= subnr) if (cu_nrofentries <= subnr)
{ {
cu_vector = DBG_realloc(cu_vector, sizeof(cu_vector[0])*(subnr+1)); cu_vector = DBG_realloc(cu_vector, sizeof(cu_vector[0])*(subnr+1));
memset(cu_vector+cu_nrofentries, 0, sizeof(cu_vector[0])*(subnr+1-cu_nrofentries)); memset(cu_vector+cu_nrofentries, 0, sizeof(cu_vector[0])*(subnr+1-cu_nrofentries));
@ -234,11 +234,11 @@ DEBUG_FileSubNr2StabEnum(int filenr, int subnr)
else else
{ {
include_def* idef; include_def* idef;
assert(filenr <= cu_include_stk_idx); assert(filenr <= cu_include_stk_idx);
idef = &include_defs[cu_include_stack[filenr]]; idef = &include_defs[cu_include_stack[filenr]];
if (idef->nrofentries <= subnr) if (idef->nrofentries <= subnr)
{ {
idef->vector = DBG_realloc(idef->vector, sizeof(idef->vector[0])*(subnr+1)); idef->vector = DBG_realloc(idef->vector, sizeof(idef->vector[0])*(subnr+1));
@ -251,7 +251,7 @@ DEBUG_FileSubNr2StabEnum(int filenr, int subnr)
return ret; return ret;
} }
static static
struct datatype** struct datatype**
DEBUG_ReadTypeEnum(char **x) { DEBUG_ReadTypeEnum(char **x) {
int filenr,subnr; int filenr,subnr;
@ -303,7 +303,7 @@ static int DEBUG_PTS_ReadNum(struct ParseTypedefData* ptd, int* v)
return 0; return 0;
} }
static int DEBUG_PTS_ReadTypeReference(struct ParseTypedefData* ptd, static int DEBUG_PTS_ReadTypeReference(struct ParseTypedefData* ptd,
int* filenr, int* subnr) int* filenr, int* subnr)
{ {
if (*ptd->ptr == '(') { if (*ptd->ptr == '(') {
@ -320,7 +320,7 @@ static int DEBUG_PTS_ReadTypeReference(struct ParseTypedefData* ptd,
return 0; return 0;
} }
static int DEBUG_PTS_ReadRange(struct ParseTypedefData* ptd, struct datatype** dt, static int DEBUG_PTS_ReadRange(struct ParseTypedefData* ptd, struct datatype** dt,
int* lo, int* hi) int* lo, int* hi)
{ {
/* type ';' <int> ';' <int> ';' */ /* type ';' <int> ';' <int> ';' */
@ -350,7 +350,7 @@ static inline int DEBUG_PTS_ReadAggregate(struct ParseTypedefData* ptd, struct d
* but don't store results into the struct * but don't store results into the struct
* FIXME: there's a quite ugly memory leak in there... * FIXME: there's a quite ugly memory leak in there...
*/ */
/* Now parse the individual elements of the structure/union. */ /* Now parse the individual elements of the structure/union. */
while (*ptd->ptr != ';') { while (*ptd->ptr != ';') {
/* agg_name : type ',' <int:offset> ',' <int:size> */ /* agg_name : type ',' <int:offset> ',' <int:size> */
@ -396,7 +396,7 @@ static inline int DEBUG_PTS_ReadArray(struct ParseTypedefData* ptd, struct datat
struct datatype* rdt; struct datatype* rdt;
/* ar<typeinfo_nodef>;<int>;<int>;<typeinfo> */ /* ar<typeinfo_nodef>;<int>;<int>;<typeinfo> */
if (*ptd->ptr++ != 'r') return -1; if (*ptd->ptr++ != 'r') return -1;
/* FIXME: range type is lost, always assume int */ /* FIXME: range type is lost, always assume int */
if (DEBUG_PTS_ReadRange(ptd, &rdt, &lo, &hi) == -1) return -1; if (DEBUG_PTS_ReadRange(ptd, &rdt, &lo, &hi) == -1) return -1;
@ -470,7 +470,7 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
} else if (!dt1 && !dt2) { } else if (!dt1 && !dt2) {
new_dt = NULL; new_dt = NULL;
} else { } else {
DEBUG_Printf(DBG_CHN_MESG, "Unknown condition %08lx %08lx (%s)\n", DEBUG_Printf(DBG_CHN_MESG, "Unknown condition %08lx %08lx (%s)\n",
(unsigned long)dt1, (unsigned long)dt2, ptd->ptr); (unsigned long)dt1, (unsigned long)dt2, ptd->ptr);
return -1; return -1;
} }
@ -502,13 +502,13 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
dt2 = DEBUG_TypeCast(DT_STRUCT, typename); dt2 = DEBUG_TypeCast(DT_STRUCT, typename);
if (!dt1) { if (!dt1) {
new_dt = DEBUG_NewDataType(DT_STRUCT, typename); new_dt = DEBUG_NewDataType(DT_STRUCT, typename);
/* we need to set it here, because a struct can hold a pointer /* we need to set it here, because a struct can hold a pointer
* to itself * to itself
*/ */
*DEBUG_FileSubNr2StabEnum(filenr1, subnr1) = new_dt; *DEBUG_FileSubNr2StabEnum(filenr1, subnr1) = new_dt;
} else { } else {
if (DEBUG_GetType(dt1) != DT_STRUCT) { if (DEBUG_GetType(dt1) != DT_STRUCT) {
DEBUG_Printf(DBG_CHN_MESG, DEBUG_Printf(DBG_CHN_MESG,
"Forward declaration is not an aggregate\n"); "Forward declaration is not an aggregate\n");
return -1; return -1;
} }
@ -524,10 +524,10 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
case 's': case 'u': lo = DT_STRUCT; break; case 's': case 'u': lo = DT_STRUCT; break;
default: return -1; default: return -1;
} }
idx = ptd->idx; idx = ptd->idx;
if (DEBUG_PTS_ReadID(ptd) == -1) return -1; if (DEBUG_PTS_ReadID(ptd) == -1) return -1;
new_dt = DEBUG_NewDataType(lo, ptd->buf + idx); new_dt = DEBUG_NewDataType(lo, ptd->buf + idx);
ptd->idx = idx; ptd->idx = idx;
break; break;
case '-': case '-':
@ -538,7 +538,7 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
enum debug_type_basic basic = DT_BASIC_LAST; enum debug_type_basic basic = DT_BASIC_LAST;
switch (lo) switch (lo)
{ {
case 1: basic = DT_BASIC_INT; break; case 1: basic = DT_BASIC_INT; break;
case 2: basic = DT_BASIC_CHAR; break; case 2: basic = DT_BASIC_CHAR; break;
case 3: basic = DT_BASIC_SHORTINT; break; case 3: basic = DT_BASIC_SHORTINT; break;
case 4: basic = DT_BASIC_LONGINT; break; case 4: basic = DT_BASIC_LONGINT; break;
@ -622,7 +622,7 @@ static int DEBUG_ParseTypedefStab(char* ptr, const char* typename)
int ret = -1; int ret = -1;
/* check for already existing definition */ /* check for already existing definition */
ptd.idx = 0; ptd.idx = 0;
if ((ptd.ptr = strchr(ptr, ':'))) { if ((ptd.ptr = strchr(ptr, ':'))) {
ptd.ptr++; ptd.ptr++;
@ -659,7 +659,7 @@ DEBUG_ParseStabType(const char * stab)
*/ */
if (*c != '(') if (*c != '(')
c++; c++;
/* /*
* The next is either an integer or a (integer,integer). * The next is either an integer or a (integer,integer).
* The DEBUG_ReadTypeEnum takes care that stab_types is large enough. * The DEBUG_ReadTypeEnum takes care that stab_types is large enough.
*/ */
@ -667,7 +667,7 @@ DEBUG_ParseStabType(const char * stab)
} }
enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset, enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
unsigned int staboff, int stablen, unsigned int staboff, int stablen,
unsigned int strtaboff, int strtablen) unsigned int strtaboff, int strtablen)
{ {
struct name_hash * curr_func = NULL; struct name_hash * curr_func = NULL;
@ -794,7 +794,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
new_value.cookie = DV_TARGET; new_value.cookie = DV_TARGET;
stab_strcpy(symname, sizeof(symname), ptr); stab_strcpy(symname, sizeof(symname), ptr);
curr_sym = DEBUG_AddSymbol( symname, &new_value, currpath, curr_sym = DEBUG_AddSymbol( symname, &new_value, currpath,
SYM_WINE | SYM_DATA ); SYM_WINE | SYM_DATA );
break; break;
case N_PSYM: case N_PSYM:
@ -804,7 +804,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
if( curr_func != NULL && !in_external_file ) if( curr_func != NULL && !in_external_file )
{ {
stab_strcpy(symname, sizeof(symname), ptr); stab_strcpy(symname, sizeof(symname), ptr);
curr_loc = DEBUG_AddLocal( curr_func, 0, curr_loc = DEBUG_AddLocal( curr_func, 0,
stab_ptr->n_value, 0, 0, symname ); stab_ptr->n_value, 0, 0, symname );
DEBUG_SetLocalSymbolType( curr_loc, DEBUG_ParseStabType(ptr) ); DEBUG_SetLocalSymbolType( curr_loc, DEBUG_ParseStabType(ptr) );
} }
@ -813,7 +813,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
if( curr_func != NULL && !in_external_file ) if( curr_func != NULL && !in_external_file )
{ {
stab_strcpy(symname, sizeof(symname), ptr); stab_strcpy(symname, sizeof(symname), ptr);
curr_loc = DEBUG_AddLocal( curr_func, stab_ptr->n_value + 1, curr_loc = DEBUG_AddLocal( curr_func, stab_ptr->n_value + 1,
0, 0, 0, symname ); 0, 0, 0, symname );
DEBUG_SetLocalSymbolType( curr_loc, DEBUG_ParseStabType(ptr) ); DEBUG_SetLocalSymbolType( curr_loc, DEBUG_ParseStabType(ptr) );
} }
@ -822,7 +822,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
if( curr_func != NULL && !in_external_file ) if( curr_func != NULL && !in_external_file )
{ {
stab_strcpy(symname, sizeof(symname), ptr); stab_strcpy(symname, sizeof(symname), ptr);
curr_loc = DEBUG_AddLocal( curr_func, 0, curr_loc = DEBUG_AddLocal( curr_func, 0,
stab_ptr->n_value, 0, 0, symname ); stab_ptr->n_value, 0, 0, symname );
DEBUG_SetLocalSymbolType( curr_loc, DEBUG_ParseStabType(ptr) ); DEBUG_SetLocalSymbolType( curr_loc, DEBUG_ParseStabType(ptr) );
} }
@ -835,7 +835,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
if( curr_func != NULL && !in_external_file ) if( curr_func != NULL && !in_external_file )
{ {
#ifdef __ELF__ #ifdef __ELF__
DEBUG_AddLineNumber(curr_func, stab_ptr->n_desc, DEBUG_AddLineNumber(curr_func, stab_ptr->n_desc,
stab_ptr->n_value); stab_ptr->n_value);
#else #else
#if 0 #if 0
@ -844,7 +844,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
* a.out, and as a result we would end up attaching the line * a.out, and as a result we would end up attaching the line
* number to the wrong function. * number to the wrong function.
*/ */
DEBUG_AddLineNumber(curr_func, stab_ptr->n_desc, DEBUG_AddLineNumber(curr_func, stab_ptr->n_desc,
stab_ptr->n_value - curr_func->addr.off); stab_ptr->n_value - curr_func->addr.off);
#endif #endif
#endif #endif
@ -884,7 +884,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
curr_func = DEBUG_AddSymbol( symname, &new_value, currpath, curr_func = DEBUG_AddSymbol( symname, &new_value, currpath,
SYM_WINE | SYM_FUNC ); SYM_WINE | SYM_FUNC );
#endif #endif
} }
else else
{ {
/* some GCC seem to use a N_FUN "" to mark the end of a function */ /* some GCC seem to use a N_FUN "" to mark the end of a function */
@ -979,7 +979,7 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
stabbuff[0] = '\0'; stabbuff[0] = '\0';
#if 0 #if 0
DEBUG_Printf(DBG_CHN_MESG, "%d %x %s\n", stab_ptr->n_type, DEBUG_Printf(DBG_CHN_MESG, "%d %x %s\n", stab_ptr->n_type,
(unsigned int) stab_ptr->n_value, (unsigned int) stab_ptr->n_value,
strs + (unsigned int) stab_ptr->n_un.n_name); strs + (unsigned int) stab_ptr->n_un.n_name);
#endif #endif
@ -1001,8 +1001,8 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
* This is all really quite easy, since we don't have to worry about line * This is all really quite easy, since we don't have to worry about line
* numbers or local data variables. * numbers or local data variables.
*/ */
static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr, static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
u_long load_addr, Elf32_Shdr* symtab, u_long load_addr, Elf32_Shdr* symtab,
Elf32_Shdr* strtab) Elf32_Shdr* strtab)
{ {
char * curfile = NULL; char * curfile = NULL;
@ -1058,7 +1058,7 @@ static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
new_value.type = NULL; new_value.type = NULL;
new_value.addr.off = load_addr + symp->st_value; new_value.addr.off = load_addr + symp->st_value;
new_value.cookie = DV_TARGET; new_value.cookie = DV_TARGET;
flags = SYM_WINE | ((ELF32_ST_TYPE(symp->st_info) == STT_FUNC) flags = SYM_WINE | ((ELF32_ST_TYPE(symp->st_info) == STT_FUNC)
? SYM_FUNC : SYM_DATA); ? SYM_FUNC : SYM_DATA);
if( ELF32_ST_BIND(symp->st_info) == STB_GLOBAL ) if( ELF32_ST_BIND(symp->st_info) == STB_GLOBAL )
curr_sym = DEBUG_AddSymbol( symname, &new_value, NULL, flags ); curr_sym = DEBUG_AddSymbol( symname, &new_value, NULL, flags );
@ -1080,9 +1080,9 @@ static int DEBUG_ProcessElfSymtab(DBG_MODULE* module, char* addr,
* Loads the symbolic information from ELF module stored in 'filename' * Loads the symbolic information from ELF module stored in 'filename'
* the module has been loaded at 'load_offset' address, so symbols' address * the module has been loaded at 'load_offset' address, so symbols' address
* relocation is performed * relocation is performed
* returns * returns
* -1 if the file cannot be found/opened * -1 if the file cannot be found/opened
* 0 if the file doesn't contain symbolic info (or this info cannot be * 0 if the file doesn't contain symbolic info (or this info cannot be
* read or parsed) * read or parsed)
* 1 on success * 1 on success
*/ */
@ -1112,14 +1112,14 @@ enum DbgInfoLoad DEBUG_LoadElfStabs(DBG_MODULE* module)
* Now open the file, so that we can mmap() it. * Now open the file, so that we can mmap() it.
*/ */
if ((fd = open(module->module_name, O_RDONLY)) == -1) goto leave; if ((fd = open(module->module_name, O_RDONLY)) == -1) goto leave;
dil = DIL_NOINFO; dil = DIL_NOINFO;
/* /*
* Now mmap() the file. * Now mmap() the file.
*/ */
addr = mmap(0, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); addr = mmap(0, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if (addr == (char*)0xffffffff) goto leave; if (addr == (char*)0xffffffff) goto leave;
/* /*
* Next, we need to find a few of the internal ELF headers within * Next, we need to find a few of the internal ELF headers within
* this thing. We need the main executable header, and the section * this thing. We need the main executable header, and the section
@ -1128,27 +1128,27 @@ enum DbgInfoLoad DEBUG_LoadElfStabs(DBG_MODULE* module)
ehptr = (Elf32_Ehdr*) addr; ehptr = (Elf32_Ehdr*) addr;
spnt = (Elf32_Shdr*) (addr + ehptr->e_shoff); spnt = (Elf32_Shdr*) (addr + ehptr->e_shoff);
shstrtab = (addr + spnt[ehptr->e_shstrndx].sh_offset); shstrtab = (addr + spnt[ehptr->e_shstrndx].sh_offset);
stabsect = stabstrsect = -1; stabsect = stabstrsect = -1;
for (i = 0; i < ehptr->e_shnum; i++) { for (i = 0; i < ehptr->e_shnum; i++) {
if (strcmp(shstrtab + spnt[i].sh_name, ".stab") == 0) if (strcmp(shstrtab + spnt[i].sh_name, ".stab") == 0)
stabsect = i; stabsect = i;
if (strcmp(shstrtab + spnt[i].sh_name, ".stabstr") == 0) if (strcmp(shstrtab + spnt[i].sh_name, ".stabstr") == 0)
stabstrsect = i; stabstrsect = i;
} }
if (stabsect == -1 || stabstrsect == -1) { if (stabsect == -1 || stabstrsect == -1) {
DEBUG_Printf(DBG_CHN_WARN, "no .stab section\n"); DEBUG_Printf(DBG_CHN_WARN, "no .stab section\n");
goto leave; goto leave;
} }
/* /*
* OK, now just parse all of the stabs. * OK, now just parse all of the stabs.
*/ */
if (DEBUG_ParseStabs(addr, if (DEBUG_ParseStabs(addr,
module->elf_info->elf_addr, module->elf_info->elf_addr,
spnt[stabsect].sh_offset, spnt[stabsect].sh_offset,
spnt[stabsect].sh_size, spnt[stabsect].sh_size,
spnt[stabstrsect].sh_offset, spnt[stabstrsect].sh_offset,
@ -1159,36 +1159,36 @@ enum DbgInfoLoad DEBUG_LoadElfStabs(DBG_MODULE* module)
DEBUG_Printf(DBG_CHN_WARN, "bad stabs\n"); DEBUG_Printf(DBG_CHN_WARN, "bad stabs\n");
goto leave; goto leave;
} }
for (i = 0; i < ehptr->e_shnum; i++) { for (i = 0; i < ehptr->e_shnum; i++) {
if ( (strcmp(shstrtab + spnt[i].sh_name, ".symtab") == 0) if ( (strcmp(shstrtab + spnt[i].sh_name, ".symtab") == 0)
&& (spnt[i].sh_type == SHT_SYMTAB)) && (spnt[i].sh_type == SHT_SYMTAB))
DEBUG_ProcessElfSymtab(module, addr, module->elf_info->elf_addr, DEBUG_ProcessElfSymtab(module, addr, module->elf_info->elf_addr,
spnt + i, spnt + spnt[i].sh_link); spnt + i, spnt + spnt[i].sh_link);
if ( (strcmp(shstrtab + spnt[i].sh_name, ".dynsym") == 0) if ( (strcmp(shstrtab + spnt[i].sh_name, ".dynsym") == 0)
&& (spnt[i].sh_type == SHT_DYNSYM)) && (spnt[i].sh_type == SHT_DYNSYM))
DEBUG_ProcessElfSymtab(module, addr, module->elf_info->elf_addr, DEBUG_ProcessElfSymtab(module, addr, module->elf_info->elf_addr,
spnt + i, spnt + spnt[i].sh_link); spnt + i, spnt + spnt[i].sh_link);
} }
leave: leave:
if (addr != (char*)0xffffffff) munmap(addr, statbuf.st_size); if (addr != (char*)0xffffffff) munmap(addr, statbuf.st_size);
if (fd != -1) close(fd); if (fd != -1) close(fd);
return dil; return dil;
} }
/* /*
* Loads the information for ELF module stored in 'filename' * Loads the information for ELF module stored in 'filename'
* the module has been loaded at 'load_offset' address * the module has been loaded at 'load_offset' address
* returns * returns
* -1 if the file cannot be found/opened * -1 if the file cannot be found/opened
* 0 if the file doesn't contain symbolic info (or this info cannot be * 0 if the file doesn't contain symbolic info (or this info cannot be
* read or parsed) * read or parsed)
* 1 on success * 1 on success
*/ */
static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename, static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
unsigned int load_offset, unsigned int load_offset,
unsigned int* dyn_addr) unsigned int* dyn_addr)
{ {
@ -1210,12 +1210,12 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
/* check that the file exists, and that the module hasn't been loaded yet */ /* check that the file exists, and that the module hasn't been loaded yet */
if (stat(filename, &statbuf) == -1) goto leave; if (stat(filename, &statbuf) == -1) goto leave;
/* /*
* Now open the file, so that we can mmap() it. * Now open the file, so that we can mmap() it.
*/ */
if ((fd = open(filename, O_RDONLY)) == -1) goto leave; if ((fd = open(filename, O_RDONLY)) == -1) goto leave;
/* /*
* Now mmap() the file. * Now mmap() the file.
*/ */
@ -1223,7 +1223,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
if (addr == (char*)0xffffffff) goto leave; if (addr == (char*)0xffffffff) goto leave;
dil = DIL_NOINFO; dil = DIL_NOINFO;
/* /*
* Next, we need to find a few of the internal ELF headers within * Next, we need to find a few of the internal ELF headers within
* this thing. We need the main executable header, and the section * this thing. We need the main executable header, and the section
@ -1248,7 +1248,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
if (size < ppnt[i].p_vaddr - delta + ppnt[i].p_memsz) if (size < ppnt[i].p_vaddr - delta + ppnt[i].p_memsz)
size = ppnt[i].p_vaddr - delta + ppnt[i].p_memsz; size = ppnt[i].p_vaddr - delta + ppnt[i].p_memsz;
} }
for (i = 0; i < ehptr->e_shnum; i++) { for (i = 0; i < ehptr->e_shnum; i++) {
if (strcmp(shstrtab + spnt[i].sh_name, ".bss") == 0 && if (strcmp(shstrtab + spnt[i].sh_name, ".bss") == 0 &&
spnt[i].sh_type == SHT_NOBITS) { spnt[i].sh_type == SHT_NOBITS) {
@ -1260,8 +1260,8 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
if (dyn_addr) *dyn_addr = spnt[i].sh_addr; if (dyn_addr) *dyn_addr = spnt[i].sh_addr;
} }
} }
module = DEBUG_RegisterELFModule((load_offset == 0) ? ehptr->e_entry : load_offset, module = DEBUG_RegisterELFModule((load_offset == 0) ? ehptr->e_entry : load_offset,
size, filename); size, filename);
if (!module) { if (!module) {
dil = DIL_ERROR; dil = DIL_ERROR;
@ -1280,13 +1280,13 @@ static enum DbgInfoLoad DEBUG_ProcessElfFile(const char* filename,
if (addr != (char*)0xffffffff) munmap(addr, statbuf.st_size); if (addr != (char*)0xffffffff) munmap(addr, statbuf.st_size);
if (fd != -1) close(fd); if (fd != -1) close(fd);
if (module) module->dil = dil; if (module) module->dil = dil;
return dil; return dil;
} }
static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename, static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
unsigned int load_offset, unsigned int load_offset,
unsigned int* dyn_addr, unsigned int* dyn_addr,
const char* path) const char* path)
{ {
enum DbgInfoLoad dil = DIL_ERROR; enum DbgInfoLoad dil = DIL_ERROR;
@ -1313,7 +1313,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfFileFromPath(const char * filename,
return dil; return dil;
} }
static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename, static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename,
unsigned int load_offset, unsigned int load_offset,
unsigned int* dyn_addr) unsigned int* dyn_addr)
{ {
@ -1335,7 +1335,7 @@ static enum DbgInfoLoad DEBUG_ProcessElfObject(const char* filename,
return dil; return dil;
} }
static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr) static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
{ {
u_long lm_addr; u_long lm_addr;
@ -1361,7 +1361,7 @@ static BOOL DEBUG_WalkList(struct r_debug* dbg_hdr)
DEBUG_ProcessElfObject(bufstr, (unsigned)lm.l_addr, NULL); DEBUG_ProcessElfObject(bufstr, (unsigned)lm.l_addr, NULL);
} }
} }
return TRUE; return TRUE;
} }
@ -1369,12 +1369,12 @@ static BOOL DEBUG_RescanElf(void)
{ {
struct r_debug dbg_hdr; struct r_debug dbg_hdr;
if (!DEBUG_CurrProcess || if (!DEBUG_CurrProcess ||
!DEBUG_READ_MEM_VERBOSE((void*)DEBUG_CurrProcess->dbg_hdr_addr, &dbg_hdr, sizeof(dbg_hdr))) !DEBUG_READ_MEM_VERBOSE((void*)DEBUG_CurrProcess->dbg_hdr_addr, &dbg_hdr, sizeof(dbg_hdr)))
return FALSE; return FALSE;
switch (dbg_hdr.r_state) { switch (dbg_hdr.r_state) {
case RT_CONSISTENT: case RT_CONSISTENT:
DEBUG_WalkList(&dbg_hdr); DEBUG_WalkList(&dbg_hdr);
DEBUG_CheckDelayedBP(); DEBUG_CheckDelayedBP();
break; break;
@ -1393,35 +1393,35 @@ enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name)
struct r_debug dbg_hdr; struct r_debug dbg_hdr;
enum DbgInfoLoad dil = DIL_NOINFO; enum DbgInfoLoad dil = DIL_NOINFO;
unsigned int dyn_addr; unsigned int dyn_addr;
/* /*
* Make sure we can stat and open this file. * Make sure we can stat and open this file.
*/ */
if (exe_name == NULL) goto leave; if (exe_name == NULL) goto leave;
DEBUG_ProcessElfObject(exe_name, 0, &dyn_addr); DEBUG_ProcessElfObject(exe_name, 0, &dyn_addr);
do { do {
if (!DEBUG_READ_MEM_VERBOSE((void*)dyn_addr, &dyn, sizeof(dyn))) if (!DEBUG_READ_MEM_VERBOSE((void*)dyn_addr, &dyn, sizeof(dyn)))
goto leave; goto leave;
dyn_addr += sizeof(dyn); dyn_addr += sizeof(dyn);
} while (dyn.d_tag != DT_DEBUG && dyn.d_tag != DT_NULL); } while (dyn.d_tag != DT_DEBUG && dyn.d_tag != DT_NULL);
if (dyn.d_tag == DT_NULL) goto leave; if (dyn.d_tag == DT_NULL) goto leave;
/* /*
* OK, now dig into the actual tables themselves. * OK, now dig into the actual tables themselves.
*/ */
if (!DEBUG_READ_MEM_VERBOSE((void*)dyn.d_un.d_ptr, &dbg_hdr, sizeof(dbg_hdr))) if (!DEBUG_READ_MEM_VERBOSE((void*)dyn.d_un.d_ptr, &dbg_hdr, sizeof(dbg_hdr)))
goto leave; goto leave;
assert(!DEBUG_CurrProcess->dbg_hdr_addr); assert(!DEBUG_CurrProcess->dbg_hdr_addr);
DEBUG_CurrProcess->dbg_hdr_addr = (u_long)dyn.d_un.d_ptr; DEBUG_CurrProcess->dbg_hdr_addr = (u_long)dyn.d_un.d_ptr;
if (dbg_hdr.r_brk) { if (dbg_hdr.r_brk) {
DBG_VALUE value; DBG_VALUE value;
DEBUG_Printf(DBG_CHN_TRACE, "Setting up a breakpoint on r_brk(%lx)\n", DEBUG_Printf(DBG_CHN_TRACE, "Setting up a breakpoint on r_brk(%lx)\n",
(unsigned long)dbg_hdr.r_brk); (unsigned long)dbg_hdr.r_brk);
DEBUG_SetBreakpoints(FALSE); DEBUG_SetBreakpoints(FALSE);
value.type = NULL; value.type = NULL;
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
@ -1430,9 +1430,9 @@ enum DbgInfoLoad DEBUG_ReadExecutableDbgInfo(const char* exe_name)
DEBUG_AddBreakpoint(&value, DEBUG_RescanElf); DEBUG_AddBreakpoint(&value, DEBUG_RescanElf);
DEBUG_SetBreakpoints(TRUE); DEBUG_SetBreakpoints(TRUE);
} }
dil = DEBUG_WalkList(&dbg_hdr); dil = DEBUG_WalkList(&dbg_hdr);
leave: leave:
return dil; return dil;
} }

View File

@ -70,7 +70,7 @@ void DEBUG_InfoStack(void)
{ {
#ifdef __i386__ #ifdef __i386__
DBG_VALUE value; DBG_VALUE value;
value.type = NULL; value.type = NULL;
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
value.addr.seg = DEBUG_context.SegSs; value.addr.seg = DEBUG_context.SegSs;
@ -109,8 +109,8 @@ static void DEBUG_ForceFrame(DBG_ADDR *stack, DBG_ADDR *code, int frameno, enum
if (noisy) if (noisy)
frames[theframe].frame = DEBUG_PrintAddressAndArgs( code, mode, stack->off, TRUE ); frames[theframe].frame = DEBUG_PrintAddressAndArgs( code, mode, stack->off, TRUE );
else else
DEBUG_FindNearestSymbol( code, TRUE, DEBUG_FindNearestSymbol( code, TRUE,
&frames[theframe].frame.sym, stack->off, &frames[theframe].frame.sym, stack->off,
&frames[theframe].frame.list); &frames[theframe].frame.list);
frames[theframe].ss = stack->seg; frames[theframe].ss = stack->seg;
frames[theframe].ebp = stack->off; frames[theframe].ebp = stack->off;
@ -126,9 +126,9 @@ static BOOL DEBUG_Frame16(DBG_THREAD* thread, DBG_ADDR *addr, unsigned int *cs,
FRAME16 frame; FRAME16 frame;
void* p = (void*)DEBUG_ToLinear(addr); void* p = (void*)DEBUG_ToLinear(addr);
DBG_ADDR code; DBG_ADDR code;
if (!p) return FALSE; if (!p) return FALSE;
if (!DEBUG_READ_MEM(p, &frame, sizeof(frame))) { if (!DEBUG_READ_MEM(p, &frame, sizeof(frame))) {
if (noisy) DEBUG_InvalAddr(addr); if (noisy) DEBUG_InvalAddr(addr);
return FALSE; return FALSE;
@ -141,7 +141,7 @@ static BOOL DEBUG_Frame16(DBG_THREAD* thread, DBG_ADDR *addr, unsigned int *cs,
* but check whether it could be anyway */ * but check whether it could be anyway */
if (((frame.cs&7)==7) && (frame.cs != *cs)) { if (((frame.cs&7)==7) && (frame.cs != *cs)) {
LDT_ENTRY le; LDT_ENTRY le;
if (GetThreadSelectorEntry( thread->handle, frame.cs, &le) && if (GetThreadSelectorEntry( thread->handle, frame.cs, &le) &&
(le.HighWord.Bits.Type & 0x08)) { /* code segment */ (le.HighWord.Bits.Type & 0x08)) { /* code segment */
/* it is very uncommon to push a code segment cs as /* it is very uncommon to push a code segment cs as
@ -164,9 +164,9 @@ static BOOL DEBUG_Frame32(DBG_ADDR *addr, unsigned int *cs, int frameno, int noi
void* p = (void*)DEBUG_ToLinear(addr); void* p = (void*)DEBUG_ToLinear(addr);
DBG_ADDR code; DBG_ADDR code;
DWORD old_bp = addr->off; DWORD old_bp = addr->off;
if (!p) return FALSE; if (!p) return FALSE;
if (!DEBUG_READ_MEM(p, &frame, sizeof(frame))) { if (!DEBUG_READ_MEM(p, &frame, sizeof(frame))) {
if (noisy) DEBUG_InvalAddr(addr); if (noisy) DEBUG_InvalAddr(addr);
return FALSE; return FALSE;
@ -204,7 +204,7 @@ void DEBUG_BackTrace(DWORD tid, BOOL noisy)
int copy_nframe = 0; int copy_nframe = 0;
int copy_curr_frame = 0; int copy_curr_frame = 0;
struct bt_info* copy_frames = NULL; struct bt_info* copy_frames = NULL;
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Backtrace:\n" ); if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Backtrace:\n" );
if (tid == DEBUG_CurrTid) if (tid == DEBUG_CurrTid)
@ -284,8 +284,8 @@ void DEBUG_BackTrace(DWORD tid, BOOL noisy)
return; return;
} }
/* cur_switch holds address of curr_stack's field in TEB in debuggee /* cur_switch holds address of curr_stack's field in TEB in debuggee
* address space * address space
*/ */
cur_switch = (DWORD)thread->teb + OFFSET_OF(TEB, cur_stack); cur_switch = (DWORD)thread->teb + OFFSET_OF(TEB, cur_stack);
if (!DEBUG_READ_MEM((void*)cur_switch, &next_switch, sizeof(next_switch))) { if (!DEBUG_READ_MEM((void*)cur_switch, &next_switch, sizeof(next_switch))) {
@ -295,7 +295,7 @@ void DEBUG_BackTrace(DWORD tid, BOOL noisy)
if (is16) { if (is16) {
if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) { if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) {
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n", if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
(unsigned long)(STACK32FRAME*)next_switch ); (unsigned long)(STACK32FRAME*)next_switch );
return; return;
} }
@ -306,9 +306,9 @@ void DEBUG_BackTrace(DWORD tid, BOOL noisy)
tmp.seg = SELECTOROF(next_switch); tmp.seg = SELECTOROF(next_switch);
tmp.off = OFFSETOF(next_switch); tmp.off = OFFSETOF(next_switch);
p = DEBUG_ToLinear(&tmp); p = DEBUG_ToLinear(&tmp);
if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) { if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) {
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n", if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
(unsigned long)(STACK16FRAME*)p ); (unsigned long)(STACK16FRAME*)p );
return; return;
} }
@ -320,7 +320,7 @@ void DEBUG_BackTrace(DWORD tid, BOOL noisy)
sw_addr.seg = (DWORD)-1; sw_addr.seg = (DWORD)-1;
sw_addr.off = (DWORD)-1; sw_addr.off = (DWORD)-1;
} }
for (ok = TRUE; ok;) { for (ok = TRUE; ok;) {
if ((frames[frameno].ss == sw_addr.seg) && if ((frames[frameno].ss == sw_addr.seg) &&
sw_addr.off && (frames[frameno].ebp >= sw_addr.off)) sw_addr.off && (frames[frameno].ebp >= sw_addr.off))
@ -328,65 +328,65 @@ void DEBUG_BackTrace(DWORD tid, BOOL noisy)
/* 16<->32 switch... /* 16<->32 switch...
* yes, I know this is confusing, it gave me a headache too */ * yes, I know this is confusing, it gave me a headache too */
if (is16) { if (is16) {
if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) { if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) {
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n", if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
(unsigned long)(STACK32FRAME*)next_switch ); (unsigned long)(STACK32FRAME*)next_switch );
return; return;
} }
code.seg = 0; code.seg = 0;
code.off = frame32.retaddr; code.off = frame32.retaddr;
cs = 0; cs = 0;
addr.seg = 0; addr.seg = 0;
addr.off = frame32.ebp; addr.off = frame32.ebp;
DEBUG_ForceFrame( &addr, &code, ++frameno, MODE_32, noisy, NULL ); DEBUG_ForceFrame( &addr, &code, ++frameno, MODE_32, noisy, NULL );
next_switch = cur_switch; next_switch = cur_switch;
tmp.seg = SELECTOROF(next_switch); tmp.seg = SELECTOROF(next_switch);
tmp.off = OFFSETOF(next_switch); tmp.off = OFFSETOF(next_switch);
p = DEBUG_ToLinear(&tmp); p = DEBUG_ToLinear(&tmp);
if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) { if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) {
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n", if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
(unsigned long)(STACK16FRAME*)p ); (unsigned long)(STACK16FRAME*)p );
return; return;
} }
cur_switch = (DWORD)frame16.frame32; cur_switch = (DWORD)frame16.frame32;
sw_addr.seg = 0; sw_addr.seg = 0;
sw_addr.off = cur_switch; sw_addr.off = cur_switch;
is16 = FALSE; is16 = FALSE;
} else { } else {
tmp.seg = SELECTOROF(next_switch); tmp.seg = SELECTOROF(next_switch);
tmp.off = OFFSETOF(next_switch); tmp.off = OFFSETOF(next_switch);
p = DEBUG_ToLinear(&tmp); p = DEBUG_ToLinear(&tmp);
if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) { if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) {
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n", if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
(unsigned long)(STACK16FRAME*)p ); (unsigned long)(STACK16FRAME*)p );
return; return;
} }
code.seg = frame16.cs; code.seg = frame16.cs;
code.off = frame16.ip; code.off = frame16.ip;
cs = frame16.cs; cs = frame16.cs;
addr.seg = SELECTOROF(next_switch); addr.seg = SELECTOROF(next_switch);
addr.off = frame16.bp; addr.off = frame16.bp;
DEBUG_ForceFrame( &addr, &code, ++frameno, MODE_16, noisy, NULL ); DEBUG_ForceFrame( &addr, &code, ++frameno, MODE_16, noisy, NULL );
next_switch = cur_switch; next_switch = cur_switch;
if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) { if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) {
if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n", if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
(unsigned long)(STACK32FRAME*)next_switch ); (unsigned long)(STACK32FRAME*)next_switch );
return; return;
} }
cur_switch = (DWORD)frame32.frame16; cur_switch = (DWORD)frame32.frame16;
sw_addr.seg = SELECTOROF(cur_switch); sw_addr.seg = SELECTOROF(cur_switch);
sw_addr.off = OFFSETOF(cur_switch); sw_addr.off = OFFSETOF(cur_switch);
is16 = TRUE; is16 = TRUE;
} }
if (!DEBUG_READ_MEM((void*)DEBUG_ToLinear(&sw_addr), &ch, sizeof(ch))) { if (!DEBUG_READ_MEM((void*)DEBUG_ToLinear(&sw_addr), &ch, sizeof(ch))) {

View File

@ -116,7 +116,7 @@ static unsigned int type_hash( const char * name )
p = name; p = name;
while (*p) while (*p)
{ {
hash = (hash << 4) + *p++; hash = (hash << 4) + *p++;
@ -131,7 +131,7 @@ static unsigned int type_hash( const char * name )
static struct datatype * static struct datatype *
DEBUG_InitBasic(int type, char * name, int size, int b_signed, DEBUG_InitBasic(int type, char * name, int size, int b_signed,
char * output_format) char * output_format)
{ {
int hash; int hash;
@ -174,12 +174,12 @@ DEBUG_LookupDataType(enum debug_type xtype, int hash, const char * typename)
{ {
for( dt = type_hash_table[hash]; dt; dt = dt->next ) for( dt = type_hash_table[hash]; dt; dt = dt->next )
{ {
if( xtype != dt->type || dt->name == NULL if( xtype != dt->type || dt->name == NULL
|| dt->name[0] != typename[0]) || dt->name[0] != typename[0])
{ {
continue; continue;
} }
if( strcmp(dt->name, typename) == 0 ) if( strcmp(dt->name, typename) == 0 )
{ {
return dt; return dt;
@ -223,11 +223,11 @@ DEBUG_NewDataType(enum debug_type xtype, const char * typename)
if( dt == NULL ) if( dt == NULL )
{ {
dt = (struct datatype *) DBG_alloc(sizeof(struct datatype)); dt = (struct datatype *) DBG_alloc(sizeof(struct datatype));
if( dt != NULL ) if( dt != NULL )
{ {
memset(dt, 0, sizeof(*dt)); memset(dt, 0, sizeof(*dt));
dt->type = xtype; dt->type = xtype;
if( typename != NULL ) if( typename != NULL )
{ {
@ -266,7 +266,7 @@ DEBUG_FindOrMakePointerType(struct datatype * reftype)
{ {
continue; continue;
} }
if( dt->un.pointer.pointsto == reftype ) if( dt->un.pointer.pointsto == reftype )
{ {
return dt; return dt;
@ -277,7 +277,7 @@ DEBUG_FindOrMakePointerType(struct datatype * reftype)
if( dt == NULL ) if( dt == NULL )
{ {
dt = (struct datatype *) DBG_alloc(sizeof(struct datatype)); dt = (struct datatype *) DBG_alloc(sizeof(struct datatype));
if( dt != NULL ) if( dt != NULL )
{ {
dt->type = DT_POINTER; dt->type = DT_POINTER;
@ -351,33 +351,33 @@ DEBUG_GetExprValue(const DBG_VALUE* _value, char** format)
struct en_values * e; struct en_values * e;
char * def_format = "0x%x"; char * def_format = "0x%x";
DBG_VALUE value = *_value; DBG_VALUE value = *_value;
assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST); assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST);
rtn = 0; rtn2 = 0; rtn = 0; rtn2 = 0;
/* FIXME? I don't quite get this... /* FIXME? I don't quite get this...
* if this is wrong, value.addr shall be linearized * if this is wrong, value.addr shall be linearized
*/ */
value.addr.seg = 0; value.addr.seg = 0;
assert(value.type != NULL); assert(value.type != NULL);
switch (value.type->type) { switch (value.type->type) {
case DT_BASIC: case DT_BASIC:
if (value.type->un.basic.basic_size > sizeof(rtn)) { if (value.type->un.basic.basic_size > sizeof(rtn)) {
DEBUG_Printf(DBG_CHN_ERR, "Size too large (%d)\n", DEBUG_Printf(DBG_CHN_ERR, "Size too large (%d)\n",
value.type->un.basic.basic_size); value.type->un.basic.basic_size);
return 0; return 0;
} }
/* FIXME: following code implies i386 byte ordering */ /* FIXME: following code implies i386 byte ordering */
if (_value->cookie == DV_TARGET) { if (_value->cookie == DV_TARGET) {
if (!DEBUG_READ_MEM_VERBOSE((void*)value.addr.off, &rtn, if (!DEBUG_READ_MEM_VERBOSE((void*)value.addr.off, &rtn,
value.type->un.basic.basic_size)) value.type->un.basic.basic_size))
return 0; return 0;
} else { } else {
memcpy(&rtn, (void*)value.addr.off, value.type->un.basic.basic_size); memcpy(&rtn, (void*)value.addr.off, value.type->un.basic.basic_size);
} }
if ( (value.type->un.basic.b_signed) if ( (value.type->un.basic.b_signed)
&& ((value.type->un.basic.basic_size & 3) != 0) && ((value.type->un.basic.basic_size & 3) != 0)
&& ((rtn >> (value.type->un.basic.basic_size * 8 - 1)) != 0)) { && ((rtn >> (value.type->un.basic.basic_size * 8 - 1)) != 0)) {
@ -394,12 +394,12 @@ DEBUG_GetExprValue(const DBG_VALUE* _value, char** format)
if (value.type->un.basic.output_format != NULL) { if (value.type->un.basic.output_format != NULL) {
def_format = value.type->un.basic.output_format; def_format = value.type->un.basic.output_format;
} }
/* /*
* Check for single character prints that are out of range. * Check for single character prints that are out of range.
*/ */
if ( value.type->un.basic.basic_size == 1 if ( value.type->un.basic.basic_size == 1
&& strcmp(def_format, "'%c'") == 0 && strcmp(def_format, "'%c'") == 0
&& ((rtn < 0x20) || (rtn > 0x80))) { && ((rtn < 0x20) || (rtn > 0x80))) {
def_format = "%d"; def_format = "%d";
} }
@ -411,16 +411,16 @@ DEBUG_GetExprValue(const DBG_VALUE* _value, char** format)
} else { } else {
rtn2 = *(unsigned int*)(value.addr.off); rtn2 = *(unsigned int*)(value.addr.off);
} }
type2 = value.type->un.pointer.pointsto; type2 = value.type->un.pointer.pointsto;
if (!type2) { if (!type2) {
def_format = "Internal symbol error: unable to access memory location 0x%08x"; def_format = "Internal symbol error: unable to access memory location 0x%08x";
rtn = 0; rtn = 0;
break; break;
} }
if (type2->type == DT_BASIC && type2->un.basic.basic_size == 1) { if (type2->type == DT_BASIC && type2->un.basic.basic_size == 1) {
if (_value->cookie == DV_TARGET) { if (_value->cookie == DV_TARGET) {
char ch; char ch;
def_format = "\"%S\""; def_format = "\"%S\"";
@ -461,8 +461,8 @@ DEBUG_GetExprValue(const DBG_VALUE* _value, char** format)
rtn = 0; rtn = 0;
break; break;
} }
if (format != NULL) { if (format != NULL) {
*format = def_format; *format = def_format;
} }
@ -594,7 +594,7 @@ DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2)
} }
int int
DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type, DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type,
int offset, int size) int offset, int size)
{ {
struct member * m; struct member * m;
@ -605,7 +605,7 @@ DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type
{ {
for(last = dt->un.structure.members; last; last = last->next) for(last = dt->un.structure.members; last; last = last->next)
{ {
if( (last->name[0] == name[0]) if( (last->name[0] == name[0])
&& (strcmp(last->name, name) == 0) ) && (strcmp(last->name, name) == 0) )
{ {
return TRUE; return TRUE;
@ -620,7 +620,7 @@ DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type
{ {
return FALSE; return FALSE;
} }
m->name = DBG_strdup(name); m->name = DBG_strdup(name);
m->type = type; m->type = type;
m->offset = offset; m->offset = offset;
@ -653,7 +653,7 @@ DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type
{ {
return FALSE; return FALSE;
} }
e->name = DBG_strdup(name); e->name = DBG_strdup(name);
e->value = offset; e->value = offset;
e->next = dt->un.enumeration.members; e->next = dt->un.enumeration.members;
@ -666,7 +666,7 @@ DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type
return TRUE; return TRUE;
} }
struct datatype * struct datatype *
DEBUG_GetPointerType(struct datatype * dt) DEBUG_GetPointerType(struct datatype * dt)
{ {
if( dt->type == DT_POINTER ) if( dt->type == DT_POINTER )
@ -707,7 +707,7 @@ DEBUG_SetArrayParams(struct datatype * dt, int min, int max, struct datatype * d
} }
int int
DEBUG_SetBitfieldParams(struct datatype * dt, int offset, int nbits, DEBUG_SetBitfieldParams(struct datatype * dt, int offset, int nbits,
struct datatype * dt2) struct datatype * dt2)
{ {
assert(dt->type == DT_BITFIELD); assert(dt->type == DT_BITFIELD);
@ -736,7 +736,7 @@ int DEBUG_GetObjectSize(struct datatype * dt)
case DT_ENUM: case DT_ENUM:
return sizeof(int); return sizeof(int);
case DT_ARRAY: case DT_ARRAY:
return (dt->un.array.end - dt->un.array.start) return (dt->un.array.end - dt->un.array.start)
* DEBUG_GetObjectSize(dt->un.array.basictype); * DEBUG_GetObjectSize(dt->un.array.basictype);
case DT_BITFIELD: case DT_BITFIELD:
/* /*
@ -780,7 +780,7 @@ DEBUG_ArrayIndex(const DBG_VALUE * value, DBG_VALUE * result, int index)
size = DEBUG_GetObjectSize(value->type->un.array.basictype); size = DEBUG_GetObjectSize(value->type->un.array.basictype);
result->type = value->type->un.array.basictype; result->type = value->type->un.array.basictype;
result->addr.off = value->addr.off + size * (index - value->type->un.array.start); result->addr.off = value->addr.off + size * (index - value->type->un.array.start);
/* Contents of array must be on same target */ /* Contents of array must be on same target */
result->cookie = value->cookie; result->cookie = value->cookie;
} }
@ -814,7 +814,7 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
DEBUG_Printf( DBG_CHN_MESG, "Count other than 1 is meaningless in 'print' command\n" ); DEBUG_Printf( DBG_CHN_MESG, "Count other than 1 is meaningless in 'print' command\n" );
return; return;
} }
if( value->type == NULL ) if( value->type == NULL )
{ {
/* No type, just print the addr value */ /* No type, just print the addr value */
@ -823,7 +823,7 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, "0x%08lx", value->addr.off ); DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, "0x%08lx", value->addr.off );
goto leave; goto leave;
} }
if( level == 0 ) if( level == 0 )
{ {
DEBUG_nchar = 0; DEBUG_nchar = 0;
@ -897,7 +897,7 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
default: assert(0); default: assert(0);
} }
DEBUG_nchar += clen; DEBUG_nchar += clen;
if (clen != len) if (clen != len)
{ {
DEBUG_Printf(DBG_CHN_MESG, "...\""); DEBUG_Printf(DBG_CHN_MESG, "...\"");
goto leave; goto leave;
@ -929,7 +929,7 @@ DEBUG_Print( const DBG_VALUE *value, int count, char format, int level )
break; break;
case DT_FUNC: case DT_FUNC:
DEBUG_Printf(DBG_CHN_MESG, "Function at ???\n"); DEBUG_Printf(DBG_CHN_MESG, "Function at ???\n");
break; break;
default: default:
DEBUG_Printf(DBG_CHN_MESG, "Unknown type (%d)\n", value->type->type); DEBUG_Printf(DBG_CHN_MESG, "Unknown type (%d)\n", value->type->type);
assert(FALSE); assert(FALSE);
@ -986,7 +986,7 @@ DEBUG_DumpTypes(void)
nm++; nm++;
} }
} }
DEBUG_Printf(DBG_CHN_MESG, "0x%08lx - STRUCT(%s) %d %d %s\n", DEBUG_Printf(DBG_CHN_MESG, "0x%08lx - STRUCT(%s) %d %d %s\n",
(unsigned long)dt, name, dt->un.structure.size, nm, member_name); (unsigned long)dt, name, dt->un.structure.size, nm, member_name);
break; break;
case DT_ARRAY: case DT_ARRAY:
@ -994,11 +994,11 @@ DEBUG_DumpTypes(void)
(unsigned long)dt, name, (unsigned long)dt->un.array.basictype); (unsigned long)dt, name, (unsigned long)dt->un.array.basictype);
break; break;
case DT_ENUM: case DT_ENUM:
DEBUG_Printf(DBG_CHN_MESG, "0x%08lx - ENUM(%s)\n", DEBUG_Printf(DBG_CHN_MESG, "0x%08lx - ENUM(%s)\n",
(unsigned long)dt, name); (unsigned long)dt, name);
break; break;
case DT_BITFIELD: case DT_BITFIELD:
DEBUG_Printf(DBG_CHN_MESG, "0x%08lx - BITFIELD(%s)\n", DEBUG_Printf(DBG_CHN_MESG, "0x%08lx - BITFIELD(%s)\n",
(unsigned long)dt, name); (unsigned long)dt, name);
break; break;
case DT_FUNC: case DT_FUNC:
@ -1093,7 +1093,7 @@ int DEBUG_PrintType( const DBG_VALUE *value )
{ {
assert(value->cookie == DV_TARGET || value->cookie == DV_HOST); assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
if (!value->type) if (!value->type)
{ {
DEBUG_Printf(DBG_CHN_MESG, "Unknown type\n"); DEBUG_Printf(DBG_CHN_MESG, "Unknown type\n");
return FALSE; return FALSE;

View File

@ -113,7 +113,7 @@ static BOOL DEBUG_IntVarsRW(int read)
for (i = 0; i < DBG_IV_LAST; i++) { for (i = 0; i < DBG_IV_LAST; i++) {
if (read) { if (read) {
if (!DEBUG_IntVars[i].pval) { if (!DEBUG_IntVars[i].pval) {
if (!RegQueryValueEx(hkey, DEBUG_IntVars[i].name, 0, if (!RegQueryValueEx(hkey, DEBUG_IntVars[i].name, 0,
&type, (LPSTR)&val, &count)) &type, (LPSTR)&val, &count))
DEBUG_IntVars[i].val = val; DEBUG_IntVars[i].val = val;
DEBUG_IntVars[i].pval = &DEBUG_IntVars[i].val; DEBUG_IntVars[i].pval = &DEBUG_IntVars[i].val;
@ -123,7 +123,7 @@ static BOOL DEBUG_IntVarsRW(int read)
} else { } else {
/* FIXME: type should be infered from basic type -if any- of intvar */ /* FIXME: type should be infered from basic type -if any- of intvar */
if (DEBUG_IntVars[i].pval == &DEBUG_IntVars[i].val) if (DEBUG_IntVars[i].pval == &DEBUG_IntVars[i].val)
RegSetValueEx(hkey, DEBUG_IntVars[i].name, 0, RegSetValueEx(hkey, DEBUG_IntVars[i].name, 0,
type, (LPCVOID)DEBUG_IntVars[i].pval, count); type, (LPCVOID)DEBUG_IntVars[i].pval, count);
} }
} }
@ -141,7 +141,7 @@ DBG_INTVAR* DEBUG_GetIntVar(const char* name)
} }
return NULL; return NULL;
} }
static WINE_EXCEPTION_FILTER(wine_dbg) static WINE_EXCEPTION_FILTER(wine_dbg)
{ {
DEBUG_Printf(DBG_CHN_MESG, "\nwine_dbg: Exception (%lx) inside debugger, continuing...\n", GetExceptionCode()); DEBUG_Printf(DBG_CHN_MESG, "\nwine_dbg: Exception (%lx) inside debugger, continuing...\n", GetExceptionCode());
@ -152,7 +152,7 @@ static WINE_EXCEPTION_FILTER(wine_dbg)
DBG_PROCESS* DEBUG_GetProcess(DWORD pid) DBG_PROCESS* DEBUG_GetProcess(DWORD pid)
{ {
DBG_PROCESS* p; DBG_PROCESS* p;
for (p = DEBUG_ProcessList; p; p = p->next) for (p = DEBUG_ProcessList; p; p = p->next)
if (p->pid == pid) break; if (p->pid == pid) break;
return p; return p;
@ -220,11 +220,11 @@ static BOOL DEBUG_ProcessGetStringIndirect(char* buffer, int size, HANDLE hp, LP
{ {
LPVOID ad; LPVOID ad;
DWORD sz; DWORD sz;
if ( addr if ( addr
&& ReadProcessMemory(hp, addr, &ad, sizeof(ad), &sz) && ReadProcessMemory(hp, addr, &ad, sizeof(ad), &sz)
&& sz == sizeof(ad) && sz == sizeof(ad)
&& ad && ad
&& ReadProcessMemory(hp, ad, buffer, size, &sz)) && ReadProcessMemory(hp, ad, buffer, size, &sz))
return TRUE; return TRUE;
*(WCHAR*)buffer = 0; *(WCHAR*)buffer = 0;
@ -234,19 +234,19 @@ static BOOL DEBUG_ProcessGetStringIndirect(char* buffer, int size, HANDLE hp, LP
DBG_THREAD* DEBUG_GetThread(DBG_PROCESS* p, DWORD tid) DBG_THREAD* DEBUG_GetThread(DBG_PROCESS* p, DWORD tid)
{ {
DBG_THREAD* t; DBG_THREAD* t;
for (t = p->threads; t; t = t->next) for (t = p->threads; t; t = t->next)
if (t->tid == tid) break; if (t->tid == tid) break;
return t; return t;
} }
static DBG_THREAD* DEBUG_AddThread(DBG_PROCESS* p, DWORD tid, static DBG_THREAD* DEBUG_AddThread(DBG_PROCESS* p, DWORD tid,
HANDLE h, LPVOID start, LPVOID teb) HANDLE h, LPVOID start, LPVOID teb)
{ {
DBG_THREAD* t = DBG_alloc(sizeof(DBG_THREAD)); DBG_THREAD* t = DBG_alloc(sizeof(DBG_THREAD));
if (!t) if (!t)
return NULL; return NULL;
t->handle = h; t->handle = h;
t->tid = tid; t->tid = tid;
t->start = start; t->start = start;
@ -270,10 +270,10 @@ static DBG_THREAD* DEBUG_AddThread(DBG_PROCESS* p, DWORD tid,
static void DEBUG_InitCurrThread(void) static void DEBUG_InitCurrThread(void)
{ {
if (DEBUG_CurrThread->start) { if (DEBUG_CurrThread->start) {
if (DEBUG_CurrThread->process->num_threads == 1 || if (DEBUG_CurrThread->process->num_threads == 1 ||
DBG_IVAR(BreakAllThreadsStartup)) { DBG_IVAR(BreakAllThreadsStartup)) {
DBG_VALUE value; DBG_VALUE value;
DEBUG_SetBreakpoints(FALSE); DEBUG_SetBreakpoints(FALSE);
value.type = NULL; value.type = NULL;
value.cookie = DV_TARGET; value.cookie = DV_TARGET;
@ -315,7 +315,7 @@ BOOL DEBUG_Detach(void)
{ {
/* remove all set breakpoints in debuggee code */ /* remove all set breakpoints in debuggee code */
DEBUG_SetBreakpoints(FALSE); DEBUG_SetBreakpoints(FALSE);
/* needed for single stepping (ugly). /* needed for single stepping (ugly).
* should this be handled inside the server ??? */ * should this be handled inside the server ??? */
#ifdef __i386__ #ifdef __i386__
DEBUG_context.EFlags &= ~STEP_FLAG; DEBUG_context.EFlags &= ~STEP_FLAG;
@ -357,11 +357,11 @@ static BOOL DEBUG_ExceptionProlog(BOOL is_debug, BOOL force, DWORD code)
} }
DEBUG_Printf(DBG_CHN_MESG, ".\n"); DEBUG_Printf(DBG_CHN_MESG, ".\n");
} }
DEBUG_LoadEntryPoints("Loading new modules symbols:\n"); DEBUG_LoadEntryPoints("Loading new modules symbols:\n");
if (!force && is_debug && if (!force && is_debug &&
DEBUG_ShouldContinue(&addr, code, DEBUG_ShouldContinue(&addr, code,
&DEBUG_CurrThread->exec_count)) &DEBUG_CurrThread->exec_count))
return FALSE; return FALSE;
@ -407,7 +407,7 @@ static BOOL DEBUG_ExceptionProlog(BOOL is_debug, BOOL force, DWORD code)
DEBUG_DisassembleInstruction(&addr); DEBUG_DisassembleInstruction(&addr);
/* resets list internal arguments so we can look at source code when needed */ /* resets list internal arguments so we can look at source code when needed */
DEBUG_FindNearestSymbol(&addr, TRUE, NULL, 0, &list); DEBUG_FindNearestSymbol(&addr, TRUE, NULL, 0, &list);
if (list.sourcefile) DEBUG_List(&list, NULL, 0); if (list.sourcefile) DEBUG_List(&list, NULL, 0);
} }
return TRUE; return TRUE;
@ -490,7 +490,7 @@ static void DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_chance, BOOL
break; break;
case EXCEPTION_ACCESS_VIOLATION: case EXCEPTION_ACCESS_VIOLATION:
if (rec->NumberParameters == 2) if (rec->NumberParameters == 2)
DEBUG_Printf(DBG_CHN_MESG, "page fault on %s access to 0x%08lx", DEBUG_Printf(DBG_CHN_MESG, "page fault on %s access to 0x%08lx",
rec->ExceptionInformation[0] ? "write" : "read", rec->ExceptionInformation[0] ? "write" : "read",
rec->ExceptionInformation[1]); rec->ExceptionInformation[1]);
else else
@ -548,10 +548,10 @@ static void DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_chance, BOOL
} }
#if 0 #if 0
DEBUG_Printf(DBG_CHN_TRACE, DEBUG_Printf(DBG_CHN_TRACE,
"Entering debugger PC=%lx EFL=%08lx mode=%d count=%d\n", "Entering debugger PC=%lx EFL=%08lx mode=%d count=%d\n",
#ifdef __i386__ #ifdef __i386__
DEBUG_context.Eip, DEBUG_context.EFlags, DEBUG_context.Eip, DEBUG_context.EFlags,
#else #else
0L, 0L, 0L, 0L,
#endif #endif
@ -583,10 +583,10 @@ static void DEBUG_HandleException(EXCEPTION_RECORD *rec, BOOL first_chance, BOOL
DEBUG_ExceptionEpilog(); DEBUG_ExceptionEpilog();
#if 0 #if 0
DEBUG_Printf(DBG_CHN_TRACE, DEBUG_Printf(DBG_CHN_TRACE,
"Exiting debugger PC=%lx EFL=%08lx mode=%d count=%d\n", "Exiting debugger PC=%lx EFL=%08lx mode=%d count=%d\n",
#ifdef __i386__ #ifdef __i386__
DEBUG_context.Eip, DEBUG_context.EFlags, DEBUG_context.Eip, DEBUG_context.EFlags,
#else #else
0L, 0L, 0L, 0L,
#endif #endif
@ -605,9 +605,9 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
__TRY { __TRY {
if ((DEBUG_CurrProcess = DEBUG_GetProcess(de->dwProcessId)) != NULL) if ((DEBUG_CurrProcess = DEBUG_GetProcess(de->dwProcessId)) != NULL)
DEBUG_CurrThread = DEBUG_GetThread(DEBUG_CurrProcess, de->dwThreadId); DEBUG_CurrThread = DEBUG_GetThread(DEBUG_CurrProcess, de->dwThreadId);
else else
DEBUG_CurrThread = NULL; DEBUG_CurrThread = NULL;
switch (de->dwDebugEventCode) { switch (de->dwDebugEventCode) {
case EXCEPTION_DEBUG_EVENT: case EXCEPTION_DEBUG_EVENT:
if (!DEBUG_CurrThread) { if (!DEBUG_CurrThread) {
@ -615,9 +615,9 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
de->dwProcessId, de->dwThreadId); de->dwProcessId, de->dwThreadId);
break; break;
} }
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exception code=%08lx\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exception code=%08lx\n",
de->dwProcessId, de->dwThreadId, de->dwProcessId, de->dwThreadId,
de->u.Exception.ExceptionRecord.ExceptionCode); de->u.Exception.ExceptionRecord.ExceptionCode);
if (DEBUG_CurrProcess->continue_on_first_exception) { if (DEBUG_CurrProcess->continue_on_first_exception) {
@ -641,20 +641,20 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
DEBUG_Printf(DBG_CHN_WARN, "Can't get thread's context\n"); DEBUG_Printf(DBG_CHN_WARN, "Can't get thread's context\n");
break; break;
} }
DEBUG_HandleException(&de->u.Exception.ExceptionRecord, DEBUG_HandleException(&de->u.Exception.ExceptionRecord,
de->u.Exception.dwFirstChance, de->u.Exception.dwFirstChance,
DEBUG_CurrThread->wait_for_first_exception); DEBUG_CurrThread->wait_for_first_exception);
if (DEBUG_CurrThread) { if (DEBUG_CurrThread) {
DEBUG_CurrThread->wait_for_first_exception = 0; DEBUG_CurrThread->wait_for_first_exception = 0;
SetThreadContext(DEBUG_CurrThread->handle, &DEBUG_context); SetThreadContext(DEBUG_CurrThread->handle, &DEBUG_context);
} }
break; break;
case CREATE_THREAD_DEBUG_EVENT: case CREATE_THREAD_DEBUG_EVENT:
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create thread D @%08lx\n", de->dwProcessId, de->dwThreadId, DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create thread D @%08lx\n", de->dwProcessId, de->dwThreadId,
(unsigned long)(LPVOID)de->u.CreateThread.lpStartAddress); (unsigned long)(LPVOID)de->u.CreateThread.lpStartAddress);
if (DEBUG_CurrProcess == NULL) { if (DEBUG_CurrProcess == NULL) {
DEBUG_Printf(DBG_CHN_ERR, "Unknown process\n"); DEBUG_Printf(DBG_CHN_ERR, "Unknown process\n");
break; break;
@ -663,11 +663,11 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
DEBUG_Printf(DBG_CHN_TRACE, "Thread already listed, skipping\n"); DEBUG_Printf(DBG_CHN_TRACE, "Thread already listed, skipping\n");
break; break;
} }
DEBUG_CurrThread = DEBUG_AddThread(DEBUG_CurrProcess, DEBUG_CurrThread = DEBUG_AddThread(DEBUG_CurrProcess,
de->dwThreadId, de->dwThreadId,
de->u.CreateThread.hThread, de->u.CreateThread.hThread,
de->u.CreateThread.lpStartAddress, de->u.CreateThread.lpStartAddress,
de->u.CreateThread.lpThreadLocalBase); de->u.CreateThread.lpThreadLocalBase);
if (!DEBUG_CurrThread) { if (!DEBUG_CurrThread) {
DEBUG_Printf(DBG_CHN_ERR, "Couldn't create thread\n"); DEBUG_Printf(DBG_CHN_ERR, "Couldn't create thread\n");
@ -675,20 +675,20 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
} }
DEBUG_InitCurrThread(); DEBUG_InitCurrThread();
break; break;
case CREATE_PROCESS_DEBUG_EVENT: case CREATE_PROCESS_DEBUG_EVENT:
DEBUG_ProcessGetStringIndirect(buffer, sizeof(buffer), DEBUG_ProcessGetStringIndirect(buffer, sizeof(buffer),
de->u.CreateProcessInfo.hProcess, de->u.CreateProcessInfo.hProcess,
de->u.CreateProcessInfo.lpImageName); de->u.CreateProcessInfo.lpImageName);
/* FIXME unicode ? de->u.CreateProcessInfo.fUnicode */ /* FIXME unicode ? de->u.CreateProcessInfo.fUnicode */
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create process '%s'/%p @%08lx (%ld<%ld>)\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create process '%s'/%p @%08lx (%ld<%ld>)\n",
de->dwProcessId, de->dwThreadId, de->dwProcessId, de->dwThreadId,
buffer, de->u.CreateProcessInfo.lpImageName, buffer, de->u.CreateProcessInfo.lpImageName,
(unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress, (unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress,
de->u.CreateProcessInfo.dwDebugInfoFileOffset, de->u.CreateProcessInfo.dwDebugInfoFileOffset,
de->u.CreateProcessInfo.nDebugInfoSize); de->u.CreateProcessInfo.nDebugInfoSize);
if ((DEBUG_CurrProcess = DEBUG_GetProcess(de->dwProcessId)) != NULL) { if ((DEBUG_CurrProcess = DEBUG_GetProcess(de->dwProcessId)) != NULL) {
if (DEBUG_CurrProcess->handle) { if (DEBUG_CurrProcess->handle) {
DEBUG_Printf(DBG_CHN_ERR, "Skipping already defined process\n"); DEBUG_Printf(DBG_CHN_ERR, "Skipping already defined process\n");
@ -707,44 +707,44 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
break; break;
} }
} }
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create thread I @%08lx\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create thread I @%08lx\n",
de->dwProcessId, de->dwThreadId, de->dwProcessId, de->dwThreadId,
(unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress); (unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress);
DEBUG_CurrThread = DEBUG_AddThread(DEBUG_CurrProcess, DEBUG_CurrThread = DEBUG_AddThread(DEBUG_CurrProcess,
de->dwThreadId, de->dwThreadId,
de->u.CreateProcessInfo.hThread, de->u.CreateProcessInfo.hThread,
de->u.CreateProcessInfo.lpStartAddress, de->u.CreateProcessInfo.lpStartAddress,
de->u.CreateProcessInfo.lpThreadLocalBase); de->u.CreateProcessInfo.lpThreadLocalBase);
if (!DEBUG_CurrThread) { if (!DEBUG_CurrThread) {
DEBUG_Printf(DBG_CHN_ERR, "Couldn't create thread\n"); DEBUG_Printf(DBG_CHN_ERR, "Couldn't create thread\n");
break; break;
} }
DEBUG_InitCurrProcess(); DEBUG_InitCurrProcess();
DEBUG_InitCurrThread(); DEBUG_InitCurrThread();
/* module is either PE, NE or ELF module (for WineLib), but all /* module is either PE, NE or ELF module (for WineLib), but all
* are loaded with wine, so load its symbols, then the main module * are loaded with wine, so load its symbols, then the main module
*/ */
do do
{ {
char* ptr = getenv("WINELOADER"); char* ptr = getenv("WINELOADER");
if (!ptr || DEBUG_ReadExecutableDbgInfo( ptr ) == DIL_ERROR) if (!ptr || DEBUG_ReadExecutableDbgInfo( ptr ) == DIL_ERROR)
DEBUG_ReadExecutableDbgInfo( "wine" ); DEBUG_ReadExecutableDbgInfo( "wine" );
} while (0); } while (0);
DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile, DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
(DWORD)de->u.CreateProcessInfo.lpBaseOfImage); (DWORD)de->u.CreateProcessInfo.lpBaseOfImage);
break; break;
case EXIT_THREAD_DEBUG_EVENT: case EXIT_THREAD_DEBUG_EVENT:
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exit thread (%ld)\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exit thread (%ld)\n",
de->dwProcessId, de->dwThreadId, de->u.ExitThread.dwExitCode); de->dwProcessId, de->dwThreadId, de->u.ExitThread.dwExitCode);
if (DEBUG_CurrThread == NULL) { if (DEBUG_CurrThread == NULL) {
DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n"); DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n");
break; break;
@ -752,11 +752,11 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
/* FIXME: remove break point set on thread startup */ /* FIXME: remove break point set on thread startup */
DEBUG_DelThread(DEBUG_CurrThread); DEBUG_DelThread(DEBUG_CurrThread);
break; break;
case EXIT_PROCESS_DEBUG_EVENT: case EXIT_PROCESS_DEBUG_EVENT:
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exit process (%ld)\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exit process (%ld)\n",
de->dwProcessId, de->dwThreadId, de->u.ExitProcess.dwExitCode); de->dwProcessId, de->dwThreadId, de->u.ExitProcess.dwExitCode);
if (DEBUG_CurrProcess == NULL) { if (DEBUG_CurrProcess == NULL) {
DEBUG_Printf(DBG_CHN_ERR, "Unknown process\n"); DEBUG_Printf(DBG_CHN_ERR, "Unknown process\n");
break; break;
@ -769,19 +769,19 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
DEBUG_Printf(DBG_CHN_MESG, "Process of pid=%08lx has terminated\n", DEBUG_CurrPid); DEBUG_Printf(DBG_CHN_MESG, "Process of pid=%08lx has terminated\n", DEBUG_CurrPid);
break; break;
case LOAD_DLL_DEBUG_EVENT: case LOAD_DLL_DEBUG_EVENT:
if (DEBUG_CurrThread == NULL) { if (DEBUG_CurrThread == NULL) {
DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n"); DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n");
break; break;
} }
DEBUG_ProcessGetStringIndirect(buffer, sizeof(buffer), DEBUG_ProcessGetStringIndirect(buffer, sizeof(buffer),
DEBUG_CurrThread->process->handle, DEBUG_CurrThread->process->handle,
de->u.LoadDll.lpImageName); de->u.LoadDll.lpImageName);
/* FIXME unicode: de->u.LoadDll.fUnicode */ /* FIXME unicode: de->u.LoadDll.fUnicode */
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: loads DLL %s @%08lx (%ld<%ld>)\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: loads DLL %s @%08lx (%ld<%ld>)\n",
de->dwProcessId, de->dwThreadId, de->dwProcessId, de->dwThreadId,
buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll, buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll,
de->u.LoadDll.dwDebugInfoFileOffset, de->u.LoadDll.dwDebugInfoFileOffset,
de->u.LoadDll.nDebugInfoSize); de->u.LoadDll.nDebugInfoSize);
@ -789,43 +789,43 @@ static void DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, (DWORD)de->u.LoadDll.lpBaseOfDll); DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, (DWORD)de->u.LoadDll.lpBaseOfDll);
DEBUG_CheckDelayedBP(); DEBUG_CheckDelayedBP();
if (DBG_IVAR(BreakOnDllLoad)) { if (DBG_IVAR(BreakOnDllLoad)) {
DEBUG_Printf(DBG_CHN_MESG, "Stopping on DLL %s loading at %08lx\n", DEBUG_Printf(DBG_CHN_MESG, "Stopping on DLL %s loading at %08lx\n",
buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll); buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll);
DEBUG_Parser(); DEBUG_Parser();
} }
break; break;
case UNLOAD_DLL_DEBUG_EVENT: case UNLOAD_DLL_DEBUG_EVENT:
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: unload DLL @%08lx\n", de->dwProcessId, de->dwThreadId, DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: unload DLL @%08lx\n", de->dwProcessId, de->dwThreadId,
(unsigned long)de->u.UnloadDll.lpBaseOfDll); (unsigned long)de->u.UnloadDll.lpBaseOfDll);
break; break;
case OUTPUT_DEBUG_STRING_EVENT: case OUTPUT_DEBUG_STRING_EVENT:
if (DEBUG_CurrThread == NULL) { if (DEBUG_CurrThread == NULL) {
DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n"); DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n");
break; break;
} }
DEBUG_ProcessGetString(buffer, sizeof(buffer), DEBUG_ProcessGetString(buffer, sizeof(buffer),
DEBUG_CurrThread->process->handle, DEBUG_CurrThread->process->handle,
de->u.DebugString.lpDebugStringData); de->u.DebugString.lpDebugStringData);
/* FIXME unicode de->u.DebugString.fUnicode ? */ /* FIXME unicode de->u.DebugString.fUnicode ? */
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: output debug string (%s)\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: output debug string (%s)\n",
de->dwProcessId, de->dwThreadId, buffer); de->dwProcessId, de->dwThreadId, buffer);
break; break;
case RIP_EVENT: case RIP_EVENT:
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: rip error=%ld type=%ld\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: rip error=%ld type=%ld\n",
de->dwProcessId, de->dwThreadId, de->u.RipInfo.dwError, de->dwProcessId, de->dwThreadId, de->u.RipInfo.dwError,
de->u.RipInfo.dwType); de->u.RipInfo.dwType);
break; break;
default: default:
DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: unknown event (%ld)\n", DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: unknown event (%ld)\n",
de->dwProcessId, de->dwThreadId, de->dwDebugEventCode); de->dwProcessId, de->dwThreadId, de->dwDebugEventCode);
} }
} __EXCEPT(wine_dbg) { } __EXCEPT(wine_dbg) {
DEBUG_ExitMode = EXIT_CONTINUE; DEBUG_ExitMode = EXIT_CONTINUE;
} }
@ -837,8 +837,8 @@ static DWORD DEBUG_MainLoop(void)
DEBUG_EVENT de; DEBUG_EVENT de;
DEBUG_Printf(DBG_CHN_MESG, " on pid %lx\n", DEBUG_CurrPid); DEBUG_Printf(DBG_CHN_MESG, " on pid %lx\n", DEBUG_CurrPid);
while (DEBUG_ExitMode == EXIT_CONTINUE) while (DEBUG_ExitMode == EXIT_CONTINUE)
{ {
/* wait until we get at least one loaded process */ /* wait until we get at least one loaded process */
while (!DEBUG_ProcessList) while (!DEBUG_ProcessList)
@ -848,12 +848,12 @@ static DWORD DEBUG_MainLoop(void)
} }
if (DEBUG_ExitMode != EXIT_CONTINUE) break; if (DEBUG_ExitMode != EXIT_CONTINUE) break;
while ((DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_PASS) && while ((DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_PASS) &&
DEBUG_ProcessList && DEBUG_ProcessList &&
WaitForDebugEvent(&de, INFINITE)) WaitForDebugEvent(&de, INFINITE))
{ {
DEBUG_HandleDebugEvent(&de); DEBUG_HandleDebugEvent(&de);
ContinueDebugEvent(de.dwProcessId, de.dwThreadId, ContinueDebugEvent(de.dwProcessId, de.dwThreadId,
(DEBUG_ExitMode == EXIT_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE); (DEBUG_ExitMode == EXIT_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE);
} }
if (DEBUG_ExitMode == EXIT_DETACH && DEBUG_Detach()) if (DEBUG_ExitMode == EXIT_DETACH && DEBUG_Detach())
@ -865,7 +865,7 @@ static DWORD DEBUG_MainLoop(void)
DEBUG_ExitMode = EXIT_QUIT; DEBUG_ExitMode = EXIT_QUIT;
} }
} }
DEBUG_Printf(DBG_CHN_MESG, "WineDbg terminated on pid %lx\n", DEBUG_CurrPid); DEBUG_Printf(DBG_CHN_MESG, "WineDbg terminated on pid %lx\n", DEBUG_CurrPid);
return 0; return 0;
@ -878,11 +878,11 @@ static DWORD DEBUG_AutoMode(void)
DEBUG_Printf(DBG_CHN_MESG, " on pid %lx\n", DEBUG_CurrPid); DEBUG_Printf(DBG_CHN_MESG, " on pid %lx\n", DEBUG_CurrPid);
while ((DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_PASS) && while ((DEBUG_ExitMode == EXIT_CONTINUE || DEBUG_ExitMode == EXIT_PASS) &&
DEBUG_ProcessList && DEBUG_ProcessList &&
WaitForDebugEvent(&de, INFINITE)) WaitForDebugEvent(&de, INFINITE))
{ {
DEBUG_HandleDebugEvent(&de); DEBUG_HandleDebugEvent(&de);
ContinueDebugEvent(de.dwProcessId, de.dwThreadId, ContinueDebugEvent(de.dwProcessId, de.dwThreadId,
(DEBUG_ExitMode == EXIT_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE); (DEBUG_ExitMode == EXIT_PASS) ? DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE);
} }
/* print some extra information */ /* print some extra information */
@ -904,8 +904,8 @@ static BOOL DEBUG_Start(LPSTR cmdLine)
startup.cb = sizeof(startup); startup.cb = sizeof(startup);
startup.dwFlags = STARTF_USESHOWWINDOW; startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL; startup.wShowWindow = SW_SHOWNORMAL;
if (!CreateProcess(NULL, cmdLine, NULL, NULL, if (!CreateProcess(NULL, cmdLine, NULL, NULL,
FALSE, DEBUG_PROCESS|DETACHED_PROCESS, NULL, NULL, &startup, &info)) { FALSE, DEBUG_PROCESS|DETACHED_PROCESS, NULL, NULL, &startup, &info)) {
DEBUG_Printf(DBG_CHN_MESG, "Couldn't start process '%s'\n", cmdLine); DEBUG_Printf(DBG_CHN_MESG, "Couldn't start process '%s'\n", cmdLine);
return FALSE; return FALSE;
@ -938,10 +938,10 @@ static void DEBUG_InitConsole(void)
SMALL_RECT sr; SMALL_RECT sr;
DWORD mode; DWORD mode;
/* keep it as a cuiexe for now, so that Wine won't touch the Unix stdin, /* keep it as a cuiexe for now, so that Wine won't touch the Unix stdin,
* stdout and stderr streams * stdout and stderr streams
*/ */
if (DBG_IVAR(UseXTerm)) if (DBG_IVAR(UseXTerm))
{ {
FreeConsole(); FreeConsole();
AllocConsole(); AllocConsole();
@ -970,7 +970,7 @@ int main(int argc, char** argv)
/* Initialize the type handling stuff. */ /* Initialize the type handling stuff. */
DEBUG_InitTypes(); DEBUG_InitTypes();
DEBUG_InitCVDataTypes(); DEBUG_InitCVDataTypes();
/* Initialize internal vars (types must have been initialized before) */ /* Initialize internal vars (types must have been initialized before) */
if (!DEBUG_IntVarsRW(TRUE)) return -1; if (!DEBUG_IntVarsRW(TRUE)) return -1;
@ -988,9 +988,9 @@ int main(int argc, char** argv)
} }
DEBUG_InitConsole(); DEBUG_InitConsole();
DEBUG_Printf(DBG_CHN_MESG, "WineDbg starting... "); DEBUG_Printf(DBG_CHN_MESG, "WineDbg starting... ");
if (argc == 3) { if (argc == 3) {
HANDLE hEvent; HANDLE hEvent;
DWORD pid; DWORD pid;
@ -1009,11 +1009,11 @@ int main(int argc, char** argv)
DEBUG_CurrPid = pid; DEBUG_CurrPid = pid;
} }
} }
if (DEBUG_CurrPid == 0 && argc > 1) { if (DEBUG_CurrPid == 0 && argc > 1) {
int i, len; int i, len;
LPSTR cmdLine; LPSTR cmdLine;
if (!(cmdLine = DBG_alloc(len = 1))) goto oom_leave; if (!(cmdLine = DBG_alloc(len = 1))) goto oom_leave;
cmdLine[0] = '\0'; cmdLine[0] = '\0';

View File

@ -160,7 +160,7 @@ OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
/****************************************************************************** /******************************************************************************
* OpenEventLogA [ADVAPI32.@] * OpenEventLogA [ADVAPI32.@]
*/ */
HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source) HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source)
{ {
FIXME("(%s,%s),stub!\n",uncname,source); FIXME("(%s,%s),stub!\n",uncname,source);
return 0xcafe4242; return 0xcafe4242;
@ -204,7 +204,7 @@ BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOf
*/ */
BOOL WINAPI BOOL WINAPI
ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded ) DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
{ {
FIXME("stub\n"); FIXME("stub\n");
@ -269,8 +269,8 @@ BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD d
* lpRawData [] * lpRawData []
*/ */
BOOL WINAPI BOOL WINAPI
ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory,
DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings,
DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData ) DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
{ {
FIXME("stub\n"); FIXME("stub\n");

View File

@ -76,7 +76,7 @@ inline static int is_version_nt(void)
* FIXME MAXIMUM_ALLOWED in access mask not supported by server * FIXME MAXIMUM_ALLOWED in access mask not supported by server
*/ */
DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR class, DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR class,
DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa, DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa,
LPHKEY retkey, LPDWORD dispos ) LPHKEY retkey, LPDWORD dispos )
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
@ -105,7 +105,7 @@ DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR cl
* FIXME MAXIMUM_ALLOWED in access mask not supported by server * FIXME MAXIMUM_ALLOWED in access mask not supported by server
*/ */
DWORD WINAPI RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR class, DWORD WINAPI RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR class,
DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa, DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa,
LPHKEY retkey, LPDWORD dispos ) LPHKEY retkey, LPDWORD dispos )
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
@ -442,9 +442,9 @@ DWORD WINAPI RegEnumKeyA( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
* security [O] Buffer for security descriptor length * security [O] Buffer for security descriptor length
* modif [O] Modification time * modif [O] Modification time
* *
* - win95 allows class to be valid and class_len to be NULL * - win95 allows class to be valid and class_len to be NULL
* - winnt returns ERROR_INVALID_PARAMETER if class is valid and class_len is NULL * - winnt returns ERROR_INVALID_PARAMETER if class is valid and class_len is NULL
* - both allow class to be NULL and class_len to be NULL * - both allow class to be NULL and class_len to be NULL
* (it's hard to test validity, so test !NULL instead) * (it's hard to test validity, so test !NULL instead)
*/ */
DWORD WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPDWORD reserved, DWORD WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPDWORD reserved,
@ -652,7 +652,7 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
* Failure: Error code * Failure: Error code
* *
* NOTES * NOTES
* win95 does not care about count for REG_SZ and finds out the len by itself (js) * win95 does not care about count for REG_SZ and finds out the len by itself (js)
* NT does definitely care (aj) * NT does definitely care (aj)
*/ */
DWORD WINAPI RegSetValueExW( HKEY hkey, LPCWSTR name, DWORD reserved, DWORD WINAPI RegSetValueExW( HKEY hkey, LPCWSTR name, DWORD reserved,
@ -780,7 +780,7 @@ DWORD WINAPI RegSetValueA( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWOR
* not required. * not required.
* count [I/O] Address of data buffer size * count [I/O] Address of data buffer size
* *
* RETURNS * RETURNS
* ERROR_SUCCESS: Success * ERROR_SUCCESS: Success
* ERROR_MORE_DATA: !!! if the specified buffer is not big enough to hold the data * ERROR_MORE_DATA: !!! if the specified buffer is not big enough to hold the data
* buffer is left untouched. The MS-documentation is wrong (js) !!! * buffer is left untouched. The MS-documentation is wrong (js) !!!
@ -850,7 +850,7 @@ DWORD WINAPI RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDWORD reserved, LPDWOR
* RegQueryValueExA [ADVAPI32.@] * RegQueryValueExA [ADVAPI32.@]
* *
* NOTES: * NOTES:
* the documentation is wrong: if the buffer is too small it remains untouched * the documentation is wrong: if the buffer is too small it remains untouched
*/ */
DWORD WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWORD type, DWORD WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWORD type,
LPBYTE data, LPDWORD count ) LPBYTE data, LPDWORD count )
@ -1441,7 +1441,7 @@ LONG WINAPI RegUnLoadKeyA( HKEY hkey, LPCSTR lpSubKey )
LONG WINAPI RegReplaceKeyW( HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpNewFile, LONG WINAPI RegReplaceKeyW( HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpNewFile,
LPCWSTR lpOldFile ) LPCWSTR lpOldFile )
{ {
FIXME("(%x,%s,%s,%s): stub\n", hkey, debugstr_w(lpSubKey), FIXME("(%x,%s,%s,%s): stub\n", hkey, debugstr_w(lpSubKey),
debugstr_w(lpNewFile),debugstr_w(lpOldFile)); debugstr_w(lpNewFile),debugstr_w(lpOldFile));
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1560,7 +1560,7 @@ DWORD WINAPI RegFlushKey( HKEY hkey )
* hHey [I] Predefined registry handle * hHey [I] Predefined registry handle
* phkResult [I] Address of buffer for remote registry handle * phkResult [I] Address of buffer for remote registry handle
*/ */
LONG WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey, LONG WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey,
LPHKEY phkResult ) LPHKEY phkResult )
{ {
TRACE("(%s,%x,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult); TRACE("(%s,%x,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult);
@ -1597,7 +1597,7 @@ LONG WINAPI RegConnectRegistryA( LPCSTR machine, HKEY hkey, LPHKEY reskey )
* hEvent [I] Handle of signaled event * hEvent [I] Handle of signaled event
* fAsync [I] Flag for asynchronous reporting * fAsync [I] Flag for asynchronous reporting
*/ */
LONG WINAPI RegNotifyChangeKeyValue( HKEY hkey, BOOL fWatchSubTree, LONG WINAPI RegNotifyChangeKeyValue( HKEY hkey, BOOL fWatchSubTree,
DWORD fdwNotifyFilter, HANDLE hEvent, DWORD fdwNotifyFilter, HANDLE hEvent,
BOOL fAsync ) BOOL fAsync )
{ {

View File

@ -65,7 +65,7 @@ static void dumpLsaAttributes( PLSA_OBJECT_ATTRIBUTES oa )
* RETURNS STD * RETURNS STD
*/ */
BOOL WINAPI BOOL WINAPI
OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
HANDLE *TokenHandle ) HANDLE *TokenHandle )
{ {
CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle )); CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle ));
@ -81,7 +81,7 @@ OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess,
* thandle [] * thandle []
*/ */
BOOL WINAPI BOOL WINAPI
OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess,
BOOL OpenAsSelf, HANDLE *TokenHandle) BOOL OpenAsSelf, HANDLE *TokenHandle)
{ {
CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle)); CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle));
@ -192,7 +192,7 @@ AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
PSID *pSid ) PSID *pSid )
{ {
CallWin32ToNt (RtlAllocateAndInitializeSid( CallWin32ToNt (RtlAllocateAndInitializeSid(
pIdentifierAuthority, nSubAuthorityCount, pIdentifierAuthority, nSubAuthorityCount,
nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
pSid )); pSid ));
@ -207,7 +207,7 @@ AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
PVOID WINAPI PVOID WINAPI
FreeSid( PSID pSid ) FreeSid( PSID pSid )
{ {
RtlFreeSid(pSid); RtlFreeSid(pSid);
return NULL; /* is documented like this */ return NULL; /* is documented like this */
} }
@ -253,7 +253,7 @@ EqualSid( PSID pSid1, PSID pSid2 )
/****************************************************************************** /******************************************************************************
* EqualPrefixSid [ADVAPI32.@] * EqualPrefixSid [ADVAPI32.@]
*/ */
BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2) BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
{ {
return RtlEqualPrefixSid(pSid1, pSid2); return RtlEqualPrefixSid(pSid1, pSid2);
} }
@ -338,7 +338,7 @@ GetLengthSid (PSID pSid)
###### SECURITY DESCRIPTOR FUNCTIONS ###### ###### SECURITY DESCRIPTOR FUNCTIONS ######
############################################## ##############################################
*/ */
/****************************************************************************** /******************************************************************************
* InitializeSecurityDescriptor [ADVAPI32.@] * InitializeSecurityDescriptor [ADVAPI32.@]
* *
@ -379,7 +379,7 @@ GetSecurityDescriptorOwner( SECURITY_DESCRIPTOR *pDescr, PSID *pOwner,
* *
* PARAMS * PARAMS
*/ */
BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor,
PSID pOwner, BOOL bOwnerDefaulted) PSID pOwner, BOOL bOwnerDefaulted)
{ {
CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted)); CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted));
@ -393,7 +393,7 @@ BOOL WINAPI GetSecurityDescriptorGroup(
LPBOOL GroupDefaulted) LPBOOL GroupDefaulted)
{ {
CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted)); CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted));
} }
/****************************************************************************** /******************************************************************************
* SetSecurityDescriptorGroup [ADVAPI32.@] * SetSecurityDescriptorGroup [ADVAPI32.@]
*/ */
@ -426,12 +426,12 @@ BOOL WINAPI GetSecurityDescriptorDacl(
{ {
CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent, CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent,
pDacl, (PBOOLEAN)lpbDaclDefaulted)); pDacl, (PBOOLEAN)lpbDaclDefaulted));
} }
/****************************************************************************** /******************************************************************************
* SetSecurityDescriptorDacl [ADVAPI32.@] * SetSecurityDescriptorDacl [ADVAPI32.@]
*/ */
BOOL WINAPI BOOL WINAPI
SetSecurityDescriptorDacl ( SetSecurityDescriptorDacl (
PSECURITY_DESCRIPTOR lpsd, PSECURITY_DESCRIPTOR lpsd,
BOOL daclpresent, BOOL daclpresent,
@ -451,7 +451,7 @@ BOOL WINAPI GetSecurityDescriptorSacl(
{ {
CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd, CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd,
(PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted)); (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted));
} }
/************************************************************************** /**************************************************************************
* SetSecurityDescriptorSacl [ADVAPI32.@] * SetSecurityDescriptorSacl [ADVAPI32.@]
@ -489,7 +489,7 @@ BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescri
PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision) PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
{ {
CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision)); CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision));
} }
/* ############################## /* ##############################
###### ACL FUNCTIONS ###### ###### ACL FUNCTIONS ######
@ -526,7 +526,7 @@ DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev)
BOOL WINAPI BOOL WINAPI
LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid ) LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, LPVOID lpLuid )
{ {
FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName), FIXME("(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
debugstr_w(lpName), lpLuid); debugstr_w(lpName), lpLuid);
return TRUE; return TRUE;
} }
@ -555,7 +555,7 @@ LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, LPVOID lpLuid )
* privileges * privileges
*/ */
BOOL WINAPI BOOL WINAPI
GetFileSecurityA( LPCSTR lpFileName, GetFileSecurityA( LPCSTR lpFileName,
SECURITY_INFORMATION RequestedInformation, SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength, LPDWORD lpnLengthNeeded ) DWORD nLength, LPDWORD lpnLengthNeeded )
@ -579,12 +579,12 @@ GetFileSecurityA( LPCSTR lpFileName,
* lpnLengthNeeded [] * lpnLengthNeeded []
*/ */
BOOL WINAPI BOOL WINAPI
GetFileSecurityW( LPCWSTR lpFileName, GetFileSecurityW( LPCWSTR lpFileName,
SECURITY_INFORMATION RequestedInformation, SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength, LPDWORD lpnLengthNeeded ) DWORD nLength, LPDWORD lpnLengthNeeded )
{ {
FIXME("(%s) : stub\n", debugstr_w(lpFileName) ); FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
return TRUE; return TRUE;
} }
@ -686,11 +686,11 @@ BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
* pSecurityDescriptor [] * pSecurityDescriptor []
*/ */
BOOL WINAPI BOOL WINAPI
SetFileSecurityW( LPCWSTR lpFileName, SetFileSecurityW( LPCWSTR lpFileName,
SECURITY_INFORMATION RequestedInformation, SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor ) PSECURITY_DESCRIPTOR pSecurityDescriptor )
{ {
FIXME("(%s) : stub\n", debugstr_w(lpFileName) ); FIXME("(%s) : stub\n", debugstr_w(lpFileName) );
return TRUE; return TRUE;
} }
@ -752,7 +752,7 @@ LsaOpenPolicy(
* LsaQueryInformationPolicy [ADVAPI32.@] * LsaQueryInformationPolicy [ADVAPI32.@]
*/ */
NTSTATUS WINAPI NTSTATUS WINAPI
LsaQueryInformationPolicy( LsaQueryInformationPolicy(
IN LSA_HANDLE PolicyHandle, IN LSA_HANDLE PolicyHandle,
IN POLICY_INFORMATION_CLASS InformationClass, IN POLICY_INFORMATION_CLASS InformationClass,
OUT PVOID *Buffer) OUT PVOID *Buffer)
@ -778,7 +778,7 @@ LsaQueryInformationPolicy(
SID sid; SID sid;
}; };
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi)); struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN")); RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
xdi->ppdi.Sid = &(xdi->sid); xdi->ppdi.Sid = &(xdi->sid);
@ -789,8 +789,8 @@ LsaQueryInformationPolicy(
*Buffer = xdi; *Buffer = xdi;
} }
break; break;
case PolicyAuditLogInformation: case PolicyAuditLogInformation:
case PolicyPdAccountInformation: case PolicyPdAccountInformation:
case PolicyLsaServerRoleInformation: case PolicyLsaServerRoleInformation:
case PolicyReplicaSourceInformation: case PolicyReplicaSourceInformation:
case PolicyDefaultQuotaInformation: case PolicyDefaultQuotaInformation:
@ -803,8 +803,8 @@ LsaQueryInformationPolicy(
return FALSE; return FALSE;
} }
} }
return TRUE; return TRUE;
} }
/****************************************************************************** /******************************************************************************
* LsaLookupSids [ADVAPI32.@] * LsaLookupSids [ADVAPI32.@]
@ -816,13 +816,13 @@ typedef struct
LONG DomainIndex; LONG DomainIndex;
} LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME; } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
typedef struct typedef struct
{ {
LSA_UNICODE_STRING Name; LSA_UNICODE_STRING Name;
PSID Sid; PSID Sid;
} LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION; } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
typedef struct typedef struct
{ {
ULONG Entries; ULONG Entries;
PLSA_TRUST_INFORMATION Domains; PLSA_TRUST_INFORMATION Domains;
@ -977,7 +977,7 @@ BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult) BOOL WINAPI PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
{ {
FIXME("stub %d %p %p\n", ClientToken, RequiredPrivileges, pfResult); FIXME("stub %d %p %p\n", ClientToken, RequiredPrivileges, pfResult);
if (pfResult) if (pfResult)
*pfResult=TRUE; *pfResult=TRUE;
return TRUE; return TRUE;
} }

View File

@ -42,7 +42,7 @@ EnumServicesStatusA( SC_HANDLE hSCManager, DWORD dwServiceType,
DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices, DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices,
DWORD cbBufSize, LPDWORD pcbBytesNeeded, DWORD cbBufSize, LPDWORD pcbBytesNeeded,
LPDWORD lpServicesReturned, LPDWORD lpResumeHandle ) LPDWORD lpServicesReturned, LPDWORD lpResumeHandle )
{ FIXME("%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager, { FIXME("%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager,
dwServiceType, dwServiceState, lpServices, cbBufSize, dwServiceType, dwServiceState, lpServices, cbBufSize,
pcbBytesNeeded, lpServicesReturned, lpResumeHandle); pcbBytesNeeded, lpServicesReturned, lpResumeHandle);
SetLastError (ERROR_ACCESS_DENIED); SetLastError (ERROR_ACCESS_DENIED);
@ -57,7 +57,7 @@ EnumServicesStatusW( SC_HANDLE hSCManager, DWORD dwServiceType,
DWORD dwServiceState, LPENUM_SERVICE_STATUSW lpServices, DWORD dwServiceState, LPENUM_SERVICE_STATUSW lpServices,
DWORD cbBufSize, LPDWORD pcbBytesNeeded, DWORD cbBufSize, LPDWORD pcbBytesNeeded,
LPDWORD lpServicesReturned, LPDWORD lpResumeHandle ) LPDWORD lpServicesReturned, LPDWORD lpResumeHandle )
{ FIXME("%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager, { FIXME("%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager,
dwServiceType, dwServiceState, lpServices, cbBufSize, dwServiceType, dwServiceState, lpServices, cbBufSize,
pcbBytesNeeded, lpServicesReturned, lpResumeHandle); pcbBytesNeeded, lpServicesReturned, lpResumeHandle);
SetLastError (ERROR_ACCESS_DENIED); SetLastError (ERROR_ACCESS_DENIED);
@ -69,14 +69,14 @@ EnumServicesStatusW( SC_HANDLE hSCManager, DWORD dwServiceType,
*/ */
BOOL WINAPI BOOL WINAPI
StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent ) StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
{ {
LPSERVICE_MAIN_FUNCTIONA fpMain; LPSERVICE_MAIN_FUNCTIONA fpMain;
HANDLE wait; HANDLE wait;
DWORD dwNumServiceArgs ; DWORD dwNumServiceArgs ;
LPWSTR *lpArgVecW; LPWSTR *lpArgVecW;
LPSTR *lpArgVecA; LPSTR *lpArgVecA;
int i; int i;
TRACE("(%p)\n", servent); TRACE("(%p)\n", servent);
wait = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, "ADVAPI32_ServiceStartData"); wait = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, "ADVAPI32_ServiceStartData");
if(wait == 0) if(wait == 0)
@ -93,7 +93,7 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
/* Convert the Unicode arg vectors back to ASCII */ /* Convert the Unicode arg vectors back to ASCII */
if(dwNumServiceArgs) if(dwNumServiceArgs)
lpArgVecA = (LPSTR*) HeapAlloc( GetProcessHeap(), 0, lpArgVecA = (LPSTR*) HeapAlloc( GetProcessHeap(), 0,
dwNumServiceArgs*sizeof(LPSTR) ); dwNumServiceArgs*sizeof(LPSTR) );
else else
lpArgVecA = NULL; lpArgVecA = NULL;
@ -102,7 +102,7 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
lpArgVecA[i]=HEAP_strdupWtoA(GetProcessHeap(), 0, lpArgVecW[i]); lpArgVecA[i]=HEAP_strdupWtoA(GetProcessHeap(), 0, lpArgVecW[i]);
/* FIXME: should we blindly start all services? */ /* FIXME: should we blindly start all services? */
while (servent->lpServiceName) { while (servent->lpServiceName) {
TRACE("%s at %p)\n", debugstr_a(servent->lpServiceName),servent); TRACE("%s at %p)\n", debugstr_a(servent->lpServiceName),servent);
fpMain = servent->lpServiceProc; fpMain = servent->lpServiceProc;
@ -131,12 +131,12 @@ StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
*/ */
BOOL WINAPI BOOL WINAPI
StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent ) StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
{ {
LPSERVICE_MAIN_FUNCTIONW fpMain; LPSERVICE_MAIN_FUNCTIONW fpMain;
HANDLE wait; HANDLE wait;
DWORD dwNumServiceArgs ; DWORD dwNumServiceArgs ;
LPWSTR *lpServiceArgVectors ; LPWSTR *lpServiceArgVectors ;
TRACE("(%p)\n", servent); TRACE("(%p)\n", servent);
wait = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, "ADVAPI32_ServiceStartData"); wait = OpenSemaphoreA(SEMAPHORE_ALL_ACCESS, FALSE, "ADVAPI32_ServiceStartData");
if(wait == 0) if(wait == 0)
@ -152,7 +152,7 @@ StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
ReleaseSemaphore(wait, 1, NULL); ReleaseSemaphore(wait, 1, NULL);
/* FIXME: should we blindly start all services? */ /* FIXME: should we blindly start all services? */
while (servent->lpServiceName) { while (servent->lpServiceName) {
TRACE("%s at %p)\n", debugstr_w(servent->lpServiceName),servent); TRACE("%s at %p)\n", debugstr_w(servent->lpServiceName),servent);
fpMain = servent->lpServiceProc; fpMain = servent->lpServiceProc;
@ -172,7 +172,7 @@ SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA( LPCSTR lpServiceName, RegisterServiceCtrlHandlerA( LPCSTR lpServiceName,
LPHANDLER_FUNCTION lpfHandler ) LPHANDLER_FUNCTION lpfHandler )
{ FIXME("%s %p\n", lpServiceName, lpfHandler); { FIXME("%s %p\n", lpServiceName, lpfHandler);
return 0xcacacafe; return 0xcacacafe;
} }
/****************************************************************************** /******************************************************************************
@ -183,10 +183,10 @@ RegisterServiceCtrlHandlerA( LPCSTR lpServiceName,
* lpfHandler [] * lpfHandler []
*/ */
SERVICE_STATUS_HANDLE WINAPI SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName, RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName,
LPHANDLER_FUNCTION lpfHandler ) LPHANDLER_FUNCTION lpfHandler )
{ FIXME("%s %p\n", debugstr_w(lpServiceName), lpfHandler); { FIXME("%s %p\n", debugstr_w(lpServiceName), lpfHandler);
return 0xcacacafe; return 0xcacacafe;
} }
/****************************************************************************** /******************************************************************************
@ -215,7 +215,7 @@ SetServiceStatus( SERVICE_STATUS_HANDLE hService, LPSERVICE_STATUS lpStatus )
SC_HANDLE WINAPI SC_HANDLE WINAPI
OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName, OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName,
DWORD dwDesiredAccess ) DWORD dwDesiredAccess )
{ {
LPWSTR lpMachineNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpMachineName); LPWSTR lpMachineNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpMachineName);
LPWSTR lpDatabaseNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpDatabaseName); LPWSTR lpDatabaseNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpDatabaseName);
SC_HANDLE ret = OpenSCManagerW(lpMachineNameW,lpDatabaseNameW, SC_HANDLE ret = OpenSCManagerW(lpMachineNameW,lpDatabaseNameW,
@ -248,7 +248,7 @@ OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
HKEY hKey; HKEY hKey;
LONG r; LONG r;
TRACE("(%s,%s,0x%08lx)\n", debugstr_w(lpMachineName), TRACE("(%s,%s,0x%08lx)\n", debugstr_w(lpMachineName),
debugstr_w(lpDatabaseName), dwDesiredAccess); debugstr_w(lpDatabaseName), dwDesiredAccess);
/* /*
@ -294,7 +294,7 @@ AllocateLocallyUniqueId( PLUID lpluid )
* RETURNS STD * RETURNS STD
*/ */
BOOL WINAPI BOOL WINAPI
ControlService( SC_HANDLE hService, DWORD dwControl, ControlService( SC_HANDLE hService, DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus ) LPSERVICE_STATUS lpServiceStatus )
{ {
FIXME("(%d,%ld,%p): stub\n",hService,dwControl,lpServiceStatus); FIXME("(%d,%ld,%p): stub\n",hService,dwControl,lpServiceStatus);
@ -317,7 +317,7 @@ CloseServiceHandle( SC_HANDLE hSCObject )
TRACE("(%x)\n", hSCObject); TRACE("(%x)\n", hSCObject);
RegCloseKey(hSCObject); RegCloseKey(hSCObject);
return TRUE; return TRUE;
} }
@ -326,7 +326,7 @@ CloseServiceHandle( SC_HANDLE hSCObject )
* OpenServiceA [ADVAPI32.@] * OpenServiceA [ADVAPI32.@]
*/ */
SC_HANDLE WINAPI SC_HANDLE WINAPI
OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName, OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
DWORD dwDesiredAccess ) DWORD dwDesiredAccess )
{ {
LPWSTR lpServiceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpServiceName); LPWSTR lpServiceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpServiceName);
@ -387,11 +387,11 @@ OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName,
*/ */
SC_HANDLE WINAPI SC_HANDLE WINAPI
CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
LPCWSTR lpDisplayName, DWORD dwDesiredAccess, LPCWSTR lpDisplayName, DWORD dwDesiredAccess,
DWORD dwServiceType, DWORD dwStartType, DWORD dwServiceType, DWORD dwStartType,
DWORD dwErrorControl, LPCWSTR lpBinaryPathName, DWORD dwErrorControl, LPCWSTR lpBinaryPathName,
LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId,
LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName,
LPCWSTR lpPassword ) LPCWSTR lpPassword )
{ {
FIXME("(%u,%s,%s,...)\n", hSCManager, debugstr_w(lpServiceName), debugstr_w(lpDisplayName)); FIXME("(%u,%s,%s,...)\n", hSCManager, debugstr_w(lpServiceName), debugstr_w(lpDisplayName));
@ -404,11 +404,11 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
*/ */
SC_HANDLE WINAPI SC_HANDLE WINAPI
CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName, CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
LPCSTR lpDisplayName, DWORD dwDesiredAccess, LPCSTR lpDisplayName, DWORD dwDesiredAccess,
DWORD dwServiceType, DWORD dwStartType, DWORD dwServiceType, DWORD dwStartType,
DWORD dwErrorControl, LPCSTR lpBinaryPathName, DWORD dwErrorControl, LPCSTR lpBinaryPathName,
LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId,
LPCSTR lpDependencies, LPCSTR lpServiceStartName, LPCSTR lpDependencies, LPCSTR lpServiceStartName,
LPCSTR lpPassword ) LPCSTR lpPassword )
{ {
HKEY hKey; HKEY hKey;
@ -417,7 +417,7 @@ CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
TRACE("(%u,%s,%s,...)\n", hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName)); TRACE("(%u,%s,%s,...)\n", hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName));
r = RegCreateKeyExA(hSCManager, lpServiceName, 0, NULL, r = RegCreateKeyExA(hSCManager, lpServiceName, 0, NULL,
REG_OPTION_NON_VOLATILE, dwDesiredAccess, NULL, &hKey, &dp); REG_OPTION_NON_VOLATILE, dwDesiredAccess, NULL, &hKey, &dp);
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
@ -439,14 +439,14 @@ CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
r = RegSetValueExA(hKey, "ErrorControl", 0, REG_DWORD, r = RegSetValueExA(hKey, "ErrorControl", 0, REG_DWORD,
(LPVOID)&dwErrorControl, sizeof (DWORD) ); (LPVOID)&dwErrorControl, sizeof (DWORD) );
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
if(lpBinaryPathName) if(lpBinaryPathName)
{ {
r = RegSetValueExA(hKey, "ImagePath", 0, REG_SZ, r = RegSetValueExA(hKey, "ImagePath", 0, REG_SZ,
lpBinaryPathName,strlen(lpBinaryPathName)+1 ); lpBinaryPathName,strlen(lpBinaryPathName)+1 );
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
@ -454,28 +454,28 @@ CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
if(lpLoadOrderGroup) if(lpLoadOrderGroup)
{ {
r = RegSetValueExA(hKey, "Group", 0, REG_SZ, r = RegSetValueExA(hKey, "Group", 0, REG_SZ,
lpLoadOrderGroup, strlen(lpLoadOrderGroup)+1 ); lpLoadOrderGroup, strlen(lpLoadOrderGroup)+1 );
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
} }
r = RegSetValueExA(hKey, "ErrorControl", 0, REG_DWORD, r = RegSetValueExA(hKey, "ErrorControl", 0, REG_DWORD,
(LPVOID)&dwErrorControl, sizeof (DWORD) ); (LPVOID)&dwErrorControl, sizeof (DWORD) );
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
if(lpDependencies) if(lpDependencies)
{ {
DWORD len = 0; DWORD len = 0;
/* determine the length of a double null terminated multi string */ /* determine the length of a double null terminated multi string */
do { do {
len += (strlen(&lpDependencies[len])+1); len += (strlen(&lpDependencies[len])+1);
} while (lpDependencies[len++]); } while (lpDependencies[len++]);
/* FIXME: this should be unicode */ /* FIXME: this should be unicode */
r = RegSetValueExA(hKey, "Dependencies", 0, REG_MULTI_SZ, r = RegSetValueExA(hKey, "Dependencies", 0, REG_MULTI_SZ,
lpDependencies, len ); lpDependencies, len );
if (r!=ERROR_SUCCESS) if (r!=ERROR_SUCCESS)
return 0; return 0;
@ -526,7 +526,7 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
TRACE("(%d,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors); TRACE("(%d,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors);
if(dwNumServiceArgs) if(dwNumServiceArgs)
lpwstr = (LPWSTR*) HeapAlloc( GetProcessHeap(), 0, lpwstr = (LPWSTR*) HeapAlloc( GetProcessHeap(), 0,
dwNumServiceArgs*sizeof(LPWSTR) ); dwNumServiceArgs*sizeof(LPWSTR) );
else else
lpwstr = NULL; lpwstr = NULL;
@ -615,14 +615,14 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
} }
} }
/* /*
* FIXME: lpServiceArgsVectors need to be stored and returned to * FIXME: lpServiceArgsVectors need to be stored and returned to
* the service when it calls StartServiceCtrlDispatcher * the service when it calls StartServiceCtrlDispatcher
* *
* Chuck these in a global (yuk) so we can pass them to * Chuck these in a global (yuk) so we can pass them to
* another process - address space separation will break this. * another process - address space separation will break this.
*/ */
r = WaitForSingleObject(data,INFINITE); r = WaitForSingleObject(data,INFINITE);
if( r == WAIT_FAILED) if( r == WAIT_FAILED)
@ -635,8 +635,8 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
ZeroMemory(&startupinfo,sizeof(STARTUPINFOA)); ZeroMemory(&startupinfo,sizeof(STARTUPINFOA));
startupinfo.cb = sizeof(STARTUPINFOA); startupinfo.cb = sizeof(STARTUPINFOA);
r = CreateProcessA(path, r = CreateProcessA(path,
NULL, NULL,
NULL, /* process security attribs */ NULL, /* process security attribs */
NULL, /* thread security attribs */ NULL, /* thread security attribs */
FALSE, /* inherit handles */ FALSE, /* inherit handles */
@ -655,7 +655,7 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
/* docs for StartServiceCtrlDispatcher say this should be 30 sec */ /* docs for StartServiceCtrlDispatcher say this should be 30 sec */
r = WaitForSingleObject(wait,30000); r = WaitForSingleObject(wait,30000);
ReleaseSemaphore(data, 1, NULL); ReleaseSemaphore(data, 1, NULL);
if( r == WAIT_FAILED) if( r == WAIT_FAILED)
@ -670,7 +670,7 @@ StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
* PARAMS * PARAMS
* hService [] * hService []
* lpservicestatus [] * lpservicestatus []
* *
*/ */
BOOL WINAPI BOOL WINAPI
QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus ) QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )

View File

@ -1,4 +1,4 @@
/* /*
* Copyright 1999 Marcus Meissner * Copyright 1999 Marcus Meissner
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -144,14 +144,14 @@ static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LP
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) { static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface); ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->AddRef()\n",iface); FIXME("(%p)->AddRef()\n",iface);
return ++(This->ref); return ++(This->ref);
} }
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) { static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface); ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->Release()\n",iface); FIXME("(%p)->Release()\n",iface);
if (!--(This->ref)) { if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,iface); HeapFree(GetProcessHeap(),0,iface);
@ -253,14 +253,14 @@ static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) { static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
ICOM_THIS(IAVIStreamImpl,iface); ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->AddRef()\n",iface); FIXME("(%p)->AddRef()\n",iface);
return ++(This->ref); return ++(This->ref);
} }
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) { static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
ICOM_THIS(IAVIStreamImpl,iface); ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->Release()\n",iface); FIXME("(%p)->Release()\n",iface);
if (!--(This->ref)) { if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
@ -301,7 +301,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID fo
as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize); as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize);
memcpy(as->lpInputFormat,format,formatsize); memcpy(as->lpInputFormat,format,formatsize);
if (as->iscompressing) { if (as->iscompressing) {
int xsize; int xsize;
/* Set up the Compressor part */ /* Set up the Compressor part */
xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat); xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat);
as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize); as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize);
@ -384,7 +384,7 @@ static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,
*/ */
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) { HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
AVISTREAMINFOW psiw; AVISTREAMINFOW psiw;
/* Only the szName at the end is different */ /* Only the szName at the end is different */
memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName)); memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
MultiByteToWideChar( CP_ACP, 0, psi->szName, -1, MultiByteToWideChar( CP_ACP, 0, psi->szName, -1,
@ -481,7 +481,7 @@ HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsS
as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS); as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
/* May happen. for instance if the codec is not able to compress */ /* May happen. for instance if the codec is not able to compress */
if (!as->hic) if (!as->hic)
return AVIERR_UNSUPPORTED; return AVIERR_UNSUPPORTED;
ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO)); ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));

View File

@ -79,7 +79,7 @@ static ULONG WINAPI COMCAT_IClassFactory_Release(LPCLASSFACTORY iface)
if (InterlockedDecrement(&This->ref) == 0) { if (InterlockedDecrement(&This->ref) == 0) {
InterlockedDecrement(&dll_ref); InterlockedDecrement(&dll_ref);
} }
return This->ref;; return This->ref;
} }
/********************************************************************** /**********************************************************************

View File

@ -71,7 +71,7 @@ typedef struct
int nLoop; int nLoop;
int currFrame; int currFrame;
/* tranparency info*/ /* tranparency info*/
COLORREF transparentColor; COLORREF transparentColor;
HBRUSH hbrushBG; HBRUSH hbrushBG;
HBITMAP hbmPrevFrame; HBITMAP hbmPrevFrame;
} ANIMATE_INFO; } ANIMATE_INFO;
@ -81,8 +81,8 @@ typedef struct
static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
{ {
SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND, SendMessageA(GetParent(infoPtr->hWnd), WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif), MAKEWPARAM(GetDlgCtrlID(infoPtr->hWnd), notif),
(LPARAM)infoPtr->hWnd); (LPARAM)infoPtr->hWnd);
} }
@ -91,19 +91,19 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam
HRSRC hrsrc; HRSRC hrsrc;
MMIOINFO mminfo; MMIOINFO mminfo;
LPVOID lpAvi; LPVOID lpAvi;
hrsrc = FindResourceA(hInst, lpName, "AVI"); hrsrc = FindResourceA(hInst, lpName, "AVI");
if (!hrsrc) if (!hrsrc)
return FALSE; return FALSE;
infoPtr->hRes = LoadResource(hInst, hrsrc); infoPtr->hRes = LoadResource(hInst, hrsrc);
if (!infoPtr->hRes) if (!infoPtr->hRes)
return FALSE; return FALSE;
lpAvi = LockResource(infoPtr->hRes); lpAvi = LockResource(infoPtr->hRes);
if (!lpAvi) if (!lpAvi)
return FALSE; return FALSE;
memset(&mminfo, 0, sizeof(mminfo)); memset(&mminfo, 0, sizeof(mminfo));
mminfo.fccIOProc = FOURCC_MEM; mminfo.fccIOProc = FOURCC_MEM;
mminfo.pchBuffer = (LPSTR)lpAvi; mminfo.pchBuffer = (LPSTR)lpAvi;
@ -122,10 +122,10 @@ static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName)
{ {
infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
if (!infoPtr->hMMio) if (!infoPtr->hMMio)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
@ -135,7 +135,7 @@ static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
EnterCriticalSection(&infoPtr->cs); EnterCriticalSection(&infoPtr->cs);
/* should stop playing */ /* should stop playing */
if (infoPtr->hThread) if (infoPtr->hThread)
{ {
if (!TerminateThread(infoPtr->hThread,0)) if (!TerminateThread(infoPtr->hThread,0))
WARN("could not destroy animation thread!\n"); WARN("could not destroy animation thread!\n");
@ -197,36 +197,36 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
infoPtr->indata = infoPtr->outdata = NULL; infoPtr->indata = infoPtr->outdata = NULL;
infoPtr->hWnd = 0; infoPtr->hWnd = 0;
infoPtr->hMMio = 0; infoPtr->hMMio = 0;
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0; infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
} }
infoPtr->transparentColor = ANIMATE_COLOR_NONE; infoPtr->transparentColor = ANIMATE_COLOR_NONE;
} }
static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource) static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
{ {
HDC hdcMask; HDC hdcMask;
HBITMAP hbmMask; HBITMAP hbmMask;
HBITMAP hbmOld; HBITMAP hbmOld;
/* create a transparency mask */ /* create a transparency mask */
hdcMask = CreateCompatibleDC(hdcDest); hdcMask = CreateCompatibleDC(hdcDest);
hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL); hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
hbmOld = SelectObject(hdcMask, hbmMask); hbmOld = SelectObject(hdcMask, hbmMask);
SetBkColor(hdcSource,infoPtr->transparentColor); SetBkColor(hdcSource,infoPtr->transparentColor);
BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY); BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
/* mask the source bitmap */ /* mask the source bitmap */
SetBkColor(hdcSource, RGB(0,0,0)); SetBkColor(hdcSource, RGB(0,0,0));
SetTextColor(hdcSource, RGB(255,255,255)); SetTextColor(hdcSource, RGB(255,255,255));
BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND); BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
/* mask the destination bitmap */ /* mask the destination bitmap */
SetBkColor(hdcDest, RGB(255,255,255)); SetBkColor(hdcDest, RGB(255,255,255));
SetTextColor(hdcDest, RGB(0,0,0)); SetTextColor(hdcDest, RGB(0,0,0));
BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND); BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
/* combine source and destination */ /* combine source and destination */
@ -260,48 +260,48 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
pBitmapInfo = (LPBITMAPINFO)infoPtr->outbih; pBitmapInfo = (LPBITMAPINFO)infoPtr->outbih;
nWidth = infoPtr->outbih->biWidth; nWidth = infoPtr->outbih->biWidth;
nHeight = infoPtr->outbih->biHeight; nHeight = infoPtr->outbih->biHeight;
} else } else
{ {
pBitmapData = infoPtr->indata; pBitmapData = infoPtr->indata;
pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih; pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
nWidth = infoPtr->inbih->biWidth; nWidth = infoPtr->inbih->biWidth;
nHeight = infoPtr->inbih->biHeight; nHeight = infoPtr->inbih->biHeight;
} }
if(!infoPtr->hbmPrevFrame) if(!infoPtr->hbmPrevFrame)
{ {
infoPtr->hbmPrevFrame=CreateCompatibleBitmap(hDC, nWidth,nHeight ); infoPtr->hbmPrevFrame=CreateCompatibleBitmap(hDC, nWidth,nHeight );
} }
SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS); SetDIBits(hDC, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, (LPBITMAPINFO)pBitmapInfo, DIB_RGB_COLORS);
hdcMem = CreateCompatibleDC(hDC); hdcMem = CreateCompatibleDC(hDC);
hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame); hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame);
/* /*
* we need to get the transparent color even without ACS_TRANSPARENT, * we need to get the transparent color even without ACS_TRANSPARENT,
* because the style can be changed later on and the color should always * because the style can be changed later on and the color should always
* be obtained in the first frame * be obtained in the first frame
*/ */
if(infoPtr->transparentColor == ANIMATE_COLOR_NONE) if(infoPtr->transparentColor == ANIMATE_COLOR_NONE)
{ {
infoPtr->transparentColor = GetPixel(hdcMem,0,0); infoPtr->transparentColor = GetPixel(hdcMem,0,0);
} }
if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{ {
HDC hdcFinal = CreateCompatibleDC(hDC); HDC hdcFinal = CreateCompatibleDC(hDC);
HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal); HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
RECT rect; RECT rect;
rect.left = 0; rect.left = 0;
rect.top = 0; rect.top = 0;
rect.right = nWidth; rect.right = nWidth;
rect.bottom = nHeight; rect.bottom = nHeight;
if(!infoPtr->hbrushBG) if(!infoPtr->hbrushBG)
infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH); infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH);
@ -314,16 +314,16 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
DeleteObject(infoPtr->hbmPrevFrame); DeleteObject(infoPtr->hbmPrevFrame);
infoPtr->hbmPrevFrame = hbmFinal; infoPtr->hbmPrevFrame = hbmFinal;
} }
if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER) if (GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_CENTER)
{ {
RECT rect; RECT rect;
GetWindowRect(infoPtr->hWnd, &rect); GetWindowRect(infoPtr->hWnd, &rect);
nOffsetX = ((rect.right - rect.left) - nWidth)/2; nOffsetX = ((rect.right - rect.left) - nWidth)/2;
nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
} }
BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld); SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem); DeleteDC(hdcMem);
@ -340,9 +340,9 @@ static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET); mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
if (infoPtr->hic && if (infoPtr->hic &&
fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
LeaveCriticalSection(&infoPtr->cs); LeaveCriticalSection(&infoPtr->cs);
WARN("Decompression error\n"); WARN("Decompression error\n");
@ -371,7 +371,7 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
{ {
ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_; ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_;
HDC hDC; HDC hDC;
if(!infoPtr) if(!infoPtr)
{ {
WARN("animation structure undefined!\n"); WARN("animation structure undefined!\n");
@ -379,8 +379,8 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
} }
while(1) while(1)
{ {
if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT) if(GetWindowLongA(infoPtr->hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{ {
hDC = GetDC(infoPtr->hWnd); hDC = GetDC(infoPtr->hWnd);
/* sometimes the animation window will be destroyed in between /* sometimes the animation window will be destroyed in between
@ -388,11 +388,11 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd); infoPtr->hbrushBG = SendMessageA(GetParent(infoPtr->hWnd),WM_CTLCOLORSTATIC,hDC, infoPtr->hWnd);
ReleaseDC(infoPtr->hWnd,hDC); ReleaseDC(infoPtr->hWnd,hDC);
} }
EnterCriticalSection(&infoPtr->cs); EnterCriticalSection(&infoPtr->cs);
ANIMATE_DrawFrame(infoPtr); ANIMATE_DrawFrame(infoPtr);
LeaveCriticalSection(&infoPtr->cs); LeaveCriticalSection(&infoPtr->cs);
/* time is in microseconds, we should convert it to milliseconds */ /* time is in microseconds, we should convert it to milliseconds */
Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000); Sleep((infoPtr->mah.dwMicroSecPerFrame+500)/1000);
} }
@ -419,7 +419,7 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->nToFrame == 0xFFFF) if (infoPtr->nToFrame == 0xFFFF)
infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1; infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
TRACE("(repeat=%d from=%d to=%d);\n", TRACE("(repeat=%d from=%d to=%d);\n",
infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame); infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
if (infoPtr->nFromFrame >= infoPtr->nToFrame || if (infoPtr->nFromFrame >= infoPtr->nToFrame ||
@ -442,9 +442,9 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
ERR("Could not create animation thread!\n"); ERR("Could not create animation thread!\n");
return FALSE; return FALSE;
} }
} }
ANIMATE_Notify(infoPtr, ACN_START); ANIMATE_Notify(infoPtr, ACN_START);
return TRUE; return TRUE;
@ -512,13 +512,13 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash)); mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)), TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)),
HIBYTE(LOWORD(infoPtr->ash.fccType)), HIBYTE(LOWORD(infoPtr->ash.fccType)),
LOBYTE(HIWORD(infoPtr->ash.fccType)), LOBYTE(HIWORD(infoPtr->ash.fccType)),
HIBYTE(HIWORD(infoPtr->ash.fccType))); HIBYTE(HIWORD(infoPtr->ash.fccType)));
TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)), TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)),
HIBYTE(LOWORD(infoPtr->ash.fccHandler)), HIBYTE(LOWORD(infoPtr->ash.fccHandler)),
LOBYTE(HIWORD(infoPtr->ash.fccHandler)), LOBYTE(HIWORD(infoPtr->ash.fccHandler)),
HIBYTE(HIWORD(infoPtr->ash.fccHandler))); HIBYTE(HIWORD(infoPtr->ash.fccHandler)));
TRACE("ash.dwFlags=%ld\n", infoPtr->ash.dwFlags); TRACE("ash.dwFlags=%ld\n", infoPtr->ash.dwFlags);
TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority); TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority);
@ -531,7 +531,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
TRACE("ash.dwSuggestedBufferSize=%ld\n", infoPtr->ash.dwSuggestedBufferSize); TRACE("ash.dwSuggestedBufferSize=%ld\n", infoPtr->ash.dwSuggestedBufferSize);
TRACE("ash.dwQuality=%ld\n", infoPtr->ash.dwQuality); TRACE("ash.dwQuality=%ld\n", infoPtr->ash.dwQuality);
TRACE("ash.dwSampleSize=%ld\n", infoPtr->ash.dwSampleSize); TRACE("ash.dwSampleSize=%ld\n", infoPtr->ash.dwSampleSize);
TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left, TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right); infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
mmioAscend(infoPtr->hMMio, &mmckInfo, 0); mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
@ -565,10 +565,10 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
mmioAscend(infoPtr->hMMio, &mmckInfo, 0); mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
mmioAscend(infoPtr->hMMio, &mmckList, 0); mmioAscend(infoPtr->hMMio, &mmckList, 0);
#if 0 #if 0
/* an AVI has 0 or 1 video stream, and to be animated should not contain /* an AVI has 0 or 1 video stream, and to be animated should not contain
* an audio stream, so only one strl is allowed * an audio stream, so only one strl is allowed
*/ */
mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l'); mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) { if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
@ -589,7 +589,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
/* FIXME: should handle the 'rec ' LIST when present */ /* FIXME: should handle the 'rec ' LIST when present */
infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
infoPtr->mah.dwTotalFrames * sizeof(DWORD)); infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex) { if (!infoPtr->lpIndex) {
WARN("Can't alloc index array\n"); WARN("Can't alloc index array\n");
@ -597,7 +597,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
} }
numFrame = insize = 0; numFrame = insize = 0;
while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
numFrame < infoPtr->mah.dwTotalFrames) { numFrame < infoPtr->mah.dwTotalFrames) {
infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset; infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
if (insize < mmckInfo.cksize) if (insize < mmckInfo.cksize)
@ -633,7 +633,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
(infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')) || (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')) ||
(infoPtr->ash.fccHandler == mmioFOURCC(0, 0, 0, 0))) (infoPtr->ash.fccHandler == mmioFOURCC(0, 0, 0, 0)))
{ {
infoPtr->hic = 0; infoPtr->hic = 0;
return TRUE; return TRUE;
} }
@ -643,8 +643,8 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
WARN("Can't load codec for the file\n"); WARN("Can't load codec for the file\n");
return FALSE; return FALSE;
} }
outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD)infoPtr->inbih, 0L); (DWORD)infoPtr->inbih, 0L);
infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
@ -653,7 +653,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return FALSE; return FALSE;
} }
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
WARN("Can't get output BIH\n"); WARN("Can't get output BIH\n");
return FALSE; return FALSE;
@ -665,7 +665,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return FALSE; return FALSE;
} }
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
WARN("Can't begin decompression\n"); WARN("Can't begin decompression\n");
return FALSE; return FALSE;
@ -686,7 +686,7 @@ static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam)
TRACE("Closing avi!\n"); TRACE("Closing avi!\n");
return TRUE; return TRUE;
} }
if (!hInstance) if (!hInstance)
hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE); hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE);
@ -786,7 +786,7 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
infoPtr->hbmPrevFrame = 0; infoPtr->hbmPrevFrame = 0;
InitializeCriticalSection(&infoPtr->cs); InitializeCriticalSection(&infoPtr->cs);
return 0; return 0;
} }
@ -810,11 +810,11 @@ static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam) static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam)
{ {
RECT rect; RECT rect;
HBRUSH hBrush = 0; HBRUSH hBrush = 0;
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{ {
hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); hBrush = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
} }
GetClientRect(hWnd, &rect); GetClientRect(hWnd, &rect);
@ -840,27 +840,27 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
{ {
case ACM_OPENA: case ACM_OPENA:
return ANIMATE_OpenA(hWnd, wParam, lParam); return ANIMATE_OpenA(hWnd, wParam, lParam);
/* case ACM_OPEN32W: FIXME!! */ /* case ACM_OPEN32W: FIXME!! */
/* return ANIMATE_Open32W(hWnd, wParam, lParam); */ /* return ANIMATE_Open32W(hWnd, wParam, lParam); */
case ACM_PLAY: case ACM_PLAY:
return ANIMATE_Play(hWnd, wParam, lParam); return ANIMATE_Play(hWnd, wParam, lParam);
case ACM_STOP: case ACM_STOP:
return ANIMATE_Stop(hWnd, wParam, lParam); return ANIMATE_Stop(hWnd, wParam, lParam);
case WM_NCCREATE: case WM_NCCREATE:
ANIMATE_Create(hWnd, wParam, lParam); ANIMATE_Create(hWnd, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam); return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_NCHITTEST: case WM_NCHITTEST:
return HTTRANSPARENT; return HTTRANSPARENT;
case WM_DESTROY: case WM_DESTROY:
ANIMATE_Destroy(hWnd, wParam, lParam); ANIMATE_Destroy(hWnd, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam); return DefWindowProcA(hWnd, uMsg, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
ANIMATE_EraseBackground(hWnd, wParam, lParam); ANIMATE_EraseBackground(hWnd, wParam, lParam);
break; break;
@ -874,7 +874,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd); infoPtr->hbrushBG = SendMessageA(GetParent(hWnd),WM_CTLCOLORSTATIC,(HDC)wParam, hWnd);
} }
return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd)); return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
case WM_CLOSE: case WM_CLOSE:
ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd)); ANIMATE_Free(ANIMATE_GetInfoPtr(hWnd));
return TRUE; return TRUE;
@ -882,16 +882,16 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
case WM_PAINT: case WM_PAINT:
{ {
ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* the animation isn't playing, don't paint */ /* the animation isn't playing, don't paint */
if(!infoPtr->uTimer && !infoPtr->hThread) if(!infoPtr->uTimer && !infoPtr->hThread)
/* default paint handling */ /* default paint handling */
return DefWindowProcA(hWnd, uMsg, wParam, lParam); return DefWindowProcA(hWnd, uMsg, wParam, lParam);
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC, infoPtr->hbrushBG = SendMessageA(GetParent(hWnd), WM_CTLCOLORSTATIC,
(HDC)wParam, hWnd); (HDC)wParam, hWnd);
if (wParam) if (wParam)
{ {
EnterCriticalSection(&infoPtr->cs); EnterCriticalSection(&infoPtr->cs);
@ -906,7 +906,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
EnterCriticalSection(&infoPtr->cs); EnterCriticalSection(&infoPtr->cs);
ANIMATE_PaintFrame(infoPtr, hDC); ANIMATE_PaintFrame(infoPtr, hDC);
LeaveCriticalSection(&infoPtr->cs); LeaveCriticalSection(&infoPtr->cs);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
} }
@ -919,7 +919,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)
ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam); return DefWindowProcA(hWnd, uMsg, wParam, lParam);
} }
return 0; return 0;
@ -937,7 +937,7 @@ void ANIMATE_Register(void)
wndClass.hCursor = LoadCursorA(0, IDC_ARROWA); wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = ANIMATE_CLASSA; wndClass.lpszClassName = ANIMATE_CLASSA;
RegisterClassA(&wndClass); RegisterClassA(&wndClass);
} }

View File

@ -87,12 +87,12 @@ typedef struct
/* /*
* Special flag set in DRAWITEMSTRUCT itemState field. It is set by * Special flag set in DRAWITEMSTRUCT itemState field. It is set by
* the ComboEx version of the Combo Window Proc so that when the * the ComboEx version of the Combo Window Proc so that when the
* WM_DRAWITEM message is then passed to ComboEx, we know that this * WM_DRAWITEM message is then passed to ComboEx, we know that this
* particular WM_DRAWITEM message is for listbox only items. Any messasges * particular WM_DRAWITEM message is for listbox only items. Any messasges
* without this flag is then for the Edit control field. * without this flag is then for the Edit control field.
* *
* We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that * We really cannot use the ODS_COMBOBOXEDIT flag because MSDN states that
* only version 4.0 applications will have ODS_COMBOBOXEDIT set. * only version 4.0 applications will have ODS_COMBOBOXEDIT set.
*/ */
#define ODS_COMBOEXLBOX 0x4000 #define ODS_COMBOEXLBOX 0x4000
@ -163,7 +163,7 @@ static void COMBOEX_DumpInput (COMBOBOXEXITEMW *input)
inline static CBE_ITEMDATA *get_item_data(COMBOEX_INFO *infoPtr, INT index) inline static CBE_ITEMDATA *get_item_data(COMBOEX_INFO *infoPtr, INT index)
{ {
return (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, CB_GETITEMDATA, return (CBE_ITEMDATA *)SendMessageW (infoPtr->hwndCombo, CB_GETITEMDATA,
(WPARAM)index, 0); (WPARAM)index, 0);
} }
@ -206,14 +206,14 @@ COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, INT code, NMCOMBOBOXEXW *hdr)
if (code == CBEN_ENDEDITW) code = CBEN_ENDEDITA; if (code == CBEN_ENDEDITW) code = CBEN_ENDEDITA;
else if (code == CBEN_GETDISPINFOW) code = CBEN_GETDISPINFOA; else if (code == CBEN_GETDISPINFOW) code = CBEN_GETDISPINFOA;
else if (code == CBEN_DRAGBEGINW) code = CBEN_DRAGBEGINA; else if (code == CBEN_DRAGBEGINW) code = CBEN_DRAGBEGINA;
ret = COMBOEX_Notify (infoPtr, code, (NMHDR *)hdr); ret = COMBOEX_Notify (infoPtr, code, (NMHDR *)hdr);
if (astr && hdr->ceItem.pszText == (LPWSTR)astr) if (astr && hdr->ceItem.pszText == (LPWSTR)astr)
hdr->ceItem.pszText = wstr; hdr->ceItem.pszText = wstr;
if (astr) COMCTL32_Free(astr); if (astr) COMCTL32_Free(astr);
return ret; return ret;
} }
} }
@ -227,7 +227,7 @@ static INT COMBOEX_NotifyEndEdit (COMBOEX_INFO *infoPtr, NMCBEENDEDITW *neew, LP
return COMBOEX_Notify (infoPtr, CBEN_ENDEDITW, &neew->hdr); return COMBOEX_Notify (infoPtr, CBEN_ENDEDITW, &neew->hdr);
} else { } else {
NMCBEENDEDITA neea; NMCBEENDEDITA neea;
memcpy (&neea.hdr, &neew->hdr, sizeof(NMHDR)); memcpy (&neea.hdr, &neew->hdr, sizeof(NMHDR));
neea.fChanged = neew->fChanged; neea.fChanged = neew->fChanged;
neea.iNewSelection = neew->iNewSelection; neea.iNewSelection = neew->iNewSelection;
@ -253,10 +253,10 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
NMCOMBOBOXEXW nmce; NMCOMBOBOXEXW nmce;
LPWSTR text, buf; LPWSTR text, buf;
INT len; INT len;
if (item->pszText != LPSTR_TEXTCALLBACKW) if (item->pszText != LPSTR_TEXTCALLBACKW)
return item->pszText; return item->pszText;
ZeroMemory(&nmce, sizeof(nmce)); ZeroMemory(&nmce, sizeof(nmce));
nmce.ceItem.mask = CBEIF_TEXT; nmce.ceItem.mask = CBEIF_TEXT;
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce); COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
@ -276,7 +276,7 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
text = buf; text = buf;
} else } else
text = nmce.ceItem.pszText; text = nmce.ceItem.pszText;
if (nmce.ceItem.mask & CBEIF_DI_SETITEM) if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
item->pszText = text; item->pszText = text;
return text; return text;
@ -395,7 +395,7 @@ static void COMBOEX_SetEditText (COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
} }
} }
static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index) static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index)
{ {
CBE_ITEMDATA *item; CBE_ITEMDATA *item;
@ -425,7 +425,7 @@ static inline BOOL COMBOEX_HasEdit(COMBOEX_INFO *infoPtr)
{ {
return infoPtr->hwndEdit; return infoPtr->hwndEdit;
} }
/* *** CBEM_xxx message support *** */ /* *** CBEM_xxx message support *** */
@ -480,7 +480,7 @@ static BOOL COMBOEX_GetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
if(!COMBOEX_GetItemW (infoPtr, &tmpcit)) return FALSE; if(!COMBOEX_GetItemW (infoPtr, &tmpcit)) return FALSE;
if (is_textW(tmpcit.pszText) && cit->pszText) if (is_textW(tmpcit.pszText) && cit->pszText)
WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1, WideCharToMultiByte (CP_ACP, 0, tmpcit.pszText, -1,
cit->pszText, cit->cchTextMax, NULL, NULL); cit->pszText, cit->cchTextMax, NULL, NULL);
else if (cit->pszText) cit->pszText[0] = 0; else if (cit->pszText) cit->pszText[0] = 0;
else cit->pszText = (LPSTR)tmpcit.pszText; else cit->pszText = (LPSTR)tmpcit.pszText;
@ -519,7 +519,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
/* get zero-filled space and chain it in */ /* get zero-filled space and chain it in */
if(!(item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof(*item)))) return -1; if(!(item = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof(*item)))) return -1;
/* locate position to insert new item in */ /* locate position to insert new item in */
if (index == infoPtr->nb_items) { if (index == infoPtr->nb_items) {
/* fast path for iItem = -1 */ /* fast path for iItem = -1 */
@ -575,7 +575,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
if (TRACE_ON(comboex)) COMBOEX_DumpItem (item); if (TRACE_ON(comboex)) COMBOEX_DumpItem (item);
SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING,
(WPARAM)cit->iItem, (LPARAM)item); (WPARAM)cit->iItem, (LPARAM)item);
memset (&nmcit.ceItem, 0, sizeof(nmcit.ceItem)); memset (&nmcit.ceItem, 0, sizeof(nmcit.ceItem));
@ -601,15 +601,15 @@ static INT COMBOEX_InsertItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len); MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
citW.pszText = wstr; citW.pszText = wstr;
} }
ret = COMBOEX_InsertItemW(infoPtr, &citW);; ret = COMBOEX_InsertItemW(infoPtr, &citW);
if (wstr) COMCTL32_Free(wstr); if (wstr) COMCTL32_Free(wstr);
return ret; return ret;
} }
static DWORD static DWORD
COMBOEX_SetExtendedStyle (COMBOEX_INFO *infoPtr, DWORD mask, DWORD style) COMBOEX_SetExtendedStyle (COMBOEX_INFO *infoPtr, DWORD mask, DWORD style)
{ {
DWORD dwTemp; DWORD dwTemp;
@ -675,7 +675,7 @@ static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
if (!(item = COMBOEX_FindItem(infoPtr, index))) return FALSE; if (!(item = COMBOEX_FindItem(infoPtr, index))) return FALSE;
/* add/change stuff to the internal item structure */ /* add/change stuff to the internal item structure */
item->mask |= cit->mask; item->mask |= cit->mask;
if (cit->mask & CBEIF_TEXT) { if (cit->mask & CBEIF_TEXT) {
INT len = 0; INT len = 0;
@ -725,7 +725,7 @@ static BOOL COMBOEX_SetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len); MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
citW.pszText = wstr; citW.pszText = wstr;
} }
ret = COMBOEX_SetItemW(infoPtr, &citW);; ret = COMBOEX_SetItemW(infoPtr, &citW);
if (wstr) COMCTL32_Free(wstr); if (wstr) COMCTL32_Free(wstr);
@ -856,7 +856,7 @@ static INT COMBOEX_SetItemHeight (COMBOEX_INFO *infoPtr, INT index, UINT height)
GetWindowRect (infoPtr->hwndCombo, &cb_wrect); GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
GetWindowRect (infoPtr->hwndSelf, &cbx_wrect); GetWindowRect (infoPtr->hwndSelf, &cbx_wrect);
GetClientRect (infoPtr->hwndSelf, &cbx_crect); GetClientRect (infoPtr->hwndSelf, &cbx_crect);
/* the height of comboex as height of the combo + comboex border */ /* the height of comboex as height of the combo + comboex border */
height = cb_wrect.bottom-cb_wrect.top height = cb_wrect.bottom-cb_wrect.top
+ cbx_wrect.bottom-cbx_wrect.top + cbx_wrect.bottom-cbx_wrect.top
- (cbx_crect.bottom-cbx_crect.top); - (cbx_crect.bottom-cbx_crect.top);
@ -894,7 +894,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
/* initialize info structure */ /* initialize info structure */
/* note that infoPtr is allocated zero-filled */ /* note that infoPtr is allocated zero-filled */
infoPtr->hwndSelf = hwnd; infoPtr->hwndSelf = hwnd;
infoPtr->selected = -1; infoPtr->selected = -1;
@ -933,14 +933,14 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
infoPtr->hwndCombo = CreateWindowW (COMBOBOX, NIL, infoPtr->hwndCombo = CreateWindowW (COMBOBOX, NIL,
/* following line added to match native */ /* following line added to match native */
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VSCROLL |
CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST | CBS_NOINTEGRALHEIGHT | CBS_DROPDOWNLIST |
/* was base and is necessary */ /* was base and is necessary */
WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
cs->y, cs->x, cs->cx, cs->cy, hwnd, cs->y, cs->x, cs->cx, cs->cy, hwnd,
(HMENU) GetWindowLongW (hwnd, GWL_ID), (HMENU) GetWindowLongW (hwnd, GWL_ID),
GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); GetWindowLongW (hwnd, GWL_HINSTANCE), NULL);
/* /*
* native does the following at this point according to trace: * native does the following at this point according to trace:
* GetWindowThreadProcessId(hwndCombo,0) * GetWindowThreadProcessId(hwndCombo,0)
* GetCurrentThreadId() * GetCurrentThreadId()
@ -949,11 +949,11 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
*/ */
/* /*
* Setup a property to hold the pointer to the COMBOBOXEX * Setup a property to hold the pointer to the COMBOBOXEX
* data structure. * data structure.
*/ */
SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd);
infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndCombo, infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndCombo,
GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc); GWL_WNDPROC, (LONG)COMBOEX_ComboWndProc);
infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
@ -966,7 +966,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
infoPtr->hwndEdit = CreateWindowExW (0, EDIT, NIL, infoPtr->hwndEdit = CreateWindowExW (0, EDIT, NIL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | ES_AUTOHSCROLL,
0, 0, 0, 0, /* will set later */ 0, 0, 0, 0, /* will set later */
infoPtr->hwndCombo, infoPtr->hwndCombo,
(HMENU) GetWindowLongW (hwnd, GWL_ID), (HMENU) GetWindowLongW (hwnd, GWL_ID),
GetWindowLongW (hwnd, GWL_HINSTANCE), GetWindowLongW (hwnd, GWL_HINSTANCE),
NULL); NULL);
@ -979,11 +979,11 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
*/ */
/* /*
* Setup a property to hold the pointer to the COMBOBOXEX * Setup a property to hold the pointer to the COMBOBOXEX
* data structure. * data structure.
*/ */
SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd);
infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndEdit, infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongW(infoPtr->hwndEdit,
GWL_WNDPROC, (LONG)COMBOEX_EditWndProc); GWL_WNDPROC, (LONG)COMBOEX_EditWndProc);
infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); infoPtr->font = SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
} }
@ -993,7 +993,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
* all associated controls * all associated controls
*/ */
if (!infoPtr->font) { if (!infoPtr->font) {
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof(mylogfont),
&mylogfont, 0); &mylogfont, 0);
infoPtr->font = infoPtr->defaultFont = CreateFontIndirectW (&mylogfont); infoPtr->font = infoPtr->defaultFont = CreateFontIndirectW (&mylogfont);
} }
@ -1014,21 +1014,21 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom, wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
clrc1.left, clrc1.top, clrc1.right, clrc1.bottom, clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
SetWindowPos(infoPtr->hwndCombo, HWND_TOP, SetWindowPos(infoPtr->hwndCombo, HWND_TOP,
0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top, 0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,
SWP_NOACTIVATE | SWP_NOREDRAW); SWP_NOACTIVATE | SWP_NOREDRAW);
GetWindowRect(infoPtr->hwndCombo, &cmbwrc); GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
TRACE("CB window=(%d,%d)-(%d,%d)\n", TRACE("CB window=(%d,%d)-(%d,%d)\n",
cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom); cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
SetWindowPos(hwnd, HWND_TOP, SetWindowPos(hwnd, HWND_TOP,
0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top, 0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
COMBOEX_AdjustEditPos (infoPtr); COMBOEX_AdjustEditPos (infoPtr);
/* /*
* Create an item structure to represent the data in the * Create an item structure to represent the data in the
* EDIT control. It is allocated zero-filled. * EDIT control. It is allocated zero-filled.
*/ */
infoPtr->edit = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA)); infoPtr->edit = (CBE_ITEMDATA *)COMCTL32_Alloc (sizeof (CBE_ITEMDATA));
@ -1060,11 +1060,11 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa
SetFocus (infoPtr->hwndCombo); SetFocus (infoPtr->hwndCombo);
ShowWindow (infoPtr->hwndEdit, SW_HIDE); ShowWindow (infoPtr->hwndEdit, SW_HIDE);
return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf); return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
case CBN_CLOSEUP: case CBN_CLOSEUP:
SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf); SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
/* /*
* from native trace of first dropdown after typing in URL in IE4 * from native trace of first dropdown after typing in URL in IE4
* CB_GETCURSEL(Combo) * CB_GETCURSEL(Combo)
* GetWindowText(Edit) * GetWindowText(Edit)
* CB_GETCURSEL(Combo) * CB_GETCURSEL(Combo)
@ -1074,7 +1074,7 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa
* CB_GETCURSEL(Combo) * CB_GETCURSEL(Combo)
* CB_SETCURSEL(COMBOEX, n) * CB_SETCURSEL(COMBOEX, n)
* SetFocus(Combo) * SetFocus(Combo)
* the rest is supposition * the rest is supposition
*/ */
ShowWindow (infoPtr->hwndEdit, SW_SHOW); ShowWindow (infoPtr->hwndEdit, SW_SHOW);
InvalidateRect (infoPtr->hwndCombo, 0, TRUE); InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
@ -1154,7 +1154,7 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa
return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf); return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
case CBN_SELENDOK: case CBN_SELENDOK:
/* /*
* We have to change the handle since we are the control * We have to change the handle since we are the control
* issuing the message. IE4 depends on this. * issuing the message. IE4 depends on this.
*/ */
@ -1188,7 +1188,7 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa
return 0; return 0;
default: default:
/* /*
* We have to change the handle since we are the control * We have to change the handle since we are the control
* issuing the message. IE4 depends on this. * issuing the message. IE4 depends on this.
* We also need to set the focus back to the Edit control * We also need to set the focus back to the Edit control
@ -1263,13 +1263,13 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
if (!IsWindowEnabled(infoPtr->hwndCombo)) return 0; if (!IsWindowEnabled(infoPtr->hwndCombo)) return 0;
TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n", TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
dis->CtlType, dis->CtlID); dis->CtlType, dis->CtlID);
TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n", TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
dis->itemID, dis->itemAction, dis->itemState); dis->itemID, dis->itemAction, dis->itemState);
TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n", TRACE("hWnd=0x%04x hDC=0x%04x (%d,%d)-(%d,%d) itemData=0x%08lx\n",
dis->hwndItem, dis->hDC, dis->rcItem.left, dis->hwndItem, dis->hDC, dis->rcItem.left,
dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom, dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom,
dis->itemData); dis->itemData);
/* MSDN says: */ /* MSDN says: */
@ -1285,13 +1285,13 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
/* though the list box or combo box has the focus. */ /* though the list box or combo box has the focus. */
if (dis->itemID == 0xffffffff) { if (dis->itemID == 0xffffffff) {
if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) || if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) { ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) {
TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n", TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",
dis->rcItem.left, dis->rcItem.top, dis->rcItem.left, dis->rcItem.top,
dis->rcItem.right, dis->rcItem.bottom); dis->rcItem.right, dis->rcItem.bottom);
} }
else if ((dis->CtlType == ODT_COMBOBOX) && else if ((dis->CtlType == ODT_COMBOBOX) &&
(dis->itemAction == ODA_DRAWENTIRE)) { (dis->itemAction == ODA_DRAWENTIRE)) {
/* draw of edit control data */ /* draw of edit control data */
@ -1333,7 +1333,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); item->pszText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
if (item->pszText) if (item->pszText)
GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1); GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1);
TRACE("edit control hwndEdit=%0x, text len=%d str=%s\n", TRACE("edit control hwndEdit=%0x, text len=%d str=%s\n",
infoPtr->hwndEdit, len, debugstr_txt(item->pszText)); infoPtr->hwndEdit, len, debugstr_txt(item->pszText));
} }
@ -1381,8 +1381,8 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
} else { } else {
/* drawing combo/edit entry */ /* drawing combo/edit entry */
if (IsWindowVisible(infoPtr->hwndEdit)) { if (IsWindowVisible(infoPtr->hwndEdit)) {
/* if we have an edit control, the slave the /* if we have an edit control, the slave the
* selection state to the Edit focus state * selection state to the Edit focus state
*/ */
if (infoPtr->flags & WCBE_EDITFOCUSED) { if (infoPtr->flags & WCBE_EDITFOCUSED) {
if (item->mask & CBEIF_SELECTEDIMAGE) if (item->mask & CBEIF_SELECTEDIMAGE)
@ -1390,7 +1390,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
drawstate = ILD_SELECTED; drawstate = ILD_SELECTED;
} }
} else { } else {
/* if we don't have an edit control, use /* if we don't have an edit control, use
* the requested state. * the requested state.
*/ */
if (dis->itemState & ODS_SELECTED) { if (dis->itemState & ODS_SELECTED) {
@ -1414,10 +1414,10 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
len = strlenW (str); len = strlenW (str);
GetTextExtentPoint32W (dis->hDC, str, len, &txtsize); GetTextExtentPoint32W (dis->hDC, str, len, &txtsize);
if (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) { if (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) {
int overlay = item->iOverlay; int overlay = item->iOverlay;
if (drawimage == I_IMAGECALLBACK) { if (drawimage == I_IMAGECALLBACK) {
NMCOMBOBOXEXW nmce; NMCOMBOBOXEXW nmce;
ZeroMemory(&nmce, sizeof(nmce)); ZeroMemory(&nmce, sizeof(nmce));
@ -1441,11 +1441,11 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
item->iOverlay = nmce.ceItem.iOverlay; item->iOverlay = nmce.ceItem.iOverlay;
overlay = nmce.ceItem.iOverlay; overlay = nmce.ceItem.iOverlay;
} }
if (drawimage >= 0 && if (drawimage >= 0 &&
!(infoPtr->dwExtStyle & (CBES_EX_NOEDITIMAGE | CBES_EX_NOEDITIMAGEINDENT))) { !(infoPtr->dwExtStyle & (CBES_EX_NOEDITIMAGE | CBES_EX_NOEDITIMAGEINDENT))) {
if (overlay > 0) ImageList_SetOverlayImage (infoPtr->himl, overlay, 1); if (overlay > 0) ImageList_SetOverlayImage (infoPtr->himl, overlay, 1);
ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, xbase, dis->rcItem.top, ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, xbase, dis->rcItem.top,
drawstate | (overlay > 0 ? INDEXTOOVERLAYMASK(1) : 0)); drawstate | (overlay > 0 ? INDEXTOOVERLAYMASK(1) : 0));
} }
@ -1472,7 +1472,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
SetTextColor (dis->hDC, txc); SetTextColor (dis->hDC, txc);
} }
} }
if (dis->itemAction & ODA_FOCUS) { if (dis->itemAction & ODA_FOCUS) {
rect.left = xbase + xioff - 1; rect.left = xbase + xioff - 1;
rect.right = rect.left + txtsize.cx + 2; rect.right = rect.left + txtsize.cx + 2;
@ -1508,7 +1508,7 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
infoPtr->items = 0; infoPtr->items = 0;
} }
if (infoPtr->defaultFont) if (infoPtr->defaultFont)
DeleteObject (infoPtr->defaultFont); DeleteObject (infoPtr->defaultFont);
/* free comboex info data */ /* free comboex info data */
@ -1564,7 +1564,7 @@ static LRESULT COMBOEX_NotifyFormat (COMBOEX_INFO *infoPtr, LPARAM lParam)
static LRESULT COMBOEX_Size (COMBOEX_INFO *infoPtr, INT width, INT height) static LRESULT COMBOEX_Size (COMBOEX_INFO *infoPtr, INT width, INT height)
{ {
TRACE("(width=%d, height=%d)\n", width, height); TRACE("(width=%d, height=%d)\n", width, height);
MoveWindow (infoPtr->hwndCombo, 0, 0, width, height, TRUE); MoveWindow (infoPtr->hwndCombo, 0, 0, width, height, TRUE);
@ -1585,8 +1585,8 @@ static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
/* width is winpos value + border width of comboex */ /* width is winpos value + border width of comboex */
width = wp->cx width = wp->cx
+ (cbx_wrect.right-cbx_wrect.left) + (cbx_wrect.right-cbx_wrect.left)
- (cbx_crect.right-cbx_crect.left); - (cbx_crect.right-cbx_crect.left);
TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n", TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n",
wp->x, wp->y, wp->cx, wp->cy, wp->flags); wp->x, wp->y, wp->cx, wp->cy, wp->flags);
@ -1630,7 +1630,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
RECT rect; RECT rect;
LRESULT lret; LRESULT lret;
TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n",
hwnd, uMsg, wParam, lParam, infoPtr); hwnd, uMsg, wParam, lParam, infoPtr);
if (!infoPtr) return 0; if (!infoPtr) return 0;
@ -1642,12 +1642,12 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* handle (ignore) the return character */ /* handle (ignore) the return character */
if (wParam == VK_RETURN) return 0; if (wParam == VK_RETURN) return 0;
/* all other characters pass into the real Edit */ /* all other characters pass into the real Edit */
return CallWindowProcW (infoPtr->prevEditWndProc, return CallWindowProcW (infoPtr->prevEditWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
/* /*
* The following was determined by traces of the native * The following was determined by traces of the native
*/ */
hDC = (HDC) wParam; hDC = (HDC) wParam;
obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW)); obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW));
@ -1656,7 +1656,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
rect.left, rect.top, rect.right, rect.bottom); rect.left, rect.top, rect.right, rect.bottom);
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
SetBkColor (hDC, obkc); SetBkColor (hDC, obkc);
return CallWindowProcW (infoPtr->prevEditWndProc, return CallWindowProcW (infoPtr->prevEditWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
case WM_KEYDOWN: { case WM_KEYDOWN: {
@ -1671,7 +1671,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
* GetWindowTextA(Edit,&?, 0x104) x * GetWindowTextA(Edit,&?, 0x104) x
* CB_GETCURSEL to Combo rets -1 x * CB_GETCURSEL to Combo rets -1 x
* WM_NOTIFY to COMBOEX parent (rebar) x * WM_NOTIFY to COMBOEX parent (rebar) x
* (CBEN_ENDEDIT{A|W} * (CBEN_ENDEDIT{A|W}
* fChanged = FALSE x * fChanged = FALSE x
* inewSelection = -1 x * inewSelection = -1 x
* txt="www.hoho" x * txt="www.hoho" x
@ -1700,9 +1700,9 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ERR("item %d not found. Problem!\n", oldItem); ERR("item %d not found. Problem!\n", oldItem);
break; break;
} }
infoPtr->selected = oldItem; infoPtr->selected = oldItem;
COMBOEX_SetEditText (infoPtr, item); COMBOEX_SetEditText (infoPtr, item);
RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
RDW_INVALIDATE); RDW_INVALIDATE);
break; break;
@ -1712,9 +1712,9 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
* GetWindowTextA(Edit,&?, 0x104) x * GetWindowTextA(Edit,&?, 0x104) x
* CB_GETCURSEL to Combo rets -1 x * CB_GETCURSEL to Combo rets -1 x
* CB_GETCOUNT to Combo rets 0 * CB_GETCOUNT to Combo rets 0
* if >0 loop * if >0 loop
* CB_GETITEMDATA to match * CB_GETITEMDATA to match
* *** above 3 lines simulated by FindItem x * *** above 3 lines simulated by FindItem x
* WM_NOTIFY to COMBOEX parent (rebar) x * WM_NOTIFY to COMBOEX parent (rebar) x
* (CBEN_ENDEDIT{A|W} x * (CBEN_ENDEDIT{A|W} x
* fChanged = TRUE (-1) x * fChanged = TRUE (-1) x
@ -1749,20 +1749,20 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
cbeend.iNewSelection = selected; cbeend.iNewSelection = selected;
cbeend.fChanged = TRUE; cbeend.fChanged = TRUE;
cbeend.iWhy = CBENF_RETURN; cbeend.iWhy = CBENF_RETURN;
if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) { if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
/* abort the change, restore previous */ /* abort the change, restore previous */
TRACE("Notify requested abort of change\n"); TRACE("Notify requested abort of change\n");
COMBOEX_SetEditText (infoPtr, infoPtr->edit); COMBOEX_SetEditText (infoPtr, infoPtr->edit);
RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
RDW_INVALIDATE); RDW_INVALIDATE);
return 0; return 0;
} }
oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0); oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
if (oldItem != -1) { if (oldItem != -1) {
/* if something is selected, then deselect it */ /* if something is selected, then deselect it */
SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL,
(WPARAM)-1, 0); (WPARAM)-1, 0);
} }
InvalidateRect (infoPtr->hwndCombo, 0, 0); InvalidateRect (infoPtr->hwndCombo, 0, 0);
@ -1786,13 +1786,13 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SETFOCUS: case WM_SETFOCUS:
/* remember the focus to set state of icon */ /* remember the focus to set state of icon */
lret = CallWindowProcW (infoPtr->prevEditWndProc, lret = CallWindowProcW (infoPtr->prevEditWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
infoPtr->flags |= WCBE_EDITFOCUSED; infoPtr->flags |= WCBE_EDITFOCUSED;
return lret; return lret;
case WM_KILLFOCUS: case WM_KILLFOCUS:
/* /*
* do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS
*/ */
infoPtr->flags &= ~WCBE_EDITFOCUSED; infoPtr->flags &= ~WCBE_EDITFOCUSED;
@ -1810,7 +1810,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* fall through */ /* fall through */
default: default:
return CallWindowProcW (infoPtr->prevEditWndProc, return CallWindowProcW (infoPtr->prevEditWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
} }
return 0; return 0;
@ -1830,7 +1830,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
RECT rect; RECT rect;
WCHAR edit_text[260]; WCHAR edit_text[260];
TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n", TRACE("hwnd=%x msg=%x wparam=%x lParam=%lx, info_ptr=%p\n",
hwnd, uMsg, wParam, lParam, infoPtr); hwnd, uMsg, wParam, lParam, infoPtr);
if (!infoPtr) return 0; if (!infoPtr) return 0;
@ -1848,12 +1848,12 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
* that ComboEx knows this is listbox. * that ComboEx knows this is listbox.
*/ */
((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX; ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
return CallWindowProcW (infoPtr->prevComboWndProc, return CallWindowProcW (infoPtr->prevComboWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
/* /*
* The following was determined by traces of the native * The following was determined by traces of the native
*/ */
hDC = (HDC) wParam; hDC = (HDC) wParam;
obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW)); obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW));
@ -1862,7 +1862,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
rect.left, rect.top, rect.right, rect.bottom); rect.left, rect.top, rect.right, rect.bottom);
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
SetBkColor (hDC, obkc); SetBkColor (hDC, obkc);
return CallWindowProcW (infoPtr->prevComboWndProc, return CallWindowProcW (infoPtr->prevComboWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
case WM_SETCURSOR: case WM_SETCURSOR:
@ -1877,7 +1877,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
nmmse.pt.y = 0; nmmse.pt.y = 0;
nmmse.dwHitInfo = lParam; nmmse.dwHitInfo = lParam;
COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse); COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);
return CallWindowProcW (infoPtr->prevComboWndProc, return CallWindowProcW (infoPtr->prevComboWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
case WM_COMMAND: case WM_COMMAND:
@ -1917,11 +1917,11 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
InvalidateRect (infoPtr->hwndCombo, 0, 0); InvalidateRect (infoPtr->hwndCombo, 0, 0);
if (focusedhwnd) if (focusedhwnd)
SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS, SendMessageW (infoPtr->hwndCombo, WM_KILLFOCUS,
(WPARAM)focusedhwnd, 0); (WPARAM)focusedhwnd, 0);
return 0; return 0;
case EN_SETFOCUS: { case EN_SETFOCUS: {
/* /*
* For EN_SETFOCUS this issues the same calls and messages * For EN_SETFOCUS this issues the same calls and messages
* as the native seems to do. * as the native seems to do.
* *
@ -1947,7 +1947,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
case EN_CHANGE: { case EN_CHANGE: {
/* /*
* For EN_CHANGE this issues the same calls and messages * For EN_CHANGE this issues the same calls and messages
* as the native seems to do. * as the native seems to do.
*/ */
@ -2023,7 +2023,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break; break;
}/* fall through */ }/* fall through */
default: default:
return CallWindowProcW (infoPtr->prevComboWndProc, return CallWindowProcW (infoPtr->prevComboWndProc,
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
} }
return 0; return 0;
@ -2114,7 +2114,7 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
uMsg, wParam, lParam); uMsg, wParam, lParam);
/* Combo messages OK to just forward to the regular COMBO */ /* Combo messages OK to just forward to the regular COMBO */
case CB_GETCOUNT: case CB_GETCOUNT:
case CB_GETCURSEL: case CB_GETCURSEL:
case CB_GETDROPPEDSTATE: case CB_GETDROPPEDSTATE:
case CB_SETDROPPEDWIDTH: case CB_SETDROPPEDWIDTH:
@ -2194,7 +2194,7 @@ void COMBOEX_Register (void)
wndClass.hCursor = LoadCursorW (0, IDC_ARROWW); wndClass.hCursor = LoadCursorW (0, IDC_ARROWW);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = WC_COMBOBOXEXW; wndClass.lpszClassName = WC_COMBOBOXEXW;
RegisterClassW (&wndClass); RegisterClassW (&wndClass);
} }

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* *
* Common definitions (resource ids and global variables) * Common definitions (resource ids and global variables)
* *
* Copyright 1999 Thuy Nguyen * Copyright 1999 Thuy Nguyen
@ -93,7 +93,7 @@ extern HBRUSH COMCTL32_hPattern55AABrush;
/* DragList icon */ /* DragList icon */
#define IDI_DRAGARROW 150 #define IDI_DRAGARROW 150
typedef struct typedef struct
{ {
COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */ COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */
COLORREF clrBtnShadow; /* COLOR_BTNSHADOW */ COLORREF clrBtnShadow; /* COLOR_BTNSHADOW */
@ -121,7 +121,7 @@ VOID COMCTL32_RefreshSysColors(void);
INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen); INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen);
BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc);
#define COMCTL32_VERSION_MINOR 0 #define COMCTL32_VERSION_MINOR 0
#define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 0, 0 #define WINE_FILEVERSION 5, COMCTL32_VERSION_MINOR, 0, 0
#define WINE_FILEVERSIONSTR "5.00" #define WINE_FILEVERSIONSTR "5.00"

View File

@ -273,7 +273,7 @@ DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags,
break; break;
} }
nResult = (pfnCompare)(*pWork1, *pWork2, lParam); nResult = (pfnCompare)(*pWork1, *pWork2, lParam);
TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n",
nResult, nIndex, nCount); nResult, nIndex, nCount);
if (nResult == 0) if (nResult == 0)
@ -522,7 +522,7 @@ VOID MRU_SaveChanged( LPWINEMRULIST mp )
*/ */
/* open the sub key */ /* open the sub key */
if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,
0, KEY_WRITE, &newkey))) { 0, KEY_WRITE, &newkey))) {
/* not present - what to do ??? */ /* not present - what to do ??? */
ERR("Can not open key, error=%d, attempting to create\n", ERR("Can not open key, error=%d, attempting to create\n",
@ -542,7 +542,7 @@ VOID MRU_SaveChanged( LPWINEMRULIST mp )
} }
if (mp->wineFlags & WMRUF_CHANGED) { if (mp->wineFlags & WMRUF_CHANGED) {
mp->wineFlags &= ~WMRUF_CHANGED; mp->wineFlags &= ~WMRUF_CHANGED;
err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ,
mp->realMRU, strlen(mp->realMRU) + 1); mp->realMRU, strlen(mp->realMRU) + 1);
if (err) { if (err) {
ERR("error saving MRUList, err=%d\n", err); ERR("error saving MRUList, err=%d\n", err);
@ -555,8 +555,8 @@ VOID MRU_SaveChanged( LPWINEMRULIST mp )
if (witem->itemFlag & WMRUIF_CHANGED) { if (witem->itemFlag & WMRUIF_CHANGED) {
witem->itemFlag &= ~WMRUIF_CHANGED; witem->itemFlag &= ~WMRUIF_CHANGED;
realname[0] = 'a' + i; realname[0] = 'a' + i;
err = RegSetValueExW(newkey, realname, 0, err = RegSetValueExW(newkey, realname, 0,
(mp->extview.dwFlags & MRUF_BINARY_LIST) ? (mp->extview.dwFlags & MRUF_BINARY_LIST) ?
REG_BINARY : REG_SZ, REG_BINARY : REG_SZ,
&witem->datastart, witem->size); &witem->datastart, witem->size);
if (err) { if (err) {
@ -601,7 +601,7 @@ FreeMRUList (HANDLE hMRUList)
/************************************************************************** /**************************************************************************
* FindMRUData [COMCTL32.169] * FindMRUData [COMCTL32.169]
* *
* Searches binary list for item that matches lpData of length cbData. * Searches binary list for item that matches lpData of length cbData.
* Returns position in list order 0 -> MRU and if lpRegNum != NULL then value * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
* corresponding to item's reg. name will be stored in it ('a' -> 0). * corresponding to item's reg. name will be stored in it ('a' -> 0).
@ -636,7 +636,7 @@ FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
for(i=0; i<mp->cursize; i++) { for(i=0; i<mp->cursize; i++) {
if (mp->extview.dwFlags & MRUF_BINARY_LIST) { if (mp->extview.dwFlags & MRUF_BINARY_LIST) {
if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart, if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart,
cbData)) cbData))
break; break;
} }
@ -678,7 +678,7 @@ FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
/************************************************************************** /**************************************************************************
* AddMRUData [COMCTL32.167] * AddMRUData [COMCTL32.167]
* *
* Add item to MRU binary list. If item already exists in list then it is * Add item to MRU binary list. If item already exists in list then it is
* simply moved up to the top of the list and not added again. If list is * simply moved up to the top of the list and not added again. If list is
* full then the least recently used item is removed to make room. * full then the least recently used item is removed to make room.
@ -718,7 +718,7 @@ AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData)
} }
/* Allocate space for new item and move in the data */ /* Allocate space for new item and move in the data */
mp->array[replace] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(cbData + mp->array[replace] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(cbData +
sizeof(WINEMRUITEM)); sizeof(WINEMRUITEM));
witem->itemFlag |= WMRUIF_CHANGED; witem->itemFlag |= WMRUIF_CHANGED;
witem->size = cbData; witem->size = cbData;
@ -730,7 +730,7 @@ AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData)
mp->realMRU[i] = mp->realMRU[i-1]; mp->realMRU[i] = mp->realMRU[i-1];
} }
mp->realMRU[0] = replace + 'a'; mp->realMRU[0] = replace + 'a';
TRACE("(%08x, %p, %ld) adding data, /%c/ now most current\n", TRACE("(%08x, %p, %ld) adding data, /%c/ now most current\n",
hList, lpData, cbData, replace+'a'); hList, lpData, cbData, replace+'a');
ret = replace; ret = replace;
@ -744,7 +744,7 @@ AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData)
/************************************************************************** /**************************************************************************
* AddMRUStringW [COMCTL32.401] * AddMRUStringW [COMCTL32.401]
* *
* Add item to MRU string list. If item already exists in list them it is * Add item to MRU string list. If item already exists in list them it is
* simply moved up to the top of the list and not added again. If list is * simply moved up to the top of the list and not added again. If list is
* full then the least recently used item is removed to make room. * full then the least recently used item is removed to make room.
@ -807,7 +807,7 @@ FindMRUStringW (HANDLE hList, LPCWSTR lpszString, LPINT lpRegNum)
/************************************************************************** /**************************************************************************
* FindMRUStringA [COMCTL32.155] * FindMRUStringA [COMCTL32.155]
* *
* Searches string list for item that matches lpszString. * Searches string list for item that matches lpszString.
* Returns position in list order 0 -> MRU and if lpRegNum != NULL then value * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
* corresponding to item's reg. name will be stored in it ('a' -> 0). * corresponding to item's reg. name will be stored in it ('a' -> 0).
@ -858,10 +858,10 @@ HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
sizeof(LPVOID)); sizeof(LPVOID));
/* open the sub key */ /* open the sub key */
if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,
0, 0,
emptyW, emptyW,
REG_OPTION_NON_VOLATILE, REG_OPTION_NON_VOLATILE,
KEY_READ | KEY_WRITE, KEY_READ | KEY_WRITE,
0, 0,
&newkey, &newkey,
@ -877,7 +877,7 @@ HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
/* get values from key 'MRUList' */ /* get values from key 'MRUList' */
if (newkey) { if (newkey) {
datasize = mp->extview.nMaxItems + 1; datasize = mp->extview.nMaxItems + 1;
if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU,
&datasize))) { &datasize))) {
/* not present - set size to 1 (will become 0 later) */ /* not present - set size to 1 (will become 0 later) */
datasize = 1; datasize = 1;
@ -897,10 +897,10 @@ HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
/* not present - what to do ??? */ /* not present - what to do ??? */
ERR("Key %s not found 1\n", debugstr_w(realname)); ERR("Key %s not found 1\n", debugstr_w(realname));
} }
mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize + mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize +
sizeof(WINEMRUITEM)); sizeof(WINEMRUITEM));
witem->size = datasize; witem->size = datasize;
if(RegQueryValueExW( newkey, realname, 0, &type, if(RegQueryValueExW( newkey, realname, 0, &type,
&witem->datastart, &datasize)) { &witem->datastart, &datasize)) {
/* not present - what to do ??? */ /* not present - what to do ??? */
ERR("Key %s not found 2\n", debugstr_w(realname)); ERR("Key %s not found 2\n", debugstr_w(realname));
@ -939,7 +939,7 @@ CreateMRUListLazyW (LPCREATEMRULISTW lpcml, DWORD dwParam2, DWORD dwParam3, DWOR
strcpyW((LPWSTR)mp->extview.lpszSubKey, lpcml->lpszSubKey); strcpyW((LPWSTR)mp->extview.lpszSubKey, lpcml->lpszSubKey);
mp->isUnicode = TRUE; mp->isUnicode = TRUE;
return CreateMRUListLazy_common(mp); return CreateMRUListLazy_common(mp);
} }
/************************************************************************** /**************************************************************************
@ -1008,7 +1008,7 @@ CreateMRUListA (LPCREATEMRULISTA lpcml)
* string lists specifies full length of string. Enumerating past the end * string lists specifies full length of string. Enumerating past the end
* of list returns -1. * of list returns -1.
* If lpBuffer == NULL or nItemPos is -ve return value is no. of items in * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in
* the list. * the list.
*/ */
INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer, INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer,
DWORD nBufferSize) DWORD nBufferSize)
@ -1023,16 +1023,16 @@ DWORD nBufferSize)
desired -= 'a'; desired -= 'a';
TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired); TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired);
witem = mp->array[desired]; witem = mp->array[desired];
datasize = min( witem->size, nBufferSize ); datasize = min( witem->size, nBufferSize );
memcpy( lpBuffer, &witem->datastart, datasize); memcpy( lpBuffer, &witem->datastart, datasize);
TRACE("(%08x, %d, %p, %ld): returning len=%d\n", TRACE("(%08x, %d, %p, %ld): returning len=%d\n",
hList, nItemPos, lpBuffer, nBufferSize, datasize); hList, nItemPos, lpBuffer, nBufferSize, datasize);
return datasize; return datasize;
} }
/************************************************************************** /**************************************************************************
* EnumMRUListA [COMCTL32.154] * EnumMRUListA [COMCTL32.154]
* *
*/ */
INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer,
DWORD nBufferSize) DWORD nBufferSize)
@ -1049,7 +1049,7 @@ DWORD nBufferSize)
TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired); TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired);
witem = mp->array[desired]; witem = mp->array[desired];
if(mp->extview.dwFlags & MRUF_BINARY_LIST) { if(mp->extview.dwFlags & MRUF_BINARY_LIST) {
datasize = min( witem->size, nBufferSize ); datasize = min( witem->size, nBufferSize );
memcpy( lpBuffer, &witem->datastart, datasize); memcpy( lpBuffer, &witem->datastart, datasize);
} else { } else {
lenA = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1, lenA = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1,
@ -1058,11 +1058,11 @@ DWORD nBufferSize)
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1, WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1,
lpBuffer, datasize, NULL, NULL); lpBuffer, datasize, NULL, NULL);
} }
TRACE("(%08x, %d, %p, %ld): returning len=%d\n", TRACE("(%08x, %d, %p, %ld): returning len=%d\n",
hList, nItemPos, lpBuffer, nBufferSize, datasize); hList, nItemPos, lpBuffer, nBufferSize, datasize);
return datasize; return datasize;
} }
/************************************************************************** /**************************************************************************
* Str_GetPtrA [COMCTL32.233] * Str_GetPtrA [COMCTL32.233]
@ -1118,7 +1118,7 @@ BOOL WINAPI
Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc) Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc)
{ {
TRACE("(%p %p)\n", lppDest, lpSrc); TRACE("(%p %p)\n", lppDest, lpSrc);
if (lpSrc) { if (lpSrc) {
LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1); LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1);
if (!ptr) if (!ptr)
@ -1191,7 +1191,7 @@ BOOL WINAPI
Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc) Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc)
{ {
TRACE("(%p %p)\n", lppDest, lpSrc); TRACE("(%p %p)\n", lppDest, lpSrc);
if (lpSrc) { if (lpSrc) {
INT len = strlenW (lpSrc) + 1; INT len = strlenW (lpSrc) + 1;
LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR)); LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR));
@ -1363,7 +1363,7 @@ DSA_Destroy (const HDSA hdsa)
/************************************************************************** /**************************************************************************
* DSA_GetItem [COMCTL32.322] * DSA_GetItem [COMCTL32.322]
* *
* PARAMS * PARAMS
* hdsa [I] pointer to the array control structure * hdsa [I] pointer to the array control structure
@ -1381,7 +1381,7 @@ DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest)
LPVOID pSrc; LPVOID pSrc;
TRACE("(%p %d %p)\n", hdsa, nIndex, pDest); TRACE("(%p %d %p)\n", hdsa, nIndex, pDest);
if (!hdsa) if (!hdsa)
return FALSE; return FALSE;
if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) if ((nIndex < 0) || (nIndex >= hdsa->nItemCount))
@ -1395,7 +1395,7 @@ DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest)
/************************************************************************** /**************************************************************************
* DSA_GetItemPtr [COMCTL32.323] * DSA_GetItemPtr [COMCTL32.323]
* *
* Retrieves a pointer to the specified item. * Retrieves a pointer to the specified item.
* *
@ -1421,7 +1421,7 @@ DSA_GetItemPtr (const HDSA hdsa, INT nIndex)
return NULL; return NULL;
pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
TRACE("-- ret=%p\n", pSrc); TRACE("-- ret=%p\n", pSrc);
return pSrc; return pSrc;
@ -1429,7 +1429,7 @@ DSA_GetItemPtr (const HDSA hdsa, INT nIndex)
/************************************************************************** /**************************************************************************
* DSA_SetItem [COMCTL32.325] * DSA_SetItem [COMCTL32.325]
* *
* Sets the contents of an item in the array. * Sets the contents of an item in the array.
* *
@ -1448,12 +1448,12 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
{ {
INT nSize, nNewItems; INT nSize, nNewItems;
LPVOID pDest, lpTemp; LPVOID pDest, lpTemp;
TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
if ((!hdsa) || nIndex < 0) if ((!hdsa) || nIndex < 0)
return FALSE; return FALSE;
if (hdsa->nItemCount <= nIndex) { if (hdsa->nItemCount <= nIndex) {
/* within the old array */ /* within the old array */
if (hdsa->nMaxCount > nIndex) { if (hdsa->nMaxCount > nIndex) {
@ -1473,7 +1473,7 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
hdsa->nMaxCount = nNewItems; hdsa->nMaxCount = nNewItems;
hdsa->nItemCount = nIndex + 1; hdsa->nItemCount = nIndex + 1;
hdsa->pData = lpTemp; hdsa->pData = lpTemp;
} }
} }
/* put the new entry in */ /* put the new entry in */
@ -1487,7 +1487,7 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
/************************************************************************** /**************************************************************************
* DSA_InsertItem [COMCTL32.324] * DSA_InsertItem [COMCTL32.324]
* *
* PARAMS * PARAMS
* hdsa [I] pointer to the array control structure * hdsa [I] pointer to the array control structure
@ -1504,7 +1504,7 @@ DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
{ {
INT nNewItems, nSize; INT nNewItems, nSize;
LPVOID lpTemp, lpDest; LPVOID lpTemp, lpDest;
TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
if ((!hdsa) || nIndex < 0) if ((!hdsa) || nIndex < 0)
@ -1524,7 +1524,7 @@ DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
return -1; return -1;
hdsa->nMaxCount = nNewItems; hdsa->nMaxCount = nNewItems;
hdsa->pData = lpTemp; hdsa->pData = lpTemp;
} }
/* do we need to move elements ? */ /* do we need to move elements ? */
@ -1549,7 +1549,7 @@ DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
/************************************************************************** /**************************************************************************
* DSA_DeleteItem [COMCTL32.326] * DSA_DeleteItem [COMCTL32.326]
* *
* PARAMS * PARAMS
* hdsa [I] pointer to the array control structure * hdsa [I] pointer to the array control structure
@ -1565,7 +1565,7 @@ DSA_DeleteItem (const HDSA hdsa, INT nIndex)
{ {
LPVOID lpDest,lpSrc; LPVOID lpDest,lpSrc;
INT nSize; INT nSize;
TRACE("(%p %d)\n", hdsa, nIndex); TRACE("(%p %d)\n", hdsa, nIndex);
if (!hdsa) if (!hdsa)
@ -1582,9 +1582,9 @@ DSA_DeleteItem (const HDSA hdsa, INT nIndex)
lpDest, lpSrc, nSize); lpDest, lpSrc, nSize);
memmove (lpDest, lpSrc, nSize); memmove (lpDest, lpSrc, nSize);
} }
hdsa->nItemCount--; hdsa->nItemCount--;
/* free memory ? */ /* free memory ? */
if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) { if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) {
nSize = hdsa->nItemSize * hdsa->nItemCount; nSize = hdsa->nItemSize * hdsa->nItemCount;
@ -1619,7 +1619,7 @@ DSA_DeleteAllItems (const HDSA hdsa)
{ {
TRACE("(%p)\n", hdsa); TRACE("(%p)\n", hdsa);
if (!hdsa) if (!hdsa)
return FALSE; return FALSE;
if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) if (hdsa->pData && (!COMCTL32_Free (hdsa->pData)))
return FALSE; return FALSE;
@ -1949,12 +1949,12 @@ BOOL WINAPI
DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
{ {
LPVOID *lpTemp; LPVOID *lpTemp;
TRACE("(%p %d %p)\n", hdpa, i, p); TRACE("(%p %d %p)\n", hdpa, i, p);
if ((!hdpa) || i < 0) if ((!hdpa) || i < 0)
return FALSE; return FALSE;
if (hdpa->nItemCount <= i) { if (hdpa->nItemCount <= i) {
/* within the old array */ /* within the old array */
if (hdpa->nMaxCount > i) { if (hdpa->nMaxCount > i) {
@ -1973,8 +1973,8 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
return FALSE; return FALSE;
hdpa->nItemCount = nNewItems; hdpa->nItemCount = nNewItems;
hdpa->ptrs = lpTemp; hdpa->ptrs = lpTemp;
} }
} }
/* put the new entry in */ /* put the new entry in */
@ -2003,7 +2003,7 @@ DPA_DeletePtr (const HDPA hdpa, INT i)
{ {
LPVOID *lpDest, *lpSrc, lpTemp = NULL; LPVOID *lpDest, *lpSrc, lpTemp = NULL;
INT nSize; INT nSize;
TRACE("(%p %d)\n", hdpa, i); TRACE("(%p %d)\n", hdpa, i);
if ((!hdpa) || i < 0 || i >= hdpa->nItemCount) if ((!hdpa) || i < 0 || i >= hdpa->nItemCount)
@ -2020,9 +2020,9 @@ DPA_DeletePtr (const HDPA hdpa, INT i)
lpDest, lpSrc, nSize); lpDest, lpSrc, nSize);
memmove (lpDest, lpSrc, nSize); memmove (lpDest, lpSrc, nSize);
} }
hdpa->nItemCount --; hdpa->nItemCount --;
/* free memory ?*/ /* free memory ?*/
if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount); INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
@ -2033,7 +2033,7 @@ DPA_DeletePtr (const HDPA hdpa, INT i)
return NULL; return NULL;
hdpa->nMaxCount = nNewItems; hdpa->nMaxCount = nNewItems;
hdpa->ptrs = (LPVOID*)lpDest; hdpa->ptrs = (LPVOID*)lpDest;
} }
return lpTemp; return lpTemp;
@ -2058,7 +2058,7 @@ DPA_DeleteAllPtrs (const HDPA hdpa)
{ {
TRACE("(%p)\n", hdpa); TRACE("(%p)\n", hdpa);
if (!hdpa) if (!hdpa)
return FALSE; return FALSE;
if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs)))
@ -2097,7 +2097,7 @@ DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r,
LPVOID t; LPVOID t;
TRACE("l=%i r=%i\n", l, r); TRACE("l=%i r=%i\n", l, r);
if (l==r) /* one element is always sorted */ if (l==r) /* one element is always sorted */
return; return;
if (r<l) /* oops, got it in the wrong order */ if (r<l) /* oops, got it in the wrong order */
@ -2110,7 +2110,7 @@ DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r,
DPA_QuickSort(lpPtrs, m+1, r, pfnCompare, lParam); DPA_QuickSort(lpPtrs, m+1, r, pfnCompare, lParam);
/* join the two sides */ /* join the two sides */
while( (l<=m) && (m<r) ) while( (l<=m) && (m<r) )
{ {
if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0) if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0)
{ {
@ -2228,7 +2228,7 @@ DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart,
INT nIndex; INT nIndex;
TRACE("linear search\n"); TRACE("linear search\n");
nIndex = (nStart == -1)? 0 : nStart; nIndex = (nStart == -1)? 0 : nStart;
lpPtr = hdpa->ptrs; lpPtr = hdpa->ptrs;
for (; nIndex < hdpa->nItemCount; nIndex++) { for (; nIndex < hdpa->nItemCount; nIndex++) {
@ -2493,7 +2493,7 @@ COMCTL32_StrToIntW (LPWSTR lpString)
* PARAMS * PARAMS
* hdpa [I] handle to the dynamic pointer array * hdpa [I] handle to the dynamic pointer array
* enumProc [I] * enumProc [I]
* lParam [I] * lParam [I]
* *
* RETURNS * RETURNS
* none * none
@ -2674,7 +2674,7 @@ LPSTR WINAPI COMCTL32_StrRChrA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch )
if (*lpStart != LOBYTE(wMatch)) continue; if (*lpStart != LOBYTE(wMatch)) continue;
if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue; if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue;
lpGotIt = lpStart; lpGotIt = lpStart;
} }
return (LPSTR)lpGotIt; return (LPSTR)lpGotIt;
} }
@ -2728,7 +2728,7 @@ INT WINAPI COMCTL32_StrSpnW( LPWSTR lpStr, LPWSTR lpSet) {
for(; (*lpLoop != 0); lpLoop++) for(; (*lpLoop != 0); lpLoop++)
if( strchrW(lpSet, *(WORD*)lpLoop)) if( strchrW(lpSet, *(WORD*)lpLoop))
return (INT)(lpLoop-lpStr); return (INT)(lpLoop-lpStr);
return (INT)(lpLoop-lpStr); return (INT)(lpLoop-lpStr);
} }

View File

@ -1,4 +1,4 @@
/* /*
* Common controls functions * Common controls functions
* *
* Copyright 1997 Dimitrie O. Paun * Copyright 1997 Dimitrie O. Paun
@ -274,7 +274,7 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
/*********************************************************************** /***********************************************************************
* ShowHideMenuCtl [COMCTL32.3] * ShowHideMenuCtl [COMCTL32.3]
* *
* Shows or hides controls and updates the corresponding menu item. * Shows or hides controls and updates the corresponding menu item.
* *
@ -497,9 +497,9 @@ void WINAPI DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
HWND WINAPI HWND WINAPI
CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid) CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
{ {
return CreateWindowA(STATUSCLASSNAMEA, text, style, return CreateWindowA(STATUSCLASSNAMEA, text, style,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
parent, wid, 0, 0); parent, wid, 0, 0);
} }
@ -561,7 +561,7 @@ CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
if (hUD) { if (hUD) {
SendMessageA (hUD, UDM_SETBUDDY, buddy, 0); SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
} }
return hUD; return hUD;
@ -936,7 +936,7 @@ COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
*/ */
HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline) HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
{ {
FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE", FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE",
debugstr_w(cmdline)); debugstr_w(cmdline));
return S_OK; return S_OK;

View File

@ -55,7 +55,7 @@ typedef struct
int haveFocus; int haveFocus;
int *fieldspec; int *fieldspec;
RECT *fieldRect; RECT *fieldRect;
int *buflen; int *buflen;
char textbuf[256]; char textbuf[256];
POINT monthcal_pos; POINT monthcal_pos;
} DATETIME_INFO, *LPDATETIME_INFO; } DATETIME_INFO, *LPDATETIME_INFO;
@ -65,12 +65,12 @@ extern int MONTHCAL_MonthLength(int month, int year);
/* this list of defines is closely related to `allowedformatchars' defined /* this list of defines is closely related to `allowedformatchars' defined
* in datetime.c; the high nibble indicates the `base type' of the format * in datetime.c; the high nibble indicates the `base type' of the format
* specifier. * specifier.
* Do not change without first reading DATETIME_UseFormat. * Do not change without first reading DATETIME_UseFormat.
* *
*/ */
#define DT_END_FORMAT 0 #define DT_END_FORMAT 0
#define ONEDIGITDAY 0x01 #define ONEDIGITDAY 0x01
#define TWODIGITDAY 0x02 #define TWODIGITDAY 0x02
#define THREECHARDAY 0x03 #define THREECHARDAY 0x03
@ -122,7 +122,7 @@ DATETIME_GetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam )
TRACE("%04x %08lx\n",wParam,lParam); TRACE("%04x %08lx\n",wParam,lParam);
if (!lParam) return GDT_NONE; if (!lParam) return GDT_NONE;
if ((dwStyle & DTS_SHOWNONE) && if ((dwStyle & DTS_SHOWNONE) &&
(SendMessageA (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0))) (SendMessageA (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0)))
return GDT_NONE; return GDT_NONE;
@ -141,7 +141,7 @@ DATETIME_SetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam )
TRACE("%04x %08lx\n",wParam,lParam); TRACE("%04x %08lx\n",wParam,lParam);
if (!lParam) return 0; if (!lParam) return 0;
if (lParam==GDT_VALID) if (lParam==GDT_VALID)
MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date); MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
if (lParam==GDT_NONE) { if (lParam==GDT_NONE) {
infoPtr->dateValid=FALSE; infoPtr->dateValid=FALSE;
@ -225,20 +225,20 @@ DATETIME_SetMonthCalFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
/* /*
Split up a formattxt in actions. Split up a formattxt in actions.
See ms documentation for the meaning of the letter codes/'specifiers'. See ms documentation for the meaning of the letter codes/'specifiers'.
Notes: Notes:
*'dddddd' is handled as 'dddd' plus 'dd'. *'dddddd' is handled as 'dddd' plus 'dd'.
*unrecognized formats are strings (here given the type DT_STRING; *unrecognized formats are strings (here given the type DT_STRING;
start of the string is encoded in lower bits of DT_STRING. start of the string is encoded in lower bits of DT_STRING.
Therefore, 'string' ends finally up as '<show seconds>tring'. Therefore, 'string' ends finally up as '<show seconds>tring'.
*/ */
static void static void
DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt) DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt)
{ {
int i,j,k,len; int i,j,k,len;
@ -255,20 +255,20 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt)
for (i=0; i<strlen (formattxt); i++) { for (i=0; i<strlen (formattxt); i++) {
TRACE ("\n%d %c:",i, formattxt[i]); TRACE ("\n%d %c:",i, formattxt[i]);
for (j=0; j<len; j++) { for (j=0; j<len; j++) {
if (allowedformatchars[j]==formattxt[i]) { if (allowedformatchars[j]==formattxt[i]) {
TRACE ("%c[%d,%x]",allowedformatchars[j], *nrFields, TRACE ("%c[%d,%x]",allowedformatchars[j], *nrFields,
infoPtr->fieldspec[*nrFields]); infoPtr->fieldspec[*nrFields]);
if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) { if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
infoPtr->fieldspec[*nrFields]=(j<<4) +1; infoPtr->fieldspec[*nrFields]=(j<<4) +1;
break; break;
} }
if (infoPtr->fieldspec[*nrFields]>>4!=j) { if (infoPtr->fieldspec[*nrFields]>>4!=j) {
(*nrFields)++; (*nrFields)++;
infoPtr->fieldspec[*nrFields]=(j<<4) +1; infoPtr->fieldspec[*nrFields]=(j<<4) +1;
break; break;
} }
if ((infoPtr->fieldspec[*nrFields] & 0x0f)==maxrepetition[j]) { if ((infoPtr->fieldspec[*nrFields] & 0x0f)==maxrepetition[j]) {
(*nrFields)++; (*nrFields)++;
infoPtr->fieldspec[*nrFields]=(j<<4) +1; infoPtr->fieldspec[*nrFields]=(j<<4) +1;
break; break;
} }
@ -283,12 +283,12 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt)
if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) { if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
infoPtr->fieldspec[*nrFields]=DT_STRING+k; infoPtr->fieldspec[*nrFields]=DT_STRING+k;
infoPtr->buflen[*nrFields]=0; infoPtr->buflen[*nrFields]=0;
} else } else
if ((infoPtr->fieldspec[*nrFields] & DT_STRING)!=DT_STRING) { if ((infoPtr->fieldspec[*nrFields] & DT_STRING)!=DT_STRING) {
(*nrFields)++; (*nrFields)++;
infoPtr->fieldspec[*nrFields]=DT_STRING+k; infoPtr->fieldspec[*nrFields]=DT_STRING+k;
infoPtr->buflen[*nrFields]=0; infoPtr->buflen[*nrFields]=0;
} }
infoPtr->textbuf[k]=formattxt[i]; infoPtr->textbuf[k]=formattxt[i];
k++; k++;
infoPtr->buflen[*nrFields]++; infoPtr->buflen[*nrFields]++;
@ -306,7 +306,7 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, const char *formattxt)
} }
static LRESULT static LRESULT
DATETIME_SetFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_SetFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr= DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr= DATETIME_GetInfoPtr (hwnd);
@ -317,15 +317,15 @@ DATETIME_SetFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (!lParam) { if (!lParam) {
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
if (dwStyle & DTS_LONGDATEFORMAT) if (dwStyle & DTS_LONGDATEFORMAT)
format_item=LOCALE_SLONGDATE; format_item=LOCALE_SLONGDATE;
else if (dwStyle & DTS_TIMEFORMAT) else if (dwStyle & DTS_TIMEFORMAT)
format_item=LOCALE_STIMEFORMAT; format_item=LOCALE_STIMEFORMAT;
else /* DTS_SHORTDATEFORMAT */ else /* DTS_SHORTDATEFORMAT */
format_item=LOCALE_SSHORTDATE; format_item=LOCALE_SSHORTDATE;
GetLocaleInfoA( GetSystemDefaultLCID(), format_item,format_buf,sizeof(format_buf)); GetLocaleInfoA( GetSystemDefaultLCID(), format_item,format_buf,sizeof(format_buf));
DATETIME_UseFormat (infoPtr, format_buf); DATETIME_UseFormat (infoPtr, format_buf);
} }
else else
DATETIME_UseFormat (infoPtr, (char *) lParam); DATETIME_UseFormat (infoPtr, (char *) lParam);
@ -333,7 +333,7 @@ DATETIME_SetFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
DATETIME_SetFormatW (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_SetFormatW (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
@ -348,14 +348,14 @@ DATETIME_SetFormatW (HWND hwnd, WPARAM wParam, LPARAM lParam)
retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf); retval=DATETIME_SetFormat (hwnd, 0, (LPARAM) buf);
COMCTL32_Free (buf); COMCTL32_Free (buf);
return retval; return retval;
} }
else else
return DATETIME_SetFormat (hwnd, 0, 0); return DATETIME_SetFormat (hwnd, 0, 0);
} }
static void static void
DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result) DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
{ {
SYSTEMTIME date = infoPtr->date; SYSTEMTIME date = infoPtr->date;
@ -370,7 +370,7 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
} }
if (!infoPtr->fieldspec) return; if (!infoPtr->fieldspec) return;
spec=infoPtr->fieldspec[count]; spec=infoPtr->fieldspec[count];
if (spec & DT_STRING) { if (spec & DT_STRING) {
int txtlen=infoPtr->buflen[count]; int txtlen=infoPtr->buflen[count];
@ -381,18 +381,18 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
return; return;
} }
switch (spec) { switch (spec) {
case DT_END_FORMAT: case DT_END_FORMAT:
*result=0; *result=0;
break; break;
case ONEDIGITDAY: case ONEDIGITDAY:
sprintf (result,"%d",date.wDay); sprintf (result,"%d",date.wDay);
break; break;
case TWODIGITDAY: case TWODIGITDAY:
sprintf (result,"%.2d",date.wDay); sprintf (result,"%.2d",date.wDay);
break; break;
case THREECHARDAY: case THREECHARDAY:
GetLocaleInfoA( LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7, GetLocaleInfoA( LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1+(date.wDayOfWeek+6)%7,
result,4); result,4);
/*sprintf (result,"%.3s",days[date.wDayOfWeek]);*/ /*sprintf (result,"%.3s",days[date.wDayOfWeek]);*/
@ -402,83 +402,83 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
buffer,sizeof(buffer)); buffer,sizeof(buffer));
strcpy (result,buffer); strcpy (result,buffer);
break; break;
case ONEDIGIT12HOUR: case ONEDIGIT12HOUR:
if (date.wHour>12) if (date.wHour>12)
sprintf (result,"%d",date.wHour-12); sprintf (result,"%d",date.wHour-12);
else else
sprintf (result,"%d",date.wHour); sprintf (result,"%d",date.wHour);
break; break;
case TWODIGIT12HOUR: case TWODIGIT12HOUR:
if (date.wHour>12) if (date.wHour>12)
sprintf (result,"%.2d",date.wHour-12); sprintf (result,"%.2d",date.wHour-12);
else else
sprintf (result,"%.2d",date.wHour); sprintf (result,"%.2d",date.wHour);
break; break;
case ONEDIGIT24HOUR: case ONEDIGIT24HOUR:
sprintf (result,"%d",date.wHour); sprintf (result,"%d",date.wHour);
break; break;
case TWODIGIT24HOUR: case TWODIGIT24HOUR:
sprintf (result,"%.2d",date.wHour); sprintf (result,"%.2d",date.wHour);
break; break;
case ONEDIGITSECOND: case ONEDIGITSECOND:
sprintf (result,"%d",date.wSecond); sprintf (result,"%d",date.wSecond);
break; break;
case TWODIGITSECOND: case TWODIGITSECOND:
sprintf (result,"%.2d",date.wSecond); sprintf (result,"%.2d",date.wSecond);
break; break;
case ONEDIGITMINUTE: case ONEDIGITMINUTE:
sprintf (result,"%d",date.wMinute); sprintf (result,"%d",date.wMinute);
break; break;
case TWODIGITMINUTE: case TWODIGITMINUTE:
sprintf (result,"%.2d",date.wMinute); sprintf (result,"%.2d",date.wMinute);
break; break;
case ONEDIGITMONTH: case ONEDIGITMONTH:
sprintf (result,"%d",date.wMonth); sprintf (result,"%d",date.wMonth);
break; break;
case TWODIGITMONTH: case TWODIGITMONTH:
sprintf (result,"%.2d",date.wMonth); sprintf (result,"%.2d",date.wMonth);
break; break;
case THREECHARMONTH: case THREECHARMONTH:
GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1, GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,
buffer,sizeof(buffer)); buffer,sizeof(buffer));
sprintf (result,"%.3s",buffer); sprintf (result,"%.3s",buffer);
break; break;
case FULLMONTH: case FULLMONTH:
GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1, GetLocaleInfoA( GetSystemDefaultLCID(),LOCALE_SMONTHNAME1+date.wMonth -1,
result,sizeof(result)); result,sizeof(result));
break; break;
case ONELETTERAMPM: case ONELETTERAMPM:
if (date.wHour<12) if (date.wHour<12)
strcpy (result,"A"); strcpy (result,"A");
else else
strcpy (result,"P"); strcpy (result,"P");
break; break;
case TWOLETTERAMPM: case TWOLETTERAMPM:
if (date.wHour<12) if (date.wHour<12)
strcpy (result,"AM"); strcpy (result,"AM");
else else
strcpy (result,"PM"); strcpy (result,"PM");
break; break;
case FORMATCALLBACK: case FORMATCALLBACK:
FIXME ("Not implemented\n"); FIXME ("Not implemented\n");
strcpy (result,"xxx"); strcpy (result,"xxx");
break; break;
case ONEDIGITYEAR: case ONEDIGITYEAR:
sprintf (result,"%d",date.wYear-10* (int) floor(date.wYear/10)); sprintf (result,"%d",date.wYear-10* (int) floor(date.wYear/10));
break; break;
case TWODIGITYEAR: case TWODIGITYEAR:
sprintf (result,"%.2d",date.wYear-100* (int) floor(date.wYear/100)); sprintf (result,"%.2d",date.wYear-100* (int) floor(date.wYear/100));
break; break;
case FULLYEAR: case FULLYEAR:
sprintf (result,"%d",date.wYear); sprintf (result,"%d",date.wYear);
break; break;
} }
TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result); TRACE ("arg%d=%x->[%s]\n",count,infoPtr->fieldspec[count],result);
} }
static void static void
DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number) DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number)
{ {
SYSTEMTIME *date = &infoPtr->date; SYSTEMTIME *date = &infoPtr->date;
@ -489,53 +489,53 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number)
spec=infoPtr->fieldspec[number]; spec=infoPtr->fieldspec[number];
if ((spec & DTHT_DATEFIELD)==0) return; if ((spec & DTHT_DATEFIELD)==0) return;
switch (spec) { switch (spec) {
case ONEDIGITDAY: case ONEDIGITDAY:
case TWODIGITDAY: case TWODIGITDAY:
case THREECHARDAY: case THREECHARDAY:
case FULLDAY: case FULLDAY:
date->wDay++; date->wDay++;
if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))
date->wDay=1; date->wDay=1;
break; break;
case ONEDIGIT12HOUR: case ONEDIGIT12HOUR:
case TWODIGIT12HOUR: case TWODIGIT12HOUR:
case ONEDIGIT24HOUR: case ONEDIGIT24HOUR:
case TWODIGIT24HOUR: case TWODIGIT24HOUR:
date->wHour++; date->wHour++;
if (date->wHour>23) date->wHour=0; if (date->wHour>23) date->wHour=0;
break; break;
case ONEDIGITSECOND: case ONEDIGITSECOND:
case TWODIGITSECOND: case TWODIGITSECOND:
date->wSecond++; date->wSecond++;
if (date->wSecond>59) date->wSecond=0; if (date->wSecond>59) date->wSecond=0;
break; break;
case ONEDIGITMINUTE: case ONEDIGITMINUTE:
case TWODIGITMINUTE: case TWODIGITMINUTE:
date->wMinute++; date->wMinute++;
if (date->wMinute>59) date->wMinute=0; if (date->wMinute>59) date->wMinute=0;
break; break;
case ONEDIGITMONTH: case ONEDIGITMONTH:
case TWODIGITMONTH: case TWODIGITMONTH:
case THREECHARMONTH: case THREECHARMONTH:
case FULLMONTH: case FULLMONTH:
date->wMonth++; date->wMonth++;
if (date->wMonth>12) date->wMonth=1; if (date->wMonth>12) date->wMonth=1;
if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))
date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
break; break;
case ONELETTERAMPM: case ONELETTERAMPM:
case TWOLETTERAMPM: case TWOLETTERAMPM:
date->wHour+=12; date->wHour+=12;
if (date->wHour>23) date->wHour-=24; if (date->wHour>23) date->wHour-=24;
break; break;
case FORMATCALLBACK: case FORMATCALLBACK:
FIXME ("Not implemented\n"); FIXME ("Not implemented\n");
break; break;
case ONEDIGITYEAR: case ONEDIGITYEAR:
case TWODIGITYEAR: case TWODIGITYEAR:
case FULLYEAR: case FULLYEAR:
date->wYear++; date->wYear++;
break; break;
} }
@ -543,7 +543,7 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number)
} }
static void static void
DATETIME_DecreaseField (DATETIME_INFO *infoPtr, int number) DATETIME_DecreaseField (DATETIME_INFO *infoPtr, int number)
{ {
SYSTEMTIME *date = & infoPtr->date; SYSTEMTIME *date = & infoPtr->date;
@ -554,65 +554,65 @@ DATETIME_DecreaseField (DATETIME_INFO *infoPtr, int number)
spec = infoPtr->fieldspec[number]; spec = infoPtr->fieldspec[number];
if ((spec & DTHT_DATEFIELD)==0) return; if ((spec & DTHT_DATEFIELD)==0) return;
TRACE ("%x\n",spec); TRACE ("%x\n",spec);
switch (spec) { switch (spec) {
case ONEDIGITDAY: case ONEDIGITDAY:
case TWODIGITDAY: case TWODIGITDAY:
case THREECHARDAY: case THREECHARDAY:
case FULLDAY: case FULLDAY:
date->wDay--; date->wDay--;
if (date->wDay<1) if (date->wDay<1)
date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
break; break;
case ONEDIGIT12HOUR: case ONEDIGIT12HOUR:
case TWODIGIT12HOUR: case TWODIGIT12HOUR:
case ONEDIGIT24HOUR: case ONEDIGIT24HOUR:
case TWODIGIT24HOUR: case TWODIGIT24HOUR:
if (date->wHour) if (date->wHour)
date->wHour--; date->wHour--;
else else
date->wHour=23; date->wHour=23;
break; break;
case ONEDIGITSECOND: case ONEDIGITSECOND:
case TWODIGITSECOND: case TWODIGITSECOND:
if (date->wHour) if (date->wHour)
date->wSecond--; date->wSecond--;
else else
date->wHour=59; date->wHour=59;
break; break;
case ONEDIGITMINUTE: case ONEDIGITMINUTE:
case TWODIGITMINUTE: case TWODIGITMINUTE:
if (date->wMinute) if (date->wMinute)
date->wMinute--; date->wMinute--;
else else
date->wMinute=59; date->wMinute=59;
break; break;
case ONEDIGITMONTH: case ONEDIGITMONTH:
case TWODIGITMONTH: case TWODIGITMONTH:
case THREECHARMONTH: case THREECHARMONTH:
case FULLMONTH: case FULLMONTH:
if (date->wMonth>1) if (date->wMonth>1)
date->wMonth--; date->wMonth--;
else else
date->wMonth=12; date->wMonth=12;
if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear)) if (date->wDay>MONTHCAL_MonthLength(date->wMonth,date->wYear))
date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
break; break;
case ONELETTERAMPM: case ONELETTERAMPM:
case TWOLETTERAMPM: case TWOLETTERAMPM:
if (date->wHour<12) if (date->wHour<12)
date->wHour+=12; date->wHour+=12;
else else
date->wHour-=12; date->wHour-=12;
break; break;
case FORMATCALLBACK: case FORMATCALLBACK:
FIXME ("Not implemented\n"); FIXME ("Not implemented\n");
break; break;
case ONEDIGITYEAR: case ONEDIGITYEAR:
case TWODIGITYEAR: case TWODIGITYEAR:
case FULLYEAR: case FULLYEAR:
date->wYear--; date->wYear--;
break; break;
} }
@ -620,7 +620,7 @@ DATETIME_DecreaseField (DATETIME_INFO *infoPtr, int number)
} }
static void static void
DATETIME_ResetFieldDown (DATETIME_INFO *infoPtr, int number) DATETIME_ResetFieldDown (DATETIME_INFO *infoPtr, int number)
{ {
SYSTEMTIME *date = &infoPtr->date; SYSTEMTIME *date = &infoPtr->date;
@ -631,47 +631,47 @@ DATETIME_ResetFieldDown (DATETIME_INFO *infoPtr, int number)
spec = infoPtr->fieldspec[number]; spec = infoPtr->fieldspec[number];
if ((spec & DTHT_DATEFIELD)==0) return; if ((spec & DTHT_DATEFIELD)==0) return;
switch (spec) { switch (spec) {
case ONEDIGITDAY: case ONEDIGITDAY:
case TWODIGITDAY: case TWODIGITDAY:
case THREECHARDAY: case THREECHARDAY:
case FULLDAY: case FULLDAY:
date->wDay = 1; date->wDay = 1;
break; break;
case ONEDIGIT12HOUR: case ONEDIGIT12HOUR:
case TWODIGIT12HOUR: case TWODIGIT12HOUR:
case ONEDIGIT24HOUR: case ONEDIGIT24HOUR:
case TWODIGIT24HOUR: case TWODIGIT24HOUR:
case ONELETTERAMPM: case ONELETTERAMPM:
case TWOLETTERAMPM: case TWOLETTERAMPM:
date->wHour = 0; date->wHour = 0;
break; break;
case ONEDIGITSECOND: case ONEDIGITSECOND:
case TWODIGITSECOND: case TWODIGITSECOND:
date->wSecond = 0; date->wSecond = 0;
break; break;
case ONEDIGITMINUTE: case ONEDIGITMINUTE:
case TWODIGITMINUTE: case TWODIGITMINUTE:
date->wMinute = 0; date->wMinute = 0;
break; break;
case ONEDIGITMONTH: case ONEDIGITMONTH:
case TWODIGITMONTH: case TWODIGITMONTH:
case THREECHARMONTH: case THREECHARMONTH:
case FULLMONTH: case FULLMONTH:
date->wMonth = 1; date->wMonth = 1;
case FORMATCALLBACK: case FORMATCALLBACK:
FIXME ("Not implemented\n"); FIXME ("Not implemented\n");
break; break;
case ONEDIGITYEAR: case ONEDIGITYEAR:
case TWODIGITYEAR: case TWODIGITYEAR:
/* FYI: On 1752/9/14 the calendar changed and England and the /* FYI: On 1752/9/14 the calendar changed and England and the
* American colonies changed to the Gregorian calendar. This change * American colonies changed to the Gregorian calendar. This change
* involved having September 14th follow September 2nd. So no date * involved having September 14th follow September 2nd. So no date
* algorithm works before that date. * algorithm works before that date.
*/ */
case FULLYEAR: case FULLYEAR:
date->wSecond = 0; date->wSecond = 0;
date->wMinute = 0; date->wMinute = 0;
date->wHour = 0; date->wHour = 0;
@ -684,7 +684,7 @@ DATETIME_ResetFieldDown (DATETIME_INFO *infoPtr, int number)
} }
static void static void
DATETIME_ResetFieldUp (DATETIME_INFO *infoPtr, int number) DATETIME_ResetFieldUp (DATETIME_INFO *infoPtr, int number)
{ {
SYSTEMTIME *date = & infoPtr->date; SYSTEMTIME *date = & infoPtr->date;
@ -695,41 +695,41 @@ DATETIME_ResetFieldUp (DATETIME_INFO *infoPtr, int number)
spec=infoPtr->fieldspec[number]; spec=infoPtr->fieldspec[number];
if ((spec & DTHT_DATEFIELD)==0) return; if ((spec & DTHT_DATEFIELD)==0) return;
switch (spec) { switch (spec) {
case ONEDIGITDAY: case ONEDIGITDAY:
case TWODIGITDAY: case TWODIGITDAY:
case THREECHARDAY: case THREECHARDAY:
case FULLDAY: case FULLDAY:
date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear); date->wDay=MONTHCAL_MonthLength(date->wMonth,date->wYear);
break; break;
case ONEDIGIT12HOUR: case ONEDIGIT12HOUR:
case TWODIGIT12HOUR: case TWODIGIT12HOUR:
case ONEDIGIT24HOUR: case ONEDIGIT24HOUR:
case TWODIGIT24HOUR: case TWODIGIT24HOUR:
case ONELETTERAMPM: case ONELETTERAMPM:
case TWOLETTERAMPM: case TWOLETTERAMPM:
date->wHour=23; date->wHour=23;
break; break;
case ONEDIGITSECOND: case ONEDIGITSECOND:
case TWODIGITSECOND: case TWODIGITSECOND:
date->wSecond=59; date->wSecond=59;
break; break;
case ONEDIGITMINUTE: case ONEDIGITMINUTE:
case TWODIGITMINUTE: case TWODIGITMINUTE:
date->wMinute=59; date->wMinute=59;
break; break;
case ONEDIGITMONTH: case ONEDIGITMONTH:
case TWODIGITMONTH: case TWODIGITMONTH:
case THREECHARMONTH: case THREECHARMONTH:
case FULLMONTH: case FULLMONTH:
date->wMonth=12; date->wMonth=12;
case FORMATCALLBACK: case FORMATCALLBACK:
FIXME ("Not implemented\n"); FIXME ("Not implemented\n");
break; break;
case ONEDIGITYEAR: case ONEDIGITYEAR:
case TWODIGITYEAR: case TWODIGITYEAR:
case FULLYEAR: case FULLYEAR:
date->wYear=9999; /* Y10K problem? naaah. */ date->wYear=9999; /* Y10K problem? naaah. */
break; break;
} }
@ -751,14 +751,14 @@ static void DATETIME_Refresh (HWND hwnd, HDC hdc)
HBRUSH hbr; HBRUSH hbr;
SIZE size; SIZE size;
COLORREF oldBk, oldTextColor; COLORREF oldBk, oldTextColor;
/* draw control edge */ /* draw control edge */
TRACE("\n"); TRACE("\n");
hbr = CreateSolidBrush(RGB(255, 255, 255)); hbr = CreateSolidBrush(RGB(255, 255, 255));
FillRect(hdc, rcClient, hbr); FillRect(hdc, rcClient, hbr);
DrawEdge(hdc, rcClient, EDGE_SUNKEN, BF_RECT); DrawEdge(hdc, rcClient, EDGE_SUNKEN, BF_RECT);
DeleteObject(hbr); DeleteObject(hbr);
if (infoPtr->dateValid) { if (infoPtr->dateValid) {
char txt[80]; char txt[80];
HFONT oldFont; HFONT oldFont;
@ -825,7 +825,7 @@ DATETIME_HitTest (HWND hwnd, DATETIME_INFO *infoPtr, POINT pt)
for (i=0; i<infoPtr->nrFields; i++) { for (i=0; i<infoPtr->nrFields; i++) {
if (PtInRect (&infoPtr->fieldRect[i], pt)) { if (PtInRect (&infoPtr->fieldRect[i], pt)) {
retval = i; retval = i;
TRACE("Hit in date text in field %d\n", i); TRACE("Hit in date text in field %d\n", i);
break; break;
} }
} }
@ -838,7 +838,7 @@ done:
static LRESULT static LRESULT
DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
int old, new; int old, new;
POINT pt; POINT pt;
@ -867,7 +867,7 @@ DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
if(dwStyle & DTS_RIGHTALIGN) if(dwStyle & DTS_RIGHTALIGN)
infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right - infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right -
infoPtr->calbutton.left) + 145); infoPtr->calbutton.left) + 145);
else else
infoPtr->monthcal_pos.x = 8; infoPtr->monthcal_pos.x = 8;
infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom; infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom;
@ -881,7 +881,7 @@ DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
ShowWindow(infoPtr->hMonthCal, SW_SHOW); ShowWindow(infoPtr->hMonthCal, SW_SHOW);
TRACE ("dt:%x mc:%x mc parent:%x, desktop:%x, mcpp:%x\n", TRACE ("dt:%x mc:%x mc parent:%x, desktop:%x, mcpp:%x\n",
hwnd,infoPtr->hMonthCal, hwnd,infoPtr->hMonthCal,
GetParent (infoPtr->hMonthCal), GetParent (infoPtr->hMonthCal),
GetDesktopWindow (), GetDesktopWindow (),
GetParent (GetParent (infoPtr->hMonthCal))); GetParent (GetParent (infoPtr->hMonthCal)));
@ -897,10 +897,10 @@ DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
DATETIME_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
TRACE("\n"); TRACE("\n");
if(infoPtr->bCalDepressed == TRUE) { if(infoPtr->bCalDepressed == TRUE) {
infoPtr->bCalDepressed = FALSE; infoPtr->bCalDepressed = FALSE;
InvalidateRect(hwnd, &(infoPtr->calbutton), TRUE); InvalidateRect(hwnd, &(infoPtr->calbutton), TRUE);
@ -927,7 +927,7 @@ DATETIME_Paint (HWND hwnd, WPARAM wParam)
static LRESULT static LRESULT
DATETIME_ParentNotify (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_ParentNotify (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
LPNMHDR lpnmh = (LPNMHDR) lParam; LPNMHDR lpnmh = (LPNMHDR) lParam;
TRACE ("%x,%lx\n",wParam, lParam); TRACE ("%x,%lx\n",wParam, lParam);
@ -941,7 +941,7 @@ static LRESULT
DATETIME_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
LPNMHDR lpnmh = (LPNMHDR) lParam; LPNMHDR lpnmh = (LPNMHDR) lParam;
TRACE ("%x,%lx\n",wParam, lParam); TRACE ("%x,%lx\n",wParam, lParam);
@ -951,7 +951,7 @@ DATETIME_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
DATETIME_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
@ -970,7 +970,7 @@ DATETIME_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
switch (wParam) { switch (wParam) {
case VK_ADD: case VK_ADD:
case VK_UP: case VK_UP:
DATETIME_IncreaseField (infoPtr,FieldNum); DATETIME_IncreaseField (infoPtr,FieldNum);
DATETIME_SendDateTimeChangeNotify (hwnd); DATETIME_SendDateTimeChangeNotify (hwnd);
break; break;
@ -987,17 +987,17 @@ DATETIME_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
DATETIME_ResetFieldUp(infoPtr,FieldNum); DATETIME_ResetFieldUp(infoPtr,FieldNum);
DATETIME_SendDateTimeChangeNotify (hwnd); DATETIME_SendDateTimeChangeNotify (hwnd);
break; break;
case VK_LEFT: case VK_LEFT:
do { do {
if (infoPtr->select==0) { if (infoPtr->select==0) {
infoPtr->select = infoPtr->nrFields - 1; infoPtr->select = infoPtr->nrFields - 1;
wrap++; wrap++;
} else } else
infoPtr->select--; infoPtr->select--;
} }
while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2)); while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));
break; break;
case VK_RIGHT: case VK_RIGHT:
do { do {
infoPtr->select++; infoPtr->select++;
if (infoPtr->select==infoPtr->nrFields) { if (infoPtr->select==infoPtr->nrFields) {
@ -1018,7 +1018,7 @@ DATETIME_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
DATETIME_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
TRACE ("\n"); TRACE ("\n");
@ -1036,12 +1036,12 @@ DATETIME_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
DATETIME_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
TRACE ("\n"); TRACE ("\n");
if (infoPtr->haveFocus==0) { if (infoPtr->haveFocus==0) {
DATETIME_SendSimpleNotify (hwnd, NM_SETFOCUS); DATETIME_SendSimpleNotify (hwnd, NM_SETFOCUS);
infoPtr->haveFocus = DTHT_GOTFOCUS; infoPtr->haveFocus = DTHT_GOTFOCUS;
} }
@ -1055,7 +1055,7 @@ static BOOL
DATETIME_SendDateTimeChangeNotify (HWND hwnd) DATETIME_SendDateTimeChangeNotify (HWND hwnd)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
NMDATETIMECHANGE dtdtc; NMDATETIMECHANGE dtdtc;
TRACE ("\n"); TRACE ("\n");
@ -1123,7 +1123,7 @@ DATETIME_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
if(dwStyle & DTS_RIGHTALIGN) if(dwStyle & DTS_RIGHTALIGN)
infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right - infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right -
infoPtr->calbutton.left) + 145); infoPtr->calbutton.left) + 145);
else else
infoPtr->monthcal_pos.x = 8; infoPtr->monthcal_pos.x = 8;
infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom; infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom;
@ -1155,10 +1155,10 @@ DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
SetWindowLongA (hwnd, 0, (DWORD)infoPtr); SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
if (dwStyle & DTS_SHOWNONE) { if (dwStyle & DTS_SHOWNONE) {
infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0, infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
2,2,13,13, 2,2,13,13,
hwnd, hwnd,
0, GetWindowLongA (hwnd, GWL_HINSTANCE), 0); 0, GetWindowLongA (hwnd, GWL_HINSTANCE), 0);
SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 1, 0); SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 1, 0);
} }
@ -1179,10 +1179,10 @@ DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
DATETIME_SetFormat (hwnd, 0, 0); DATETIME_SetFormat (hwnd, 0, 0);
/* create the monthcal control */ /* create the monthcal control */
infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0, infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0,
WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS, WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS,
0, 0, 0, 0, 0, 0, 0, 0,
GetParent(hwnd), GetParent(hwnd),
0, 0, 0); 0, 0, 0);
/* initialize info structure */ /* initialize info structure */
@ -1197,7 +1197,7 @@ static LRESULT
DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
TRACE("\n"); TRACE("\n");
COMCTL32_Free (infoPtr); COMCTL32_Free (infoPtr);
SetWindowLongA( hwnd, 0, 0 ); SetWindowLongA( hwnd, 0, 0 );
@ -1210,7 +1210,7 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!DATETIME_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) if (!DATETIME_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
return DefWindowProcA( hwnd, uMsg, wParam, lParam ); return DefWindowProcA( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
{ {
@ -1307,7 +1307,7 @@ DATETIME_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = DATETIMEPICK_CLASSA; wndClass.lpszClassName = DATETIMEPICK_CLASSA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -79,10 +79,10 @@ HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
* *
* Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE, * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
* the return is nonzero if InitializeFlatSB has been called for this window, or * the return is nonzero if InitializeFlatSB has been called for this window, or
* zero otherwise. * zero otherwise.
* *
*/ */
BOOL WINAPI BOOL WINAPI
FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop) FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
{ {
TRACE("[%04x] propIndex=%d\n", hwnd, propIndex); TRACE("[%04x] propIndex=%d\n", hwnd, propIndex);
@ -93,7 +93,7 @@ FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
/*********************************************************************** /***********************************************************************
* FlatSB_SetScrollProp (COMCTL32.36) * FlatSB_SetScrollProp (COMCTL32.36)
*/ */
BOOL WINAPI BOOL WINAPI
FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag) FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
{ {
TRACE("[%04x] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag); TRACE("[%04x] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
@ -109,7 +109,7 @@ FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
* bars on and off without having to write conditional code." * bars on and off without having to write conditional code."
* *
* So, if we just call the standard functions until we implement * So, if we just call the standard functions until we implement
* the flat scroll bar functions, flat scroll bars will show up and * the flat scroll bar functions, flat scroll bars will show up and
* behave properly, as though they had simply not been setup to * behave properly, as though they had simply not been setup to
* have flat properties. * have flat properties.
* *
@ -120,7 +120,7 @@ FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
/*********************************************************************** /***********************************************************************
* FlatSB_EnableScrollBar (COMCTL32.29) * FlatSB_EnableScrollBar (COMCTL32.29)
*/ */
BOOL WINAPI BOOL WINAPI
FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags) FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
{ {
return EnableScrollBar(hwnd, nBar, flags); return EnableScrollBar(hwnd, nBar, flags);
@ -129,7 +129,7 @@ FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
/*********************************************************************** /***********************************************************************
* FlatSB_ShowScrollBar (COMCTL32.38) * FlatSB_ShowScrollBar (COMCTL32.38)
*/ */
BOOL WINAPI BOOL WINAPI
FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow) FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
{ {
return ShowScrollBar(hwnd, nBar, fShow); return ShowScrollBar(hwnd, nBar, fShow);
@ -138,7 +138,7 @@ FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
/*********************************************************************** /***********************************************************************
* FlatSB_GetScrollRange (COMCTL32.33) * FlatSB_GetScrollRange (COMCTL32.33)
*/ */
BOOL WINAPI BOOL WINAPI
FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max) FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
{ {
return GetScrollRange(hwnd, nBar, min, max); return GetScrollRange(hwnd, nBar, min, max);
@ -147,7 +147,7 @@ FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
/*********************************************************************** /***********************************************************************
* FlatSB_GetScrollInfo (COMCTL32.30) * FlatSB_GetScrollInfo (COMCTL32.30)
*/ */
BOOL WINAPI BOOL WINAPI
FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info) FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
{ {
return GetScrollInfo(hwnd, nBar, info); return GetScrollInfo(hwnd, nBar, info);
@ -156,7 +156,7 @@ FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
/*********************************************************************** /***********************************************************************
* FlatSB_GetScrollPos (COMCTL32.31) * FlatSB_GetScrollPos (COMCTL32.31)
*/ */
INT WINAPI INT WINAPI
FlatSB_GetScrollPos(HWND hwnd, int nBar) FlatSB_GetScrollPos(HWND hwnd, int nBar)
{ {
return GetScrollPos(hwnd, nBar); return GetScrollPos(hwnd, nBar);
@ -165,7 +165,7 @@ FlatSB_GetScrollPos(HWND hwnd, int nBar)
/*********************************************************************** /***********************************************************************
* FlatSB_SetScrollPos (COMCTL32.35) * FlatSB_SetScrollPos (COMCTL32.35)
*/ */
INT WINAPI INT WINAPI
FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw) FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
{ {
return SetScrollPos(hwnd, nBar, pos, bRedraw); return SetScrollPos(hwnd, nBar, pos, bRedraw);
@ -174,7 +174,7 @@ FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
/*********************************************************************** /***********************************************************************
* FlatSB_SetScrollInfo (COMCTL32.34) * FlatSB_SetScrollInfo (COMCTL32.34)
*/ */
INT WINAPI INT WINAPI
FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw) FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
{ {
return SetScrollInfo(hwnd, nBar, info, bRedraw); return SetScrollInfo(hwnd, nBar, info, bRedraw);
@ -183,7 +183,7 @@ FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
/*********************************************************************** /***********************************************************************
* FlatSB_SetScrollRange (COMCTL32.37) * FlatSB_SetScrollRange (COMCTL32.37)
*/ */
INT WINAPI INT WINAPI
FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw) FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
{ {
return SetScrollRange(hwnd, nBar, min, max, bRedraw); return SetScrollRange(hwnd, nBar, min, max, bRedraw);
@ -211,7 +211,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
return DefWindowProcA( hwnd, uMsg, wParam, lParam ); return DefWindowProcA( hwnd, uMsg, wParam, lParam );
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
@ -243,7 +243,7 @@ FLATSB_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = FLATSB_CLASSA; wndClass.lpszClassName = FLATSB_CLASSA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -42,7 +42,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(header); WINE_DEFAULT_DEBUG_CHANNEL(header);
typedef struct typedef struct
{ {
INT cxy; INT cxy;
HBITMAP hbm; HBITMAP hbm;
@ -98,13 +98,13 @@ HEADER_IndexToOrder (HWND hwnd, INT iItem)
} }
static INT static INT
HEADER_OrderToIndex(HWND hwnd, WPARAM wParam) HEADER_OrderToIndex(HWND hwnd, WPARAM wParam)
{ {
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
INT i,iorder = (INT)wParam; INT i,iorder = (INT)wParam;
if ((iorder <0) || iorder >infoPtr->uNumItem) if ((iorder <0) || iorder >infoPtr->uNumItem)
return iorder; return iorder;
for (i=0; i<infoPtr->uNumItem; i++) for (i=0; i<infoPtr->uNumItem; i++)
@ -162,7 +162,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
if (!infoPtr->bRectsValid) if (!infoPtr->bRectsValid)
HEADER_SetItemBounds(hwnd); HEADER_SetItemBounds(hwnd);
r = phdi->rect; r = phdi->rect;
if (r.right - r.left == 0) if (r.right - r.left == 0)
return phdi->rect.right; return phdi->rect.right;
@ -329,7 +329,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
} }
static void static void
HEADER_Refresh (HWND hwnd, HDC hdc) HEADER_Refresh (HWND hwnd, HDC hdc)
{ {
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
@ -594,7 +594,7 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
INT iItem = (INT)wParam; INT iItem = (INT)wParam;
TRACE("[iItem=%d]\n", iItem); TRACE("[iItem=%d]\n", iItem);
if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem)) if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
return FALSE; return FALSE;
@ -633,7 +633,7 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
HEADER_SetItemBounds (hwnd); HEADER_SetItemBounds (hwnd);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
} }
@ -685,7 +685,7 @@ HEADER_GetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
phdi->pszText, phdi->cchTextMax, NULL, NULL); phdi->pszText, phdi->cchTextMax, NULL, NULL);
else else
*phdi->pszText = 0; *phdi->pszText = 0;
} }
else else
phdi->pszText = LPSTR_TEXTCALLBACKA; phdi->pszText = LPSTR_TEXTCALLBACKA;
} }
@ -779,7 +779,7 @@ HEADER_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
HEADER_GetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam) HEADER_GetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
int i; int i;
@ -793,7 +793,7 @@ HEADER_GetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
static LRESULT static LRESULT
HEADER_SetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam) HEADER_SetOrderArray(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
int i; int i;
@ -877,7 +877,7 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
(infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM)); (infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
} }
} }
COMCTL32_Free (oldItems); COMCTL32_Free (oldItems);
} }
@ -924,7 +924,7 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
else else
lpItem->iOrder=nItem; lpItem->iOrder=nItem;
HEADER_SetItemBounds (hwnd); HEADER_SetItemBounds (hwnd);
@ -976,7 +976,7 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
(infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM)); (infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
} }
} }
COMCTL32_Free (oldItems); COMCTL32_Free (oldItems);
} }
@ -989,7 +989,7 @@ HEADER_InsertItemW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (phdi->mask & HDI_TEXT) { if (phdi->mask & HDI_TEXT) {
WCHAR wide_null_char = 0; WCHAR wide_null_char = 0;
if (!phdi->pszText) /* null pointer check */ if (!phdi->pszText) /* null pointer check */
phdi->pszText = &wide_null_char; phdi->pszText = &wide_null_char;
if (phdi->pszText != LPSTR_TEXTCALLBACKW) { if (phdi->pszText != LPSTR_TEXTCALLBACKW) {
len = strlenW (phdi->pszText); len = strlenW (phdi->pszText);
lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
@ -1304,7 +1304,7 @@ HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
UINT flags; UINT flags;
INT nItem; INT nItem;
pt.x = (INT)LOWORD(lParam); pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam); pt.y = (INT)HIWORD(lParam);
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
@ -1327,13 +1327,13 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT nItem; INT nItem;
HDC hdc; HDC hdc;
pt.x = (INT)LOWORD(lParam); pt.x = (INT)LOWORD(lParam);
pt.y = (INT)HIWORD(lParam); pt.y = (INT)HIWORD(lParam);
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
if ((dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) { if ((dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) {
SetCapture (hwnd); SetCapture (hwnd);
infoPtr->bCaptured = TRUE; infoPtr->bCaptured = TRUE;
infoPtr->bPressed = TRUE; infoPtr->bPressed = TRUE;
infoPtr->iMoveItem = nItem; infoPtr->iMoveItem = nItem;
@ -1345,11 +1345,11 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
ReleaseDC (hwnd, hdc); ReleaseDC (hwnd, hdc);
TRACE("Pressed item %d!\n", nItem); TRACE("Pressed item %d!\n", nItem);
} }
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) { else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
if (!(HEADER_SendHeaderNotify (hwnd, HDN_BEGINTRACKA, nItem,0))) { if (!(HEADER_SendHeaderNotify (hwnd, HDN_BEGINTRACKA, nItem,0))) {
SetCapture (hwnd); SetCapture (hwnd);
infoPtr->bCaptured = TRUE; infoPtr->bCaptured = TRUE;
infoPtr->bTracking = TRUE; infoPtr->bTracking = TRUE;
infoPtr->iMoveItem = nItem; infoPtr->iMoveItem = nItem;
infoPtr->nOldWidth = infoPtr->items[nItem].cxy; infoPtr->nOldWidth = infoPtr->items[nItem].cxy;
@ -1412,7 +1412,7 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->bRectsValid = FALSE; infoPtr->bRectsValid = FALSE;
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
/* FIXME: Should some WM_NOTIFY be sent */ /* FIXME: Should some WM_NOTIFY be sent */
} }
TRACE("Released item %d!\n", infoPtr->iMoveItem); TRACE("Released item %d!\n", infoPtr->iMoveItem);
infoPtr->bPressed = FALSE; infoPtr->bPressed = FALSE;
@ -1447,7 +1447,7 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem, HDI_WIDTH); HEADER_SendHeaderNotify(hwnd, HDN_ITEMCHANGINGA, infoPtr->iMoveItem, HDI_WIDTH);
HEADER_SetItemBounds (hwnd); HEADER_SetItemBounds (hwnd);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
/* /*
* } * }
*/ */
} }
@ -1536,7 +1536,7 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset; infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;
if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left) if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)
infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left; infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;
infoPtr->items[infoPtr->iMoveItem].cxy = infoPtr->items[infoPtr->iMoveItem].cxy =
infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left; infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;
HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack); HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
ReleaseDC (hwnd, hdc); ReleaseDC (hwnd, hdc);
@ -1586,7 +1586,7 @@ HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */ /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y));
return bRet; return bRet;
} }
@ -1637,7 +1637,7 @@ HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
ReleaseDC (0, hdc); ReleaseDC (0, hdc);
infoPtr->bRectsValid = FALSE; infoPtr->bRectsValid = FALSE;
if (lParam) { if (lParam) {
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
} }
@ -1680,7 +1680,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case HDM_GETITEMRECT: case HDM_GETITEMRECT:
return HEADER_GetItemRect (hwnd, wParam, lParam); return HEADER_GetItemRect (hwnd, wParam, lParam);
case HDM_GETORDERARRAY: case HDM_GETORDERARRAY:
return HEADER_GetOrderArray(hwnd, wParam, lParam); return HEADER_GetOrderArray(hwnd, wParam, lParam);
case HDM_GETUNICODEFORMAT: case HDM_GETUNICODEFORMAT:
@ -1754,7 +1754,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SIZE: case WM_SIZE:
return HEADER_Size (hwnd, wParam); return HEADER_Size (hwnd, wParam);
case WM_PAINT: case WM_PAINT:
return HEADER_Paint (hwnd, wParam); return HEADER_Paint (hwnd, wParam);
@ -1768,7 +1768,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return HEADER_SetFont (hwnd, wParam, lParam); return HEADER_SetFont (hwnd, wParam, lParam);
default: default:
if (msg >= WM_USER) if (msg >= WM_USER)
ERR("unknown msg %04x wp=%04x lp=%08lx\n", ERR("unknown msg %04x wp=%04x lp=%08lx\n",
msg, wParam, lParam ); msg, wParam, lParam );
return DefWindowProcA (hwnd, msg, wParam, lParam); return DefWindowProcA (hwnd, msg, wParam, lParam);
@ -1789,7 +1789,7 @@ HEADER_Register (void)
wndClass.cbWndExtra = sizeof(HEADER_INFO *); wndClass.cbWndExtra = sizeof(HEADER_INFO *);
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.lpszClassName = WC_HEADERA; wndClass.lpszClassName = WC_HEADERA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -365,7 +365,7 @@ HOTKEY_Register (void)
wndClass.hCursor = 0; wndClass.hCursor = 0;
wndClass.hbrBackground = 0; wndClass.hbrBackground = 0;
wndClass.lpszClassName = HOTKEY_CLASSA; wndClass.lpszClassName = HOTKEY_CLASSA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -33,7 +33,7 @@
* Comments: * Comments:
* - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use * - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use
* ImageList_DrawIndirect. Since ImageList_DrawIndirect is still * ImageList_DrawIndirect. Since ImageList_DrawIndirect is still
* partially implemented, the functions mentioned above will be * partially implemented, the functions mentioned above will be
* limited in functionality too. * limited in functionality too.
* *
* - Hotspot handling still not correct. The Hotspot passed to BeginDrag * - Hotspot handling still not correct. The Hotspot passed to BeginDrag
@ -80,7 +80,7 @@ static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0, FALSE };
/************************************************************************* /*************************************************************************
* IMAGELIST_InternalExpandBitmaps [Internal] * IMAGELIST_InternalExpandBitmaps [Internal]
* *
* Expands the bitmaps of an image list by the given number of images. * Expands the bitmaps of an image list by the given number of images.
* *
@ -127,7 +127,7 @@ IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT c
himl->hbmImage = hbmNewBitmap; himl->hbmImage = hbmNewBitmap;
if (himl->hbmMask) { if (himl->hbmMask) {
hbmNewBitmap = hbmNewBitmap =
CreateBitmap (nNewWidth, cy, 1, 1, NULL); CreateBitmap (nNewWidth, cy, 1, 1, NULL);
if (hbmNewBitmap == 0) if (hbmNewBitmap == 0)
@ -149,7 +149,7 @@ IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT c
/************************************************************************* /*************************************************************************
* IMAGELIST_InternalDraw [Internal] * IMAGELIST_InternalDraw [Internal]
* *
* Draws the image in the ImageList (without the mask) * Draws the image in the ImageList (without the mask)
* *
@ -162,7 +162,7 @@ IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT c
* nothing * nothing
* *
* NOTES * NOTES
* This function is used by ImageList_DrawIndirect, when it is * This function is used by ImageList_DrawIndirect, when it is
* required to draw only the Image (without the mask) to the screen. * required to draw only the Image (without the mask) to the screen.
* *
* Blending and Overlays styles are accomplished by another function * Blending and Overlays styles are accomplished by another function
@ -175,10 +175,10 @@ IMAGELIST_InternalDraw(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
hImageDC = CreateCompatibleDC(0); hImageDC = CreateCompatibleDC(0);
hOldBitmap = SelectObject(hImageDC, pimldp->himl->hbmImage); hOldBitmap = SelectObject(hImageDC, pimldp->himl->hbmImage);
BitBlt(pimldp->hdcDst, BitBlt(pimldp->hdcDst,
pimldp->x, pimldp->y, cx, cy, pimldp->x, pimldp->y, cx, cy,
hImageDC, hImageDC,
pimldp->himl->cx * pimldp->i, 0, pimldp->himl->cx * pimldp->i, 0,
SRCCOPY); SRCCOPY);
SelectObject(hImageDC, hOldBitmap); SelectObject(hImageDC, hOldBitmap);
@ -187,7 +187,7 @@ IMAGELIST_InternalDraw(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
/************************************************************************* /*************************************************************************
* IMAGELIST_InternalDrawMask [Internal] * IMAGELIST_InternalDrawMask [Internal]
* *
* Draws the image in the ImageList with the mask * Draws the image in the ImageList with the mask
* *
@ -200,7 +200,7 @@ IMAGELIST_InternalDraw(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
* nothing * nothing
* *
* NOTES * NOTES
* This function is used by ImageList_DrawIndirect, when it is * This function is used by ImageList_DrawIndirect, when it is
* required to draw the Image with the mask to the screen. * required to draw the Image with the mask to the screen.
* *
* Blending and Overlays styles are accomplished by another function. * Blending and Overlays styles are accomplished by another function.
@ -216,8 +216,8 @@ IMAGELIST_InternalDrawMask(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
COLORREF oldBkColor, oldFgColor; COLORREF oldBkColor, oldFgColor;
UINT fStyle = pimldp->fStyle & (~ILD_OVERLAYMASK); UINT fStyle = pimldp->fStyle & (~ILD_OVERLAYMASK);
/* /*
* We need a dc and bitmap to draw on that is * We need a dc and bitmap to draw on that is
* not on the screen. * not on the screen.
*/ */
HDC hOffScreenDC = 0; HDC hOffScreenDC = 0;
@ -232,11 +232,11 @@ IMAGELIST_InternalDrawMask(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
/* Create a compatible DC. */ /* Create a compatible DC. */
hOffScreenDC = CreateCompatibleDC( pimldp->hdcDst ); hOffScreenDC = CreateCompatibleDC( pimldp->hdcDst );
if ( hOffScreenDC ) if ( hOffScreenDC )
{ {
hOffScreenBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy ); hOffScreenBmp = CreateCompatibleBitmap( pimldp->hdcDst, cx, cy );
if ( hOffScreenBmp ) if ( hOffScreenBmp )
SelectObject( hOffScreenDC, hOffScreenBmp ); SelectObject( hOffScreenDC, hOffScreenBmp );
else else
goto cleanup; goto cleanup;
@ -246,43 +246,43 @@ IMAGELIST_InternalDrawMask(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
hOldBitmapImage = SelectObject(hImageDC, himlLocal->hbmImage); hOldBitmapImage = SelectObject(hImageDC, himlLocal->hbmImage);
hOldBitmapMask = SelectObject(hMaskDC, himlLocal->hbmMask); hOldBitmapMask = SelectObject(hMaskDC, himlLocal->hbmMask);
/* /*
* Get a copy of the image for the masking operations. * Get a copy of the image for the masking operations.
* We will use the copy, and this dc for all the various * We will use the copy, and this dc for all the various
* blitting, and then do one final blit to the screen dc. * blitting, and then do one final blit to the screen dc.
* This should clean up most of the flickering. * This should clean up most of the flickering.
*/ */
BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x, BitBlt( hOffScreenDC, 0, 0, cx, cy, pimldp->hdcDst, pimldp->x,
pimldp->y, SRCCOPY); pimldp->y, SRCCOPY);
/* /*
* Draw the Background for the appropriate Styles * Draw the Background for the appropriate Styles
*/ */
if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE if( bUseCustomBackground && (fStyle == ILD_NORMAL || fStyle & ILD_IMAGE
|| bBlendFlag) ) || bBlendFlag) )
{ {
hBrush = CreateSolidBrush (himlLocal->clrBk); hBrush = CreateSolidBrush (himlLocal->clrBk);
hOldBrush = SelectObject (pimldp->hdcDst, hBrush); hOldBrush = SelectObject (pimldp->hdcDst, hBrush);
PatBlt( hOffScreenDC, pimldp->x, pimldp->y, cx, cy, PATCOPY ); PatBlt( hOffScreenDC, pimldp->x, pimldp->y, cx, cy, PATCOPY );
DeleteObject (SelectObject (pimldp->hdcDst, hOldBrush)); DeleteObject (SelectObject (pimldp->hdcDst, hOldBrush));
} }
/* /*
* Draw Image Transparently over the current background * Draw Image Transparently over the current background
*/ */
if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) || if(fStyle == ILD_NORMAL || (fStyle & ILD_TRANSPARENT) ||
((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag) ((fStyle & ILD_IMAGE) && bUseCustomBackground) || bBlendFlag)
{ /* { /*
* To obtain a transparent look, background color should be set * To obtain a transparent look, background color should be set
* to white and foreground color to black when blting the * to white and foreground color to black when blting the
* monochrome mask. * monochrome mask.
*/ */
oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) ); oldBkColor = SetBkColor( hOffScreenDC, RGB( 0xff, 0xff, 0xff ) );
oldFgColor = SetTextColor( hOffScreenDC, RGB( 0, 0, 0 ) ); oldFgColor = SetTextColor( hOffScreenDC, RGB( 0, 0, 0 ) );
BitBlt( hOffScreenDC, 0, 0, cx, cy,hMaskDC, himlLocal->cx * pimldp->i, BitBlt( hOffScreenDC, 0, 0, cx, cy,hMaskDC, himlLocal->cx * pimldp->i,
@ -290,18 +290,18 @@ IMAGELIST_InternalDrawMask(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,himlLocal->cx * pimldp->i, BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,himlLocal->cx * pimldp->i,
0, SRCPAINT ); 0, SRCPAINT );
} }
/* /*
* Draw the image when no Background is specified * Draw the image when no Background is specified
*/ */
else if((fStyle & ILD_IMAGE) && !bUseCustomBackground) else if((fStyle & ILD_IMAGE) && !bUseCustomBackground)
{ {
BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC, BitBlt( hOffScreenDC, 0, 0, cx, cy, hImageDC,
himlLocal->cx * pimldp->i, 0, SRCCOPY); himlLocal->cx * pimldp->i, 0, SRCCOPY);
} }
/* /*
* Draw the mask with or without a background * Draw the mask with or without a background
*/ */
else if(fStyle & ILD_MASK) else if(fStyle & ILD_MASK)
@ -309,32 +309,32 @@ IMAGELIST_InternalDrawMask(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
BitBlt( hOffScreenDC, 0, 0, cx, cy, hMaskDC, himlLocal->cx * pimldp->i, BitBlt( hOffScreenDC, 0, 0, cx, cy, hMaskDC, himlLocal->cx * pimldp->i,
0, bUseCustomBackground ? SRCCOPY : SRCAND); 0, bUseCustomBackground ? SRCCOPY : SRCAND);
} }
/* /*
* Blit the bitmap to the screen now. * Blit the bitmap to the screen now.
*/ */
BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy,
hOffScreenDC, 0, 0, SRCCOPY); hOffScreenDC, 0, 0, SRCCOPY);
SelectObject(hImageDC, hOldBitmapImage); SelectObject(hImageDC, hOldBitmapImage);
SelectObject(hMaskDC, hOldBitmapMask); SelectObject(hMaskDC, hOldBitmapMask);
cleanup: cleanup:
DeleteDC(hImageDC); DeleteDC(hImageDC);
DeleteDC(hMaskDC); DeleteDC(hMaskDC);
DeleteDC( hOffScreenDC ); DeleteDC( hOffScreenDC );
DeleteObject( hOffScreenBmp ); DeleteObject( hOffScreenBmp );
return; return;
} }
/************************************************************************* /*************************************************************************
* IMAGELIST_InternalDrawBlend [Internal] * IMAGELIST_InternalDrawBlend [Internal]
* *
* Draws the Blend over the current image * Draws the Blend over the current image
* *
* PARAMS * PARAMS
* pimldp [I] pointer to IMAGELISTDRAWPARAMS structure. * pimldp [I] pointer to IMAGELISTDRAWPARAMS structure.
@ -345,9 +345,9 @@ cleanup:
* nothing * nothing
* *
* NOTES * NOTES
* This functions is used by ImageList_DrawIndirect, when it is * This functions is used by ImageList_DrawIndirect, when it is
* required to add the blend to the current image. * required to add the blend to the current image.
* *
*/ */
static VOID static VOID
IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
@ -386,15 +386,15 @@ IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
hOldMaskBitmap = (HBITMAP) SelectObject(hMaskDC, himlLocal->hbmMask); hOldMaskBitmap = (HBITMAP) SelectObject(hMaskDC, himlLocal->hbmMask);
BitBlt(hBlendMaskDC, BitBlt(hBlendMaskDC,
0,0, cx, cy, 0,0, cx, cy,
hMaskDC, hMaskDC,
himlLocal->cx * pimldp->i,0, himlLocal->cx * pimldp->i,0,
0x220326); /* NOTSRCAND */ 0x220326); /* NOTSRCAND */
BitBlt(hBlendMaskDC, BitBlt(hBlendMaskDC,
0,0, cx, cy, 0,0, cx, cy,
hBlendMaskDC, hBlendMaskDC,
0,0, 0,0,
NOTSRCCOPY); NOTSRCCOPY);
SelectObject(hMaskDC, hOldMaskBitmap); SelectObject(hMaskDC, hOldMaskBitmap);
@ -408,10 +408,10 @@ IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
hBlendColorBrush = CreateSolidBrush(clrBlend); hBlendColorBrush = CreateSolidBrush(clrBlend);
hOldBrush = (HBRUSH) SelectObject (pimldp->hdcDst, hBlendColorBrush); hOldBrush = (HBRUSH) SelectObject (pimldp->hdcDst, hBlendColorBrush);
BitBlt (pimldp->hdcDst, BitBlt (pimldp->hdcDst,
pimldp->x, pimldp->y, cx, cy, pimldp->x, pimldp->y, cx, cy,
hBlendMaskDC, hBlendMaskDC,
0, 0, 0, 0,
0xB8074A); /* PSDPxax */ 0xB8074A); /* PSDPxax */
SelectObject(pimldp->hdcDst, hOldBrush); SelectObject(pimldp->hdcDst, hOldBrush);
@ -424,9 +424,9 @@ IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
} }
/************************************************************************* /*************************************************************************
* IMAGELIST_InternalDrawOverlay [Internal] * IMAGELIST_InternalDrawOverlay [Internal]
* *
* Draws the overlay image * Draws the overlay image
* *
* PARAMS * PARAMS
* pimldp [I] pointer to IMAGELISTDRAWPARAMS structure. * pimldp [I] pointer to IMAGELISTDRAWPARAMS structure.
@ -437,12 +437,12 @@ IMAGELIST_InternalDrawBlend(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
* nothing * nothing
* *
* NOTES * NOTES
* This functions is used by ImageList_DrawIndirect, when it is * This functions is used by ImageList_DrawIndirect, when it is
* required to draw the overlay * required to draw the overlay
* *
* *
*/ */
static VOID static VOID
IMAGELIST_InternalDrawOverlay(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy) IMAGELIST_InternalDrawOverlay(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
{ {
INT nOvlIdx; INT nOvlIdx;
@ -458,21 +458,21 @@ IMAGELIST_InternalDrawOverlay(IMAGELISTDRAWPARAMS *pimldp, INT cx, INT cy)
hImageDC = CreateCompatibleDC(0); hImageDC = CreateCompatibleDC(0);
if (pimldp->himl->hbmMask) if (pimldp->himl->hbmMask)
{ {
hOldBitmap = (HBITMAP) SelectObject (hImageDC, hOldBitmap = (HBITMAP) SelectObject (hImageDC,
pimldp->himl->hbmMask); pimldp->himl->hbmMask);
BitBlt (pimldp->hdcDst, BitBlt (pimldp->hdcDst,
pimldp->x, pimldp->y, cx, cy, pimldp->x, pimldp->y, cx, cy,
hImageDC, pimldp->himl->cx * nOvlIdx, 0, hImageDC, pimldp->himl->cx * nOvlIdx, 0,
SRCAND); SRCAND);
SelectObject(hImageDC, hOldBitmap); SelectObject(hImageDC, hOldBitmap);
} }
hOldBitmap = (HBITMAP) SelectObject (hImageDC, hOldBitmap = (HBITMAP) SelectObject (hImageDC,
pimldp->himl->hbmImage); pimldp->himl->hbmImage);
BitBlt (pimldp->hdcDst, BitBlt (pimldp->hdcDst,
pimldp->x, pimldp->y, cx, cy, pimldp->x, pimldp->y, cx, cy,
hImageDC, hImageDC,
pimldp->himl->cx * nOvlIdx, 0, pimldp->himl->cx * nOvlIdx, 0,
SRCPAINT); SRCPAINT);
@ -539,10 +539,10 @@ ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
hOldBitmapMask = (HBITMAP) SelectObject(hdcMask, himl->hbmMask); hOldBitmapMask = (HBITMAP) SelectObject(hdcMask, himl->hbmMask);
hOldBitmapTemp = (HBITMAP) SelectObject(hdcTemp, hbmMask); hOldBitmapTemp = (HBITMAP) SelectObject(hdcTemp, hbmMask);
BitBlt (hdcMask, BitBlt (hdcMask,
nStartX, 0, bmp.bmWidth, bmp.bmHeight, nStartX, 0, bmp.bmWidth, bmp.bmHeight,
hdcTemp, hdcTemp,
0, 0, 0, 0,
SRCCOPY); SRCCOPY);
SelectObject(hdcTemp, hOldBitmapTemp); SelectObject(hdcTemp, hOldBitmapTemp);
@ -550,10 +550,10 @@ ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
/* Remove the background from the image /* Remove the background from the image
*/ */
BitBlt (hdcImage, BitBlt (hdcImage,
nStartX, 0, bmp.bmWidth, bmp.bmHeight, nStartX, 0, bmp.bmWidth, bmp.bmHeight,
hdcMask, hdcMask,
nStartX, 0, nStartX, 0,
0x220326); /* NOTSRCAND */ 0x220326); /* NOTSRCAND */
SelectObject(hdcMask, hOldBitmapMask); SelectObject(hdcMask, hOldBitmapMask);
@ -594,7 +594,7 @@ ImageList_AddIcon (HIMAGELIST himl, HICON hIcon)
/************************************************************************* /*************************************************************************
* ImageList_AddMasked [COMCTL32.42] * ImageList_AddMasked [COMCTL32.42]
* *
* Adds an image or images to an image list and creates a mask from the * Adds an image or images to an image list and creates a mask from the
* specified bitmap using the mask color. * specified bitmap using the mask color.
@ -659,9 +659,9 @@ ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
bkColor = (clrMask != CLR_DEFAULT) ? clrMask : bkColor = (clrMask != CLR_DEFAULT) ? clrMask :
GetPixel (hdcBitmap, 0, 0); GetPixel (hdcBitmap, 0, 0);
SetBkColor (hdcBitmap, bkColor); SetBkColor (hdcBitmap, bkColor);
BitBlt (hdcMask, BitBlt (hdcMask,
nMaskXOffset, 0, bmp.bmWidth, bmp.bmHeight, nMaskXOffset, 0, bmp.bmWidth, bmp.bmHeight,
hdcBitmap, 0, 0, hdcBitmap, 0, 0,
SRCCOPY); SRCCOPY);
SetBkColor(hdcBitmap, RGB(255,255,255)); SetBkColor(hdcBitmap, RGB(255,255,255));
@ -676,17 +676,17 @@ ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
on windows where it failed (BUT ImageList_Add is OK) on windows where it failed (BUT ImageList_Add is OK)
This is here in case some apps rely on this bug This is here in case some apps rely on this bug
*/ */
BitBlt(hdcBitmap, BitBlt(hdcBitmap,
0, 0, bmp.bmWidth, bmp.bmHeight, 0, 0, bmp.bmWidth, bmp.bmHeight,
hdcMask, hdcMask,
nMaskXOffset, 0, nMaskXOffset, 0,
0x220326); /* NOTSRCAND */ 0x220326); /* NOTSRCAND */
/* Copy result to the imagelist /* Copy result to the imagelist
*/ */
BitBlt (hdcImage, BitBlt (hdcImage,
nIndex * himl->cx, 0, bmp.bmWidth, bmp.bmHeight, nIndex * himl->cx, 0, bmp.bmWidth, bmp.bmHeight,
hdcBitmap, hdcBitmap,
0, 0, 0, 0,
SRCCOPY); SRCCOPY);
/* Clean up /* Clean up
*/ */
@ -706,7 +706,7 @@ ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
/************************************************************************* /*************************************************************************
* ImageList_BeginDrag [COMCTL32.43] * ImageList_BeginDrag [COMCTL32.43]
* *
* Creates a temporary image list that contains one image. It will be used * Creates a temporary image list that contains one image. It will be used
* as a drag image. * as a drag image.
@ -774,9 +774,9 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
/************************************************************************* /*************************************************************************
* ImageList_Copy [COMCTL32.44] * ImageList_Copy [COMCTL32.44]
* *
* Copies an image of the source image list to an image of the * Copies an image of the source image list to an image of the
* destination image list. Images can be copied or swapped. * destination image list. Images can be copied or swapped.
* *
* PARAMS * PARAMS
@ -800,7 +800,7 @@ BOOL WINAPI
ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc, ImageList_Copy (HIMAGELIST himlDst, INT iDst, HIMAGELIST himlSrc,
INT iSrc, INT uFlags) INT iSrc, INT uFlags)
{ {
HDC hdcSrc, hdcDst; HDC hdcSrc, hdcDst;
TRACE("iDst=%d iSrc=%d\n", iDst, iSrc); TRACE("iDst=%d iSrc=%d\n", iDst, iSrc);
@ -924,7 +924,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
HDC hdc; HDC hdc;
INT nCount; INT nCount;
HBITMAP hbmTemp; HBITMAP hbmTemp;
static WORD aBitBlend25[] = static WORD aBitBlend25[] =
{0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00}; {0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00};
static WORD aBitBlend50[] = static WORD aBitBlend50[] =
@ -967,7 +967,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
} }
else else
himl->hbmImage = 0; himl->hbmImage = 0;
if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) { if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) {
himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy,
1, 1, NULL); 1, 1, NULL);
@ -996,7 +996,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
/************************************************************************* /*************************************************************************
* ImageList_Destroy [COMCTL32.46] * ImageList_Destroy [COMCTL32.46]
* *
* Destroys an image list. * Destroys an image list.
* *
@ -1010,7 +1010,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
BOOL WINAPI BOOL WINAPI
ImageList_Destroy (HIMAGELIST himl) ImageList_Destroy (HIMAGELIST himl)
{ {
if (!himl) if (!himl)
return FALSE; return FALSE;
@ -1025,7 +1025,7 @@ ImageList_Destroy (HIMAGELIST himl)
DeleteObject (himl->hbrBlend25); DeleteObject (himl->hbrBlend25);
if (himl->hbrBlend50) if (himl->hbrBlend50)
DeleteObject (himl->hbrBlend50); DeleteObject (himl->hbrBlend50);
COMCTL32_Free (himl); COMCTL32_Free (himl);
return TRUE; return TRUE;
@ -1033,7 +1033,7 @@ ImageList_Destroy (HIMAGELIST himl)
/************************************************************************* /*************************************************************************
* ImageList_DragEnter [COMCTL32.47] * ImageList_DragEnter [COMCTL32.47]
* *
* Locks window update and displays the drag image at the given position. * Locks window update and displays the drag image at the given position.
* *
@ -1077,7 +1077,7 @@ ImageList_DragEnter (HWND hwndLock, INT x, INT y)
/************************************************************************* /*************************************************************************
* ImageList_DragLeave [COMCTL32.48] * ImageList_DragLeave [COMCTL32.48]
* *
* Unlocks window update and hides the drag image. * Unlocks window update and hides the drag image.
* *
@ -1110,7 +1110,7 @@ ImageList_DragLeave (HWND hwndLock)
/************************************************************************* /*************************************************************************
* ImageList_DragMove [COMCTL32.49] * ImageList_DragMove [COMCTL32.49]
* *
* Moves the drag image. * Moves the drag image.
* *
@ -1149,7 +1149,7 @@ ImageList_DragMove (INT x, INT y)
INT origOldX, origOldY; INT origOldX, origOldY;
INT origRegX, origRegY; INT origRegX, origRegY;
INT sizeRegX, sizeRegY; INT sizeRegX, sizeRegY;
/* calculate the update region */ /* calculate the update region */
origNewX = x - InternalDrag.dxHotspot; origNewX = x - InternalDrag.dxHotspot;
@ -1203,7 +1203,7 @@ ImageList_DragMove (INT x, INT y)
/************************************************************************* /*************************************************************************
* ImageList_DragShowNolock [COMCTL32.50] * ImageList_DragShowNolock [COMCTL32.50]
* *
* Shows or hides the drag image. * Shows or hides the drag image.
* *
@ -1248,7 +1248,7 @@ ImageList_DragShowNolock (BOOL bShow)
InternalDrag.himl->cx, InternalDrag.himl->cy); InternalDrag.himl->cx, InternalDrag.himl->cy);
} }
SelectObject(hdcBg, InternalDrag.hbmBg); SelectObject(hdcBg, InternalDrag.hbmBg);
if (bShow) { if (bShow) {
/* save the background */ /* save the background */
BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy, BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy,
@ -1256,7 +1256,7 @@ ImageList_DragShowNolock (BOOL bShow)
/* show the image */ /* show the image */
/* FIXME: this should be drawn semitransparent */ /* FIXME: this should be drawn semitransparent */
ImageList_Draw(InternalDrag.himl, 0, hdcDrag, x, y, ILD_NORMAL); ImageList_Draw(InternalDrag.himl, 0, hdcDrag, x, y, ILD_NORMAL);
} else { } else {
/* hide the image */ /* hide the image */
BitBlt(hdcDrag, x, y, InternalDrag.himl->cx, InternalDrag.himl->cy, BitBlt(hdcDrag, x, y, InternalDrag.himl->cx, InternalDrag.himl->cy,
hdcBg, 0, 0, SRCCOPY); hdcBg, 0, 0, SRCCOPY);
@ -1372,7 +1372,7 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
/************************************************************************* /*************************************************************************
* ImageList_DrawIndirect [COMCTL32.53] * ImageList_DrawIndirect [COMCTL32.53]
* *
* Draws an image using ... * Draws an image using ...
* *
@ -1387,8 +1387,8 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
BOOL WINAPI BOOL WINAPI
ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp) ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
{ {
INT cx, cy; INT cx, cy;
/* /*
Do some Error Checking Do some Error Checking
*/ */
if (pimldp == NULL) if (pimldp == NULL)
@ -1417,7 +1417,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
{ {
IMAGELIST_InternalDraw(pimldp, cx, cy); IMAGELIST_InternalDraw(pimldp, cx, cy);
} }
/* /*
Apply the blend if needed to the Image Apply the blend if needed to the Image
*/ */
if((pimldp->fStyle & ILD_BLEND50) if((pimldp->fStyle & ILD_BLEND50)
@ -1594,7 +1594,7 @@ ImageList_GetFlags(HIMAGELIST himl)
/************************************************************************* /*************************************************************************
* ImageList_GetIcon [COMCTL32.59] * ImageList_GetIcon [COMCTL32.59]
* *
* Creates an icon from a masked image of an image list. * Creates an icon from a masked image of an image list.
* *
@ -1646,12 +1646,12 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
/* /*
* CreateIconIndirect requires us to deselect the bitmaps from * CreateIconIndirect requires us to deselect the bitmaps from
* the DCs before calling * the DCs before calling
*/ */
SelectObject(hdcSrc, hOldSrcBitmap); SelectObject(hdcSrc, hOldSrcBitmap);
SelectObject(hdcDst, hOldDstBitmap); SelectObject(hdcDst, hOldDstBitmap);
hIcon = CreateIconIndirect (&ii); hIcon = CreateIconIndirect (&ii);
DeleteDC (hdcSrc); DeleteDC (hdcSrc);
DeleteDC (hdcDst); DeleteDC (hdcDst);
@ -1745,18 +1745,18 @@ ImageList_GetImageInfo (HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
pImageInfo->hbmImage = himl->hbmImage; pImageInfo->hbmImage = himl->hbmImage;
pImageInfo->hbmMask = himl->hbmMask; pImageInfo->hbmMask = himl->hbmMask;
pImageInfo->rcImage.top = 0; pImageInfo->rcImage.top = 0;
pImageInfo->rcImage.bottom = himl->cy; pImageInfo->rcImage.bottom = himl->cy;
pImageInfo->rcImage.left = i * himl->cx; pImageInfo->rcImage.left = i * himl->cx;
pImageInfo->rcImage.right = (i+1) * himl->cx; pImageInfo->rcImage.right = (i+1) * himl->cx;
return TRUE; return TRUE;
} }
/************************************************************************* /*************************************************************************
* ImageList_GetImageRect [COMCTL32.63] * ImageList_GetImageRect [COMCTL32.63]
* *
* Retrieves the rectangle of the specified image in an image list. * Retrieves the rectangle of the specified image in an image list.
* *
@ -1855,7 +1855,7 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
GetIconInfo (handle, &ii); GetIconInfo (handle, &ii);
GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp); GetObjectA (ii.hbmColor, sizeof(BITMAP), (LPVOID)&bmp);
himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
ILC_MASK | ILC_COLOR, 1, cGrow); ILC_MASK | ILC_COLOR, 1, cGrow);
ImageList_Add (himl, ii.hbmColor, ii.hbmMask); ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
DeleteObject (ii.hbmColor); DeleteObject (ii.hbmColor);
@ -1863,7 +1863,7 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
} }
DeleteObject (handle); DeleteObject (handle);
return himl; return himl;
} }
@ -1932,7 +1932,7 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
GetIconInfo (handle, &ii); GetIconInfo (handle, &ii);
GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp); GetObjectA (ii.hbmMask, sizeof(BITMAP), (LPVOID)&bmp);
himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight, himl = ImageList_Create (bmp.bmWidth, bmp.bmHeight,
ILC_MASK | ILC_COLOR, 1, cGrow); ILC_MASK | ILC_COLOR, 1, cGrow);
ImageList_Add (himl, ii.hbmColor, ii.hbmMask); ImageList_Add (himl, ii.hbmColor, ii.hbmMask);
DeleteObject (ii.hbmColor); DeleteObject (ii.hbmColor);
@ -1940,13 +1940,13 @@ ImageList_LoadImageW (HINSTANCE hi, LPCWSTR lpbmp, INT cx, INT cGrow,
} }
DeleteObject (handle); DeleteObject (handle);
return himl; return himl;
} }
/************************************************************************* /*************************************************************************
* ImageList_Merge [COMCTL32.67] * ImageList_Merge [COMCTL32.67]
* *
* Creates a new image list that contains a merged image from the specified * Creates a new image list that contains a merged image from the specified
* images of both source image lists. * images of both source image lists.
@ -2030,40 +2030,40 @@ ImageList_Merge (HIMAGELIST himl1, INT i1, HIMAGELIST himl2, INT i2,
hdcDstImage = CreateCompatibleDC (0); hdcDstImage = CreateCompatibleDC (0);
nX1 = i1 * himl1->cx; nX1 = i1 * himl1->cx;
nX2 = i2 * himl2->cx; nX2 = i2 * himl2->cx;
/* copy image */ /* copy image */
SelectObject (hdcSrcImage, himl1->hbmImage); SelectObject (hdcSrcImage, himl1->hbmImage);
SelectObject (hdcDstImage, himlDst->hbmImage); SelectObject (hdcDstImage, himlDst->hbmImage);
BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, BitBlt (hdcDstImage, 0, 0, cxDst, cyDst,
hdcSrcImage, 0, 0, BLACKNESS); hdcSrcImage, 0, 0, BLACKNESS);
BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy,
hdcSrcImage, nX1, 0, SRCCOPY); hdcSrcImage, nX1, 0, SRCCOPY);
SelectObject (hdcSrcImage, himl2->hbmMask); SelectObject (hdcSrcImage, himl2->hbmMask);
BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
hdcSrcImage, nX2, 0, SRCAND); hdcSrcImage, nX2, 0, SRCAND);
SelectObject (hdcSrcImage, himl2->hbmImage); SelectObject (hdcSrcImage, himl2->hbmImage);
BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
hdcSrcImage, nX2, 0, SRCPAINT); hdcSrcImage, nX2, 0, SRCPAINT);
/* copy mask */ /* copy mask */
SelectObject (hdcSrcImage, himl1->hbmMask); SelectObject (hdcSrcImage, himl1->hbmMask);
SelectObject (hdcDstImage, himlDst->hbmMask); SelectObject (hdcDstImage, himlDst->hbmMask);
BitBlt (hdcDstImage, 0, 0, cxDst, cyDst, BitBlt (hdcDstImage, 0, 0, cxDst, cyDst,
hdcSrcImage, 0, 0, WHITENESS); hdcSrcImage, 0, 0, WHITENESS);
BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy, BitBlt (hdcDstImage, xOff1, yOff1, himl1->cx, himl1->cy,
hdcSrcImage, nX1, 0, SRCCOPY); hdcSrcImage, nX1, 0, SRCCOPY);
SelectObject (hdcSrcImage, himl2->hbmMask); SelectObject (hdcSrcImage, himl2->hbmMask);
BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy, BitBlt (hdcDstImage, xOff2, yOff2, himl2->cx, himl2->cy,
hdcSrcImage, nX2, 0, SRCAND); hdcSrcImage, nX2, 0, SRCAND);
DeleteDC (hdcSrcImage); DeleteDC (hdcSrcImage);
DeleteDC (hdcDstImage); DeleteDC (hdcDstImage);
himlDst->cCurImage = 1; himlDst->cCurImage = 1;
} }
return himlDst; return himlDst;
} }
@ -2193,10 +2193,10 @@ ret1:
* ILHEAD ilheadstruct; * ILHEAD ilheadstruct;
* *
* for the color image part: * for the color image part:
* BITMAPFILEHEADER bmfh; * BITMAPFILEHEADER bmfh;
* BITMAPINFOHEADER bmih; * BITMAPINFOHEADER bmih;
* only if it has a palette: * only if it has a palette:
* RGBQUAD rgbs[nr_of_paletted_colors]; * RGBQUAD rgbs[nr_of_paletted_colors];
* *
* BYTE colorbits[imagesize]; * BYTE colorbits[imagesize];
* *
@ -2204,7 +2204,7 @@ ret1:
* BITMAPFILEHEADER bmfh_mask; * BITMAPFILEHEADER bmfh_mask;
* BITMAPINFOHEADER bmih_mask; * BITMAPINFOHEADER bmih_mask;
* only if it has a palette (it usually does not): * only if it has a palette (it usually does not):
* RGBQUAD rgbs[nr_of_paletted_colors]; * RGBQUAD rgbs[nr_of_paletted_colors];
* *
* BYTE maskbits[imagesize]; * BYTE maskbits[imagesize];
* *
@ -2296,7 +2296,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
ERR("Invalid image list handle!\n"); ERR("Invalid image list handle!\n");
return FALSE; return FALSE;
} }
if ((i < -1) || (i >= himl->cCurImage)) { if ((i < -1) || (i >= himl->cCurImage)) {
ERR("index out of range! %d\n", i); ERR("index out of range! %d\n", i);
return FALSE; return FALSE;
@ -2339,7 +2339,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
himl->cCurImage, himl->cCurImage - 1); himl->cCurImage, himl->cCurImage - 1);
TRACE(" - Max. number of images: %d / %d (Old/New)\n", TRACE(" - Max. number of images: %d / %d (Old/New)\n",
himl->cMaxImage, himl->cCurImage + himl->cGrow - 1); himl->cMaxImage, himl->cCurImage + himl->cGrow - 1);
hbmNewImage = hbmNewImage =
CreateBitmap (cxNew, himl->cy, 1, himl->uBitsPixel, NULL); CreateBitmap (cxNew, himl->cy, 1, himl->uBitsPixel, NULL);
@ -2354,7 +2354,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
/* copy all images and masks prior to the "removed" image */ /* copy all images and masks prior to the "removed" image */
if (i > 0) { if (i > 0) {
TRACE("Pre image copy: Copy %d images\n", i); TRACE("Pre image copy: Copy %d images\n", i);
SelectObject (hdcSrc, himl->hbmImage); SelectObject (hdcSrc, himl->hbmImage);
SelectObject (hdcDst, hbmNewImage); SelectObject (hdcDst, hbmNewImage);
BitBlt (hdcDst, 0, 0, i * himl->cx, himl->cy, BitBlt (hdcDst, 0, 0, i * himl->cx, himl->cy,
@ -2405,7 +2405,7 @@ ImageList_Remove (HIMAGELIST himl, INT i)
/************************************************************************* /*************************************************************************
* ImageList_Replace [COMCTL32.70] * ImageList_Replace [COMCTL32.70]
* *
* Replaces an image in an image list with a new image. * Replaces an image in an image list with a new image.
* *
@ -2431,7 +2431,7 @@ ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage,
ERR("Invalid image list handle!\n"); ERR("Invalid image list handle!\n");
return FALSE; return FALSE;
} }
if ((i >= himl->cMaxImage) || (i < 0)) { if ((i >= himl->cMaxImage) || (i < 0)) {
ERR("Invalid image index!\n"); ERR("Invalid image index!\n");
return FALSE; return FALSE;
@ -2461,10 +2461,10 @@ ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage,
/* Remove the background from the image /* Remove the background from the image
*/ */
SelectObject (hdcImageList, himl->hbmImage); SelectObject (hdcImageList, himl->hbmImage);
StretchBlt (hdcImageList, StretchBlt (hdcImageList,
i*himl->cx, 0, himl->cx, himl->cy, i*himl->cx, 0, himl->cx, himl->cy,
hdcImage, hdcImage,
0, 0, bmp.bmWidth, bmp.bmHeight, 0, 0, bmp.bmWidth, bmp.bmHeight,
0x220326); /* NOTSRCAND */ 0x220326); /* NOTSRCAND */
} }
@ -2508,8 +2508,8 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon)
return -1; return -1;
hBestFitIcon = CopyImage( hBestFitIcon = CopyImage(
hIcon, IMAGE_ICON, hIcon, IMAGE_ICON,
himl->cx, himl->cy, himl->cx, himl->cy,
LR_COPYFROMRESOURCE); LR_COPYFROMRESOURCE);
GetIconInfo (hBestFitIcon, &ii); GetIconInfo (hBestFitIcon, &ii);
@ -2572,7 +2572,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon)
/************************************************************************* /*************************************************************************
* ImageList_SetBkColor [COMCTL32.76] * ImageList_SetBkColor [COMCTL32.76]
* *
* Sets the background color of an image list. * Sets the background color of an image list.
* *
@ -2682,7 +2682,7 @@ ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT iDrag,
/************************************************************************* /*************************************************************************
* ImageList_SetFilter [COMCTL32.78] * ImageList_SetFilter [COMCTL32.78]
* *
* Sets a filter (or does something completely different)!!??? * Sets a filter (or does something completely different)!!???
* *
@ -2822,7 +2822,7 @@ ImageList_SetImageCount (HIMAGELIST himl, INT iImageCount)
/* delete 'empty' image space */ /* delete 'empty' image space */
SetBkColor (hdcBitmap, RGB(255, 255, 255)); SetBkColor (hdcBitmap, RGB(255, 255, 255));
SetTextColor (hdcBitmap, RGB(0, 0, 0)); SetTextColor (hdcBitmap, RGB(0, 0, 0));
PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, PatBlt (hdcBitmap, nCopyCount * himl->cx, 0,
(nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);
#endif #endif
DeleteObject (himl->hbmImage); DeleteObject (himl->hbmImage);
@ -2847,7 +2847,7 @@ ImageList_SetImageCount (HIMAGELIST himl, INT iImageCount)
/* delete 'empty' image space */ /* delete 'empty' image space */
SetBkColor (hdcBitmap, RGB(255, 255, 255)); SetBkColor (hdcBitmap, RGB(255, 255, 255));
SetTextColor (hdcBitmap, RGB(0, 0, 0)); SetTextColor (hdcBitmap, RGB(0, 0, 0));
PatBlt (hdcBitmap, nCopyCount * himl->cx, 0, PatBlt (hdcBitmap, nCopyCount * himl->cx, 0,
(nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS); (nNewCount - nCopyCount) * himl->cx, himl->cy, BLACKNESS);
#endif #endif
DeleteObject (himl->hbmMask); DeleteObject (himl->hbmMask);
@ -2899,10 +2899,10 @@ ImageList_SetOverlayImage (HIMAGELIST himl, INT iImage, INT iOverlay)
/* helper for ImageList_Write - write bitmap to pstm /* helper for ImageList_Write - write bitmap to pstm
* currently everything is written as 24 bit RGB, except masks * currently everything is written as 24 bit RGB, except masks
*/ */
static BOOL static BOOL
_write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy) _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy)
{ {
LPBITMAPFILEHEADER bmfh; LPBITMAPFILEHEADER bmfh;
@ -2917,7 +2917,7 @@ _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy)
xdc = GetDC(0); xdc = GetDC(0);
GetObjectA(hBitmap, sizeof(BITMAP), (LPVOID)&bm); GetObjectA(hBitmap, sizeof(BITMAP), (LPVOID)&bm);
/* XXX is this always correct? */ /* XXX is this always correct? */
icount = bm.bmWidth / cx; icount = bm.bmWidth / cx;
nwidth = cx << 2; nwidth = cx << 2;
@ -2959,21 +2959,21 @@ _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy)
bmih->biClrImportant = 0; bmih->biClrImportant = 0;
lpBitsOrg = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, nsizeImage); lpBitsOrg = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, nsizeImage);
if(!GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBitsOrg, if(!GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBitsOrg,
(BITMAPINFO *)bmih, DIB_RGB_COLORS)) (BITMAPINFO *)bmih, DIB_RGB_COLORS))
goto failed; goto failed;
else { else {
int i; int i;
int obpl = (((bm.bmWidth*bitCount+31) & ~31)>>3); int obpl = (((bm.bmWidth*bitCount+31) & ~31)>>3);
int nbpl = (((nwidth*bitCount+31) & ~31)>>3); int nbpl = (((nwidth*bitCount+31) & ~31)>>3);
for(i = 0; i < nheight; i++) { for(i = 0; i < nheight; i++) {
int ooff = ((nheight-1-i)%cy) * obpl + ((i/cy) * nbpl); int ooff = ((nheight-1-i)%cy) * obpl + ((i/cy) * nbpl);
int noff = (nbpl * (nheight-1-i)); int noff = (nbpl * (nheight-1-i));
memcpy(lpBits + noff, lpBitsOrg + ooff, nbpl); memcpy(lpBits + noff, lpBitsOrg + ooff, nbpl);
} }
} }
bmih->biWidth = nwidth; bmih->biWidth = nwidth;
bmih->biHeight = nheight; bmih->biHeight = nheight;

View File

@ -17,7 +17,7 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef __WINE_IMAGELIST_H #ifndef __WINE_IMAGELIST_H
#define __WINE_IMAGELIST_H #define __WINE_IMAGELIST_H

View File

@ -64,9 +64,9 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT IPADDRESS_Notify (IPADDRESS_INFO *infoPtr, UINT command) static LRESULT IPADDRESS_Notify (IPADDRESS_INFO *infoPtr, UINT command)
{ {
HWND hwnd = infoPtr->Self; HWND hwnd = infoPtr->Self;
TRACE("(command=%x)\n", command); TRACE("(command=%x)\n", command);
return SendMessageW (GetParent (hwnd), WM_COMMAND, return SendMessageW (GetParent (hwnd), WM_COMMAND,
MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd); MAKEWPARAM (GetWindowLongW (hwnd, GWL_ID), command), (LPARAM)hwnd);
} }
@ -76,7 +76,7 @@ static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
NMIPADDRESS nmip; NMIPADDRESS nmip;
TRACE("(field=%x, value=%d)\n", field, value); TRACE("(field=%x, value=%d)\n", field, value);
nmip.hdr.hwndFrom = infoPtr->Self; nmip.hdr.hwndFrom = infoPtr->Self;
nmip.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); nmip.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
nmip.hdr.code = IPN_FIELDCHANGED; nmip.hdr.code = IPN_FIELDCHANGED;
@ -88,7 +88,7 @@ static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
(WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip); (WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip);
TRACE("<-- %d\n", nmip.iValue); TRACE("<-- %d\n", nmip.iValue);
return nmip.iValue; return nmip.iValue;
} }
@ -96,12 +96,12 @@ static INT IPADDRESS_IPNotify (IPADDRESS_INFO *infoPtr, INT field, INT value)
static int IPADDRESS_GetPartIndex(IPADDRESS_INFO *infoPtr, HWND hwnd) static int IPADDRESS_GetPartIndex(IPADDRESS_INFO *infoPtr, HWND hwnd)
{ {
int i; int i;
TRACE("(hwnd=%x)\n", hwnd); TRACE("(hwnd=%x)\n", hwnd);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if (infoPtr->Part[i].EditHwnd == hwnd) return i; if (infoPtr->Part[i].EditHwnd == hwnd) return i;
ERR("We subclassed the wrong window! (hwnd=%x)\n", hwnd); ERR("We subclassed the wrong window! (hwnd=%x)\n", hwnd);
return -1; return -1;
} }
@ -114,7 +114,7 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
int i; int i;
TRACE("\n"); TRACE("\n");
GetClientRect (infoPtr->Self, &rect); GetClientRect (infoPtr->Self, &rect);
DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
@ -122,7 +122,7 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart); GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart);
pt.x = rcPart.right; pt.x = rcPart.right;
ScreenToClient(infoPtr->Self, &pt); ScreenToClient(infoPtr->Self, &pt);
rect.left = pt.x; rect.left = pt.x;
GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart); GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart);
pt.x = rcPart.left; pt.x = rcPart.left;
ScreenToClient(infoPtr->Self, &pt); ScreenToClient(infoPtr->Self, &pt);
@ -142,10 +142,10 @@ static LRESULT IPADDRESS_Create (HWND hwnd)
WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 }; WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
TRACE("\n"); TRACE("\n");
SetWindowLongW (hwnd, GWL_STYLE, SetWindowLongW (hwnd, GWL_STYLE,
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER); GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER);
infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO)); infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO));
if (!infoPtr) return -1; if (!infoPtr) return -1;
SetWindowLongW (hwnd, 0, (DWORD)infoPtr); SetWindowLongW (hwnd, 0, (DWORD)infoPtr);
@ -158,22 +158,22 @@ static LRESULT IPADDRESS_Create (HWND hwnd)
edit.bottom = rcClient.bottom - 2; edit.bottom = rcClient.bottom - 2;
infoPtr->Self = hwnd; infoPtr->Self = hwnd;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
IPPART_INFO* part = &infoPtr->Part[i]; IPPART_INFO* part = &infoPtr->Part[i];
part->LowerLimit = 0; part->LowerLimit = 0;
part->UpperLimit = 255; part->UpperLimit = 255;
edit.left = rcClient.left + i*fieldsize + 6; edit.left = rcClient.left + i*fieldsize + 6;
edit.right = rcClient.left + (i+1)*fieldsize - 2; edit.right = rcClient.left + (i+1)*fieldsize - 2;
part->EditHwnd = part->EditHwnd =
CreateWindowW (EDIT, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER, CreateWindowW (EDIT, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER,
edit.left, edit.top, edit.right - edit.left, edit.left, edit.top, edit.right - edit.left,
edit.bottom - edit.top, hwnd, (HMENU) 1, edit.bottom - edit.top, hwnd, (HMENU) 1,
GetWindowLongW (hwnd, GWL_HINSTANCE), NULL); GetWindowLongW (hwnd, GWL_HINSTANCE), NULL);
SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd); SetPropA(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
part->OrigProc = (WNDPROC) part->OrigProc = (WNDPROC)
SetWindowLongW (part->EditHwnd, GWL_WNDPROC, SetWindowLongW (part->EditHwnd, GWL_WNDPROC,
(LONG)IPADDRESS_SubclassProc); (LONG)IPADDRESS_SubclassProc);
} }
@ -186,7 +186,7 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
int i; int i;
TRACE("\n"); TRACE("\n");
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
IPPART_INFO* part = &infoPtr->Part[i]; IPPART_INFO* part = &infoPtr->Part[i];
SetWindowLongW (part->EditHwnd, GWL_WNDPROC, (LONG)part->OrigProc); SetWindowLongW (part->EditHwnd, GWL_WNDPROC, (LONG)part->OrigProc);
@ -203,9 +203,9 @@ static LRESULT IPADDRESS_Paint (IPADDRESS_INFO *infoPtr, HDC hdc)
PAINTSTRUCT ps; PAINTSTRUCT ps;
TRACE("\n"); TRACE("\n");
if (hdc) return IPADDRESS_Draw (infoPtr, hdc); if (hdc) return IPADDRESS_Draw (infoPtr, hdc);
hdc = BeginPaint (infoPtr->Self, &ps); hdc = BeginPaint (infoPtr->Self, &ps);
IPADDRESS_Draw (infoPtr, hdc); IPADDRESS_Draw (infoPtr, hdc);
EndPaint (infoPtr->Self, &ps); EndPaint (infoPtr->Self, &ps);
@ -236,7 +236,7 @@ static int IPADDRESS_GetAddress (IPADDRESS_INFO *infoPtr, LPDWORD ip_address)
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
ip_addr *= 256; ip_addr *= 256;
if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4))
ip_addr += atolW(field); ip_addr += atolW(field);
else else
invalid++; invalid++;
@ -267,7 +267,7 @@ static void IPADDRESS_ClearAddress (IPADDRESS_INFO *infoPtr)
TRACE("\n"); TRACE("\n");
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
SetWindowTextW (infoPtr->Part[i].EditHwnd, nil); SetWindowTextW (infoPtr->Part[i].EditHwnd, nil);
} }
@ -297,13 +297,13 @@ static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address)
static void IPADDRESS_SetFocusToField (IPADDRESS_INFO *infoPtr, INT index) static void IPADDRESS_SetFocusToField (IPADDRESS_INFO *infoPtr, INT index)
{ {
TRACE("(index=%d)\n", index); TRACE("(index=%d)\n", index);
if (index > 3) { if (index > 3) {
for (index = 0; index < 4; index++) for (index = 0; index < 4; index++)
if (!GetWindowTextLengthW(infoPtr->Part[index].EditHwnd)) break; if (!GetWindowTextLengthW(infoPtr->Part[index].EditHwnd)) break;
} }
if (index < 9 || index > 3) index = 0; if (index < 9 || index > 3) index = 0;
SetFocus (infoPtr->Part[index].EditHwnd); SetFocus (infoPtr->Part[index].EditHwnd);
} }
@ -317,20 +317,20 @@ static BOOL IPADDRESS_ConstrainField (IPADDRESS_INFO *infoPtr, int currentfield)
TRACE("(currentfield=%d)\n", currentfield); TRACE("(currentfield=%d)\n", currentfield);
if (currentfield < 0 || currentfield > 3) return FALSE; if (currentfield < 0 || currentfield > 3) return FALSE;
if (!GetWindowTextW (part->EditHwnd, field, 4)) return FALSE; if (!GetWindowTextW (part->EditHwnd, field, 4)) return FALSE;
curValue = atoiW(field); curValue = atoiW(field);
TRACE(" curValue=%d\n", curValue); TRACE(" curValue=%d\n", curValue);
newValue = IPADDRESS_IPNotify(infoPtr, currentfield, curValue); newValue = IPADDRESS_IPNotify(infoPtr, currentfield, curValue);
TRACE(" newValue=%d\n", newValue); TRACE(" newValue=%d\n", newValue);
if (newValue < part->LowerLimit) newValue = part->LowerLimit; if (newValue < part->LowerLimit) newValue = part->LowerLimit;
if (newValue > part->UpperLimit) newValue = part->UpperLimit; if (newValue > part->UpperLimit) newValue = part->UpperLimit;
if (newValue == curValue) return FALSE; if (newValue == curValue) return FALSE;
wsprintfW (field, fmt, newValue); wsprintfW (field, fmt, newValue);
TRACE(" field='%s'\n", debugstr_w(field)); TRACE(" field='%s'\n", debugstr_w(field));
return SetWindowTextW (part->EditHwnd, field); return SetWindowTextW (part->EditHwnd, field);
@ -343,7 +343,7 @@ static BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel)
if(cur >= -1 && cur < 4) { if(cur >= -1 && cur < 4) {
IPADDRESS_ConstrainField(infoPtr, cur); IPADDRESS_ConstrainField(infoPtr, cur);
if(cur < 3) { if(cur < 3) {
IPPART_INFO *next = &infoPtr->Part[cur + 1]; IPPART_INFO *next = &infoPtr->Part[cur + 1];
int start = 0, end = 0; int start = 0, end = 0;
@ -357,7 +357,7 @@ static BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel)
} }
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
@ -372,30 +372,30 @@ static BOOL IPADDRESS_GotoNextField (IPADDRESS_INFO *infoPtr, int cur, int sel)
* *
* alpha characters: completely ignored * alpha characters: completely ignored
* *
* digits: accepted when field text length < 2 ignored otherwise. * digits: accepted when field text length < 2 ignored otherwise.
* when 3 numbers have been entered into the field the value * when 3 numbers have been entered into the field the value
* of the field is checked, if the field value exceeds the * of the field is checked, if the field value exceeds the
* maximum value and is changed the field remains the current * maximum value and is changed the field remains the current
* field, otherwise focus moves to the field to the right * field, otherwise focus moves to the field to the right
* *
* tab: change focus from the current ipaddress control to the next * tab: change focus from the current ipaddress control to the next
* control in the tab order * control in the tab order
* *
* right arrow: move to the field on the right to the left most * right arrow: move to the field on the right to the left most
* position in that field if no text is selected, * position in that field if no text is selected,
* we are in the right most position in the field, * we are in the right most position in the field,
* we are not in the right most field * we are not in the right most field
* *
* left arrow: move to the field on the left to the right most * left arrow: move to the field on the left to the right most
* position in that field if no text is selected, * position in that field if no text is selected,
* we are in the left most position in the current field * we are in the left most position in the current field
* and we are not in the left most field * and we are not in the left most field
* *
* backspace: delete the character to the left of the cursor position, * backspace: delete the character to the left of the cursor position,
* if none are present move to the field on the left if * if none are present move to the field on the left if
* we are not in the left most field and delete the right * we are not in the left most field and delete the right
* most digit in that field while keeping the cursor * most digit in that field while keeping the cursor
* on the right side of the field * on the right side of the field
*/ */
LRESULT CALLBACK LRESULT CALLBACK
IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@ -414,14 +414,14 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == WM_CHAR || uMsg == WM_KEYDOWN) { if (uMsg == WM_CHAR || uMsg == WM_KEYDOWN) {
len = GetWindowTextLengthW (hwnd); len = GetWindowTextLengthW (hwnd);
SendMessageW(hwnd, EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel); SendMessageW(hwnd, EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
} }
switch (uMsg) { switch (uMsg) {
case WM_CHAR: case WM_CHAR:
if(isdigit(c)) { if(isdigit(c)) {
if(len == 2 && startsel==endsel && endsel==len) { if(len == 2 && startsel==endsel && endsel==len) {
/* process the digit press before we check the field */ /* process the digit press before we check the field */
int return_val = CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam); int return_val = CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam);
/* if the field value was changed stay at the current field */ /* if the field value was changed stay at the current field */
if(!IPADDRESS_ConstrainField(infoPtr, index)) if(!IPADDRESS_ConstrainField(infoPtr, index))
IPADDRESS_GotoNextField (infoPtr, index, POS_DEFAULT); IPADDRESS_GotoNextField (infoPtr, index, POS_DEFAULT);
@ -429,14 +429,14 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return return_val; return return_val;
} else if (len == 3 && startsel==endsel && endsel==len) } else if (len == 3 && startsel==endsel && endsel==len)
IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL); IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL);
else if (len < 3) break; else if (len < 3) break;
} else if(c == '.' || c == ' ') { } else if(c == '.' || c == ' ') {
if(len && startsel==endsel && startsel != 0) { if(len && startsel==endsel && startsel != 0) {
IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL);
} }
} else if (c == VK_BACK) break; } else if (c == VK_BACK) break;
return 0; return 0;
case WM_KEYDOWN: case WM_KEYDOWN:
switch(c) { switch(c) {
case VK_RIGHT: case VK_RIGHT:
@ -455,17 +455,17 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if(startsel==endsel && startsel==0 && index > 0) { if(startsel==endsel && startsel==0 && index > 0) {
IPPART_INFO *prev = &infoPtr->Part[index-1]; IPPART_INFO *prev = &infoPtr->Part[index-1];
WCHAR val[10]; WCHAR val[10];
if(GetWindowTextW(prev->EditHwnd, val, 5)) { if(GetWindowTextW(prev->EditHwnd, val, 5)) {
val[lstrlenW(val) - 1] = 0; val[lstrlenW(val) - 1] = 0;
SetWindowTextW(prev->EditHwnd, val); SetWindowTextW(prev->EditHwnd, val);
} }
IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT); IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT);
return 0; return 0;
} }
break; break;
} }
break; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0) if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0)
@ -484,12 +484,12 @@ static LRESULT WINAPI
IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
TRACE("(hwnd=0x%x msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam); TRACE("(hwnd=0x%x msg=0x%x wparam=0x%x lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam);
if (!infoPtr && (uMsg != WM_CREATE)) if (!infoPtr && (uMsg != WM_CREATE))
return DefWindowProcW (hwnd, uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam);
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
@ -553,7 +553,7 @@ void IPADDRESS_Register (void)
wndClass.hCursor = LoadCursorW (0, IDC_IBEAMW); wndClass.hCursor = LoadCursorW (0, IDC_IBEAMW);
wndClass.hbrBackground = GetStockObject(WHITE_BRUSH); wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndClass.lpszClassName = WC_IPADDRESSW; wndClass.lpszClassName = WC_IPADDRESSW;
RegisterClassW (&wndClass); RegisterClassW (&wndClass);
} }

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
* *
* *
* FIXME: handle resources better (doesn't work now); also take care * FIXME: handle resources better (doesn't work now); also take care
of internationalization. of internationalization.
* FIXME: keyboard handling. * FIXME: keyboard handling.
*/ */
@ -54,7 +54,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
/* month', wait 500 ms before going */ /* month', wait 500 ms before going */
/* to the next month */ /* to the next month */
#define MC_NEXTMONTHTIMER 1 /* Timer ID's */ #define MC_NEXTMONTHTIMER 1 /* Timer ID's */
#define MC_PREVMONTHTIMER 2 #define MC_PREVMONTHTIMER 2
typedef struct typedef struct
{ {
@ -91,12 +91,12 @@ typedef struct
DWORD rangeValid; DWORD rangeValid;
SYSTEMTIME minDate; SYSTEMTIME minDate;
SYSTEMTIME maxDate; SYSTEMTIME maxDate;
RECT rcClient; /* rect for whole client area */ RECT rcClient; /* rect for whole client area */
RECT rcDraw; /* rect for drawable portion of client area */ RECT rcDraw; /* rect for drawable portion of client area */
RECT title; /* rect for the header above the calendar */ RECT title; /* rect for the header above the calendar */
RECT titlebtnnext; /* the `next month' button in the header */ RECT titlebtnnext; /* the `next month' button in the header */
RECT titlebtnprev; /* the `prev month' button in the header */ RECT titlebtnprev; /* the `prev month' button in the header */
RECT titlemonth; /* the `month name' txt in the header */ RECT titlemonth; /* the `month name' txt in the header */
RECT titleyear; /* the `year number' txt in the header */ RECT titleyear; /* the `year number' txt in the header */
RECT wdays; /* week days at top */ RECT wdays; /* week days at top */
@ -141,7 +141,7 @@ const int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};
/* make sure that time is valid */ /* make sure that time is valid */
static int MONTHCAL_ValidateTime(SYSTEMTIME time) static int MONTHCAL_ValidateTime(SYSTEMTIME time)
{ {
if(time.wMonth > 12) return FALSE; if(time.wMonth > 12) return FALSE;
if(time.wDayOfWeek > 6) return FALSE; if(time.wDayOfWeek > 6) return FALSE;
@ -156,7 +156,7 @@ static int MONTHCAL_ValidateTime(SYSTEMTIME time)
} }
void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
{ {
to->wYear = from->wYear; to->wYear = from->wYear;
to->wMonth = from->wMonth; to->wMonth = from->wMonth;
@ -169,7 +169,7 @@ void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
} }
/* Note:Depending on DST, this may be offset by a day. /* Note:Depending on DST, this may be offset by a day.
Need to find out if we're on a DST place & adjust the clock accordingly. Need to find out if we're on a DST place & adjust the clock accordingly.
Above function assumes we have a valid data. Above function assumes we have a valid data.
Valid for year>1752; 1 <= d <= 31, 1 <= m <= 12. Valid for year>1752; 1 <= d <= 31, 1 <= m <= 12.
@ -182,15 +182,15 @@ static int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year)
{ {
year-=(month < 3); year-=(month < 3);
return((year + year/4 - year/100 + year/400 + return((year + year/4 - year/100 + year/400 +
DayOfWeekTable[month-1] + day - 1 ) % 7); DayOfWeekTable[month-1] + day - 1 ) % 7);
} }
/* From a given point, calculate the row (weekpos), column(daypos) /* From a given point, calculate the row (weekpos), column(daypos)
and day in the calendar. day== 0 mean the last day of tha last month and day in the calendar. day== 0 mean the last day of tha last month
*/ */
static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y, static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
int *daypos,int *weekpos) int *daypos,int *weekpos)
{ {
int retval, firstDay; int retval, firstDay;
@ -202,7 +202,7 @@ static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
*daypos = (x - infoPtr->days.left ) / infoPtr->width_increment; *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment;
*weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment; *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment;
firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7; firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7;
retval = *daypos + (7 * *weekpos) - firstDay; retval = *daypos + (7 * *weekpos) - firstDay;
return retval; return retval;
@ -211,7 +211,7 @@ static int MONTHCAL_CalcDayFromPos(MONTHCAL_INFO *infoPtr, int x, int y,
/* day is the day of the month, 1 == 1st day of the month */ /* day is the day of the month, 1 == 1st day of the month */
/* sets x and y to be the position of the day */ /* sets x and y to be the position of the day */
/* x == day, y == week where(0,0) == firstDay, 1st week */ /* x == day, y == week where(0,0) == firstDay, 1st week */
static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month, static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
int *x, int *y) int *x, int *y)
{ {
int firstDay, prevMonth; int firstDay, prevMonth;
@ -227,7 +227,7 @@ static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
prevMonth = month - 1; prevMonth = month - 1;
if(prevMonth==0) if(prevMonth==0)
prevMonth = 12; prevMonth = 12;
*x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7; *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7;
*y = 0; *y = 0;
return; return;
@ -240,7 +240,7 @@ static void MONTHCAL_CalcDayXY(MONTHCAL_INFO *infoPtr, int day, int month,
/* x: column(day), y: row(week) */ /* x: column(day), y: row(week) */
static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y) static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
{ {
r->left = infoPtr->days.left + x * infoPtr->width_increment; r->left = infoPtr->days.left + x * infoPtr->width_increment;
r->right = r->left + infoPtr->width_increment; r->right = r->left + infoPtr->width_increment;
@ -252,7 +252,7 @@ static void MONTHCAL_CalcDayRect(MONTHCAL_INFO *infoPtr, RECT *r, int x, int y)
/* sets the RECT struct r to the rectangle around the day and month */ /* sets the RECT struct r to the rectangle around the day and month */
/* day is the day value of the month(1 == 1st), month is the month */ /* day is the day value of the month(1 == 1st), month is the month */
/* value(january == 1, december == 12) */ /* value(january == 1, december == 12) */
static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr, static inline void MONTHCAL_CalcPosFromDay(MONTHCAL_INFO *infoPtr,
int day, int month, RECT *r) int day, int month, RECT *r)
{ {
int x, y; int x, y;
@ -278,7 +278,7 @@ int month)
x = day_rect.left; x = day_rect.left;
y = day_rect.top; y = day_rect.top;
points[0].x = x; points[0].x = x;
points[0].y = y - 1; points[0].y = y - 1;
points[1].x = x + 0.8 * infoPtr->width_increment; points[1].x = x + 0.8 * infoPtr->width_increment;
@ -287,7 +287,7 @@ int month)
points[2].y = y; points[2].y = y;
points[3].x = x + infoPtr->width_increment; points[3].x = x + infoPtr->width_increment;
points[3].y = y + 0.5 * infoPtr->height_increment; points[3].y = y + 0.5 * infoPtr->height_increment;
points[4].x = x + infoPtr->width_increment; points[4].x = x + infoPtr->width_increment;
points[4].y = y + 0.9 * infoPtr->height_increment; points[4].y = y + 0.9 * infoPtr->height_increment;
points[5].x = x + 0.6 * infoPtr->width_increment; points[5].x = x + 0.6 * infoPtr->width_increment;
@ -295,7 +295,7 @@ int month)
points[6].x = x + 0.5 * infoPtr->width_increment; points[6].x = x + 0.5 * infoPtr->width_increment;
points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just points[6].y = y + 0.9 * infoPtr->height_increment; /* bring the bottom up just
a hair to fit inside the day rectangle */ a hair to fit inside the day rectangle */
points[7].x = x + 0.2 * infoPtr->width_increment; points[7].x = x + 0.2 * infoPtr->width_increment;
points[7].y = y + 0.8 * infoPtr->height_increment; points[7].y = y + 0.8 * infoPtr->height_increment;
points[8].x = x + 0.1 * infoPtr->width_increment; points[8].x = x + 0.1 * infoPtr->width_increment;
@ -309,7 +309,7 @@ int month)
points[11].y = y + 0.3 * infoPtr->height_increment; points[11].y = y + 0.3 * infoPtr->height_increment;
points[12].x = x + 0.4 * infoPtr->width_increment; points[12].x = x + 0.4 * infoPtr->width_increment;
points[12].y = y + 0.2 * infoPtr->height_increment; points[12].y = y + 0.2 * infoPtr->height_increment;
PolyBezier(hdc, points, 13); PolyBezier(hdc, points, 13);
DeleteObject(hRedPen); DeleteObject(hRedPen);
SelectObject(hdc, hOldPen2); SelectObject(hdc, hOldPen2);
@ -329,7 +329,7 @@ static void MONTHCAL_DrawDay(HDC hdc, MONTHCAL_INFO *infoPtr, int day, int month
sprintf(buf, "%d", day); sprintf(buf, "%d", day);
/* No need to check styles: when selection is not valid, it is set to zero. /* No need to check styles: when selection is not valid, it is set to zero.
* 1<day<31, so evertyhing's OK. * 1<day<31, so evertyhing's OK.
*/ */
@ -390,7 +390,7 @@ static void MONTHCAL_DrawDay(HDC hdc, MONTHCAL_INFO *infoPtr, int day, int month
/* CHECKME: For `todays date', do we need to check the locale?*/ /* CHECKME: For `todays date', do we need to check the locale?*/
static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps) static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
{ {
MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr=MONTHCAL_GetInfoPtr(hwnd);
RECT *rcClient=&infoPtr->rcClient; RECT *rcClient=&infoPtr->rcClient;
@ -425,7 +425,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
/* fill background */ /* fill background */
hbr = CreateSolidBrush (infoPtr->bk); hbr = CreateSolidBrush (infoPtr->bk);
FillRect(hdc, rcClient, hbr); FillRect(hdc, rcClient, hbr);
DeleteObject(hbr); DeleteObject(hbr);
/* draw header */ /* draw header */
if(IntersectRect(&rcTemp, &(ps->rcPaint), title)) if(IntersectRect(&rcTemp, &(ps->rcPaint), title))
@ -434,10 +434,10 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
FillRect(hdc, title, hbr); FillRect(hdc, title, hbr);
DeleteObject(hbr); DeleteObject(hbr);
} }
/* if the previous button is pressed draw it depressed */ /* if the previous button is pressed draw it depressed */
if(IntersectRect(&rcTemp, &(ps->rcPaint), prev)) if(IntersectRect(&rcTemp, &(ps->rcPaint), prev))
{ {
if((infoPtr->status & MC_PREVPRESSED)) if((infoPtr->status & MC_PREVPRESSED))
DrawFrameControl(hdc, prev, DFC_SCROLL, DrawFrameControl(hdc, prev, DFC_SCROLL,
DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_SCROLLLEFT | DFCS_PUSHED |
@ -447,7 +447,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0)); DFCS_SCROLLLEFT |(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0));
} }
/* if next button is depressed draw it depressed */ /* if next button is depressed draw it depressed */
if(IntersectRect(&rcTemp, &(ps->rcPaint), next)) if(IntersectRect(&rcTemp, &(ps->rcPaint), next))
{ {
if((infoPtr->status & MC_NEXTPRESSED)) if((infoPtr->status & MC_NEXTPRESSED))
@ -466,14 +466,14 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
/* titlemonth->left and right are set in MONTHCAL_UpdateSize */ /* titlemonth->left and right are set in MONTHCAL_UpdateSize */
titlemonth->left = title->left; titlemonth->left = title->left;
titlemonth->right = title->right; titlemonth->right = title->right;
GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,
buf1,sizeof(buf1)); buf1,sizeof(buf1));
sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); sprintf(buf, "%s %ld", buf1, infoPtr->currentYear);
if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth))
{ {
DrawTextA(hdc, buf, strlen(buf), titlemonth, DrawTextA(hdc, buf, strlen(buf), titlemonth,
DT_CENTER | DT_VCENTER | DT_SINGLELINE); DT_CENTER | DT_VCENTER | DT_SINGLELINE);
} }
@ -481,7 +481,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
/* titlemonth left/right contained rect for whole titletxt('June 1999') /* titlemonth left/right contained rect for whole titletxt('June 1999')
* MCM_HitTestInfo wants month & year rects, so prepare these now. * MCM_HitTestInfo wants month & year rects, so prepare these now.
*(no, we can't draw them separately; the whole text is centered) *(no, we can't draw them separately; the whole text is centered)
*/ */
GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); GetTextExtentPoint32A(hdc, buf, strlen(buf), &size);
titlemonth->left = title->right / 2 - size.cx / 2; titlemonth->left = title->right / 2 - size.cx / 2;
@ -489,7 +489,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
GetTextExtentPoint32A(hdc, buf1, strlen(buf1), &size); GetTextExtentPoint32A(hdc, buf1, strlen(buf1), &size);
titlemonth->right = titlemonth->left + size.cx; titlemonth->right = titlemonth->left + size.cx;
titleyear->left = titlemonth->right; titleyear->left = titlemonth->right;
/* draw month area */ /* draw month area */
rcTemp.top=infoPtr->wdays.top; rcTemp.top=infoPtr->wdays.top;
rcTemp.left=infoPtr->wdays.left; rcTemp.left=infoPtr->wdays.left;
@ -501,13 +501,13 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
FillRect(hdc, &rcTemp, hbr); FillRect(hdc, &rcTemp, hbr);
DeleteObject(hbr); DeleteObject(hbr);
} }
/* draw line under day abbreviatons */ /* draw line under day abbreviatons */
MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL); MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL);
LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1); LineTo(hdc, rcDraw->right - 3, title->bottom + textHeight + 1);
prevMonth = infoPtr->currentMonth - 1; prevMonth = infoPtr->currentMonth - 1;
if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */ if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */
prevMonth = 12; /* december(12) of the previous year */ prevMonth = 12; /* december(12) of the previous year */
@ -537,10 +537,10 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
} }
/* draw day numbers; first, the previous month */ /* draw day numbers; first, the previous month */
firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear); firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear);
day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) +
(infoPtr->firstDay + 7 - firstDay)%7 + 1; (infoPtr->firstDay + 7 - firstDay)%7 + 1;
if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear))
day -=7; day -=7;
@ -553,7 +553,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, 0); MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, 0);
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
{ {
MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0, MONTHCAL_DrawDay(hdc, infoPtr, day, prevMonth, i, 0,
infoPtr->monthdayState[m] & mask); infoPtr->monthdayState[m] & mask);
} }
@ -577,7 +577,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
{ {
MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0, MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth, i, 0,
infoPtr->monthdayState[m] & mask); infoPtr->monthdayState[m] & mask);
if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
@ -595,7 +595,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
j = 1; /* move to the 2nd week of the current month */ j = 1; /* move to the 2nd week of the current month */
i = 0; /* move back to sunday */ i = 0; /* move back to sunday */
while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) {
MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
{ {
@ -604,8 +604,8 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) &&
(day==infoPtr->todaysDate.wDay) && (day==infoPtr->todaysDate.wDay) &&
(infoPtr->currentYear == infoPtr->todaysDate.wYear)) (infoPtr->currentYear == infoPtr->todaysDate.wYear))
if(!(dwStyle & MCS_NOTODAYCIRCLE)) if(!(dwStyle & MCS_NOTODAYCIRCLE))
MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth); MONTHCAL_CircleDay(hdc, infoPtr, day, infoPtr->currentMonth);
} }
mask<<=1; mask<<=1;
@ -627,14 +627,14 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
while((i<7) &&(j<6)) { while((i<7) &&(j<6)) {
MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j);
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay))
{ {
MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j, MONTHCAL_DrawDay(hdc, infoPtr, day, infoPtr->currentMonth + 1, i, j,
infoPtr->monthdayState[m] & mask); infoPtr->monthdayState[m] & mask);
} }
mask<<=1; mask<<=1;
day++; day++;
i++; i++;
if(i==7) { /* past saturday, go to next week's sunday */ if(i==7) { /* past saturday, go to next week's sunday */
i = 0; i = 0;
j++; j++;
@ -650,8 +650,8 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
int offset = 0; int offset = 0;
if(!(dwStyle & MCS_NOTODAYCIRCLE)) { if(!(dwStyle & MCS_NOTODAYCIRCLE)) {
/*day is the number of days from nextmonth we put on the calendar */ /*day is the number of days from nextmonth we put on the calendar */
MONTHCAL_CircleDay(hdc, infoPtr, MONTHCAL_CircleDay(hdc, infoPtr,
day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear),
infoPtr->currentMonth); infoPtr->currentMonth);
offset+=textWidth; offset+=textWidth;
} }
@ -674,7 +674,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
SelectObject(hdc, infoPtr->hFont); SelectObject(hdc, infoPtr->hFont);
} }
/*eventually draw week numbers*/ /*eventually draw week numbers*/
if(dwStyle & MCS_WEEKNUMBERS) { if(dwStyle & MCS_WEEKNUMBERS) {
/* display weeknumbers*/ /* display weeknumbers*/
int mindays; int mindays;
@ -682,7 +682,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
/* Rules what week to call the first week of a new year: /* Rules what week to call the first week of a new year:
LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?): LOCALE_IFIRSTWEEKOFYEAR == 0 (e.g US?):
The week containing Jan 1 is the first week of year The week containing Jan 1 is the first week of year
LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany): LOCALE_IFIRSTWEEKOFYEAR == 2 (e.g. Germany):
First week of year must contain 4 days of the new year First week of year must contain 4 days of the new year
LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?)
The first week of the year must contain only days of the new year The first week of the year must contain only days of the new year
@ -704,12 +704,12 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
{ {
/* calculate all those exceptions for january */ /* calculate all those exceptions for january */
weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear);
if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays)
weeknum =1; weeknum =1;
else else
{ {
weeknum = 0; weeknum = 0;
for(i=0; i<11; i++) for(i=0; i<11; i++)
weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1); weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1);
weeknum +=startofprescal+ 7; weeknum +=startofprescal+ 7;
weeknum /=7; weeknum /=7;
@ -721,7 +721,7 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
else else
{ {
weeknum = 0; weeknum = 0;
for(i=0; i<prevMonth-1; i++) for(i=0; i<prevMonth-1; i++)
weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear); weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear);
weeknum +=startofprescal+ 7; weeknum +=startofprescal+ 7;
weeknum /=7; weeknum /=7;
@ -749,26 +749,26 @@ static void MONTHCAL_Refresh(HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
days->top+=infoPtr->height_increment; days->top+=infoPtr->height_increment;
days->bottom+=infoPtr->height_increment; days->bottom+=infoPtr->height_increment;
} }
MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL); MoveToEx(hdc, infoPtr->weeknums.right, infoPtr->weeknums.top + 3 , NULL);
LineTo(hdc, infoPtr->weeknums.right, infoPtr->weeknums.bottom ); LineTo(hdc, infoPtr->weeknums.right, infoPtr->weeknums.bottom );
} }
/* currentFont was font at entering Refresh */ /* currentFont was font at entering Refresh */
SetBkColor(hdc, oldBkColor); SetBkColor(hdc, oldBkColor);
SelectObject(hdc, currentFont); SelectObject(hdc, currentFont);
SetTextColor(hdc, oldTextColor); SetTextColor(hdc, oldTextColor);
} }
static LRESULT static LRESULT
MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
LPRECT lpRect = (LPRECT) lParam; LPRECT lpRect = (LPRECT) lParam;
TRACE("%x %lx\n", wParam, lParam); TRACE("%x %lx\n", wParam, lParam);
/* validate parameters */ /* validate parameters */
if((infoPtr==NULL) ||(lpRect == NULL) ) return FALSE; if((infoPtr==NULL) ||(lpRect == NULL) ) return FALSE;
@ -781,7 +781,7 @@ MONTHCAL_GetMinReqRect(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -807,7 +807,7 @@ MONTHCAL_GetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -847,13 +847,13 @@ MONTHCAL_SetColor(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
TRACE("%x %lx\n", wParam, lParam); TRACE("%x %lx\n", wParam, lParam);
if(infoPtr->delta) if(infoPtr->delta)
return infoPtr->delta; return infoPtr->delta;
else else
@ -861,24 +861,24 @@ MONTHCAL_GetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetMonthDelta(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
int prev = infoPtr->delta; int prev = infoPtr->delta;
TRACE("%x %lx\n", wParam, lParam); TRACE("%x %lx\n", wParam, lParam);
infoPtr->delta = (int)wParam; infoPtr->delta = (int)wParam;
return prev; return prev;
} }
static LRESULT static LRESULT
MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
return infoPtr->firstDay; return infoPtr->firstDay;
} }
@ -887,7 +887,7 @@ MONTHCAL_GetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* 0 == Monday, 6 == Sunday */ /* 0 == Monday, 6 == Sunday */
/* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */
/* FIXME: we need more error checking here */ /* FIXME: we need more error checking here */
static LRESULT static LRESULT
MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -916,7 +916,7 @@ MONTHCAL_SetFirstDayOfWeek(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* FIXME: fill this in */ /* FIXME: fill this in */
static LRESULT static LRESULT
MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetMonthRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -937,7 +937,7 @@ MONTHCAL_GetMaxTodayWidth(HWND hwnd)
/* FIXME: are validated times taken from current date/time or simply /* FIXME: are validated times taken from current date/time or simply
* copied? * copied?
* FIXME: check whether MCM_GETMONTHRANGE shows correct result after * FIXME: check whether MCM_GETMONTHRANGE shows correct result after
* adjusting range with MCM_SETRANGE * adjusting range with MCM_SETRANGE
*/ */
@ -950,7 +950,7 @@ MONTHCAL_SetRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
int prev; int prev;
TRACE("%x %lx\n", wParam, lParam); TRACE("%x %lx\n", wParam, lParam);
if(wParam & GDTR_MAX) { if(wParam & GDTR_MAX) {
if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){ if(MONTHCAL_ValidateTime(lprgSysTimeArray[1])){
MONTHCAL_CopyTime(&lprgSysTimeArray[1], &infoPtr->maxDate); MONTHCAL_CopyTime(&lprgSysTimeArray[1], &infoPtr->maxDate);
@ -973,8 +973,8 @@ MONTHCAL_SetRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
prev = infoPtr->monthRange; prev = infoPtr->monthRange;
infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth; infoPtr->monthRange = infoPtr->maxDate.wMonth - infoPtr->minDate.wMonth;
if(infoPtr->monthRange!=prev) { if(infoPtr->monthRange!=prev) {
COMCTL32_ReAlloc(infoPtr->monthdayState, COMCTL32_ReAlloc(infoPtr->monthdayState,
infoPtr->monthRange * sizeof(MONTHDAYSTATE)); infoPtr->monthRange * sizeof(MONTHDAYSTATE));
} }
@ -983,7 +983,7 @@ MONTHCAL_SetRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* CHECKME: At the moment, we copy ranges anyway,regardless of /* CHECKME: At the moment, we copy ranges anyway,regardless of
* infoPtr->rangeValid; a invalid range is simply filled with zeros in * infoPtr->rangeValid; a invalid range is simply filled with zeros in
* SetRange. Is this the right behavior? * SetRange. Is this the right behavior?
*/ */
@ -1015,12 +1015,12 @@ MONTHCAL_SetDayState(HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("%x %lx\n", wParam, lParam); TRACE("%x %lx\n", wParam, lParam);
if(iMonths!=infoPtr->monthRange) return 0; if(iMonths!=infoPtr->monthRange) return 0;
for(i=0; i<iMonths; i++) for(i=0; i<iMonths; i++)
infoPtr->monthdayState[i] = dayStates[i]; infoPtr->monthdayState[i] = dayStates[i];
return 1; return 1;
} }
static LRESULT static LRESULT
MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1036,7 +1036,7 @@ MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* FIXME: if the specified date is not visible, make it visible */ /* FIXME: if the specified date is not visible, make it visible */
/* FIXME: redraw? */ /* FIXME: redraw? */
static LRESULT static LRESULT
MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1057,7 +1057,7 @@ MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1067,7 +1067,7 @@ MONTHCAL_GetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1081,7 +1081,7 @@ MONTHCAL_SetMaxSelCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1100,12 +1100,12 @@ MONTHCAL_GetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay); TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static LRESULT static LRESULT
MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1124,12 +1124,12 @@ MONTHCAL_SetSelRange(HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay); TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static LRESULT static LRESULT
MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1145,7 +1145,7 @@ MONTHCAL_GetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetToday(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd);
@ -1170,15 +1170,15 @@ MONTHCAL_HitTest(HWND hwnd, LPARAM lParam)
UINT x,y; UINT x,y;
DWORD retval; DWORD retval;
int day,wday,wnum; int day,wday,wnum;
x = lpht->pt.x; x = lpht->pt.x;
y = lpht->pt.y; y = lpht->pt.y;
retval = MCHT_NOWHERE; retval = MCHT_NOWHERE;
/* Comment in for debugging...
TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, /* Comment in for debugging...
TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y,
infoPtr->wdays.left, infoPtr->wdays.right, infoPtr->wdays.left, infoPtr->wdays.right,
infoPtr->wdays.top, infoPtr->wdays.bottom, infoPtr->wdays.top, infoPtr->wdays.bottom,
infoPtr->days.left, infoPtr->days.right, infoPtr->days.left, infoPtr->days.right,
@ -1190,7 +1190,7 @@ MONTHCAL_HitTest(HWND hwnd, LPARAM lParam)
*/ */
/* are we in the header? */ /* are we in the header? */
if(PtInRect(&infoPtr->title, lpht->pt)) { if(PtInRect(&infoPtr->title, lpht->pt)) {
if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) { if(PtInRect(&infoPtr->titlebtnprev, lpht->pt)) {
retval = MCHT_TITLEBTNPREV; retval = MCHT_TITLEBTNPREV;
@ -1208,36 +1208,36 @@ MONTHCAL_HitTest(HWND hwnd, LPARAM lParam)
retval = MCHT_TITLEYEAR; retval = MCHT_TITLEYEAR;
goto done; goto done;
} }
retval = MCHT_TITLE; retval = MCHT_TITLE;
goto done; goto done;
} }
day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum); day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum);
if(PtInRect(&infoPtr->wdays, lpht->pt)) { if(PtInRect(&infoPtr->wdays, lpht->pt)) {
retval = MCHT_CALENDARDAY; retval = MCHT_CALENDARDAY;
lpht->st.wYear = infoPtr->currentYear; lpht->st.wYear = infoPtr->currentYear;
lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth; lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth;
lpht->st.wDay = (day < 1)? lpht->st.wDay = (day < 1)?
MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day; MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day;
goto done; goto done;
} }
if(PtInRect(&infoPtr->weeknums, lpht->pt)) { if(PtInRect(&infoPtr->weeknums, lpht->pt)) {
retval = MCHT_CALENDARWEEKNUM; retval = MCHT_CALENDARWEEKNUM;
lpht->st.wYear = infoPtr->currentYear; lpht->st.wYear = infoPtr->currentYear;
lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 :
(day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ?
infoPtr->currentMonth +1 :infoPtr->currentMonth; infoPtr->currentMonth +1 :infoPtr->currentMonth;
lpht->st.wDay = (day < 1 ) ? lpht->st.wDay = (day < 1 ) ?
MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day :
(day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ?
day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day; day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day;
goto done; goto done;
} }
if(PtInRect(&infoPtr->days, lpht->pt)) if(PtInRect(&infoPtr->days, lpht->pt))
{ {
lpht->st.wYear = infoPtr->currentYear; lpht->st.wYear = infoPtr->currentYear;
if ( day < 1) if ( day < 1)
{ {
retval = MCHT_CALENDARDATEPREV; retval = MCHT_CALENDARDATEPREV;
lpht->st.wMonth = infoPtr->currentMonth - 1; lpht->st.wMonth = infoPtr->currentMonth - 1;
@ -1267,15 +1267,15 @@ MONTHCAL_HitTest(HWND hwnd, LPARAM lParam)
goto done; goto done;
} }
if(PtInRect(&infoPtr->todayrect, lpht->pt)) { if(PtInRect(&infoPtr->todayrect, lpht->pt)) {
retval = MCHT_TODAYLINK; retval = MCHT_TODAYLINK;
goto done; goto done;
} }
/* Hit nothing special? What's left must be background :-) */ /* Hit nothing special? What's left must be background :-) */
retval = MCHT_CALENDARBK; retval = MCHT_CALENDARBK;
done: done:
lpht->uHit = retval; lpht->uHit = retval;
return retval; return retval;
} }
@ -1331,7 +1331,7 @@ static void MONTHCAL_GoToPrevMonth(HWND hwnd, MONTHCAL_INFO *infoPtr)
nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); nmds.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
nmds.nmhdr.code = MCN_GETDAYSTATE; nmds.nmhdr.code = MCN_GETDAYSTATE;
nmds.cDayState = infoPtr->monthRange; nmds.cDayState = infoPtr->monthRange;
nmds.prgDayState = COMCTL32_Alloc nmds.prgDayState = COMCTL32_Alloc
(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
SendMessageA(GetParent(hwnd), WM_NOTIFY, SendMessageA(GetParent(hwnd), WM_NOTIFY,
@ -1348,7 +1348,7 @@ MONTHCAL_RButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
HMENU hMenu; HMENU hMenu;
POINT menupoint; POINT menupoint;
char buf[32]; char buf[32];
hMenu = CreatePopupMenu(); hMenu = CreatePopupMenu();
if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf)))
{ {
@ -1365,7 +1365,7 @@ MONTHCAL_RButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->currentMonth=infoPtr->todaysDate.wMonth; infoPtr->currentMonth=infoPtr->todaysDate.wMonth;
infoPtr->currentYear=infoPtr->todaysDate.wYear; infoPtr->currentYear=infoPtr->todaysDate.wYear;
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
} }
return 0; return 0;
} }
@ -1381,7 +1381,7 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
int i; int i;
POINT menupoint; POINT menupoint;
TRACE("%x %lx\n", wParam, lParam); TRACE("%x %lx\n", wParam, lParam);
if (infoPtr->hWndYearUpDown) if (infoPtr->hWndYearUpDown)
{ {
infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0);
@ -1399,7 +1399,7 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->hWndYearEdit=0; infoPtr->hWndYearEdit=0;
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
} }
ht.pt.x = (INT)LOWORD(lParam); ht.pt.x = (INT)LOWORD(lParam);
ht.pt.y = (INT)HIWORD(lParam); ht.pt.y = (INT)HIWORD(lParam);
hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht); hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
@ -1414,7 +1414,7 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
} }
if(hit == MCHT_TITLEBTNPREV){ if(hit == MCHT_TITLEBTNPREV){
MONTHCAL_GoToPrevMonth(hwnd, infoPtr); MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
infoPtr->status = MC_PREVPRESSED; infoPtr->status = MC_PREVPRESSED;
SetTimer(hwnd, MC_PREVMONTHTIMER, MC_NEXTMONTHDELAY, 0); SetTimer(hwnd, MC_PREVMONTHTIMER, MC_NEXTMONTHDELAY, 0);
@ -1424,7 +1424,7 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
if(hit == MCHT_TITLEMONTH) { if(hit == MCHT_TITLEMONTH) {
hMenu = CreatePopupMenu(); hMenu = CreatePopupMenu();
for (i=0; i<12;i++) for (i=0; i<12;i++)
{ {
GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i,
@ -1451,8 +1451,8 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->titleyear.right-infoPtr->titleyear.left, infoPtr->titleyear.right-infoPtr->titleyear.left,
infoPtr->textHeight, infoPtr->textHeight,
hwnd, hwnd,
(HMENU)NULL, (HMENU)NULL,
(HINSTANCE)NULL, (HINSTANCE)NULL,
NULL); NULL);
infoPtr->hWndYearUpDown=CreateWindowExA(0, infoPtr->hWndYearUpDown=CreateWindowExA(0,
UPDOWN_CLASSA, UPDOWN_CLASSA,
@ -1462,14 +1462,14 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
20, 20,
infoPtr->textHeight, infoPtr->textHeight,
hwnd, hwnd,
(HMENU)NULL, (HMENU)NULL,
(HINSTANCE)NULL, (HINSTANCE)NULL,
NULL); NULL);
SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753));
SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 );
SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear );
return TRUE; return TRUE;
} }
if(hit == MCHT_TODAYLINK) { if(hit == MCHT_TODAYLINK) {
infoPtr->currentMonth=infoPtr->todaysDate.wMonth; infoPtr->currentMonth=infoPtr->todaysDate.wMonth;
@ -1487,13 +1487,13 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
nmsc.nmhdr.code = MCN_SELCHANGE; nmsc.nmhdr.code = MCN_SELCHANGE;
MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
SendMessageA(GetParent(hwnd), WM_NOTIFY, SendMessageA(GetParent(hwnd), WM_NOTIFY,
(WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
MONTHCAL_CopyTime(&ht.st, &selArray[0]); MONTHCAL_CopyTime(&ht.st, &selArray[0]);
MONTHCAL_CopyTime(&ht.st, &selArray[1]); MONTHCAL_CopyTime(&ht.st, &selArray[1]);
MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray);
/* redraw both old and new days if the selected day changed */ /* redraw both old and new days if the selected day changed */
if(infoPtr->curSelDay != ht.st.wDay) { if(infoPtr->curSelDay != ht.st.wDay) {
@ -1546,7 +1546,7 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam)
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
} }
if(hit == MCHT_CALENDARDATEPREV){ if(hit == MCHT_CALENDARDATEPREV){
MONTHCAL_GoToPrevMonth(hwnd, infoPtr); MONTHCAL_GoToPrevMonth(hwnd, infoPtr);
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return TRUE; return TRUE;
@ -1564,14 +1564,14 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam)
nmsc.nmhdr.code = MCN_SELECT; nmsc.nmhdr.code = MCN_SELECT;
MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel);
MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel);
SendMessageA(GetParent(hwnd), WM_NOTIFY, SendMessageA(GetParent(hwnd), WM_NOTIFY,
(WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
/* redraw if necessary */ /* redraw if necessary */
if(redraw) if(redraw)
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return 0; return 0;
} }
@ -1586,7 +1586,7 @@ MONTHCAL_Timer(HWND hwnd, WPARAM wParam, LPARAM lParam)
if(!infoPtr) return 0; if(!infoPtr) return 0;
switch(wParam) { switch(wParam) {
case MC_NEXTMONTHTIMER: case MC_NEXTMONTHTIMER:
redraw = TRUE; redraw = TRUE;
MONTHCAL_GoToNextMonth(hwnd, infoPtr); MONTHCAL_GoToNextMonth(hwnd, infoPtr);
break; break;
@ -1618,9 +1618,9 @@ MONTHCAL_MouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam)
ht.pt.x = LOWORD(lParam); ht.pt.x = LOWORD(lParam);
ht.pt.y = HIWORD(lParam); ht.pt.y = HIWORD(lParam);
hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht); hit = MONTHCAL_HitTest(hwnd, (LPARAM)&ht);
/* not on the calendar date numbers? bail out */ /* not on the calendar date numbers? bail out */
TRACE("hit:%x\n",hit); TRACE("hit:%x\n",hit);
if((hit & MCHT_CALENDARDATE) != MCHT_CALENDARDATE) return 0; if((hit & MCHT_CALENDARDATE) != MCHT_CALENDARDATE) return 0;
@ -1638,23 +1638,23 @@ MONTHCAL_MouseMove(HWND hwnd, WPARAM wParam, LPARAM lParam)
i = 0; i = 0;
if(infoPtr->firstSelDay==selArray[0].wDay) i=1; if(infoPtr->firstSelDay==selArray[0].wDay) i=1;
TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
if(infoPtr->firstSelDay==selArray[1].wDay) { if(infoPtr->firstSelDay==selArray[1].wDay) {
/* 1st time we get here: selArray[0]=selArray[1]) */ /* 1st time we get here: selArray[0]=selArray[1]) */
/* if we're still at the first selected date, return */ /* if we're still at the first selected date, return */
if(infoPtr->firstSelDay==selday) goto done; if(infoPtr->firstSelDay==selday) goto done;
if(selday<infoPtr->firstSelDay) i = 0; if(selday<infoPtr->firstSelDay) i = 0;
} }
if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) { if(abs(infoPtr->firstSelDay - selday) >= infoPtr->maxSelCount) {
if(selday>infoPtr->firstSelDay) if(selday>infoPtr->firstSelDay)
selday = infoPtr->firstSelDay + infoPtr->maxSelCount; selday = infoPtr->firstSelDay + infoPtr->maxSelCount;
else else
selday = infoPtr->firstSelDay - infoPtr->maxSelCount; selday = infoPtr->firstSelDay - infoPtr->maxSelCount;
} }
if(selArray[i].wDay!=selday) { if(selArray[i].wDay!=selday) {
TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); TRACE("newRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i);
selArray[i].wDay = selday; selArray[i].wDay = selday;
if(selArray[0].wDay>selArray[1].wDay) { if(selArray[0].wDay>selArray[1].wDay) {
@ -1712,7 +1712,7 @@ static LRESULT
MONTHCAL_SetFocus(HWND hwnd, WPARAM wParam, LPARAM lParam) MONTHCAL_SetFocus(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TRACE("\n"); TRACE("\n");
InvalidateRect(hwnd, NULL, FALSE); InvalidateRect(hwnd, NULL, FALSE);
return 0; return 0;
@ -1769,15 +1769,15 @@ static void MONTHCAL_UpdateSize(HWND hwnd)
rcDraw->bottom = rcClient->bottom; rcDraw->bottom = rcClient->bottom;
/* recalculate the height and width increments and offsets */ /* recalculate the height and width increments and offsets */
/* FIXME: We use up all available width. This will inhibit having multiple /* FIXME: We use up all available width. This will inhibit having multiple
calendars in a row, like win doesn calendars in a row, like win doesn
*/ */
if(dwStyle & MCS_WEEKNUMBERS) if(dwStyle & MCS_WEEKNUMBERS)
xdiv=8.0; xdiv=8.0;
else else
xdiv=7.0; xdiv=7.0;
infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv; infoPtr->width_increment = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) / xdiv;
infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0; infoPtr->height_increment = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) / 10.0;
infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv); infoPtr->left_offset = (infoPtr->rcDraw.right - infoPtr->rcDraw.left) - (infoPtr->width_increment * xdiv);
infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0); infoPtr->top_offset = (infoPtr->rcDraw.bottom - infoPtr->rcDraw.top) - (infoPtr->height_increment * 10.0);
@ -1790,7 +1790,7 @@ static void MONTHCAL_UpdateSize(HWND hwnd)
/*if((rcDraw->top + 9 * infoPtr->textHeight + 5) < rcDraw->bottom) { /*if((rcDraw->top + 9 * infoPtr->textHeight + 5) < rcDraw->bottom) {
rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5; rcDraw->bottom = rcDraw->top + 9 * infoPtr->textHeight + 5;
}*/ }*/
/* calculate title area */ /* calculate title area */
title->top = rcClient->top; title->top = rcClient->top;
title->bottom = title->top + 2 * infoPtr->height_increment; title->bottom = title->top + 2 * infoPtr->height_increment;
@ -1805,17 +1805,17 @@ static void MONTHCAL_UpdateSize(HWND hwnd)
prev->right = prev->left + (title->bottom - title->top) ; prev->right = prev->left + (title->bottom - title->top) ;
next->right = title->right - 6; next->right = title->right - 6;
next->left = next->right - (title->bottom - title->top); next->left = next->right - (title->bottom - title->top);
/* titlemonth->left and right change based upon the current month */ /* titlemonth->left and right change based upon the current month */
/* and are recalculated in refresh as the current month may change */ /* and are recalculated in refresh as the current month may change */
/* without the control being resized */ /* without the control being resized */
titlemonth->top = titleyear->top = title->top + (infoPtr->height_increment)/2; titlemonth->top = titleyear->top = title->top + (infoPtr->height_increment)/2;
titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2; titlemonth->bottom = titleyear->bottom = title->bottom - (infoPtr->height_increment)/2;
/* setup the dimensions of the rectangle we draw the names of the */ /* setup the dimensions of the rectangle we draw the names of the */
/* days of the week in */ /* days of the week in */
weeknumrect->left =infoPtr->left_offset; weeknumrect->left =infoPtr->left_offset;
if(dwStyle & MCS_WEEKNUMBERS) if(dwStyle & MCS_WEEKNUMBERS)
weeknumrect->right=prev->right; weeknumrect->right=prev->right;
else else
weeknumrect->right=weeknumrect->left; weeknumrect->right=weeknumrect->left;
@ -1823,16 +1823,16 @@ static void MONTHCAL_UpdateSize(HWND hwnd)
wdays->right = days->right = wdays->left + 7 * infoPtr->width_increment; wdays->right = days->right = wdays->left + 7 * infoPtr->width_increment;
wdays->top = title->bottom ; wdays->top = title->bottom ;
wdays->bottom = wdays->top + infoPtr->height_increment; wdays->bottom = wdays->top + infoPtr->height_increment;
days->top = weeknumrect->top = wdays->bottom ; days->top = weeknumrect->top = wdays->bottom ;
days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment; days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment;
todayrect->left = rcClient->left; todayrect->left = rcClient->left;
todayrect->right = rcClient->right; todayrect->right = rcClient->right;
todayrect->top = days->bottom; todayrect->top = days->bottom;
todayrect->bottom = days->bottom + infoPtr->height_increment; todayrect->bottom = days->bottom + infoPtr->height_increment;
/* uncomment for excessive debugging /* uncomment for excessive debugging
TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n", TRACE("dx=%d dy=%d rcC[%d %d %d %d] t[%d %d %d %d] wd[%d %d %d %d] w[%d %d %d %d] t[%d %d %d %d]\n",
infoPtr->width_increment,infoPtr->height_increment, infoPtr->width_increment,infoPtr->height_increment,
rcClient->left, rcClient->right, rcClient->top, rcClient->bottom, rcClient->left, rcClient->right, rcClient->top, rcClient->bottom,
@ -1841,9 +1841,9 @@ static void MONTHCAL_UpdateSize(HWND hwnd)
days->left, days->right, days->top, days->bottom, days->left, days->right, days->top, days->bottom,
todayrect->left,todayrect->right,todayrect->top,todayrect->bottom); todayrect->left,todayrect->right,todayrect->top,todayrect->bottom);
*/ */
/* restore the originally selected font */ /* restore the originally selected font */
SelectObject(hdc, currentFont); SelectObject(hdc, currentFont);
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
} }
@ -1896,7 +1896,7 @@ MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam)
MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxDate); MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxDate);
infoPtr->maxSelCount = 7; infoPtr->maxSelCount = 7;
infoPtr->monthRange = 3; infoPtr->monthRange = 3;
infoPtr->monthdayState = COMCTL32_Alloc infoPtr->monthdayState = COMCTL32_Alloc
(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
infoPtr->titlebk = GetSysColor(COLOR_ACTIVECAPTION); infoPtr->titlebk = GetSysColor(COLOR_ACTIVECAPTION);
infoPtr->titletxt = GetSysColor(COLOR_WINDOW); infoPtr->titletxt = GetSysColor(COLOR_WINDOW);
@ -2054,7 +2054,7 @@ MONTHCAL_Register(void)
wndClass.hCursor = LoadCursorA(0, IDC_ARROWA); wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = MONTHCAL_CLASSA; wndClass.lpszClassName = MONTHCAL_CLASSA;
RegisterClassA(&wndClass); RegisterClassA(&wndClass);
} }

View File

@ -123,7 +123,7 @@ NATIVEFONT_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = WC_NATIVEFONTCTLA; wndClass.lpszClassName = WC_NATIVEFONTCTLA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -44,7 +44,7 @@ typedef struct
INT nButtonSize;/* size of the pager btns */ INT nButtonSize;/* size of the pager btns */
INT nPos; /* scroll position */ INT nPos; /* scroll position */
INT nWidth; /* from child wnd's response to PGN_CALCSIZE */ INT nWidth; /* from child wnd's response to PGN_CALCSIZE */
INT nHeight; /* from child wnd's response to PGN_CALCSIZE */ INT nHeight; /* from child wnd's response to PGN_CALCSIZE */
BOOL bForward; /* forward WM_MOUSEMOVE msgs to the contained wnd */ BOOL bForward; /* forward WM_MOUSEMOVE msgs to the contained wnd */
BOOL bCapture; /* we have captured the mouse */ BOOL bCapture; /* we have captured the mouse */
INT TLbtnState; /* state of top or left btn */ INT TLbtnState; /* state of top or left btn */
@ -63,7 +63,7 @@ typedef struct
#define INITIAL_DELAY 500 #define INITIAL_DELAY 500
#define REPEAT_DELAY 50 #define REPEAT_DELAY 50
/* the horizontal arrows are: /* the horizontal arrows are:
* *
* 01234 01234 * 01234 01234
* 1 * * * 1 * *
@ -72,7 +72,7 @@ typedef struct
* 4*** *** * 4*** ***
* 5 ** ** * 5 ** **
* 6 * * * 6 * *
* 7 * 7
* *
*/ */
static void static void
@ -115,10 +115,10 @@ PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left)
DeleteObject( hPen ); DeleteObject( hPen );
} }
/* the vertical arrows are: /* the vertical arrows are:
* *
* 01234567 01234567 * 01234567 01234567
* 1****** ** * 1****** **
* 2 **** **** * 2 **** ****
* 3 ** ****** * 3 ** ******
* 4 * 4
@ -175,14 +175,14 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect,
return; return;
if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0)) if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0))
return; return;
hBrush = CreateSolidBrush(clrBk); hBrush = CreateSolidBrush(clrBk);
hOldBrush = (HBRUSH)SelectObject(hdc, hBrush); hOldBrush = (HBRUSH)SelectObject(hdc, hBrush);
FillRect(hdc, &rc, hBrush); FillRect(hdc, &rc, hBrush);
if (btnState == PGF_HOT) if (btnState == PGF_HOT)
{ {
DrawEdge( hdc, &rc, BDR_RAISEDINNER, BF_RECT); DrawEdge( hdc, &rc, BDR_RAISEDINNER, BF_RECT);
if (horz) if (horz)
@ -190,7 +190,7 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect,
else else
PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
} }
else if (btnState == PGF_NORMAL) else if (btnState == PGF_NORMAL)
{ {
DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT);
if (horz) if (horz)
@ -198,7 +198,7 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect,
else else
PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
} }
else if (btnState == PGF_DEPRESSED) else if (btnState == PGF_DEPRESSED)
{ {
DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT); DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT);
if (horz) if (horz)
@ -206,7 +206,7 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect,
else else
PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft);
} }
else if (btnState == PGF_GRAYED) else if (btnState == PGF_GRAYED)
{ {
DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT);
if (horz) if (horz)
@ -246,7 +246,7 @@ static void PAGER_CaptureandTrack(PAGER_INFO *infoPtr, HWND hwnd)
/* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */ /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
if(!(trackinfo.dwFlags & TME_LEAVE)) { if(!(trackinfo.dwFlags & TME_LEAVE)) {
trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
/* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
/* and can properly deactivate the hot button */ /* and can properly deactivate the hot button */
_TrackMouseEvent(&trackinfo); _TrackMouseEvent(&trackinfo);
@ -270,7 +270,7 @@ PAGER_ForwardMouse (HWND hwnd, WPARAM wParam)
static inline LRESULT static inline LRESULT
PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam) PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
LRESULT btnState = PGF_INVISIBLE; LRESULT btnState = PGF_INVISIBLE;
INT btn = (INT)lParam; INT btn = (INT)lParam;
TRACE("[%08x]\n", hwnd); TRACE("[%08x]\n", hwnd);
@ -287,7 +287,7 @@ PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
static inline LRESULT static inline LRESULT
PAGER_GetPos(HWND hwnd) PAGER_GetPos(HWND hwnd)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
TRACE("[%08x] returns %d\n", hwnd, infoPtr->nPos); TRACE("[%08x] returns %d\n", hwnd, infoPtr->nPos);
return (LRESULT)infoPtr->nPos; return (LRESULT)infoPtr->nPos;
} }
@ -295,7 +295,7 @@ PAGER_GetPos(HWND hwnd)
static inline LRESULT static inline LRESULT
PAGER_GetButtonSize(HWND hwnd) PAGER_GetButtonSize(HWND hwnd)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
TRACE("[%08x] returns %d\n", hwnd, infoPtr->nButtonSize); TRACE("[%08x] returns %d\n", hwnd, infoPtr->nButtonSize);
return (LRESULT)infoPtr->nButtonSize; return (LRESULT)infoPtr->nButtonSize;
} }
@ -303,7 +303,7 @@ PAGER_GetButtonSize(HWND hwnd)
static inline LRESULT static inline LRESULT
PAGER_GetBorder(HWND hwnd) PAGER_GetBorder(HWND hwnd)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
TRACE("[%08x] returns %d\n", hwnd, infoPtr->nBorder); TRACE("[%08x] returns %d\n", hwnd, infoPtr->nBorder);
return (LRESULT)infoPtr->nBorder; return (LRESULT)infoPtr->nBorder;
} }
@ -311,13 +311,13 @@ PAGER_GetBorder(HWND hwnd)
static inline LRESULT static inline LRESULT
PAGER_GetBkColor(HWND hwnd) PAGER_GetBkColor(HWND hwnd)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
TRACE("[%08x] returns %06lx\n", hwnd, infoPtr->clrBk); TRACE("[%08x] returns %06lx\n", hwnd, infoPtr->clrBk);
return (LRESULT)infoPtr->clrBk; return (LRESULT)infoPtr->clrBk;
} }
static void static void
PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth)
{ {
NMPGCALCSIZE nmpgcs; NMPGCALCSIZE nmpgcs;
ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
@ -370,7 +370,7 @@ PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr)
if (infoPtr->nHeight < wndSize) if (infoPtr->nHeight < wndSize)
infoPtr->nHeight = wndSize; infoPtr->nHeight = wndSize;
TRACE("[%08x] SWP %dx%d at (%d,%d)\n", hwnd, TRACE("[%08x] SWP %dx%d at (%d,%d)\n", hwnd,
infoPtr->nWidth, infoPtr->nHeight, infoPtr->nWidth, infoPtr->nHeight,
0, -nPos); 0, -nPos);
SetWindowPos(infoPtr->hwndChild, 0, SetWindowPos(infoPtr->hwndChild, 0,
@ -416,7 +416,7 @@ PAGER_GetScrollRange(HWND hwnd, PAGER_INFO* infoPtr)
return scrollRange; return scrollRange;
} }
static void static void
PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange, PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange,
BOOL* needsResize, BOOL* needsRepaint) BOOL* needsResize, BOOL* needsRepaint)
{ {
@ -453,7 +453,7 @@ PAGER_GrayAndRestoreBtns(PAGER_INFO* infoPtr, INT scrollRange,
} }
static void static void
PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint) PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint)
{ {
if (infoPtr->TLbtnState & (PGF_HOT | PGF_DEPRESSED)) if (infoPtr->TLbtnState & (PGF_HOT | PGF_DEPRESSED))
@ -469,7 +469,7 @@ PAGER_NormalizeBtns(PAGER_INFO* infoPtr, BOOL* needsRepaint)
} }
} }
static void static void
PAGER_HideGrayBtns(PAGER_INFO* infoPtr, BOOL* needsResize) PAGER_HideGrayBtns(PAGER_INFO* infoPtr, BOOL* needsResize)
{ {
if (infoPtr->TLbtnState == PGF_GRAYED) if (infoPtr->TLbtnState == PGF_GRAYED)
@ -501,16 +501,16 @@ PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr,
PAGER_HideGrayBtns(infoPtr, &resizeClient); PAGER_HideGrayBtns(infoPtr, &resizeClient);
if (resizeClient) /* initiate NCCalcSize to resize client wnd */ { if (resizeClient) /* initiate NCCalcSize to resize client wnd */ {
SetWindowPos(hwnd, 0,0,0,0,0, SetWindowPos(hwnd, 0,0,0,0,0,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
} }
if (repaintBtns) if (repaintBtns)
SendMessageA(hwnd, WM_NCPAINT, 0, 0); SendMessageA(hwnd, WM_NCPAINT, 0, 0);
} }
static LRESULT static LRESULT
PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress) PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
@ -568,7 +568,7 @@ PAGER_HandleWindowPosChanging(HWND hwnd, WPARAM wParam, WINDOWPOS *winpos)
return 1; return 1;
} }
static INT static INT
PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr)
{ {
/* Must set the non-scrollable dimension to be less than the full height/width /* Must set the non-scrollable dimension to be less than the full height/width
@ -599,7 +599,7 @@ PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr)
return h; return h;
} }
static INT static INT
PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr)
{ {
/* Must set the non-scrollable dimension to be less than the full height/width /* Must set the non-scrollable dimension to be less than the full height/width
@ -658,7 +658,7 @@ PAGER_RecalcSize(HWND hwnd)
infoPtr->nPos = -1; infoPtr->nPos = -1;
PAGER_SetPos(hwnd, 0, FALSE); PAGER_SetPos(hwnd, 0, FALSE);
} }
else else
{ {
PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, TRUE); PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, TRUE);
PAGER_PositionChildWnd(hwnd, infoPtr); PAGER_PositionChildWnd(hwnd, infoPtr);
@ -679,7 +679,7 @@ PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("[%08x] %06lx\n", hwnd, infoPtr->clrBk); TRACE("[%08x] %06lx\n", hwnd, infoPtr->clrBk);
/* the native control seems to do things this way */ /* the native control seems to do things this way */
SetWindowPos(hwnd, 0,0,0,0,0, SetWindowPos(hwnd, 0,0,0,0,0,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
@ -734,14 +734,14 @@ PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (PAGER_IsHorizontal(hwnd)) { if (PAGER_IsHorizontal(hwnd)) {
hw = PAGER_SetFixedHeight(hwnd, infoPtr); hw = PAGER_SetFixedHeight(hwnd, infoPtr);
/* adjust non-scrollable dimension to fit the child */ /* adjust non-scrollable dimension to fit the child */
SetWindowPos(hwnd, 0, 0,0, hw, infoPtr->nHeight, SetWindowPos(hwnd, 0, 0,0, hw, infoPtr->nHeight,
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER |
SWP_NOSIZE | SWP_NOACTIVATE); SWP_NOSIZE | SWP_NOACTIVATE);
} }
else { else {
hw = PAGER_SetFixedWidth(hwnd, infoPtr); hw = PAGER_SetFixedWidth(hwnd, infoPtr);
/* adjust non-scrollable dimension to fit the child */ /* adjust non-scrollable dimension to fit the child */
SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, hw, SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, hw,
SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER |
SWP_NOSIZE | SWP_NOACTIVATE); SWP_NOSIZE | SWP_NOACTIVATE);
} }
@ -772,8 +772,8 @@ PAGER_Scroll(HWND hwnd, INT dir)
nmpgScroll.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); nmpgScroll.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmpgScroll.hdr.code = PGN_SCROLL; nmpgScroll.hdr.code = PGN_SCROLL;
GetWindowRect(hwnd, &rcWnd); GetWindowRect(hwnd, &rcWnd);
GetClientRect(hwnd, &nmpgScroll.rcParent); GetClientRect(hwnd, &nmpgScroll.rcParent);
nmpgScroll.iXpos = nmpgScroll.iYpos = 0; nmpgScroll.iXpos = nmpgScroll.iYpos = 0;
nmpgScroll.iDir = dir; nmpgScroll.iDir = dir;
@ -788,10 +788,10 @@ PAGER_Scroll(HWND hwnd, INT dir)
nmpgScroll.iYpos = infoPtr->nPos; nmpgScroll.iYpos = infoPtr->nPos;
} }
nmpgScroll.iScroll -= 2*infoPtr->nButtonSize; nmpgScroll.iScroll -= 2*infoPtr->nButtonSize;
SendMessageA (GetParent(hwnd), WM_NOTIFY, SendMessageA (GetParent(hwnd), WM_NOTIFY,
(WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll);
TRACE("[%08x] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); TRACE("[%08x] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll);
if (nmpgScroll.iScroll > 0) if (nmpgScroll.iScroll > 0)
@ -814,12 +814,12 @@ PAGER_FmtLines(HWND hwnd)
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
/* initiate NCCalcSize to resize client wnd and get size */ /* initiate NCCalcSize to resize client wnd and get size */
SetWindowPos(hwnd, 0, 0,0,0,0, SetWindowPos(hwnd, 0, 0,0,0,0,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(infoPtr->hwndChild, 0, SetWindowPos(infoPtr->hwndChild, 0,
0,0,infoPtr->nWidth,infoPtr->nHeight, 0,0,infoPtr->nWidth,infoPtr->nHeight,
0); 0);
return DefWindowProcA (hwnd, EM_FMTLINES, 0, 0); return DefWindowProcA (hwnd, EM_FMTLINES, 0, 0);
@ -890,11 +890,11 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
/* /*
* lParam points to a RECT struct. On entry, the struct * lParam points to a RECT struct. On entry, the struct
* contains the proposed wnd rectangle for the window. * contains the proposed wnd rectangle for the window.
* On exit, the struct should contain the screen * On exit, the struct should contain the screen
* coordinates of the corresponding window's client area. * coordinates of the corresponding window's client area.
*/ */
DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam);
TRACE("orig rect=(%d,%d)-(%d,%d)\n", TRACE("orig rect=(%d,%d)-(%d,%d)\n",
@ -941,7 +941,7 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
else else
{ {
/* native does: (from trace of IE4 opening "Favorites" frame) /* native does: (from trace of IE4 opening "Favorites" frame)
* DefWindowProc * DefWindowProc
* WM_NOITFY PGN_CALCSIZE w/ dwFlag=2 * WM_NOITFY PGN_CALCSIZE w/ dwFlag=2
* GetWindowRect (child, &rc) * GetWindowRect (child, &rc)
@ -1003,7 +1003,7 @@ PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
lpRect->bottom = infoPtr->nHeight; lpRect->bottom = infoPtr->nHeight;
} }
TRACE("[%08x] client rect set to %dx%d at (%d,%d) BtnState[%d,%d]\n", TRACE("[%08x] client rect set to %dx%d at (%d,%d) BtnState[%d,%d]\n",
hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top,
lpRect->left, lpRect->top, lpRect->left, lpRect->top,
infoPtr->TLbtnState, infoPtr->BRbtnState); infoPtr->TLbtnState, infoPtr->BRbtnState);
@ -1046,13 +1046,13 @@ PAGER_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam)
PAGER_DrawButton(hdc, infoPtr->clrBk, rcTopLeft, PAGER_DrawButton(hdc, infoPtr->clrBk, rcTopLeft,
bHorizontal, TRUE, infoPtr->TLbtnState); bHorizontal, TRUE, infoPtr->TLbtnState);
PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight, PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight,
bHorizontal, FALSE, infoPtr->BRbtnState); bHorizontal, FALSE, infoPtr->BRbtnState);
ReleaseDC( hwnd, hdc ); ReleaseDC( hwnd, hdc );
return 0; return 0;
} }
static INT static INT
PAGER_HitTest (HWND hwnd, LPPOINT pt) PAGER_HitTest (HWND hwnd, LPPOINT pt)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
@ -1145,7 +1145,7 @@ PAGER_SetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
{ {
PAGER_CaptureandTrack(infoPtr, hwnd); PAGER_CaptureandTrack(infoPtr, hwnd);
SendMessageA(hwnd, WM_NCPAINT, 0, 0); SendMessageA(hwnd, WM_NCPAINT, 0, 0);
} }
return TRUE; return TRUE;
@ -1226,7 +1226,7 @@ PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* If in one of the buttons the capture and draw buttons */ /* If in one of the buttons the capture and draw buttons */
if (btnrect) { if (btnrect) {
TRACE("[%08x] draw btn (%d,%d)-(%d,%d), Capture %s, style %08lx\n", TRACE("[%08x] draw btn (%d,%d)-(%d,%d), Capture %s, style %08lx\n",
hwnd, btnrect->left, btnrect->top, hwnd, btnrect->left, btnrect->top,
btnrect->right, btnrect->bottom, btnrect->right, btnrect->bottom,
(infoPtr->bCapture) ? "TRUE" : "FALSE", (infoPtr->bCapture) ? "TRUE" : "FALSE",
dwStyle); dwStyle);
@ -1276,7 +1276,7 @@ PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT hit; INT hit;
TRACE("[%08x] at (%d,%d)\n", hwnd, SLOWORD(lParam), SHIWORD(lParam)); TRACE("[%08x] at (%d,%d)\n", hwnd, SLOWORD(lParam), SHIWORD(lParam));
hit = PAGER_HitTest(hwnd, &pt); hit = PAGER_HitTest(hwnd, &pt);
/* put btn in DEPRESSED state */ /* put btn in DEPRESSED state */
@ -1284,17 +1284,17 @@ PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED; repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED;
infoPtr->TLbtnState = PGF_DEPRESSED; infoPtr->TLbtnState = PGF_DEPRESSED;
SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0);
} }
else if (hit == HTRIGHT || hit == HTBOTTOM) else if (hit == HTRIGHT || hit == HTBOTTOM)
{ {
repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED; repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED;
infoPtr->BRbtnState = PGF_DEPRESSED; infoPtr->BRbtnState = PGF_DEPRESSED;
SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0);
} }
if (repaintBtns) if (repaintBtns)
SendMessageA(hwnd, WM_NCPAINT, 0, 0); SendMessageA(hwnd, WM_NCPAINT, 0, 0);
switch(hit) switch(hit)
{ {
@ -1357,11 +1357,11 @@ PAGER_Timer (HWND hwnd, WPARAM wParam)
/* if initial timer, kill it and start the repeat timer */ /* if initial timer, kill it and start the repeat timer */
if (wParam == TIMERID1) { if (wParam == TIMERID1) {
if (PAGER_IsHorizontal(hwnd)) { if (PAGER_IsHorizontal(hwnd)) {
dir = (infoPtr->TLbtnState & PGF_DEPRESSED) ? dir = (infoPtr->TLbtnState & PGF_DEPRESSED) ?
PGF_SCROLLLEFT : PGF_SCROLLRIGHT; PGF_SCROLLLEFT : PGF_SCROLLRIGHT;
} }
else { else {
dir = (infoPtr->TLbtnState & PGF_DEPRESSED) ? dir = (infoPtr->TLbtnState & PGF_DEPRESSED) ?
PGF_SCROLLUP : PGF_SCROLLDOWN; PGF_SCROLLUP : PGF_SCROLLDOWN;
} }
TRACE("[%08x] TIMERID1: style=%08lx, dir=%d\n", hwnd, dwStyle, dir); TRACE("[%08x] TIMERID1: style=%08lx, dir=%d\n", hwnd, dwStyle, dir);
@ -1369,7 +1369,7 @@ PAGER_Timer (HWND hwnd, WPARAM wParam)
SetTimer(hwnd, TIMERID1, REPEAT_DELAY, 0); SetTimer(hwnd, TIMERID1, REPEAT_DELAY, 0);
if (dwStyle & PGS_AUTOSCROLL) { if (dwStyle & PGS_AUTOSCROLL) {
PAGER_Scroll(hwnd, dir); PAGER_Scroll(hwnd, dir);
SetWindowPos(hwnd, 0,0,0,0,0, SetWindowPos(hwnd, 0,0,0,0,0,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
} }
@ -1381,7 +1381,7 @@ PAGER_Timer (HWND hwnd, WPARAM wParam)
KillTimer(hwnd, TIMERID2); KillTimer(hwnd, TIMERID2);
if (infoPtr->direction > 0) { if (infoPtr->direction > 0) {
PAGER_Scroll(hwnd, infoPtr->direction); PAGER_Scroll(hwnd, infoPtr->direction);
SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0);
} }
return 0; return 0;
} }
@ -1485,7 +1485,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case PGM_RECALCSIZE: case PGM_RECALCSIZE:
return PAGER_RecalcSize(hwnd); return PAGER_RecalcSize(hwnd);
case PGM_SETBKCOLOR: case PGM_SETBKCOLOR:
return PAGER_SetBkColor (hwnd, wParam, lParam); return PAGER_SetBkColor (hwnd, wParam, lParam);
@ -1536,7 +1536,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return PAGER_MouseMove (hwnd, wParam, lParam); return PAGER_MouseMove (hwnd, wParam, lParam);
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
return PAGER_MouseLeave (hwnd, wParam, lParam); return PAGER_MouseLeave (hwnd, wParam, lParam);
case WM_NCLBUTTONDOWN: case WM_NCLBUTTONDOWN:
return PAGER_NCLButtonDown (hwnd, wParam, lParam); return PAGER_NCLButtonDown (hwnd, wParam, lParam);
@ -1552,7 +1552,7 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return PAGER_EraseBackground (hwnd, wParam, lParam); return PAGER_EraseBackground (hwnd, wParam, lParam);
/* /*
case WM_PAINT: case WM_PAINT:
return PAGER_Paint (hwnd, wParam); return PAGER_Paint (hwnd, wParam);
*/ */
case WM_TIMER: case WM_TIMER:
return PAGER_Timer (hwnd, wParam); return PAGER_Timer (hwnd, wParam);
@ -1582,7 +1582,7 @@ PAGER_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = 0; wndClass.hbrBackground = 0;
wndClass.lpszClassName = WC_PAGESCROLLERA; wndClass.lpszClassName = WC_PAGESCROLLERA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -1,4 +1,4 @@
/* /*
* Progress control * Progress control
* *
* Copyright 1997, 2002 Dimitrie O. Paun * Copyright 1997, 2002 Dimitrie O. Paun
@ -44,7 +44,7 @@ typedef struct
#define UNKNOWN_PARAM(msg, wParam, lParam) WARN( \ #define UNKNOWN_PARAM(msg, wParam, lParam) WARN( \
"Unknown parameter(s) for message " #msg \ "Unknown parameter(s) for message " #msg \
"(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam); "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
/*********************************************************************** /***********************************************************************
* PROGRESS_EraseBackground * PROGRESS_EraseBackground
@ -103,14 +103,14 @@ static LRESULT PROGRESS_Draw (PROGRESS_INFO *infoPtr, HDC hdc)
/* compute extent of progress bar */ /* compute extent of progress bar */
if (dwStyle & PBS_VERTICAL) { if (dwStyle & PBS_VERTICAL) {
rightBar = rect.bottom - rightBar = rect.bottom -
MulDiv (infoPtr->CurVal - infoPtr->MinVal, MulDiv (infoPtr->CurVal - infoPtr->MinVal,
rect.bottom - rect.top, rect.bottom - rect.top,
infoPtr->MaxVal - infoPtr->MinVal); infoPtr->MaxVal - infoPtr->MinVal);
ledWidth = MulDiv (rect.right - rect.left, 2, 3); ledWidth = MulDiv (rect.right - rect.left, 2, 3);
rightMost = rect.top; rightMost = rect.top;
} else { } else {
rightBar = rect.left + rightBar = rect.left +
MulDiv (infoPtr->CurVal - infoPtr->MinVal, MulDiv (infoPtr->CurVal - infoPtr->MinVal,
rect.right - rect.left, rect.right - rect.left,
infoPtr->MaxVal - infoPtr->MinVal); infoPtr->MaxVal - infoPtr->MinVal);
@ -120,14 +120,14 @@ static LRESULT PROGRESS_Draw (PROGRESS_INFO *infoPtr, HDC hdc)
/* now draw the bar */ /* now draw the bar */
if (dwStyle & PBS_SMOOTH) { if (dwStyle & PBS_SMOOTH) {
if (dwStyle & PBS_VERTICAL) if (dwStyle & PBS_VERTICAL)
rect.top = rightBar; rect.top = rightBar;
else else
rect.right = rightBar; rect.right = rightBar;
FillRect(hdc, &rect, hbrBar); FillRect(hdc, &rect, hbrBar);
} else { } else {
if (dwStyle & PBS_VERTICAL) { if (dwStyle & PBS_VERTICAL) {
while(rect.bottom > rightBar) { while(rect.bottom > rightBar) {
rect.top = rect.bottom - ledWidth; rect.top = rect.bottom - ledWidth;
if (rect.top < rightMost) if (rect.top < rightMost)
rect.top = rightMost; rect.top = rightMost;
@ -135,7 +135,7 @@ static LRESULT PROGRESS_Draw (PROGRESS_INFO *infoPtr, HDC hdc)
rect.bottom = rect.top - LED_GAP; rect.bottom = rect.top - LED_GAP;
} }
} else { } else {
while(rect.left < rightBar) { while(rect.left < rightBar) {
rect.right = rect.left + ledWidth; rect.right = rect.left + ledWidth;
if (rect.right > rightMost) if (rect.right > rightMost)
rect.right = rightMost; rect.right = rightMost;
@ -200,7 +200,7 @@ static DWORD PROGRESS_SetRange (PROGRESS_INFO *infoPtr, int low, int high)
/* if nothing changes, simply return */ /* if nothing changes, simply return */
if(infoPtr->MinVal == low && infoPtr->MaxVal == high) return res; if(infoPtr->MinVal == low && infoPtr->MaxVal == high) return res;
infoPtr->MinVal = low; infoPtr->MinVal = low;
infoPtr->MaxVal = high; infoPtr->MaxVal = high;
PROGRESS_CoercePos(infoPtr); PROGRESS_CoercePos(infoPtr);
@ -210,7 +210,7 @@ static DWORD PROGRESS_SetRange (PROGRESS_INFO *infoPtr, int low, int high)
/*********************************************************************** /***********************************************************************
* ProgressWindowProc * ProgressWindowProc
*/ */
static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
PROGRESS_INFO *infoPtr; PROGRESS_INFO *infoPtr;
@ -220,7 +220,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
infoPtr = (PROGRESS_INFO *)GetWindowLongW(hwnd, 0); infoPtr = (PROGRESS_INFO *)GetWindowLongW(hwnd, 0);
if (!infoPtr && message != WM_CREATE) if (!infoPtr && message != WM_CREATE)
return DefWindowProcW( hwnd, message, wParam, lParam ); return DefWindowProcW( hwnd, message, wParam, lParam );
switch(message) { switch(message) {
case WM_CREATE: case WM_CREATE:
@ -240,9 +240,9 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
/* initialize the info struct */ /* initialize the info struct */
infoPtr->Self = hwnd; infoPtr->Self = hwnd;
infoPtr->MinVal = 0; infoPtr->MinVal = 0;
infoPtr->MaxVal = 100; infoPtr->MaxVal = 100;
infoPtr->CurVal = 0; infoPtr->CurVal = 0;
infoPtr->Step = 10; infoPtr->Step = 10;
infoPtr->ColorBar = CLR_DEFAULT; infoPtr->ColorBar = CLR_DEFAULT;
infoPtr->ColorBk = CLR_DEFAULT; infoPtr->ColorBk = CLR_DEFAULT;
@ -250,7 +250,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
TRACE("Progress Ctrl creation, hwnd=%04x\n", hwnd); TRACE("Progress Ctrl creation, hwnd=%04x\n", hwnd);
return 0; return 0;
} }
case WM_DESTROY: case WM_DESTROY:
TRACE("Progress Ctrl destruction, hwnd=%04x\n", hwnd); TRACE("Progress Ctrl destruction, hwnd=%04x\n", hwnd);
COMCTL32_Free (infoPtr); COMCTL32_Free (infoPtr);
@ -260,7 +260,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
case WM_ERASEBKGND: case WM_ERASEBKGND:
PROGRESS_EraseBackground(infoPtr, wParam); PROGRESS_EraseBackground(infoPtr, wParam);
return TRUE; return TRUE;
case WM_GETFONT: case WM_GETFONT:
return (LRESULT)infoPtr->Font; return (LRESULT)infoPtr->Font;
@ -269,7 +269,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
case WM_PAINT: case WM_PAINT:
return PROGRESS_Paint (infoPtr, (HDC)wParam); return PROGRESS_Paint (infoPtr, (HDC)wParam);
case PBM_DELTAPOS: case PBM_DELTAPOS:
{ {
INT oldVal; INT oldVal;
@ -301,7 +301,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
} }
return oldVal; return oldVal;
} }
case PBM_SETRANGE: case PBM_SETRANGE:
if (wParam) UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam); if (wParam) UNKNOWN_PARAM(PBM_SETRANGE, wParam, lParam);
return PROGRESS_SetRange (infoPtr, (int)LOWORD(lParam), (int)HIWORD(lParam)); return PROGRESS_SetRange (infoPtr, (int)LOWORD(lParam), (int)HIWORD(lParam));
@ -319,7 +319,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
{ {
INT oldVal; INT oldVal;
if (wParam || lParam) UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam); if (wParam || lParam) UNKNOWN_PARAM(PBM_STEPIT, wParam, lParam);
oldVal = infoPtr->CurVal; oldVal = infoPtr->CurVal;
infoPtr->CurVal += infoPtr->Step; infoPtr->CurVal += infoPtr->Step;
if(infoPtr->CurVal > infoPtr->MaxVal) if(infoPtr->CurVal > infoPtr->MaxVal)
infoPtr->CurVal = infoPtr->MinVal; infoPtr->CurVal = infoPtr->MinVal;
@ -335,7 +335,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
case PBM_SETRANGE32: case PBM_SETRANGE32:
return PROGRESS_SetRange (infoPtr, (int)wParam, (int)lParam); return PROGRESS_SetRange (infoPtr, (int)wParam, (int)lParam);
case PBM_GETRANGE: case PBM_GETRANGE:
if (lParam) { if (lParam) {
((PPBRANGE)lParam)->iLow = infoPtr->MinVal; ((PPBRANGE)lParam)->iLow = infoPtr->MinVal;
@ -359,11 +359,11 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
return 0; return 0;
default: default:
if (message >= WM_USER) if (message >= WM_USER)
ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam ); ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam );
return DefWindowProcW( hwnd, message, wParam, lParam ); return DefWindowProcW( hwnd, message, wParam, lParam );
} }
} }

View File

@ -88,7 +88,7 @@ typedef struct
* Defines and global variables * Defines and global variables
*/ */
const WCHAR PropSheetInfoStr[] = const WCHAR PropSheetInfoStr[] =
{'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 }; {'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 };
#define MAX_CAPTION_LENGTH 255 #define MAX_CAPTION_LENGTH 255
@ -442,7 +442,7 @@ BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
default: default:
p += lstrlenW( (LPCWSTR)p ) + 1; p += lstrlenW( (LPCWSTR)p ) + 1;
break; break;
} }
/* class */ /* class */
switch ((WORD)*p) switch ((WORD)*p)
@ -491,14 +491,14 @@ BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
/* /*
* Build the image list for icons * Build the image list for icons
*/ */
if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID)) if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID))
{ {
HICON hIcon; HICON hIcon;
int icon_cx = GetSystemMetrics(SM_CXSMICON); int icon_cx = GetSystemMetrics(SM_CXSMICON);
int icon_cy = GetSystemMetrics(SM_CYSMICON); int icon_cy = GetSystemMetrics(SM_CYSMICON);
if (dwFlags & PSP_USEICONID) if (dwFlags & PSP_USEICONID)
hIcon = LoadImageW(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON, hIcon = LoadImageW(lppsp->hInstance, lppsp->u2.pszIcon, IMAGE_ICON,
icon_cx, icon_cy, LR_DEFAULTCOLOR); icon_cx, icon_cy, LR_DEFAULTCOLOR);
else else
hIcon = lppsp->u2.hIcon; hIcon = lppsp->u2.hIcon;
@ -577,7 +577,7 @@ BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
/****************************************************************************** /******************************************************************************
* PROPSHEET_SizeMismatch * PROPSHEET_SizeMismatch
* *
* Verify that the tab control and the "largest" property sheet page dlg. template * Verify that the tab control and the "largest" property sheet page dlg. template
* match in size. * match in size.
*/ */
@ -701,7 +701,7 @@ static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo)
rc.bottom = rc.top + tabRect.bottom - tabRect.top; rc.bottom = rc.top + tabRect.bottom - tabRect.top;
psInfo->height = MulDiv((rc.bottom - rc.top),8,units.top); psInfo->height = MulDiv((rc.bottom - rc.top),8,units.top);
} }
if ((rc.right - rc.left) < (tabRect.right - tabRect.left)) if ((rc.right - rc.left) < (tabRect.right - tabRect.left))
{ {
rc.right = rc.left + tabRect.right - tabRect.left; rc.right = rc.left + tabRect.right - tabRect.left;
@ -778,7 +778,7 @@ static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo)
rc.bottom = rc.top + tabRect.bottom - tabRect.top; rc.bottom = rc.top + tabRect.bottom - tabRect.top;
psInfo->height = MulDiv((rc.bottom - rc.top), 8, units.top); psInfo->height = MulDiv((rc.bottom - rc.top), 8, units.top);
} }
if ((rc.right - rc.left) < (tabRect.right - tabRect.left)) if ((rc.right - rc.left) < (tabRect.right - tabRect.left))
{ {
rc.right = rc.left + tabRect.right - tabRect.left; rc.right = rc.left + tabRect.right - tabRect.left;
@ -828,10 +828,10 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
/* /*
* Get the size of the property sheet. * Get the size of the property sheet.
*/ */
GetClientRect(hwndParent, &rcSheet); GetClientRect(hwndParent, &rcSheet);
/* /*
* All buttons will be at this y coordinate. * All buttons will be at this y coordinate.
*/ */
y = rcSheet.bottom - (padding.y + buttonHeight); y = rcSheet.bottom - (padding.y + buttonHeight);
@ -867,7 +867,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
x = rcSheet.right - ((padding.x + buttonWidth) * 2); x = rcSheet.right - ((padding.x + buttonWidth) * 2);
else else
x = rcSheet.right - (padding.x + buttonWidth); x = rcSheet.right - (padding.x + buttonWidth);
SetWindowPos(hwndButton, 0, x, y, 0, 0, SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
@ -884,7 +884,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
if (psInfo->hasHelp) if (psInfo->hasHelp)
{ {
x = rcSheet.right - (padding.x + buttonWidth); x = rcSheet.right - (padding.x + buttonWidth);
SetWindowPos(hwndButton, 0, x, y, 0, 0, SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
} }
@ -1063,7 +1063,7 @@ static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheet
idButton = IDCANCEL; idButton = IDCANCEL;
} }
} }
hwndControl = GetDlgItem(hwndDlg, idButton); hwndControl = GetDlgItem(hwndDlg, idButton);
GetWindowRect(hwndControl, &rc); GetWindowRect(hwndControl, &rc);
@ -1325,7 +1325,7 @@ static BOOL PROPSHEET_Back(HWND hwndDlg)
psn.hdr.hwndFrom = hwndDlg; psn.hdr.hwndFrom = hwndDlg;
psn.hdr.idFrom = 0; psn.hdr.idFrom = 0;
psn.lParam = 0; psn.lParam = 0;
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
result = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); result = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
@ -1364,7 +1364,7 @@ static BOOL PROPSHEET_Next(HWND hwndDlg)
psn.hdr.hwndFrom = hwndDlg; psn.hdr.hwndFrom = hwndDlg;
psn.hdr.idFrom = 0; psn.hdr.idFrom = 0;
psn.lParam = 0; psn.lParam = 0;
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
@ -1403,7 +1403,7 @@ static BOOL PROPSHEET_Finish(HWND hwndDlg)
psn.hdr.hwndFrom = hwndDlg; psn.hdr.hwndFrom = hwndDlg;
psn.hdr.idFrom = 0; psn.hdr.idFrom = 0;
psn.lParam = 0; psn.lParam = 0;
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
@ -1440,7 +1440,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
psn.hdr.hwndFrom = hwndDlg; psn.hdr.hwndFrom = hwndDlg;
psn.hdr.idFrom = 0; psn.hdr.idFrom = 0;
psn.lParam = 0; psn.lParam = 0;
/* /*
* Send PSN_KILLACTIVE to the current page. * Send PSN_KILLACTIVE to the current page.
@ -1457,7 +1457,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
*/ */
psn.hdr.code = PSN_APPLY; psn.hdr.code = PSN_APPLY;
psn.lParam = lParam; psn.lParam = lParam;
for (i = 0; i < psInfo->nPages; i++) for (i = 0; i < psInfo->nPages; i++)
{ {
hwndPage = psInfo->proppage[i].hwndPage; hwndPage = psInfo->proppage[i].hwndPage;
@ -1504,13 +1504,13 @@ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam)
psn.hdr.hwndFrom = hwndDlg; psn.hdr.hwndFrom = hwndDlg;
psn.hdr.idFrom = 0; psn.hdr.idFrom = 0;
psn.lParam = 0; psn.lParam = 0;
if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
return; return;
psn.hdr.code = PSN_RESET; psn.hdr.code = PSN_RESET;
psn.lParam = lParam; psn.lParam = lParam;
for (i = 0; i < psInfo->nPages; i++) for (i = 0; i < psInfo->nPages; i++)
{ {
hwndPage = psInfo->proppage[i].hwndPage; hwndPage = psInfo->proppage[i].hwndPage;
@ -1547,7 +1547,7 @@ static void PROPSHEET_Help(HWND hwndDlg)
psn.hdr.hwndFrom = hwndDlg; psn.hdr.hwndFrom = hwndDlg;
psn.hdr.idFrom = 0; psn.hdr.idFrom = 0;
psn.lParam = 0; psn.lParam = 0;
SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
} }
@ -1649,7 +1649,7 @@ static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID)
/************************************************************************* /*************************************************************************
* BOOL PROPSHEET_CanSetCurSel [Internal] * BOOL PROPSHEET_CanSetCurSel [Internal]
* *
* Test whether the current page can be changed by sending a PSN_KILLACTIVE * Test whether the current page can be changed by sending a PSN_KILLACTIVE
* *
@ -1778,7 +1778,7 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
if(HIWORD(lpszText)) if(HIWORD(lpszText))
{ {
WCHAR szTitle[256]; WCHAR szTitle[256];
MultiByteToWideChar(CP_ACP, 0, lpszText, -1, MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
szTitle, sizeof szTitle); szTitle, sizeof szTitle);
PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle); PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle);
} }
@ -1798,7 +1798,7 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
TRACE("'%s' (style %08lx)\n", debugstr_w(lpszText), dwStyle); TRACE("'%s' (style %08lx)\n", debugstr_w(lpszText), dwStyle);
if (HIWORD(lpszText) == 0) { if (HIWORD(lpszText) == 0) {
if (!LoadStringW(psInfo->ppshheader.hInstance, if (!LoadStringW(psInfo->ppshheader.hInstance,
LOWORD(lpszText), szTitle, sizeof(szTitle)-sizeof(WCHAR))) LOWORD(lpszText), szTitle, sizeof(szTitle)-sizeof(WCHAR)))
return; return;
lpszText = szTitle; lpszText = szTitle;
@ -2020,14 +2020,14 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
DestroyPropertySheetPage(psInfo->proppage[index].hpage); DestroyPropertySheetPage(psInfo->proppage[index].hpage);
} }
/* Remove the tab */ /* Remove the tab */
SendMessageW(hwndTabControl, TCM_DELETEITEM, index, 0); SendMessageW(hwndTabControl, TCM_DELETEITEM, index, 0);
psInfo->nPages--; psInfo->nPages--;
psInfo->proppage = COMCTL32_Alloc(sizeof(PropPageInfo) * psInfo->nPages); psInfo->proppage = COMCTL32_Alloc(sizeof(PropPageInfo) * psInfo->nPages);
if (index > 0) if (index > 0)
memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo)); memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo));
if (index < psInfo->nPages) if (index < psInfo->nPages)
@ -2256,16 +2256,16 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) && HIWORD( ppsp->u.pszTemplate ) ) if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) && HIWORD( ppsp->u.pszTemplate ) )
{ {
PROPSHEET_AtoW(&ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate); PROPSHEET_AtoW(&ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate);
} }
if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) ) if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
{ {
PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon); PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon);
} }
if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle )) if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle ))
{ {
PROPSHEET_AtoW(&ppsp->pszTitle, lpPropSheetPage->pszTitle); PROPSHEET_AtoW(&ppsp->pszTitle, lpPropSheetPage->pszTitle);
} }
else if ( !(ppsp->dwFlags & PSP_USETITLE) ) else if ( !(ppsp->dwFlags & PSP_USETITLE) )
ppsp->pszTitle = NULL; ppsp->pszTitle = NULL;
@ -2455,7 +2455,7 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID)
BOOL WINAPI BOOL WINAPI
PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n",
hwnd, uMsg, wParam, lParam); hwnd, uMsg, wParam, lParam);
switch (uMsg) switch (uMsg)
@ -2471,8 +2471,8 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SetPropW(hwnd, PropSheetInfoStr, (HANDLE)psInfo); SetPropW(hwnd, PropSheetInfoStr, (HANDLE)psInfo);
/* /*
* psInfo->hwnd is not being used by WINE code - it exists * psInfo->hwnd is not being used by WINE code - it exists
* for compatibility with "real" Windoze. The same about * for compatibility with "real" Windoze. The same about
* SetWindowLong - WINE is only using the PropSheetInfoStr * SetWindowLong - WINE is only using the PropSheetInfoStr
* property. * property.
*/ */
@ -2500,7 +2500,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendMessageW(hwnd, WM_SETICON, 0, hIcon); SendMessageW(hwnd, WM_SETICON, 0, hIcon);
} }
if (psInfo->ppshheader.dwFlags & PSH_USEHICON) if (psInfo->ppshheader.dwFlags & PSH_USEHICON)
SendMessageW(hwnd, WM_SETICON, 0, psInfo->ppshheader.u.hIcon); SendMessageW(hwnd, WM_SETICON, 0, psInfo->ppshheader.u.hIcon);
@ -2527,14 +2527,14 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
} }
if (psInfo->useCallback) if (psInfo->useCallback)
(*(psInfo->ppshheader.pfnCallback))(hwnd, (*(psInfo->ppshheader.pfnCallback))(hwnd,
PSCB_INITIALIZED, (LPARAM)0); PSCB_INITIALIZED, (LPARAM)0);
idx = psInfo->active_page; idx = psInfo->active_page;
ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[idx].hpage; ppshpage = (LPCPROPSHEETPAGEW)psInfo->proppage[idx].hpage;
psInfo->active_page = -1; psInfo->active_page = -1;
PROPSHEET_SetCurSel(hwnd, idx, 1, psInfo->proppage[idx].hpage); PROPSHEET_SetCurSel(hwnd, idx, 1, psInfo->proppage[idx].hpage);
/* doing TCM_SETCURSEL seems to be needed even in case of PSH_WIZARD, /* doing TCM_SETCURSEL seems to be needed even in case of PSH_WIZARD,
@ -2547,7 +2547,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WCHAR szText[256]; WCHAR szText[256];
if (LoadStringW(psInfo->ppshheader.hInstance, if (LoadStringW(psInfo->ppshheader.hInstance,
(UINT)psInfo->ppshheader.pszCaption, szText, 255)) (UINT)psInfo->ppshheader.pszCaption, szText, 255))
PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags, szText); PROPSHEET_SetTitleW(hwnd, psInfo->ppshheader.dwFlags, szText);
} }
@ -2649,7 +2649,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
EnableWindow(hwndCancel, FALSE); EnableWindow(hwndCancel, FALSE);
if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf))) if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)))
SetWindowTextW(hwndOK, buf); SetWindowTextW(hwndOK, buf);
return FALSE; return FALSE;
} }
@ -2664,7 +2664,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case PSM_REBOOTSYSTEM: case PSM_REBOOTSYSTEM:
{ {
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
PropSheetInfoStr); PropSheetInfoStr);
psInfo->rebootSystem = TRUE; psInfo->rebootSystem = TRUE;
@ -2674,7 +2674,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case PSM_SETTITLEA: case PSM_SETTITLEA:
PROPSHEET_SetTitleA(hwnd, (DWORD) wParam, (LPCSTR) lParam); PROPSHEET_SetTitleA(hwnd, (DWORD) wParam, (LPCSTR) lParam);
return TRUE; return TRUE;
case PSM_SETTITLEW: case PSM_SETTITLEW:
PROPSHEET_SetTitleW(hwnd, (DWORD) wParam, (LPCWSTR) lParam); PROPSHEET_SetTitleW(hwnd, (DWORD) wParam, (LPCWSTR) lParam);
return TRUE; return TRUE;
@ -2730,7 +2730,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
case PSM_SETFINISHTEXTA: case PSM_SETFINISHTEXTA:
PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam); PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam);
return TRUE; return TRUE;
case PSM_SETWIZBUTTONS: case PSM_SETWIZBUTTONS:
@ -2742,13 +2742,13 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
case PSM_SETFINISHTEXTW: case PSM_SETFINISHTEXTW:
PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam); PROPSHEET_SetFinishTextW(hwnd, (LPCWSTR) lParam);
return FALSE; return FALSE;
default: default:
return FALSE; return FALSE;
} }
return FALSE; return FALSE;
} }

View File

@ -46,7 +46,7 @@
* TODO: * TODO:
* - vertical placement * - vertical placement
* - ComboBox and ComboBoxEx placement * - ComboBox and ComboBoxEx placement
* - center image * - center image
* - Layout code. * - Layout code.
* - Display code. * - Display code.
* - Some messages. * - Some messages.
@ -55,11 +55,11 @@
* Changes Guy Albertelli <galberte@neo.lrun.com> * Changes Guy Albertelli <galberte@neo.lrun.com>
* rev 2,3,4 * rev 2,3,4
* - Implement initial version of row grouping, row separators, * - Implement initial version of row grouping, row separators,
* text and background colors. Support additional messages. * text and background colors. Support additional messages.
* Support RBBS_BREAK. Implement ERASEBKGND and improve painting. * Support RBBS_BREAK. Implement ERASEBKGND and improve painting.
* rev 5 * rev 5
* - implement support for dragging Gripper left or right in a row. Supports * - implement support for dragging Gripper left or right in a row. Supports
* WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support * WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support
* RBS_BANDBORDERS. * RBS_BANDBORDERS.
* rev 6 * rev 6
* - Fix or implement notifications for RBN_HEIGHTCHANGE, RBN_CHILDSIZE. * - Fix or implement notifications for RBN_HEIGHTCHANGE, RBN_CHILDSIZE.
@ -68,7 +68,7 @@
* *
* rev 7 * rev 7
* - Fix algorithm for _Layout and _AdjustBand. * - Fix algorithm for _Layout and _AdjustBand.
* - Fix or implement RBN_ENDDRAG, RB_MOVEBAND, WM_SETREDRAW, * - Fix or implement RBN_ENDDRAG, RB_MOVEBAND, WM_SETREDRAW,
* WM_STYLECHANGED, RB_MINIMIZEBAND, RBBS_VARIABLEHEIGHT, RBS_VARHEIGHT, * WM_STYLECHANGED, RB_MINIMIZEBAND, RBBS_VARIABLEHEIGHT, RBS_VARHEIGHT,
* RBBS_HIDDEN, WM_NOTIFYFORMAT, NM_NCHITTEST, WM_SETREDRAW, RBS_AUTOSIZE, * RBBS_HIDDEN, WM_NOTIFYFORMAT, NM_NCHITTEST, WM_SETREDRAW, RBS_AUTOSIZE,
* WM_SETFONT, RBS_BORDERS * WM_SETFONT, RBS_BORDERS
@ -87,7 +87,7 @@
* 7. Invalidate window rectangles after SetBandInfo, InsertBand, ShowBand * 7. Invalidate window rectangles after SetBandInfo, InsertBand, ShowBand
* so that repainting is correct. * so that repainting is correct.
* 8. Implement RB_MAXIMIZEBAND for the "ideal=TRUE" case. * 8. Implement RB_MAXIMIZEBAND for the "ideal=TRUE" case.
* 9. Implement item custom draw notifications partially. Only done for * 9. Implement item custom draw notifications partially. Only done for
* ITEMPREPAINT and ITEMPOSTPAINT. (Used by IE4 for "Favorites" frame * ITEMPREPAINT and ITEMPOSTPAINT. (Used by IE4 for "Favorites" frame
* to draw the word "Favorites"). * to draw the word "Favorites").
* rev 8a * rev 8a
@ -96,7 +96,7 @@
* number (0) to indicate *no* band. * number (0) to indicate *no* band.
* 12. Fix CCS_VERT errors in _ForceResize, _NCCalcSize, and _NCPaint. * 12. Fix CCS_VERT errors in _ForceResize, _NCCalcSize, and _NCPaint.
* 13. Support some special cases of CCS_TOP (and therefore CCS_LEFT), * 13. Support some special cases of CCS_TOP (and therefore CCS_LEFT),
* CCS_BOTTOM (and therefore CCS_RIGHT) and CCS_NOPARENTALIGN. Not * CCS_BOTTOM (and therefore CCS_RIGHT) and CCS_NOPARENTALIGN. Not
* at all sure whether this is all cases. * at all sure whether this is all cases.
* 14. Handle returned value for the RBN_CHILDSIZE notify. * 14. Handle returned value for the RBN_CHILDSIZE notify.
* 15. Implement RBBS_CHILDEDGE, and set each bands "offChild" at _Layout * 15. Implement RBBS_CHILDEDGE, and set each bands "offChild" at _Layout
@ -121,10 +121,10 @@
* 2. Following still not handled: RBBS_FIXEDBMP, * 2. Following still not handled: RBBS_FIXEDBMP,
* RBBS_USECHEVRON, CCS_NORESIZE, * RBBS_USECHEVRON, CCS_NORESIZE,
* CCS_NOMOVEX, CCS_NOMOVEY * CCS_NOMOVEX, CCS_NOMOVEY
* 3. Following are only partially handled: * 3. Following are only partially handled:
* RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT * RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT
* 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT) * 5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT)
* to set the size of the separator width (the value SEP_WIDTH_SIZE * to set the size of the separator width (the value SEP_WIDTH_SIZE
* in here). Should be fixed!! * in here). Should be fixed!!
* 6. The following messages are not implemented: * 6. The following messages are not implemented:
* RB_BEGINDRAG, RB_DRAGMOVE, RB_ENDDRAG, RB_GETCOLORSCHEME, * RB_BEGINDRAG, RB_DRAGMOVE, RB_ENDDRAG, RB_GETCOLORSCHEME,
@ -236,7 +236,7 @@ typedef struct
BOOL bUnicode; /* TRUE if this window is W type */ BOOL bUnicode; /* TRUE if this window is W type */
BOOL NtfUnicode; /* TRUE if parent wants notify in W format */ BOOL NtfUnicode; /* TRUE if parent wants notify in W format */
BOOL DoRedraw; /* TRUE to acutally draw bands */ BOOL DoRedraw; /* TRUE to acutally draw bands */
UINT fStatus; /* Status flags (see below) */ UINT fStatus; /* Status flags (see below) */
HCURSOR hcurArrow; /* handle to the arrow cursor */ HCURSOR hcurArrow; /* handle to the arrow cursor */
HCURSOR hcurHorz; /* handle to the EW cursor */ HCURSOR hcurHorz; /* handle to the EW cursor */
HCURSOR hcurVert; /* handle to the NS cursor */ HCURSOR hcurVert; /* handle to the NS cursor */
@ -400,7 +400,7 @@ REBAR_DumpBandInfo( LPREBARBANDINFOA pB)
{ {
if( !TRACE_ON(rebar) ) return; if( !TRACE_ON(rebar) ) return;
TRACE("band info: ID=%u, size=%u, child=%04x, clrF=0x%06lx, clrB=0x%06lx\n", TRACE("band info: ID=%u, size=%u, child=%04x, clrF=0x%06lx, clrB=0x%06lx\n",
pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack); pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack);
TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask)); TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask));
if (pB->fMask & RBBIM_STYLE) if (pB->fMask & RBBIM_STYLE)
TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle)); TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
@ -418,7 +418,7 @@ REBAR_DumpBandInfo( LPREBARBANDINFOA pB)
} }
if (pB->fMask & RBBIM_CHILDSIZE) if (pB->fMask & RBBIM_CHILDSIZE)
TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n", TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
pB->cxMinChild, pB->cxMinChild,
pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral); pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
} }
@ -430,7 +430,7 @@ REBAR_DumpBand (REBAR_INFO *iP)
if(! TRACE_ON(rebar) ) return; if(! TRACE_ON(rebar) ) return;
TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n",
iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows, iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
iP->calcSize.cx, iP->calcSize.cy); iP->calcSize.cx, iP->calcSize.cy);
TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n", TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n",
@ -446,9 +446,9 @@ REBAR_DumpBand (REBAR_INFO *iP)
i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack); i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);
TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask)); TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
if (pB->fMask & RBBIM_STYLE) if (pB->fMask & RBBIM_STYLE)
TRACE("band # %u: style=0x%08x (%s)\n", TRACE("band # %u: style=0x%08x (%s)\n",
i, pB->fStyle, REBAR_FmtStyle(pB->fStyle)); i, pB->fStyle, REBAR_FmtStyle(pB->fStyle));
TRACE("band # %u: uMinH=%u xHeader=%u", TRACE("band # %u: uMinH=%u xHeader=%u",
i, pB->uMinHeight, pB->cxHeader); i, pB->uMinHeight, pB->cxHeader);
if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) { if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {
if (pB->fMask & RBBIM_SIZE) if (pB->fMask & RBBIM_SIZE)
@ -604,7 +604,7 @@ REBAR_DrawBand (HDC hdc, REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
DT_CENTER | DT_VCENTER | DT_SINGLELINE); DT_CENTER | DT_VCENTER | DT_SINGLELINE);
if (oldBkMode != TRANSPARENT) if (oldBkMode != TRANSPARENT)
SetBkMode (hdc, oldBkMode); SetBkMode (hdc, oldBkMode);
if (lpBand->clrFore != CLR_NONE) if (lpBand->clrFore != CLR_NONE)
SetTextColor (hdc, oldcolor); SetTextColor (hdc, oldcolor);
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
} }
@ -635,10 +635,10 @@ REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc)
for (i = 0; i < infoPtr->uNumBands; i++) { for (i = 0; i < infoPtr->uNumBands; i++) {
lpBand = &infoPtr->bands[i]; lpBand = &infoPtr->bands[i];
if (HIDDENBAND(lpBand)) continue; if (HIDDENBAND(lpBand)) continue;
/* now draw the band */ /* now draw the band */
TRACE("[%04x] drawing band %i, flags=%08x\n", TRACE("[%04x] drawing band %i, flags=%08x\n",
infoPtr->hwndSelf, i, lpBand->fDraw); infoPtr->hwndSelf, i, lpBand->fDraw);
REBAR_DrawBand (hdc, infoPtr, lpBand); REBAR_DrawBand (hdc, infoPtr, lpBand);
@ -649,7 +649,7 @@ REBAR_Refresh (REBAR_INFO *infoPtr, HDC hdc)
static void static void
REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend, REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
INT mcy) INT mcy)
/* Function: */ /* Function: */
/* Cycle through bands in row and fix height of each band. */ /* Cycle through bands in row and fix height of each band. */
/* Also determine whether each band has changed. */ /* Also determine whether each band has changed. */
/* On entry: */ /* On entry: */
@ -718,7 +718,7 @@ REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
/* a. inflate band till either all extra space used */ /* a. inflate band till either all extra space used */
/* or band's ->ccx reached. */ /* or band's ->ccx reached. */
/* If any band modified, add any space left to last band */ /* If any band modified, add any space left to last band */
/* adjusted. */ /* adjusted. */
/* */ /* */
/* ****************************************************** */ /* ****************************************************** */
lpBand = &infoPtr->bands[rowend]; lpBand = &infoPtr->bands[rowend];
@ -771,7 +771,7 @@ REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
} }
if ((x >= maxx) || (last_adjusted != -1)) { if ((x >= maxx) || (last_adjusted != -1)) {
if (x > maxx) { if (x > maxx) {
ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n", ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n",
x, maxx, rowstart, rowend); x, maxx, rowstart, rowend);
} }
/* done, so spread extra space */ /* done, so spread extra space */
@ -841,7 +841,7 @@ REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
} }
if (x >= maxx) { if (x >= maxx) {
if (x > maxx) { if (x > maxx) {
ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n", ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n",
x, maxx, rowstart, rowend); x, maxx, rowstart, rowend);
} }
/* done, so spread extra space */ /* done, so spread extra space */
@ -909,7 +909,7 @@ REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
/* if no gripper but either image or text, then leave space */ /* if no gripper but either image or text, then leave space */
xoff = REBAR_ALWAYS_SPACE; xoff = REBAR_ALWAYS_SPACE;
SetRect (&lpBand->rcCapImage, SetRect (&lpBand->rcCapImage,
lpBand->rcBand.left+xoff, lpBand->rcBand.top, lpBand->rcBand.left+xoff, lpBand->rcBand.top,
lpBand->rcBand.left+xoff, lpBand->rcBand.bottom); lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);
} }
@ -924,7 +924,7 @@ REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
SetRect (&lpBand->rcCapText, SetRect (&lpBand->rcCapText,
lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1, lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,
lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1); lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
/* update band height /* update band height
if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) { if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
lpBand->uMinHeight = infoPtr->imageSize.cy + 2; lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight; lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
@ -939,7 +939,7 @@ REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
/* text is visible */ /* text is visible */
if (lpBand->fStatus & HAS_TEXT) { if (lpBand->fStatus & HAS_TEXT) {
lpBand->fDraw |= DRAW_TEXT; lpBand->fDraw |= DRAW_TEXT;
lpBand->rcCapText.right = max(lpBand->rcCapText.left, lpBand->rcCapText.right = max(lpBand->rcCapText.left,
lpBand->rcCapText.right-REBAR_POST_TEXT); lpBand->rcCapText.right-REBAR_POST_TEXT);
} }
@ -958,7 +958,7 @@ REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
} }
/* flag if notify required and invalidate rectangle */ /* flag if notify required and invalidate rectangle */
if (notify && if (notify &&
((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
(oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
TRACE("Child rectangle changed for band %u\n", i); TRACE("Child rectangle changed for band %u\n", i);
@ -970,9 +970,9 @@ REBAR_CalcHorzBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
} }
if (lpBand->fDraw & NTF_INVALIDATE) { if (lpBand->fDraw & NTF_INVALIDATE) {
TRACE("invalidating (%d,%d)-(%d,%d)\n", TRACE("invalidating (%d,%d)-(%d,%d)\n",
lpBand->rcBand.left, lpBand->rcBand.left,
lpBand->rcBand.top, lpBand->rcBand.top,
lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0), lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0),
lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0)); lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0));
lpBand->fDraw &= ~NTF_INVALIDATE; lpBand->fDraw &= ~NTF_INVALIDATE;
work = lpBand->rcBand; work = lpBand->rcBand;
@ -1046,7 +1046,7 @@ REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
/* if no gripper but either image or text, then leave space */ /* if no gripper but either image or text, then leave space */
xoff = REBAR_ALWAYS_SPACE; xoff = REBAR_ALWAYS_SPACE;
/* initialize Caption image rectangle */ /* initialize Caption image rectangle */
SetRect (&lpBand->rcCapImage, SetRect (&lpBand->rcCapImage,
lpBand->rcBand.left, lpBand->rcBand.top+xoff, lpBand->rcBand.left, lpBand->rcBand.top+xoff,
lpBand->rcBand.right, lpBand->rcBand.top+xoff); lpBand->rcBand.right, lpBand->rcBand.top+xoff);
} }
@ -1059,7 +1059,7 @@ REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
lpBand->rcCapImage.bottom += infoPtr->imageSize.cy; lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;
/* set initial caption text rectangle */ /* set initial caption text rectangle */
SetRect (&lpBand->rcCapText, SetRect (&lpBand->rcCapText,
lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE, lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,
lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
/* update band height * /* update band height *
@ -1070,7 +1070,7 @@ REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
} }
else { else {
/* set initial caption text rectangle */ /* set initial caption text rectangle */
SetRect (&lpBand->rcCapText, SetRect (&lpBand->rcCapText,
lpBand->rcBand.left, lpBand->rcCapImage.bottom, lpBand->rcBand.left, lpBand->rcCapImage.bottom,
lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader); lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
} }
@ -1097,7 +1097,7 @@ REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
} }
/* flag if notify required and invalidate rectangle */ /* flag if notify required and invalidate rectangle */
if (notify && if (notify &&
((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) || ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
(oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) { (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
TRACE("Child rectangle changed for band %u\n", i); TRACE("Child rectangle changed for band %u\n", i);
@ -1109,9 +1109,9 @@ REBAR_CalcVertBand (REBAR_INFO *infoPtr, UINT rstart, UINT rend, BOOL notify)
} }
if (lpBand->fDraw & NTF_INVALIDATE) { if (lpBand->fDraw & NTF_INVALIDATE) {
TRACE("invalidating (%d,%d)-(%d,%d)\n", TRACE("invalidating (%d,%d)-(%d,%d)\n",
lpBand->rcBand.left, lpBand->rcBand.left,
lpBand->rcBand.top, lpBand->rcBand.top,
lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0), lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0),
lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0)); lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0));
lpBand->fDraw &= ~NTF_INVALIDATE; lpBand->fDraw &= ~NTF_INVALIDATE;
work = lpBand->rcBand; work = lpBand->rcBand;
@ -1258,7 +1258,7 @@ REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus)
rbcz.wID = lpBand->wID; rbcz.wID = lpBand->wID;
rbcz.rcChild = lpBand->rcChild; rbcz.rcChild = lpBand->rcChild;
rbcz.rcBand = lpBand->rcBand; rbcz.rcBand = lpBand->rcBand;
if (infoPtr->dwStyle & CCS_VERT) if (infoPtr->dwStyle & CCS_VERT)
rbcz.rcBand.top += lpBand->cxHeader; rbcz.rcBand.top += lpBand->cxHeader;
else else
rbcz.rcBand.left += lpBand->cxHeader; rbcz.rcBand.left += lpBand->cxHeader;
@ -1400,7 +1400,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
} }
/* save height of original control */ /* save height of original control */
if (infoPtr->dwStyle & CCS_VERT) if (infoPtr->dwStyle & CCS_VERT)
origheight = infoPtr->calcSize.cx; origheight = infoPtr->calcSize.cx;
else else
origheight = infoPtr->calcSize.cy; origheight = infoPtr->calcSize.cy;
@ -1439,10 +1439,10 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
lpBand->offChild.cy = ((lpBand->fStyle & RBBS_CHILDEDGE) ? 2 : 0); lpBand->offChild.cy = ((lpBand->fStyle & RBBS_CHILDEDGE) ? 2 : 0);
/* separator from previous band */ /* separator from previous band */
cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH; cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH;
/* Header: includes gripper, text, image */ /* Header: includes gripper, text, image */
cx = lpBand->cxHeader; cx = lpBand->cxHeader;
if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx; if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx;
if (infoPtr->dwStyle & CCS_VERT) if (infoPtr->dwStyle & CCS_VERT)
@ -1484,7 +1484,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
cntonrow = 0; cntonrow = 0;
} }
if (mcy < lpBand->lcy + REBARSPACE(lpBand)) if (mcy < lpBand->lcy + REBARSPACE(lpBand))
mcy = lpBand->lcy + REBARSPACE(lpBand); mcy = lpBand->lcy + REBARSPACE(lpBand);
/* if boundary rect specified then limit mcy */ /* if boundary rect specified then limit mcy */
@ -1513,7 +1513,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
rightx = clientcx; rightx = clientcx;
bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx; bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx;
lpBand->rcBand.left = x; lpBand->rcBand.left = x;
lpBand->rcBand.right = x + min(mcy, lpBand->rcBand.right = x + min(mcy,
lpBand->lcy+REBARSPACE(lpBand)); lpBand->lcy+REBARSPACE(lpBand));
lpBand->rcBand.top = min(bottomy, y + cxsep); lpBand->rcBand.top = min(bottomy, y + cxsep);
lpBand->rcBand.bottom = bottomy; lpBand->rcBand.bottom = bottomy;
@ -1527,7 +1527,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
lpBand->rcBand.left = min(rightx, x + cxsep); lpBand->rcBand.left = min(rightx, x + cxsep);
lpBand->rcBand.right = rightx; lpBand->rcBand.right = rightx;
lpBand->rcBand.top = y; lpBand->rcBand.top = y;
lpBand->rcBand.bottom = y + min(mcy, lpBand->rcBand.bottom = y + min(mcy,
lpBand->lcy+REBARSPACE(lpBand)); lpBand->lcy+REBARSPACE(lpBand));
lpBand->uMinHeight = lpBand->lcy; lpBand->uMinHeight = lpBand->lcy;
x = rightx; x = rightx;
@ -1615,7 +1615,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
REBAR_BAND *prev, *current, *walk; REBAR_BAND *prev, *current, *walk;
/* FIXME: problem # 2 */ /* FIXME: problem # 2 */
if (((infoPtr->dwStyle & CCS_VERT) ? if (((infoPtr->dwStyle & CCS_VERT) ?
#if PROBLEM2 #if PROBLEM2
(x < adjcx) : (y < adjcy) (x < adjcx) : (y < adjcy)
#else #else
@ -1697,7 +1697,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
walk->rcBand.bottom += adj_rh; walk->rcBand.bottom += adj_rh;
} }
} }
if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy)) if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy))
break; /* all done */ break; /* all done */
} }
} }
@ -1761,7 +1761,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
lpBand = &infoPtr->bands[iband]; lpBand = &infoPtr->bands[iband];
if(HIDDENBAND(lpBand)) continue; if(HIDDENBAND(lpBand)) continue;
if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue; if (lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
if (((INT)lpBand->cyMaxChild < 1) || if (((INT)lpBand->cyMaxChild < 1) ||
((INT)lpBand->cyIntegral < 1)) { ((INT)lpBand->cyIntegral < 1)) {
if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue; if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;
ERR("P2b band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n", ERR("P2b band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",
@ -1769,9 +1769,9 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
continue; continue;
} }
/* j is now the maximum height/width in the client area */ /* j is now the maximum height/width in the client area */
j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) + j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) +
ircBw(lpBand); ircBw(lpBand);
if (j > lpBand->cyMaxChild + REBARSPACE(lpBand)) if (j > lpBand->cyMaxChild + REBARSPACE(lpBand))
j = lpBand->cyMaxChild + REBARSPACE(lpBand); j = lpBand->cyMaxChild + REBARSPACE(lpBand);
diff -= (j - ircBw(lpBand)); diff -= (j - ircBw(lpBand));
if (infoPtr->dwStyle & CCS_VERT) if (infoPtr->dwStyle & CCS_VERT)
@ -1827,7 +1827,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
p = &infoPtr->rows[i-1]; p = &infoPtr->rows[i-1];
mcy = 0; mcy = 0;
TRACE("P3 processing row %d, starting band %d, ending band %d\n", TRACE("P3 processing row %d, starting band %d, ending band %d\n",
i, p->istartband, p->iendband); i, p->istartband, p->iendband);
/* Find the largest height of the bands in the row */ /* Find the largest height of the bands in the row */
@ -1839,7 +1839,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
} }
REBAR_AdjustBands (infoPtr, p->istartband, p->iendband, REBAR_AdjustBands (infoPtr, p->istartband, p->iendband,
(infoPtr->dwStyle & CCS_VERT) ? (infoPtr->dwStyle & CCS_VERT) ?
clientcy : clientcx, mcy); clientcy : clientcx, mcy);
} }
@ -1849,7 +1849,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
notify); notify);
} }
else { else {
REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands, REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands,
notify); notify);
} }
} }
@ -1875,7 +1875,7 @@ REBAR_Layout (REBAR_INFO *infoPtr, LPRECT lpRect, BOOL notify, BOOL resetclient)
infoPtr->calcSize.cy = y; infoPtr->calcSize.cy = y;
TRACE("horz, notify=%d, y=%d, origheight=%d\n", TRACE("horz, notify=%d, y=%d, origheight=%d\n",
notify, y, origheight); notify, y, origheight);
if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG; if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
} }
REBAR_DumpBand (infoPtr); REBAR_DumpBand (infoPtr);
@ -1942,7 +1942,7 @@ REBAR_ValidateBand (REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
/* calculate gripper rectangle */ /* calculate gripper rectangle */
if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) && if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (nonfixed > 1))) ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (nonfixed > 1)))
) { ) {
lpBand->fStatus |= HAS_GRIPPER; lpBand->fStatus |= HAS_GRIPPER;
@ -2185,7 +2185,7 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC
rect = lpBand->rcBand; rect = lpBand->rcBand;
TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",
(lpBand->clrBack == CLR_NONE) ? "none" : (lpBand->clrBack == CLR_NONE) ? "none" :
((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""), ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""),
GetBkColor(hdc), GetBkColor(hdc),
lpBand->rcBand.left,lpBand->rcBand.top, lpBand->rcBand.left,lpBand->rcBand.top,
@ -2392,7 +2392,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
/* a one to separate each band. */ /* a one to separate each band. */
if (i < ihitBand) if (i < ihitBand)
LHeaderSum += (band->lcx + SEP_WIDTH); LHeaderSum += (band->lcx + SEP_WIDTH);
else else
RHeaderSum += (band->lcx + SEP_WIDTH); RHeaderSum += (band->lcx + SEP_WIDTH);
} }
@ -2425,7 +2425,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
imaxdBand, LHeaderSum, RHeaderSum); imaxdBand, LHeaderSum, RHeaderSum);
REBAR_DumpBand (infoPtr); REBAR_DumpBand (infoPtr);
if (movement < 0) { if (movement < 0) {
/* *** Drag left/up *** */ /* *** Drag left/up *** */
compress = rcBlt(hitBand) - rcBlt(mindBand) - compress = rcBlt(hitBand) - rcBlt(mindBand) -
@ -2442,7 +2442,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
if (i == ihitBand) { if (i == ihitBand) {
LEADJ(band, movement) LEADJ(band, movement)
} }
else else
movement = REBAR_Shrink (infoPtr, band, movement, i); movement = REBAR_Shrink (infoPtr, band, movement, i);
band->ccx = rcBw(band); band->ccx = rcBw(band);
} }
@ -2465,7 +2465,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
first = FALSE; first = FALSE;
READJ(band, movement) READJ(band, movement)
} }
else else
movement = REBAR_Shrink (infoPtr, band, movement, i); movement = REBAR_Shrink (infoPtr, band, movement, i);
band->ccx = rcBw(band); band->ccx = rcBw(band);
} }
@ -2477,7 +2477,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
FALSE); FALSE);
} }
else { else {
REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1, REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1,
FALSE); FALSE);
} }
@ -2485,7 +2485,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, POINTS *ptsmove)
imindBand, imaxdBand); imindBand, imaxdBand);
REBAR_DumpBand (infoPtr); REBAR_DumpBand (infoPtr);
SetRect (&newrect, SetRect (&newrect,
mindBand->rcBand.left, mindBand->rcBand.left,
mindBand->rcBand.top, mindBand->rcBand.top,
maxdBand->rcBand.right, maxdBand->rcBand.right,
@ -2652,7 +2652,7 @@ REBAR_GetBandInfoA (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
lprbbi->lpText, lprbbi->cch, NULL, NULL )) lprbbi->lpText, lprbbi->cch, NULL, NULL ))
lprbbi->lpText[lprbbi->cch-1] = 0; lprbbi->lpText[lprbbi->cch-1] = 0;
} }
else else
*lprbbi->lpText = 0; *lprbbi->lpText = 0;
} }
@ -2734,7 +2734,7 @@ REBAR_GetBandInfoW (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT)) if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT))
lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch); lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
else else
*lprbbi->lpText = 0; *lprbbi->lpText = 0;
} }
@ -2922,7 +2922,7 @@ REBAR_GetToolTips (REBAR_INFO *infoPtr)
inline static LRESULT inline static LRESULT
REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr) REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr)
{ {
TRACE("%s hwnd=0x%x\n", TRACE("%s hwnd=0x%x\n",
infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf); infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
return infoPtr->bUnicode; return infoPtr->bUnicode;
@ -2940,7 +2940,7 @@ REBAR_GetVersion (REBAR_INFO *infoPtr)
static LRESULT static LRESULT
REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
if (!lprbht) if (!lprbht)
return -1; return -1;
@ -3249,7 +3249,7 @@ REBAR_MinimizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
} }
startBand = uBand; startBand = uBand;
endBand = iprevBand; endBand = iprevBand;
SetRect (&newrect, SetRect (&newrect,
lpBand->rcBand.left, lpBand->rcBand.left,
lpBand->rcBand.top, lpBand->rcBand.top,
band->rcBand.right, band->rcBand.right,
@ -3275,7 +3275,7 @@ REBAR_MinimizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
} }
startBand = iprevBand; startBand = iprevBand;
endBand = uBand; endBand = uBand;
SetRect (&newrect, SetRect (&newrect,
band->rcBand.left, band->rcBand.left,
band->rcBand.top, band->rcBand.top,
lpBand->rcBand.right, lpBand->rcBand.right,
@ -3290,7 +3290,7 @@ REBAR_MinimizeBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
FALSE); FALSE);
} }
else { else {
REBAR_CalcHorzBand (infoPtr, startBand, endBand+1, REBAR_CalcHorzBand (infoPtr, startBand, endBand+1,
FALSE); FALSE);
} }
@ -3553,12 +3553,12 @@ REBAR_SetUnicodeFormat (REBAR_INFO *infoPtr, WPARAM wParam)
{ {
BOOL bTemp = infoPtr->bUnicode; BOOL bTemp = infoPtr->bUnicode;
TRACE("to %s hwnd=0x%04x, was %s\n", TRACE("to %s hwnd=0x%04x, was %s\n",
((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf, ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf,
(bTemp) ? "TRUE" : "FALSE"); (bTemp) ? "TRUE" : "FALSE");
infoPtr->bUnicode = (BOOL)wParam; infoPtr->bUnicode = (BOOL)wParam;
return bTemp; return bTemp;
} }
@ -3892,7 +3892,7 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* get font handle for Caption Font */ /* get font handle for Caption Font */
ncm.cbSize = sizeof(NONCLIENTMETRICSA); ncm.cbSize = sizeof(NONCLIENTMETRICSA);
SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, SystemParametersInfoA (SPI_GETNONCLIENTMETRICS,
ncm.cbSize, &ncm, 0); ncm.cbSize, &ncm, 0);
/* if the font is bold, set to normal */ /* if the font is bold, set to normal */
if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) { if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) {
@ -3952,14 +3952,14 @@ REBAR_NCHitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
POINTSTOPOINT(pt, shortpt); POINTSTOPOINT(pt, shortpt);
clpt = pt; clpt = pt;
ScreenToClient (infoPtr->hwndSelf, &clpt); ScreenToClient (infoPtr->hwndSelf, &clpt);
REBAR_InternalHitTest (infoPtr, &clpt, &scrap, REBAR_InternalHitTest (infoPtr, &clpt, &scrap,
(INT *)&nmmouse.dwItemSpec); (INT *)&nmmouse.dwItemSpec);
nmmouse.dwItemData = 0; nmmouse.dwItemData = 0;
nmmouse.pt = clpt; nmmouse.pt = clpt;
nmmouse.dwHitInfo = 0; nmmouse.dwHitInfo = 0;
if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) { if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
TRACE("notify changed return value from %ld to %d\n", TRACE("notify changed return value from %ld to %d\n",
ret, i); ret, i);
ret = (LRESULT) i; ret = (LRESULT) i;
} }
TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y); TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y);
@ -4101,7 +4101,7 @@ REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
* Handles the WM_SETREDRAW message. * Handles the WM_SETREDRAW message.
* *
* Documentation: * Documentation:
* According to testing V4.71 of COMCTL32 returns the * According to testing V4.71 of COMCTL32 returns the
* *previous* status of the redraw flag (either 0 or -1) * *previous* status of the redraw flag (either 0 or -1)
* instead of the MSDN documented value of 0 if handled * instead of the MSDN documented value of 0 if handled
* *
@ -4109,7 +4109,7 @@ REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
BOOL oldredraw = infoPtr->DoRedraw; BOOL oldredraw = infoPtr->DoRedraw;
TRACE("set to %s, fStatus=%08x\n", TRACE("set to %s, fStatus=%08x\n",
(wParam) ? "TRUE" : "FALSE", infoPtr->fStatus); (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus);
infoPtr->DoRedraw = (BOOL) wParam; infoPtr->DoRedraw = (BOOL) wParam;
if (wParam) { if (wParam) {
@ -4152,11 +4152,11 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
TRACE("win rect (%d,%d)-(%d,%d)\n", TRACE("win rect (%d,%d)-(%d,%d)\n",
rcWin.left, rcWin.top, rcWin.right, rcWin.bottom); rcWin.left, rcWin.top, rcWin.right, rcWin.bottom);
if ((lParam == 0) && (rcWin.right-rcWin.left == 0) && if ((lParam == 0) && (rcWin.right-rcWin.left == 0) &&
(rcWin.bottom-rcWin.top == 0)) { (rcWin.bottom-rcWin.top == 0)) {
/* native control seems to do this */ /* native control seems to do this */
GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient); GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient);
TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n", TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n",
rcClient.right, rcClient.bottom); rcClient.right, rcClient.bottom);
} }
else { else {
@ -4170,7 +4170,7 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* do the actual WM_SIZE request */ /* do the actual WM_SIZE request */
GetClientRect (infoPtr->hwndSelf, &rcClient); GetClientRect (infoPtr->hwndSelf, &rcClient);
TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
infoPtr->calcSize.cx, infoPtr->calcSize.cy, infoPtr->calcSize.cx, infoPtr->calcSize.cy,
LOWORD(lParam), HIWORD(lParam), LOWORD(lParam), HIWORD(lParam),
rcClient.right, rcClient.bottom); rcClient.right, rcClient.bottom);
@ -4190,11 +4190,11 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* on a WM_SIZE to zero and current client not zero and AUTOSIZE */ /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */
/* native seems to use the current client rect for the size */ /* native seems to use the current client rect for the size */
infoPtr->fStatus |= BAND_NEEDS_LAYOUT; infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n", TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n",
rcClient.right, rcClient.bottom); rcClient.right, rcClient.bottom);
} }
else { else {
TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n", TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
infoPtr->calcSize.cx, infoPtr->calcSize.cy, infoPtr->calcSize.cx, infoPtr->calcSize.cy,
LOWORD(lParam), HIWORD(lParam), LOWORD(lParam), HIWORD(lParam),
rcClient.right, rcClient.bottom); rcClient.right, rcClient.bottom);
@ -4208,7 +4208,7 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
autosize.fChanged = 0; /* ??? */ autosize.fChanged = 0; /* ??? */
autosize.rcActual = autosize.rcTarget; /* ??? */ autosize.rcActual = autosize.rcTarget; /* ??? */
REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE); REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);
TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n", TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n",
autosize.rcTarget.right, autosize.rcTarget.bottom, lParam); autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);
} }
@ -4246,7 +4246,7 @@ REBAR_WindowPosChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* Save the new origin of this window - used by _ForceResize */ /* Save the new origin of this window - used by _ForceResize */
infoPtr->origin.x = lpwp->x; infoPtr->origin.x = lpwp->x;
infoPtr->origin.y = lpwp->y; infoPtr->origin.y = lpwp->y;
ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED,
wParam, lParam); wParam, lParam);
GetWindowRect(infoPtr->hwndSelf, &rc); GetWindowRect(infoPtr->hwndSelf, &rc);
TRACE("hwnd %08x new pos (%d,%d)-(%d,%d)\n", TRACE("hwnd %08x new pos (%d,%d)-(%d,%d)\n",
@ -4260,7 +4260,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n",
hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
if (!infoPtr && (uMsg != WM_NCCREATE)) if (!infoPtr && (uMsg != WM_NCCREATE))
return DefWindowProcA (hwnd, uMsg, wParam, lParam); return DefWindowProcA (hwnd, uMsg, wParam, lParam);
@ -4462,7 +4462,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* case WM_SYSCOLORCHANGE: supported according to ControlSpy */ /* case WM_SYSCOLORCHANGE: supported according to ControlSpy */
/* "Applications that have brushes using the existing system colors /* "Applications that have brushes using the existing system colors
should delete those brushes and recreate them using the new should delete those brushes and recreate them using the new
system colors." per MSDN */ system colors." per MSDN */
/* case WM_VKEYTOITEM: supported according to ControlSpy */ /* case WM_VKEYTOITEM: supported according to ControlSpy */
@ -4497,7 +4497,7 @@ REBAR_Register (void)
wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0)); wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0));
#endif #endif
wndClass.lpszClassName = REBARCLASSNAMEA; wndClass.lpszClassName = REBARCLASSNAMEA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
mindragx = GetSystemMetrics (SM_CXDRAG); mindragx = GetSystemMetrics (SM_CXDRAG);

View File

@ -124,7 +124,7 @@ STATUSBAR_DrawSizeGrip (HDC hdc, LPRECT lpRect)
} }
static void static void
STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID) STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINFO *infoPtr, int itemID)
{ {
RECT r = part->bound; RECT r = part->bound;
@ -137,7 +137,7 @@ STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINF
border = 0; border = 0;
DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST); DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST);
if (part->style & SBT_OWNERDRAW) if (part->style & SBT_OWNERDRAW)
{ {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
@ -150,14 +150,14 @@ STATUSBAR_DrawPart (HDC hdc, const STATUSWINDOWPART *part, const STATUSWINDOWINF
dis.itemData = (INT)part->text; dis.itemData = (INT)part->text;
SendMessageW (GetParent (infoPtr->Self), WM_DRAWITEM, SendMessageW (GetParent (infoPtr->Self), WM_DRAWITEM,
(WPARAM)dis.CtlID, (LPARAM)&dis); (WPARAM)dis.CtlID, (LPARAM)&dis);
} }
else else
{ {
if (part->hIcon) if (part->hIcon)
{ {
INT cy = r.bottom - r.top; INT cy = r.bottom - r.top;
r.left += 2; r.left += 2;
DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL); DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL);
r.left += cy; r.left += cy;
} }
@ -586,7 +586,7 @@ STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
if (i==oldNumParts) /* Unchanged? no need to redraw! */ if (i==oldNumParts) /* Unchanged? no need to redraw! */
return TRUE; return TRUE;
} }
for (i = 0; i < infoPtr->numParts; i++) for (i = 0; i < infoPtr->numParts; i++)
infoPtr->parts[i].x = parts[i]; infoPtr->parts[i].x = parts[i];
@ -625,13 +625,13 @@ STATUSBAR_SetParts (STATUSWINDOWINFO *infoPtr, INT count, LPINT parts)
static BOOL static BOOL
STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style, STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
LPCWSTR text, BOOL isW) LPCWSTR text, BOOL isW)
{ {
STATUSWINDOWPART *part=NULL; STATUSWINDOWPART *part=NULL;
BOOL changed = FALSE; BOOL changed = FALSE;
if (style & SBT_OWNERDRAW) { if (style & SBT_OWNERDRAW) {
TRACE("part %d, text %x\n",nPart,text); TRACE("part %d, text %x\n",nPart,text);
} }
else TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW)); else TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
@ -678,7 +678,7 @@ STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
return TRUE; return TRUE;
} }
} else { } else {
if (!changed && !part->text) if (!changed && !part->text)
return TRUE; return TRUE;
} }
@ -898,7 +898,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
SendMessageW (lpCreate->hwndParent, WM_NOTIFY, SendMessageW (lpCreate->hwndParent, WM_NOTIFY,
(WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc);
} }
} }
if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */ if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */
@ -911,7 +911,7 @@ STATUSBAR_WMCreate (HWND hwnd, LPCREATESTRUCTA lpCreate)
} }
return 0; return 0;
create_fail: create_fail:
TRACE(" failed!\n"); TRACE(" failed!\n");
if (infoPtr) STATUSBAR_WMDestroy(infoPtr); if (infoPtr) STATUSBAR_WMDestroy(infoPtr);
@ -1049,13 +1049,13 @@ STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
return FALSE; return FALSE;
} }
if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE; if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & CCS_NORESIZE) return FALSE;
/* width and height don't apply */ /* width and height don't apply */
GetClientRect (GetParent(infoPtr->Self), &parent_rect); GetClientRect (GetParent(infoPtr->Self), &parent_rect);
width = parent_rect.right - parent_rect.left; width = parent_rect.right - parent_rect.left;
x = parent_rect.left; x = parent_rect.left;
y = parent_rect.bottom - infoPtr->height; y = parent_rect.bottom - infoPtr->height;
MoveWindow (infoPtr->Self, parent_rect.left, MoveWindow (infoPtr->Self, parent_rect.left,
parent_rect.bottom - infoPtr->height, parent_rect.bottom - infoPtr->height,
width, infoPtr->height, TRUE); width, infoPtr->height, TRUE);
STATUSBAR_SetPartBounds (infoPtr); STATUSBAR_SetPartBounds (infoPtr);
@ -1063,7 +1063,7 @@ STATUSBAR_WMSize (STATUSWINDOWINFO *infoPtr, WORD flags)
} }
static LRESULT static LRESULT
STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd) STATUSBAR_NotifyFormat (STATUSWINDOWINFO *infoPtr, HWND from, INT cmd)
{ {
if (cmd == NF_REQUERY) { if (cmd == NF_REQUERY) {
@ -1144,7 +1144,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case SB_SETMINHEIGHT: case SB_SETMINHEIGHT:
return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam); return STATUSBAR_SetMinHeight (infoPtr, (INT)wParam);
case SB_SETPARTS: case SB_SETPARTS:
return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam); return STATUSBAR_SetParts (infoPtr, (INT)wParam, (LPINT)lParam);
case SB_SETTEXTA: case SB_SETTEXTA:
@ -1202,7 +1202,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NOTIFYFORMAT: case WM_NOTIFYFORMAT:
return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam); return STATUSBAR_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
case WM_PAINT: case WM_PAINT:
return STATUSBAR_WMPaint (infoPtr, (HDC)wParam); return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
@ -1251,7 +1251,7 @@ STATUS_Register (void)
wndClass.hCursor = LoadCursorW (0, IDC_ARROWW); wndClass.hCursor = LoadCursorW (0, IDC_ARROWW);
wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wndClass.lpszClassName = STATUSCLASSNAMEW; wndClass.lpszClassName = STATUSCLASSNAMEW;
RegisterClassW (&wndClass); RegisterClassW (&wndClass);
} }

File diff suppressed because it is too large Load Diff

View File

@ -85,7 +85,7 @@ typedef struct
BOOL bHot; BOOL bHot;
INT nRow; INT nRow;
RECT rect; RECT rect;
} TBUTTON_INFO; } TBUTTON_INFO;
typedef struct typedef struct
{ {
@ -170,7 +170,7 @@ typedef struct
#define SEPARATOR_WIDTH 8 #define SEPARATOR_WIDTH 8
#define TOP_BORDER 2 #define TOP_BORDER 2
#define BOTTOM_BORDER 2 #define BOTTOM_BORDER 2
#define DDARROW_WIDTH 11 #define DDARROW_WIDTH 11
#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0)) #define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
#define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE) #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE)
@ -196,7 +196,7 @@ TOOLBAR_GetText(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
lpText = (LPWSTR)btnPtr->iString; lpText = (LPWSTR)btnPtr->iString;
else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))
lpText = infoPtr->strings[btnPtr->iString]; lpText = infoPtr->strings[btnPtr->iString];
return lpText; return lpText;
} }
@ -212,7 +212,7 @@ TOOLBAR_DumpButton(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *bP, INT btn_num, BOOL in
TRACE("button %d id %d, hot=%s, row=%d, rect=(%d,%d)-(%d,%d)\n", TRACE("button %d id %d, hot=%s, row=%d, rect=(%d,%d)-(%d,%d)\n",
btn_num, bP->idCommand, btn_num, bP->idCommand,
(bP->bHot) ? "TRUE":"FALSE", bP->nRow, (bP->bHot) ? "TRUE":"FALSE", bP->nRow,
bP->rect.left, bP->rect.top, bP->rect.left, bP->rect.top,
bP->rect.right, bP->rect.bottom); bP->rect.right, bP->rect.bottom);
} }
} }
@ -263,7 +263,7 @@ TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
{ {
if(!IsWindow(infoPtr->hwndSelf)) if(!IsWindow(infoPtr->hwndSelf))
return 0; /* we have just been destroyed */ return 0; /* we have just been destroyed */
nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf); nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
nmhdr->hwndFrom = infoPtr->hwndSelf; nmhdr->hwndFrom = infoPtr->hwndSelf;
nmhdr->code = code; nmhdr->code = code;
@ -272,10 +272,10 @@ TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
(infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI"); (infoPtr->bNtfUnicode) ? "via Unicode" : "via ANSI");
if (infoPtr->bNtfUnicode) if (infoPtr->bNtfUnicode)
return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
else else
return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr);
} }
@ -286,7 +286,7 @@ TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
* If the button specifies I_IMAGECALLBACK, then the TBN_GETDISPINFO * If the button specifies I_IMAGECALLBACK, then the TBN_GETDISPINFO
* is issued to retrieve the index. * is issued to retrieve the index.
*/ */
static INT static INT
TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr) TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
{ {
INT ret = btnPtr->iBitmap; INT ret = btnPtr->iBitmap;
@ -305,14 +305,14 @@ TOOLBAR_GetBitmapIndex(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
btnPtr->iBitmap = nmgd.iImage; btnPtr->iBitmap = nmgd.iImage;
} }
ret = nmgd.iImage; ret = nmgd.iImage;
TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n", TRACE("TBN_GETDISPINFOA returned bitmap id %d, mask=%08lx, nNumBitmaps=%d\n",
ret, nmgd.dwMask, infoPtr->nNumBitmaps); ret, nmgd.dwMask, infoPtr->nNumBitmaps);
} }
return ret; return ret;
} }
static BOOL static BOOL
TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index) TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
{ {
if (((index>=0) && (index <= infoPtr->nNumBitmaps)) || if (((index>=0) && (index <= infoPtr->nNumBitmaps)) ||
@ -328,7 +328,7 @@ TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
* *
* This function validates the bitmap index (including I_IMAGECALLBACK * This function validates the bitmap index (including I_IMAGECALLBACK
* functionality). It then draws the image via the ImageList_Draw * functionality). It then draws the image via the ImageList_Draw
* function. It returns TRUE if the image was drawn, FALSE otherwise. * function. It returns TRUE if the image was drawn, FALSE otherwise.
*/ */
static BOOL static BOOL
TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST himl, TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST himl,
@ -340,7 +340,7 @@ TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST h
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
ERR("index %d is not valid, max %d\n", ERR("index %d is not valid, max %d\n",
btnPtr->iBitmap, infoPtr->nNumBitmaps); btnPtr->iBitmap, infoPtr->nNumBitmaps);
return FALSE; return FALSE;
} }
@ -375,7 +375,7 @@ TOOLBAR_TestImageExist (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
if (btnPtr->iBitmap == I_IMAGENONE) return FALSE; if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
ERR("index %d is not valid, max %d\n", ERR("index %d is not valid, max %d\n",
btnPtr->iBitmap, infoPtr->nNumBitmaps); btnPtr->iBitmap, infoPtr->nNumBitmaps);
return FALSE; return FALSE;
} }
@ -402,7 +402,7 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr)
myrect.top = lpRect->top + 2; myrect.top = lpRect->top + 2;
myrect.bottom = lpRect->bottom - 2; myrect.bottom = lpRect->bottom - 2;
newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
oldcolor = SetBkColor (hdc, newcolor); oldcolor = SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
@ -410,7 +410,7 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr)
myrect.left = myrect.right; myrect.left = myrect.right;
myrect.right = myrect.left + 1; myrect.right = myrect.left + 1;
newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight;
SetBkColor (hdc, newcolor); SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
@ -446,7 +446,7 @@ TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLB
TRACE("rect=(%d,%d)-(%d,%d)\n", TRACE("rect=(%d,%d)-(%d,%d)\n",
myrect.left, myrect.top, myrect.right, myrect.bottom); myrect.left, myrect.top, myrect.right, myrect.bottom);
newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
oldcolor = SetBkColor (hdc, newcolor); oldcolor = SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
@ -454,7 +454,7 @@ TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLB
myrect.top = myrect.bottom; myrect.top = myrect.bottom;
myrect.bottom = myrect.top + 1; myrect.bottom = myrect.top + 1;
newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight;
SetBkColor (hdc, newcolor); SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
@ -631,7 +631,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
rc.right = max(rc.left, rc.right - DDARROW_WIDTH); rc.right = max(rc.left, rc.right - DDARROW_WIDTH);
else else
rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2); rc.right = max(rc.left, rc.right - DDARROW_WIDTH - 2);
rcArrow.left = rc.right; rcArrow.left = rc.right;
} }
/* Center the bitmap horizontally and vertically */ /* Center the bitmap horizontally and vertically */
@ -645,7 +645,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
else else
rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2; rcBitmap.top+=(infoPtr->nButtonHeight - infoPtr->nBitmapHeight) / 2;
TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n", TRACE("iBitmap: %d, start=(%d,%d) w=%d, h=%d\n",
btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, btnPtr->iBitmap, rcBitmap.left, rcBitmap.top,
infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
TRACE ("iString: %x\n", btnPtr->iString); TRACE ("iString: %x\n", btnPtr->iString);
@ -656,7 +656,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
InflateRect (&rcText, -3, -3); InflateRect (&rcText, -3, -3);
if (infoPtr->himlDef && if (infoPtr->himlDef &&
TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) { TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
/* The following test looked like this before /* The following test looked like this before
* I changed it. IE4 "Links" toolbar would not * I changed it. IE4 "Links" toolbar would not
@ -664,7 +664,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
* ((dwStyle & TBSTYLE_LIST) && * ((dwStyle & TBSTYLE_LIST) &&
* ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) && * ((btnPtr->fsStyle & TBSTYLE_AUTOSIZE) == 0) &&
* (btnPtr->iBitmap != I_IMAGENONE)) * (btnPtr->iBitmap != I_IMAGENONE))
*/ */
if (dwStyle & TBSTYLE_LIST) { if (dwStyle & TBSTYLE_LIST) {
/* LIST style w/ ICON offset is by matching native. */ /* LIST style w/ ICON offset is by matching native. */
/* Matches IE4 "Links" bar. - GA 8/01 */ /* Matches IE4 "Links" bar. - GA 8/01 */
@ -711,7 +711,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
tbcd.hbrLines = 0; tbcd.hbrLines = 0;
tbcd.hpenLines = 0; tbcd.hpenLines = 0;
/* Issue Item Prepaint notify */ /* Issue Item Prepaint notify */
infoPtr->dwItemCustDraw = 0; infoPtr->dwItemCustDraw = 0;
infoPtr->dwItemCDFlag = 0; infoPtr->dwItemCDFlag = 0;
if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYITEMDRAW) if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYITEMDRAW)
@ -725,7 +725,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
infoPtr->dwItemCustDraw = ntfret & 0xffff; infoPtr->dwItemCustDraw = ntfret & 0xffff;
infoPtr->dwItemCDFlag = ntfret & 0xffff0000; infoPtr->dwItemCDFlag = ntfret & 0xffff0000;
if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT) if (infoPtr->dwItemCustDraw & CDRF_SKIPDEFAULT)
return; return;
/* save the only part of the rect that the user can change */ /* save the only part of the rect that the user can change */
rcText.right = tbcd.rcText.right + rc.left; rcText.right = tbcd.rcText.right + rc.left;
@ -765,7 +765,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
DrawEdge (hdc, &rcArrow, EDGE_RAISED, DrawEdge (hdc, &rcArrow, EDGE_RAISED,
BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST); BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
} }
if (hasDropDownArrow) if (hasDropDownArrow)
{ {
TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1, COLOR_3DHIGHLIGHT); TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top+1, COLOR_3DHIGHLIGHT);
@ -773,7 +773,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
} }
if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis, if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDis,
hdc, rcBitmap.left, rcBitmap.top, hdc, rcBitmap.left, rcBitmap.top,
ILD_NORMAL)) ILD_NORMAL))
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top); TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
@ -804,7 +804,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME); TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top, COLOR_WINDOWFRAME);
TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
hdc, rcBitmap.left+offset, rcBitmap.top+offset, hdc, rcBitmap.left+offset, rcBitmap.top+offset,
ILD_NORMAL); ILD_NORMAL);
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
@ -825,16 +825,16 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
} }
TOOLBAR_DrawPattern (hdc, &rc); TOOLBAR_DrawPattern (hdc, &rc);
TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
hdc, rcBitmap.left+1, rcBitmap.top+1, hdc, rcBitmap.left+1, rcBitmap.top+1,
ILD_NORMAL); ILD_NORMAL);
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
goto FINALNOTIFY; goto FINALNOTIFY;
} }
/* indeterminate */ /* indeterminate */
if (btnPtr->fsState & TBSTATE_INDETERMINATE) { if (btnPtr->fsState & TBSTATE_INDETERMINATE) {
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES)) if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
DrawEdge (hdc, &rc, EDGE_RAISED, DrawEdge (hdc, &rc, EDGE_RAISED,
@ -888,9 +888,9 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
if (btnPtr->bHot) { if (btnPtr->bHot) {
/* if hot, attempt to draw with himlHot, if fails, use himlDef */ /* if hot, attempt to draw with himlHot, if fails, use himlDef */
if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, if (!TOOLBAR_DrawImageList (infoPtr, btnPtr,
infoPtr->himlHot, infoPtr->himlHot,
hdc, rcBitmap.left, hdc, rcBitmap.left,
rcBitmap.top, ILD_NORMAL)) rcBitmap.top, ILD_NORMAL))
TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
hdc, rcBitmap.left, rcBitmap.top, hdc, rcBitmap.left, rcBitmap.top,
@ -918,7 +918,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef, TOOLBAR_DrawImageList (infoPtr, btnPtr, infoPtr->himlDef,
hdc, rcBitmap.left, rcBitmap.top, hdc, rcBitmap.left, rcBitmap.top,
ILD_NORMAL);} ILD_NORMAL);}
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd); TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
@ -1002,7 +1002,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
* only DrawText does. Note that the TBSTYLE_NOPREFIX is handled here. * only DrawText does. Note that the TBSTYLE_NOPREFIX is handled here.
*/ */
static void static void
TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
HDC hdc, LPSIZE lpSize) HDC hdc, LPSIZE lpSize)
{ {
RECT myrect; RECT myrect;
@ -1010,7 +1010,7 @@ TOOLBAR_MeasureString(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
lpSize->cx = 0; lpSize->cx = 0;
lpSize->cy = 0; lpSize->cy = 0;
if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) if (!(btnPtr->fsState & TBSTATE_HIDDEN) )
{ {
LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr); LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr);
@ -1080,17 +1080,17 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
/*********************************************************************** /***********************************************************************
* TOOLBAR_WrapToolbar * TOOLBAR_WrapToolbar
* *
* This function walks through the buttons and seperators in the * This function walks through the buttons and seperators in the
* toolbar, and sets the TBSTATE_WRAP flag only on those items where * toolbar, and sets the TBSTATE_WRAP flag only on those items where
* wrapping should occur based on the width of the toolbar window. * wrapping should occur based on the width of the toolbar window.
* It does *not* calculate button placement itself. That task * It does *not* calculate button placement itself. That task
* takes place in TOOLBAR_CalcToolbar. If the program wants to manage * takes place in TOOLBAR_CalcToolbar. If the program wants to manage
* the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE
* flag, and set the TBSTATE_WRAP flags manually on the appropriate items. * flag, and set the TBSTATE_WRAP flags manually on the appropriate items.
* *
* Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow * Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow
* vertical toolbar lists. * vertical toolbar lists.
*/ */
static void static void
TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle ) TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
@ -1101,10 +1101,10 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
RECT rc; RECT rc;
BOOL bWrap, bButtonWrap; BOOL bWrap, bButtonWrap;
/* When the toolbar window style is not TBSTYLE_WRAPABLE, */ /* When the toolbar window style is not TBSTYLE_WRAPABLE, */
/* no layout is necessary. Applications may use this style */ /* no layout is necessary. Applications may use this style */
/* to perform their own layout on the toolbar. */ /* to perform their own layout on the toolbar. */
if( !(dwStyle & TBSTYLE_WRAPABLE) && if( !(dwStyle & TBSTYLE_WRAPABLE) &&
!(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return; !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return;
btnPtr = infoPtr->buttons; btnPtr = infoPtr->buttons;
@ -1126,7 +1126,7 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
{ {
bWrap = FALSE; bWrap = FALSE;
btnPtr[i].fsState &= ~TBSTATE_WRAP; btnPtr[i].fsState &= ~TBSTATE_WRAP;
if (btnPtr[i].fsState & TBSTATE_HIDDEN) if (btnPtr[i].fsState & TBSTATE_HIDDEN)
continue; continue;
@ -1138,18 +1138,18 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
/* width. - GA 8/01 */ /* width. - GA 8/01 */
if ((btnPtr[i].fsStyle & TBSTYLE_SEP) && if ((btnPtr[i].fsStyle & TBSTYLE_SEP) &&
!(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN))
cx = (btnPtr[i].iBitmap > 0) ? cx = (btnPtr[i].iBitmap > 0) ?
btnPtr[i].iBitmap : SEPARATOR_WIDTH; btnPtr[i].iBitmap : SEPARATOR_WIDTH;
else else
cx = infoPtr->nButtonWidth; cx = infoPtr->nButtonWidth;
/* Two or more adjacent separators form a separator group. */ /* Two or more adjacent separators form a separator group. */
/* The first separator in a group should be wrapped to the */ /* The first separator in a group should be wrapped to the */
/* next row if the previous wrapping is on a button. */ /* next row if the previous wrapping is on a button. */
if( bButtonWrap && if( bButtonWrap &&
(btnPtr[i].fsStyle & TBSTYLE_SEP) && (btnPtr[i].fsStyle & TBSTYLE_SEP) &&
(i + 1 < infoPtr->nNumButtons ) && (i + 1 < infoPtr->nNumButtons ) &&
(btnPtr[i + 1].fsStyle & TBSTYLE_SEP) ) (btnPtr[i + 1].fsStyle & TBSTYLE_SEP) )
{ {
TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle); TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle);
btnPtr[i].fsState |= TBSTATE_WRAP; btnPtr[i].fsState |= TBSTATE_WRAP;
@ -1162,28 +1162,28 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
/* The layout makes sure the bitmap is visible, but not the button. */ /* The layout makes sure the bitmap is visible, but not the button. */
/* Test added to also wrap after a button that starts a row but */ /* Test added to also wrap after a button that starts a row but */
/* is bigger than the area. - GA 8/01 */ /* is bigger than the area. - GA 8/01 */
if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2
> infoPtr->nWidth ) || > infoPtr->nWidth ) ||
((x == infoPtr->nIndent) && (cx > infoPtr->nWidth))) ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth)))
{ {
BOOL bFound = FALSE; BOOL bFound = FALSE;
/* If the current button is a separator and not hidden, */ /* If the current button is a separator and not hidden, */
/* go to the next until it reaches a non separator. */ /* go to the next until it reaches a non separator. */
/* Wrap the last separator if it is before a button. */ /* Wrap the last separator if it is before a button. */
while( ( ((btnPtr[i].fsStyle & TBSTYLE_SEP) && while( ( ((btnPtr[i].fsStyle & TBSTYLE_SEP) &&
!(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) || !(btnPtr[i].fsStyle & TBSTYLE_DROPDOWN)) ||
(btnPtr[i].fsState & TBSTATE_HIDDEN) ) && (btnPtr[i].fsState & TBSTATE_HIDDEN) ) &&
i < infoPtr->nNumButtons ) i < infoPtr->nNumButtons )
{ {
i++; i++;
bFound = TRUE; bFound = TRUE;
} }
if( bFound && i < infoPtr->nNumButtons ) if( bFound && i < infoPtr->nNumButtons )
{ {
i--; i--;
TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n",
i, btnPtr[i].fsStyle, x, cx); i, btnPtr[i].fsStyle, x, cx);
btnPtr[i].fsState |= TBSTATE_WRAP; btnPtr[i].fsState |= TBSTATE_WRAP;
x = infoPtr->nIndent; x = infoPtr->nIndent;
@ -1193,20 +1193,20 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
else if ( i >= infoPtr->nNumButtons) else if ( i >= infoPtr->nNumButtons)
break; break;
/* If the current button is not a separator, find the last */ /* If the current button is not a separator, find the last */
/* separator and wrap it. */ /* separator and wrap it. */
for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)
{ {
if ((btnPtr[j].fsStyle & TBSTYLE_SEP) && if ((btnPtr[j].fsStyle & TBSTYLE_SEP) &&
!(btnPtr[j].fsState & TBSTATE_HIDDEN)) !(btnPtr[j].fsState & TBSTATE_HIDDEN))
{ {
bFound = TRUE; bFound = TRUE;
i = j; i = j;
TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n",
i, btnPtr[i].fsStyle, x, cx); i, btnPtr[i].fsStyle, x, cx);
x = infoPtr->nIndent; x = infoPtr->nIndent;
btnPtr[j].fsState |= TBSTATE_WRAP; btnPtr[j].fsState |= TBSTATE_WRAP;
bButtonWrap = FALSE; bButtonWrap = FALSE;
break; break;
} }
} }
@ -1215,15 +1215,15 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
/* non-hidden previous button. */ /* non-hidden previous button. */
if (!bFound) if (!bFound)
{ {
for ( j = i - 1; for ( j = i - 1;
j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--)
{ {
if (btnPtr[j].fsState & TBSTATE_HIDDEN) if (btnPtr[j].fsState & TBSTATE_HIDDEN)
continue; continue;
bFound = TRUE; bFound = TRUE;
i = j; i = j;
TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n",
i, btnPtr[i].fsStyle, x, cx); i, btnPtr[i].fsStyle, x, cx);
x = infoPtr->nIndent; x = infoPtr->nIndent;
btnPtr[j].fsState |= TBSTATE_WRAP; btnPtr[j].fsState |= TBSTATE_WRAP;
@ -1233,7 +1233,7 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
} }
/* If all above failed, wrap the current button. */ /* If all above failed, wrap the current button. */
if (!bFound) if (!bFound)
{ {
TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n", TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n",
i, btnPtr[i].fsStyle, x, cx); i, btnPtr[i].fsStyle, x, cx);
@ -1244,10 +1244,10 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
bButtonWrap = FALSE; bButtonWrap = FALSE;
else else
bButtonWrap = TRUE; bButtonWrap = TRUE;
} }
} }
else { else {
TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n",
i, btnPtr[i].fsStyle, x, cx); i, btnPtr[i].fsStyle, x, cx);
x += cx; x += cx;
} }
@ -1258,13 +1258,13 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle )
/*********************************************************************** /***********************************************************************
* TOOLBAR_CalcToolbar * TOOLBAR_CalcToolbar
* *
* This function calculates button and separator placement. It first * This function calculates button and separator placement. It first
* calculates the button sizes, gets the toolbar window width and then * calculates the button sizes, gets the toolbar window width and then
* calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap * calls TOOLBAR_WrapToolbar to determine which buttons we need to wrap
* on. It assigns a new location to each item and sends this location to * on. It assigns a new location to each item and sends this location to
* the tooltip window if appropriate. Finally, it updates the rcBound * the tooltip window if appropriate. Finally, it updates the rcBound
* rect and calculates the new required toolbar window height. * rect and calculates the new required toolbar window height.
*/ */
static void static void
TOOLBAR_CalcToolbar (HWND hwnd) TOOLBAR_CalcToolbar (HWND hwnd)
@ -1301,10 +1301,10 @@ TOOLBAR_CalcToolbar (HWND hwnd)
if (sizeString.cy > 0) if (sizeString.cy > 0)
{ {
if (usesBitmaps) if (usesBitmaps)
infoPtr->nButtonHeight = sizeString.cy + infoPtr->nButtonHeight = sizeString.cy +
2 + /* this is the space to separate text from bitmap */ 2 + /* this is the space to separate text from bitmap */
infoPtr->nBitmapHeight + 6; infoPtr->nBitmapHeight + 6;
else else
infoPtr->nButtonHeight = sizeString.cy + 6; infoPtr->nButtonHeight = sizeString.cy + 6;
} }
else if (infoPtr->nButtonHeight < infoPtr->nBitmapHeight + 6) else if (infoPtr->nButtonHeight < infoPtr->nBitmapHeight + 6)
@ -1327,8 +1327,8 @@ TOOLBAR_CalcToolbar (HWND hwnd)
y = 0; y = 0;
/* /*
* We will set the height below, and we set the width on entry * We will set the height below, and we set the width on entry
* so we do not reset them here.. * so we do not reset them here..
*/ */
#if 0 #if 0
GetClientRect( hwnd, &rc ); GetClientRect( hwnd, &rc );
@ -1389,7 +1389,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
} }
else else
{ {
if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE) if (btnPtr->fsStyle & TBSTYLE_AUTOSIZE)
{ {
SIZE sz; SIZE sz;
HDC hdc; HDC hdc;
@ -1406,7 +1406,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
/* Fudge amount measured against IE4 "menu" and "Links" */ /* Fudge amount measured against IE4 "menu" and "Links" */
/* toolbars with native control (v4.71). - GA 8/01 */ /* toolbars with native control (v4.71). - GA 8/01 */
cx = sz.cx + 6 + 5 + 5; cx = sz.cx + 6 + 5 + 5;
if ((dwStyle & TBSTYLE_LIST) && if ((dwStyle & TBSTYLE_LIST) &&
(TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef))) (TOOLBAR_TestImageExist (infoPtr, btnPtr, infoPtr->himlDef)))
cx += infoPtr->nBitmapWidth; cx += infoPtr->nBitmapWidth;
} }
@ -1414,7 +1414,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
cx = infoPtr->nButtonWidth; cx = infoPtr->nButtonWidth;
if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN)) if (hasDropDownArrows && (btnPtr->fsStyle & TBSTYLE_DROPDOWN))
cx += DDARROW_WIDTH; cx += DDARROW_WIDTH;
} }
if (btnPtr->fsState & TBSTATE_WRAP ) if (btnPtr->fsState & TBSTATE_WRAP )
bWrap = TRUE; bWrap = TRUE;
@ -1429,7 +1429,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
infoPtr->rcBound.bottom = y + cy; infoPtr->rcBound.bottom = y + cy;
/* Set the toolTip only for non-hidden, non-separator button */ /* Set the toolTip only for non-hidden, non-separator button */
if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP )) if (infoPtr->hwndToolTip && !(btnPtr->fsStyle & TBSTYLE_SEP ))
{ {
TTTOOLINFOA ti; TTTOOLINFOA ti;
@ -1454,17 +1454,17 @@ TOOLBAR_CalcToolbar (HWND hwnd)
{ {
if ( !(btnPtr->fsStyle & TBSTYLE_SEP) ) if ( !(btnPtr->fsStyle & TBSTYLE_SEP) )
y += cy; y += cy;
else else
{ {
/* UNDOCUMENTED: If a separator has a non zero bitmap index, */ /* UNDOCUMENTED: If a separator has a non zero bitmap index, */
/* it is the actual width of the separator. This is used for */ /* it is the actual width of the separator. This is used for */
/* custom controls in toolbars. */ /* custom controls in toolbars. */
if ( !(btnPtr->fsStyle & TBSTYLE_DROPDOWN)) if ( !(btnPtr->fsStyle & TBSTYLE_DROPDOWN))
y += cy + ( (btnPtr->iBitmap > 0 ) ? y += cy + ( (btnPtr->iBitmap > 0 ) ?
btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3;
else else
y += cy; y += cy;
/* nSepRows is used to calculate the extra height follwoing */ /* nSepRows is used to calculate the extra height follwoing */
/* the last row. */ /* the last row. */
nSepRows++; nSepRows++;
@ -1495,10 +1495,10 @@ TOOLBAR_CalcToolbar (HWND hwnd)
/* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */ /* nSepRows * (infoPtr->nBitmapHeight + 1) is the space following */
/* the last row. */ /* the last row. */
infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight + infoPtr->nHeight = TOP_BORDER + (nRows + 1) * infoPtr->nButtonHeight +
nSepRows * (SEPARATOR_WIDTH * 2 / 3) + nSepRows * (SEPARATOR_WIDTH * 2 / 3) +
nSepRows * (infoPtr->nBitmapHeight + 1) + nSepRows * (infoPtr->nBitmapHeight + 1) +
BOTTOM_BORDER; BOTTOM_BORDER;
#endif #endif
infoPtr->nHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top; infoPtr->nHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
@ -1513,7 +1513,7 @@ TOOLBAR_InternalHitTest (HWND hwnd, LPPOINT lpPt)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT i; INT i;
btnPtr = infoPtr->buttons; btnPtr = infoPtr->buttons;
for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
if (btnPtr->fsState & TBSTATE_HIDDEN) if (btnPtr->fsState & TBSTATE_HIDDEN)
@ -1593,7 +1593,7 @@ TOOLBAR_GetCheckedGroupButtonIndex (TOOLBAR_INFO *infoPtr, INT nIndex)
/* check next buttons */ /* check next buttons */
nRunIndex = nIndex + 1; nRunIndex = nIndex + 1;
while (nRunIndex < infoPtr->nNumButtons) { while (nRunIndex < infoPtr->nNumButtons) {
btnPtr = &infoPtr->buttons[nRunIndex]; btnPtr = &infoPtr->buttons[nRunIndex];
if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) { if ((btnPtr->fsStyle & TBSTYLE_CHECKGROUP) == TBSTYLE_CHECKGROUP) {
if (btnPtr->fsState & TBSTATE_CHECKED) if (btnPtr->fsState & TBSTATE_CHECKED)
return nRunIndex; return nRunIndex;
@ -1648,7 +1648,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
char Buffer[256]; char Buffer[256];
int i = 0; int i = 0;
int index; int index;
infoPtr = custInfo->tbInfo; infoPtr = custInfo->tbInfo;
/* send TBN_QUERYINSERT notification */ /* send TBN_QUERYINSERT notification */
@ -1668,8 +1668,8 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* send TBN_QUERYDELETE notification */ /* send TBN_QUERYDELETE notification */
nmtb.iItem = i; nmtb.iItem = i;
btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb, btnInfo->bRemovable = TOOLBAR_SendNotify ((NMHDR *) &nmtb,
infoPtr, infoPtr,
TBN_QUERYDELETE); TBN_QUERYDELETE);
index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, 0); index = (int)SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_ADDSTRING, 0, 0);
@ -1697,7 +1697,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_GETBUTTONINFOA)) if (!TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_GETBUTTONINFOA))
break; break;
TRACE("style: %x\n", nmtb.tbButton.fsStyle); TRACE("style: %x\n", nmtb.tbButton.fsStyle);
/* insert button into the apropriate list */ /* insert button into the apropriate list */
index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand, FALSE); index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand, FALSE);
@ -1773,7 +1773,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* send TBN_QUERYINSERT notification */ /* send TBN_QUERYINSERT notification */
nmtb.iItem = index; nmtb.iItem = index;
TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
TBN_QUERYINSERT); TBN_QUERYINSERT);
/* get list box item */ /* get list box item */
@ -2100,18 +2100,18 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE ("adding %d internal bitmaps!\n", nButtons); TRACE ("adding %d internal bitmaps!\n", nButtons);
/* Windows resize all the buttons to the size of a newly added standard image */ /* Windows resize all the buttons to the size of a newly added standard image */
if (lpAddBmp->nID & 1) if (lpAddBmp->nID & 1)
{ {
/* large icons */ /* large icons */
/* FIXME: on windows the size of the images is 25x24 but the size of the bitmap /* FIXME: on windows the size of the images is 25x24 but the size of the bitmap
* in rsrc is only 24x24. Fix the bitmap (how?) and then fix this * in rsrc is only 24x24. Fix the bitmap (how?) and then fix this
*/ */
SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, SendMessageA (hwnd, TB_SETBITMAPSIZE, 0,
MAKELPARAM((WORD)24, (WORD)24)); MAKELPARAM((WORD)24, (WORD)24));
SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, SendMessageA (hwnd, TB_SETBUTTONSIZE, 0,
MAKELPARAM((WORD)31, (WORD)30)); MAKELPARAM((WORD)31, (WORD)30));
} }
else else
{ {
/* small icons */ /* small icons */
SendMessageA (hwnd, TB_SETBITMAPSIZE, 0, SendMessageA (hwnd, TB_SETBITMAPSIZE, 0,
@ -2119,7 +2119,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
SendMessageA (hwnd, TB_SETBUTTONSIZE, 0, SendMessageA (hwnd, TB_SETBUTTONSIZE, 0,
MAKELPARAM((WORD)22, (WORD)22)); MAKELPARAM((WORD)22, (WORD)22));
} }
TOOLBAR_CalcToolbar (hwnd); TOOLBAR_CalcToolbar (hwnd);
} }
else else
@ -2127,10 +2127,10 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
nButtons = (INT)wParam; nButtons = (INT)wParam;
if (nButtons <= 0) if (nButtons <= 0)
return -1; return -1;
TRACE ("adding %d bitmaps!\n", nButtons); TRACE ("adding %d bitmaps!\n", nButtons);
} }
if (!(infoPtr->himlDef)) { if (!(infoPtr->himlDef)) {
/* create new default image list */ /* create new default image list */
TRACE ("creating default image list!\n"); TRACE ("creating default image list!\n");
@ -2146,7 +2146,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* Add bitmaps to the default image list */ /* Add bitmaps to the default image list */
if (lpAddBmp->hInst == (HINSTANCE)0) if (lpAddBmp->hInst == (HINSTANCE)0)
{ {
nIndex = nIndex =
ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID, ImageList_AddMasked (infoPtr->himlDef, (HBITMAP)lpAddBmp->nID,
CLR_DEFAULT); CLR_DEFAULT);
} }
@ -2476,7 +2476,7 @@ TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (szString[0] == L'|') if (szString[0] == L'|')
{ {
PWSTR p = szString + 1; PWSTR p = szString + 1;
nIndex = infoPtr->nNumStrings; nIndex = infoPtr->nNumStrings;
while (*p != L'|') { while (*p != L'|') {
@ -2698,7 +2698,7 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
btnPtr->fsState &= ~TBSTATE_CHECKED; btnPtr->fsState &= ~TBSTATE_CHECKED;
else { else {
if (btnPtr->fsStyle & TBSTYLE_GROUP) { if (btnPtr->fsStyle & TBSTYLE_GROUP) {
nOldIndex = nOldIndex =
TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex); TOOLBAR_GetCheckedGroupButtonIndex (infoPtr, nIndex);
if (nOldIndex == nIndex) if (nOldIndex == nIndex)
return 0; return 0;
@ -2781,7 +2781,7 @@ TOOLBAR_DeleteButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
return FALSE; return FALSE;
if ((infoPtr->hwndToolTip) && if ((infoPtr->hwndToolTip) &&
!(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) { !(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) {
TTTOOLINFOA ti; TTTOOLINFOA ti;
@ -2976,7 +2976,7 @@ TOOLBAR_GetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW)) if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW))
return -1; return -1;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam,
lpTbInfo->dwMask & 0x80000000); lpTbInfo->dwMask & 0x80000000);
if (nIndex == -1) if (nIndex == -1)
return -1; return -1;
@ -3134,7 +3134,7 @@ TOOLBAR_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
if (btnPtr->fsState & TBSTATE_HIDDEN) if (btnPtr->fsState & TBSTATE_HIDDEN)
return FALSE; return FALSE;
lpRect->left = btnPtr->rect.left; lpRect->left = btnPtr->rect.left;
lpRect->right = btnPtr->rect.right; lpRect->right = btnPtr->rect.right;
lpRect->bottom = btnPtr->rect.bottom; lpRect->bottom = btnPtr->rect.bottom;
@ -3195,7 +3195,7 @@ TOOLBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
lpRect = (LPRECT)lParam; lpRect = (LPRECT)lParam;
if (lpRect == NULL) if (lpRect == NULL)
return FALSE; return FALSE;
lpRect->left = btnPtr->rect.left; lpRect->left = btnPtr->rect.left;
lpRect->right = btnPtr->rect.right; lpRect->right = btnPtr->rect.right;
lpRect->bottom = btnPtr->rect.bottom; lpRect->bottom = btnPtr->rect.bottom;
@ -3273,7 +3273,7 @@ TOOLBAR_GetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TRACE("%s hwnd=0x%x stub!\n", TRACE("%s hwnd=0x%x stub!\n",
infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd); infoPtr->bUnicode ? "TRUE" : "FALSE", hwnd);
return infoPtr->bUnicode; return infoPtr->bUnicode;
@ -3471,7 +3471,7 @@ TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam)
} else if (nIndex < 0) } else if (nIndex < 0)
return FALSE; return FALSE;
/* If the string passed is not an index, assume address of string /* If the string passed is not an index, assume address of string
and do our own AddString */ and do our own AddString */
if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) { if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) {
LPWSTR ptr; LPWSTR ptr;
@ -3839,7 +3839,7 @@ TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
if (lptbbi->cbSize < sizeof(TBBUTTONINFOA)) if (lptbbi->cbSize < sizeof(TBBUTTONINFOA))
return FALSE; return FALSE;
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam,
lptbbi->dwMask & 0x80000000); lptbbi->dwMask & 0x80000000);
if (nIndex == -1) if (nIndex == -1)
@ -3863,7 +3863,7 @@ TOOLBAR_SetButtonInfoA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if ((HIWORD(btnPtr->iString) == 0) || (btnPtr->iString == -1)) if ((HIWORD(btnPtr->iString) == 0) || (btnPtr->iString == -1))
/* iString is index, zero it to make Str_SetPtr succeed */ /* iString is index, zero it to make Str_SetPtr succeed */
btnPtr->iString=0; btnPtr->iString=0;
Str_SetPtrAtoW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText); Str_SetPtrAtoW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText);
} }
return TRUE; return TRUE;
@ -3925,15 +3925,15 @@ TOOLBAR_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
/* The documentation claims you can only change the button size before /* The documentation claims you can only change the button size before
* any button has been added. But this is wrong. * any button has been added. But this is wrong.
* WINZIP32.EXE (ver 8) calls this on one of its buttons after adding * WINZIP32.EXE (ver 8) calls this on one of its buttons after adding
* it to the toolbar, and it checks that the return value is nonzero - mjm * it to the toolbar, and it checks that the return value is nonzero - mjm
* Further testing shows that we must actually perform the change too. * Further testing shows that we must actually perform the change too.
*/ */
/* /*
* The documentation also does not mention that if 0 is supplied for * The documentation also does not mention that if 0 is supplied for
* either size, the system changes it to the default of 24 wide and * either size, the system changes it to the default of 24 wide and
* 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02
*/ */
infoPtr->nButtonWidth = (cx) ? cx : 24; infoPtr->nButtonWidth = (cx) ? cx : 24;
infoPtr->nButtonHeight = (cy) ? cy : 22; infoPtr->nButtonHeight = (cy) ? cy : 22;
@ -3956,7 +3956,7 @@ TOOLBAR_SetButtonWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
(infoPtr->cxMax == (INT)HIWORD(lParam))) { (infoPtr->cxMax == (INT)HIWORD(lParam))) {
TRACE("matches current width, min=%d, max=%d, no recalc\n", TRACE("matches current width, min=%d, max=%d, no recalc\n",
infoPtr->cxMin, infoPtr->cxMax); infoPtr->cxMin, infoPtr->cxMax);
return TRUE; return TRUE;
} }
/* save new values */ /* save new values */
@ -3965,14 +3965,14 @@ TOOLBAR_SetButtonWidth (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* if both values are 0 then we are done */ /* if both values are 0 then we are done */
if (lParam == 0) { if (lParam == 0) {
TRACE("setting both min and max to 0, norecalc\n"); TRACE("setting both min and max to 0, norecalc\n");
return TRUE; return TRUE;
} }
/* otherwise we need to recalc the toolbar and in some cases /* otherwise we need to recalc the toolbar and in some cases
recalc the bounding rectangle (does DrawText w/ DT_CALCRECT recalc the bounding rectangle (does DrawText w/ DT_CALCRECT
which doesn't actually draw - GA). */ which doesn't actually draw - GA). */
TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n", TRACE("number of buttons %d, cx=%d, cy=%d, recalcing\n",
infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax); infoPtr->nNumButtons, infoPtr->cxMin, infoPtr->cxMax);
TOOLBAR_CalcToolbar (hwnd); TOOLBAR_CalcToolbar (hwnd);
@ -4021,7 +4021,7 @@ TOOLBAR_SetDisabledImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* FIXME: redraw ? */ /* FIXME: redraw ? */
return (LRESULT)himlTemp; return (LRESULT)himlTemp;
} }
@ -4060,7 +4060,7 @@ TOOLBAR_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
FIXME("Unknown Toolbar Extended Style 0x%08lx. Please report.\n", FIXME("Unknown Toolbar Extended Style 0x%08lx. Please report.\n",
(infoPtr->dwExStyle & ~TBSTYLE_EX_ALL)); (infoPtr->dwExStyle & ~TBSTYLE_EX_ALL));
return (LRESULT)dwTemp; return (LRESULT)dwTemp;
} }
@ -4080,7 +4080,7 @@ TOOLBAR_SetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* FIXME: redraw ? */ /* FIXME: redraw ? */
return (LRESULT)himlTemp; return (LRESULT)himlTemp;
} }
@ -4146,7 +4146,7 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* FIXME: redraw ? */ /* FIXME: redraw ? */
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
return (LRESULT)himlTemp; return (LRESULT)himlTemp;
} }
@ -4348,7 +4348,7 @@ TOOLBAR_SetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
BOOL bTemp; BOOL bTemp;
TRACE("%s hwnd=0x%04x stub!\n", TRACE("%s hwnd=0x%04x stub!\n",
((BOOL)wParam) ? "TRUE" : "FALSE", hwnd); ((BOOL)wParam) ? "TRUE" : "FALSE", hwnd);
bTemp = infoPtr->bUnicode; bTemp = infoPtr->bUnicode;
@ -4363,10 +4363,10 @@ TOOLBAR_GetColorScheme (HWND hwnd, LPCOLORSCHEME lParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? lParam->clrBtnHighlight = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
comctl32_color.clrBtnHighlight : comctl32_color.clrBtnHighlight :
infoPtr->clrBtnHighlight; infoPtr->clrBtnHighlight;
lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? lParam->clrBtnShadow = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
return 1; return 1;
} }
@ -4426,7 +4426,7 @@ TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhotitem.idOld = (nOldHotItem >= 0) ? nmhotitem.idOld = (nOldHotItem >= 0) ?
infoPtr->buttons[nOldHotItem].idCommand : 0; infoPtr->buttons[nOldHotItem].idCommand : 0;
if ( !(nmhotitem.dwFlags & HICF_LEAVING) ) if ( !(nmhotitem.dwFlags & HICF_LEAVING) )
nmhotitem.idNew = (infoPtr->nHotItem >= 0) ? nmhotitem.idNew = (infoPtr->nHotItem >= 0) ?
infoPtr->buttons[infoPtr->nHotItem].idCommand : 0; infoPtr->buttons[infoPtr->nHotItem].idCommand : 0;
no_hi = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE); no_hi = TOOLBAR_SendNotify((NMHDR*)&nmhotitem, infoPtr, TBN_HOTITEMCHANGE);
} }
@ -4635,7 +4635,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->dwBaseCustDraw = ntfret & 0xffff; infoPtr->dwBaseCustDraw = ntfret & 0xffff;
/* FIXME: in general the return flags *can* be or'ed together */ /* FIXME: in general the return flags *can* be or'ed together */
switch (infoPtr->dwBaseCustDraw) switch (infoPtr->dwBaseCustDraw)
{ {
case CDRF_DODEFAULT: case CDRF_DODEFAULT:
break; break;
@ -4647,7 +4647,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
} }
/* If the toolbar is "transparent" then pass the WM_ERASEBKGND up /* If the toolbar is "transparent" then pass the WM_ERASEBKGND up
* to my parent for processing. * to my parent for processing.
*/ */
if (infoPtr->bTransparent) { if (infoPtr->bTransparent) {
@ -4666,14 +4666,14 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (!ret) if (!ret)
ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam);
if ((dwStyle & TBSTYLE_CUSTOMERASE) && if ((dwStyle & TBSTYLE_CUSTOMERASE) &&
(infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) {
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
tbcd.nmcd.dwDrawStage = CDDS_POSTERASE; tbcd.nmcd.dwDrawStage = CDDS_POSTERASE;
tbcd.nmcd.hdc = (HDC)wParam; tbcd.nmcd.hdc = (HDC)wParam;
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW); ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
infoPtr->dwBaseCustDraw = ntfret & 0xffff; infoPtr->dwBaseCustDraw = ntfret & 0xffff;
switch (infoPtr->dwBaseCustDraw) switch (infoPtr->dwBaseCustDraw)
{ {
case CDRF_DODEFAULT: case CDRF_DODEFAULT:
break; break;
@ -4846,7 +4846,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
nHit); nHit);
if (nOldIndex == nHit) if (nOldIndex == nHit)
bSendMessage = FALSE; bSendMessage = FALSE;
if ((nOldIndex != nHit) && if ((nOldIndex != nHit) &&
(nOldIndex != -1)) (nOldIndex != -1))
infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED; infoPtr->buttons[nOldIndex].fsState &= ~TBSTATE_CHECKED;
btnPtr->fsState |= TBSTATE_CHECKED; btnPtr->fsState |= TBSTATE_CHECKED;
@ -4868,7 +4868,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* /*
* now we can ReleaseCapture, which triggers CAPTURECHANGED msg, * now we can ReleaseCapture, which triggers CAPTURECHANGED msg,
* that resets bCaptured and btn TBSTATE_PRESSED flags, * that resets bCaptured and btn TBSTATE_PRESSED flags,
* and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged) * and obliterates nButtonDown and nOldHit (see TOOLBAR_CaptureChanged)
*/ */
if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0)) if ((infoPtr->bCaptured) && (infoPtr->nButtonDown >= 0))
ReleaseCapture (); ReleaseCapture ();
@ -4877,7 +4877,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_SendNotify ((NMHDR *) &hdr, infoPtr, TOOLBAR_SendNotify ((NMHDR *) &hdr, infoPtr,
NM_RELEASEDCAPTURE); NM_RELEASEDCAPTURE);
/* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the /* native issues TBN_ENDDRAG here, if _LBUTTONDOWN issued the
* TBN_BEGINDRAG * TBN_BEGINDRAG
*/ */
nmtb.iItem = btnPtr->idCommand; nmtb.iItem = btnPtr->idCommand;
@ -4992,7 +4992,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */ /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */
if(!(trackinfo.dwFlags & TME_LEAVE)) { if(!(trackinfo.dwFlags & TME_LEAVE)) {
trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */
/* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */
/* and can properly deactivate the hot toolbar button */ /* and can properly deactivate the hot toolbar button */
_TrackMouseEvent(&trackinfo); _TrackMouseEvent(&trackinfo);
@ -5011,7 +5011,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* Remove the effect of an old hot button if the button was enabled and was /* Remove the effect of an old hot button if the button was enabled and was
drawn with the hot button effect */ drawn with the hot button effect */
if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem && if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem &&
(infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED)) (infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED))
{ {
oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit]; oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
@ -5025,7 +5025,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nHotItem = nHit; infoPtr->nHotItem = nHit;
/* only enabled buttons show hot effect */ /* only enabled buttons show hot effect */
if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED) if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED)
{ {
btnPtr->bHot = TRUE; btnPtr->bHot = TRUE;
@ -5116,7 +5116,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
* CreateBitmap(0x27, 0x24, 1, 1, 0) * CreateBitmap(0x27, 0x24, 1, 1, 0)
* hdc = GetDC(toolbar) * hdc = GetDC(toolbar)
* GetSystemMetrics(0x48) * GetSystemMetrics(0x48)
* fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2,
* 0, 0, 0, 0, "MARLETT") * 0, 0, 0, 0, "MARLETT")
* oldfnt = SelectObject(hdc, fnt2) * oldfnt = SelectObject(hdc, fnt2)
* GetCharWidthA(hdc, 0x36, 0x36, adr2) * GetCharWidthA(hdc, 0x36, 0x36, adr2)
@ -5205,12 +5205,12 @@ TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lppgc->dwFlag == PGF_CALCWIDTH) { if (lppgc->dwFlag == PGF_CALCWIDTH) {
lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left; lppgc->iWidth = infoPtr->rcBound.right - infoPtr->rcBound.left;
TRACE("processed PGN_CALCSIZE, returning horz size = %d\n", TRACE("processed PGN_CALCSIZE, returning horz size = %d\n",
lppgc->iWidth); lppgc->iWidth);
} }
else { else {
lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top; lppgc->iHeight = infoPtr->rcBound.bottom - infoPtr->rcBound.top;
TRACE("processed PGN_CALCSIZE, returning vert size = %d\n", TRACE("processed PGN_CALCSIZE, returning vert size = %d\n",
lppgc->iHeight); lppgc->iHeight);
} }
return 0; return 0;
@ -5231,10 +5231,10 @@ TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) { if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) {
if (infoPtr->bNtfUnicode) if (infoPtr->bNtfUnicode)
return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
wParam, lParam); wParam, lParam);
else else
return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
wParam, lParam); wParam, lParam);
#if 0 #if 0
@ -5296,7 +5296,7 @@ TOOLBAR_Paint (HWND hwnd, WPARAM wParam)
PAINTSTRUCT ps; PAINTSTRUCT ps;
/* fill ps.rcPaint with a default rect */ /* fill ps.rcPaint with a default rect */
memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound)); memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound));
hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam; hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam;
@ -5319,7 +5319,7 @@ TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam, LPARAM lParam)
* Handles the WM_SETREDRAW message. * Handles the WM_SETREDRAW message.
* *
* Documentation: * Documentation:
* According to testing V4.71 of COMCTL32 returns the * According to testing V4.71 of COMCTL32 returns the
* *previous* status of the redraw flag (either 0 or 1) * *previous* status of the redraw flag (either 0 or 1)
* instead of the MSDN documented value of 0 if handled. * instead of the MSDN documented value of 0 if handled.
* (For laughs see the "consistancy" with same function * (For laughs see the "consistancy" with same function
@ -5330,7 +5330,7 @@ TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
BOOL oldredraw = infoPtr->bDoRedraw; BOOL oldredraw = infoPtr->bDoRedraw;
TRACE("set to %s\n", TRACE("set to %s\n",
(wParam) ? "TRUE" : "FALSE"); (wParam) ? "TRUE" : "FALSE");
infoPtr->bDoRedraw = (BOOL) wParam; infoPtr->bDoRedraw = (BOOL) wParam;
if (wParam) { if (wParam) {
@ -5384,7 +5384,7 @@ TOOLBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
* this sets the working width of the toolbar, and * this sets the working width of the toolbar, and
* Calc Toolbar will not adjust it, only the height * Calc Toolbar will not adjust it, only the height
*/ */
infoPtr->nWidth = parent_rect.right - parent_rect.left; infoPtr->nWidth = parent_rect.right - parent_rect.left;
cy = infoPtr->nHeight; cy = infoPtr->nHeight;
cx = infoPtr->nWidth; cx = infoPtr->nWidth;
TOOLBAR_CalcToolbar (hwnd); TOOLBAR_CalcToolbar (hwnd);
@ -5440,7 +5440,7 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle)
infoPtr->dwDTFlags = DT_CENTER; infoPtr->dwDTFlags = DT_CENTER;
} }
infoPtr->bTransparent = (lpStyle->styleNew & TBSTYLE_TRANSPARENT); infoPtr->bTransparent = (lpStyle->styleNew & TBSTYLE_TRANSPARENT);
infoPtr->bBtnTranspnt = (lpStyle->styleNew & infoPtr->bBtnTranspnt = (lpStyle->styleNew &
(TBSTYLE_FLAT | TBSTYLE_LIST)); (TBSTYLE_FLAT | TBSTYLE_LIST));
TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew); TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew);
} }
@ -5466,7 +5466,7 @@ TOOLBAR_SysColorChange (HWND hwnd)
static LRESULT WINAPI static LRESULT WINAPI
ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n",
hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam); hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
if (!TOOLBAR_GetInfoPtr(hwnd) && (uMsg != WM_NCCREATE)) if (!TOOLBAR_GetInfoPtr(hwnd) && (uMsg != WM_NCCREATE))
@ -5774,10 +5774,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TOOLBAR_MouseMove (hwnd, wParam, lParam); return TOOLBAR_MouseMove (hwnd, wParam, lParam);
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
return TOOLBAR_MouseLeave (hwnd, wParam, lParam); return TOOLBAR_MouseLeave (hwnd, wParam, lParam);
case WM_CAPTURECHANGED: case WM_CAPTURECHANGED:
return TOOLBAR_CaptureChanged(hwnd); return TOOLBAR_CaptureChanged(hwnd);
case WM_NCACTIVATE: case WM_NCACTIVATE:
return TOOLBAR_NCActivate (hwnd, wParam, lParam); return TOOLBAR_NCActivate (hwnd, wParam, lParam);
@ -5854,7 +5854,7 @@ TOOLBAR_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wndClass.lpszClassName = TOOLBARCLASSNAMEA; wndClass.lpszClassName = TOOLBARCLASSNAMEA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -61,7 +61,7 @@
* *
* infoPtr->nTool is the tool the mouse was on on the last relayed MM * infoPtr->nTool is the tool the mouse was on on the last relayed MM
* or timer expiry or -1 if the mouse was not on a tool. * or timer expiry or -1 if the mouse was not on a tool.
* *
* infoPtr->nCurrentTool is the tool for which the tip is currently * infoPtr->nCurrentTool is the tool for which the tip is currently
* displaying text for or -1 if the tip is not shown. Actually this * displaying text for or -1 if the tip is not shown. Actually this
* will only ever be infoPtr-nTool or -1, so it could be changed to a * will only ever be infoPtr-nTool or -1, so it could be changed to a
@ -97,7 +97,7 @@ typedef struct
HINSTANCE hinst; HINSTANCE hinst;
LPWSTR lpszText; LPWSTR lpszText;
LPARAM lParam; LPARAM lParam;
} TTTOOL_INFO; } TTTOOL_INFO;
typedef struct typedef struct
@ -285,7 +285,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
ReleaseDC (hwnd, hdc); ReleaseDC (hwnd, hdc);
lpSize->cx = rc.right - rc.left + 4 + lpSize->cx = rc.right - rc.left + 4 +
infoPtr->rcMargin.left + infoPtr->rcMargin.right; infoPtr->rcMargin.left + infoPtr->rcMargin.right;
lpSize->cy = rc.bottom - rc.top + 4 + lpSize->cy = rc.bottom - rc.top + 4 +
infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
@ -367,7 +367,7 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
else { else {
rc = toolPtr->rect; rc = toolPtr->rect;
MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2); MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2);
} }
rect.bottom = rc.top - 2; rect.bottom = rc.top - 2;
rect.top = rect.bottom - size.cy; rect.top = rect.bottom - size.cy;
} }
@ -535,7 +535,7 @@ TOOLTIPS_GetToolFromInfoA (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOA lpToolInfo)
for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) { for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
toolPtr = &infoPtr->tools[nTool]; toolPtr = &infoPtr->tools[nTool];
if (!(toolPtr->uFlags & TTF_IDISHWND) && if (!(toolPtr->uFlags & TTF_IDISHWND) &&
(lpToolInfo->hwnd == toolPtr->hwnd) && (lpToolInfo->hwnd == toolPtr->hwnd) &&
(lpToolInfo->uId == toolPtr->uId)) (lpToolInfo->uId == toolPtr->uId))
return nTool; return nTool;
@ -562,7 +562,7 @@ TOOLTIPS_GetToolFromInfoW (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFOW lpToolInfo)
for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) { for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
toolPtr = &infoPtr->tools[nTool]; toolPtr = &infoPtr->tools[nTool];
if (!(toolPtr->uFlags & TTF_IDISHWND) && if (!(toolPtr->uFlags & TTF_IDISHWND) &&
(lpToolInfo->hwnd == toolPtr->hwnd) && (lpToolInfo->hwnd == toolPtr->hwnd) &&
(lpToolInfo->uId == toolPtr->uId)) (lpToolInfo->uId == toolPtr->uId))
return nTool; return nTool;
@ -738,7 +738,7 @@ TOOLTIPS_AddToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpttsi == NULL) { if (lpttsi == NULL) {
lpttsi = lpttsi =
(LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO)); (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO));
lpttsi->wpOrigProc = lpttsi->wpOrigProc =
(WNDPROC)SetWindowLongA ((HWND)toolPtr->uId, (WNDPROC)SetWindowLongA ((HWND)toolPtr->uId,
GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);
lpttsi->hwndToolTip = hwnd; lpttsi->hwndToolTip = hwnd;
@ -755,7 +755,7 @@ TOOLTIPS_AddToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpttsi == NULL) { if (lpttsi == NULL) {
lpttsi = lpttsi =
(LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO)); (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO));
lpttsi->wpOrigProc = lpttsi->wpOrigProc =
(WNDPROC)SetWindowLongA (toolPtr->hwnd, (WNDPROC)SetWindowLongA (toolPtr->hwnd,
GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);
lpttsi->hwndToolTip = hwnd; lpttsi->hwndToolTip = hwnd;
@ -840,7 +840,7 @@ TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpttsi == NULL) { if (lpttsi == NULL) {
lpttsi = lpttsi =
(LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO)); (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO));
lpttsi->wpOrigProc = lpttsi->wpOrigProc =
(WNDPROC)SetWindowLongA ((HWND)toolPtr->uId, (WNDPROC)SetWindowLongA ((HWND)toolPtr->uId,
GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);
lpttsi->hwndToolTip = hwnd; lpttsi->hwndToolTip = hwnd;
@ -857,7 +857,7 @@ TOOLTIPS_AddToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpttsi == NULL) { if (lpttsi == NULL) {
lpttsi = lpttsi =
(LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO)); (LPTT_SUBCLASS_INFO)COMCTL32_Alloc (sizeof(TT_SUBCLASS_INFO));
lpttsi->wpOrigProc = lpttsi->wpOrigProc =
(WNDPROC)SetWindowLongA (toolPtr->hwnd, (WNDPROC)SetWindowLongA (toolPtr->hwnd,
GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc); GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);
lpttsi->hwndToolTip = hwnd; lpttsi->hwndToolTip = hwnd;
@ -896,9 +896,9 @@ TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* make sure the tooltip has disappeared before deleting it */ /* make sure the tooltip has disappeared before deleting it */
TOOLTIPS_Hide(hwnd, infoPtr); TOOLTIPS_Hide(hwnd, infoPtr);
/* delete text string */ /* delete text string */
toolPtr = &infoPtr->tools[nTool]; toolPtr = &infoPtr->tools[nTool];
if ((toolPtr->hinst) && (toolPtr->lpszText)) { if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) (HIWORD((INT)toolPtr->lpszText) != 0) )
@ -962,11 +962,11 @@ TOOLTIPS_DelToolA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->nTool == nTool) if (infoPtr->nTool == nTool)
{ {
/* no current tool (0 means first tool) */ /* no current tool (0 means first tool) */
infoPtr->nTool = -1; infoPtr->nTool = -1;
} }
infoPtr->uNumTools--; infoPtr->uNumTools--;
return 0; return 0;
} }
@ -992,10 +992,10 @@ TOOLTIPS_DelToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
TRACE("tool %d\n", nTool); TRACE("tool %d\n", nTool);
/* make sure the tooltip has disappeared before deleting it */ /* make sure the tooltip has disappeared before deleting it */
TOOLTIPS_Hide(hwnd, infoPtr); TOOLTIPS_Hide(hwnd, infoPtr);
/* delete text string */ /* delete text string */
toolPtr = &infoPtr->tools[nTool]; toolPtr = &infoPtr->tools[nTool];
if ((toolPtr->hinst) && (toolPtr->lpszText)) { if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) (HIWORD((INT)toolPtr->lpszText) != 0) )
@ -1059,11 +1059,11 @@ TOOLTIPS_DelToolW (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->nTool == nTool) if (infoPtr->nTool == nTool)
{ {
/* no current tool (0 means first tool) */ /* no current tool (0 means first tool) */
infoPtr->nTool = -1; infoPtr->nTool = -1;
} }
infoPtr->uNumTools--; infoPtr->uNumTools--;
return 0; return 0;
} }
@ -2044,7 +2044,7 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
toolPtr = &infoPtr->tools[i]; toolPtr = &infoPtr->tools[i];
if ((toolPtr->hinst) && (toolPtr->lpszText)) { if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
(HIWORD((INT)toolPtr->lpszText) != 0) ) (HIWORD((INT)toolPtr->lpszText) != 0) )
{ {
COMCTL32_Free (toolPtr->lpszText); COMCTL32_Free (toolPtr->lpszText);
toolPtr->lpszText = NULL; toolPtr->lpszText = NULL;
@ -2054,7 +2054,7 @@ TOOLTIPS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* remove subclassing */ /* remove subclassing */
if (toolPtr->uFlags & TTF_SUBCLASS) { if (toolPtr->uFlags & TTF_SUBCLASS) {
LPTT_SUBCLASS_INFO lpttsi; LPTT_SUBCLASS_INFO lpttsi;
if (toolPtr->uFlags & TTF_IDISHWND) { if (toolPtr->uFlags & TTF_IDISHWND) {
lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass);
if (lpttsi) { if (lpttsi) {
@ -2470,10 +2470,10 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_GETTEXT: case WM_GETTEXT:
return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam); return TOOLTIPS_OnWMGetText (hwnd, wParam, lParam);
case WM_GETTEXTLENGTH: case WM_GETTEXTLENGTH:
return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam); return TOOLTIPS_OnWMGetTextLength (hwnd, wParam, lParam);
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONUP: case WM_LBUTTONUP:
@ -2528,7 +2528,7 @@ TOOLTIPS_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = 0; wndClass.hbrBackground = 0;
wndClass.lpszClassName = TOOLTIPS_CLASSA; wndClass.lpszClassName = TOOLTIPS_CLASSA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -23,7 +23,7 @@
* - handle dragging slider better * - handle dragging slider better
* - better tic handling. * - better tic handling.
* - more notifications. * - more notifications.
* *
*/ */
/* known bugs: /* known bugs:
@ -76,10 +76,10 @@ typedef struct
#define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)GetWindowLongA (hwnd,0)) #define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)GetWindowLongA (hwnd,0))
/* Used by TRACKBAR_Refresh to find out which parts of the control /* Used by TRACKBAR_Refresh to find out which parts of the control
need to be recalculated */ need to be recalculated */
#define TB_THUMBPOSCHANGED 1 #define TB_THUMBPOSCHANGED 1
#define TB_THUMBSIZECHANGED 2 #define TB_THUMBSIZECHANGED 2
#define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBPOSCHANGED) #define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBPOSCHANGED)
#define TB_SELECTIONCHANGED 4 #define TB_SELECTIONCHANGED 4
@ -101,7 +101,7 @@ static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
{ {
int i,tic,nrTics; int i,tic,nrTics;
if (infoPtr->uTicFreq && infoPtr->nRangeMax >= infoPtr->nRangeMin) if (infoPtr->uTicFreq && infoPtr->nRangeMax >= infoPtr->nRangeMin)
nrTics=(infoPtr->nRangeMax - infoPtr->nRangeMin)/infoPtr->uTicFreq; nrTics=(infoPtr->nRangeMax - infoPtr->nRangeMin)/infoPtr->uTicFreq;
else { else {
nrTics=0; nrTics=0;
@ -112,7 +112,7 @@ static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
} }
if (nrTics!=infoPtr->uNumTics) { if (nrTics!=infoPtr->uNumTics) {
infoPtr->tics=COMCTL32_ReAlloc (infoPtr->tics, infoPtr->tics=COMCTL32_ReAlloc (infoPtr->tics,
(nrTics+1)*sizeof (DWORD)); (nrTics+1)*sizeof (DWORD));
infoPtr->uNumTics=nrTics; infoPtr->uNumTics=nrTics;
} }
@ -123,12 +123,12 @@ static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
} }
/* converts from physical (mouse) position to logical position /* converts from physical (mouse) position to logical position
(in range of trackbar) */ (in range of trackbar) */
static inline DOUBLE static inline DOUBLE
TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place, TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
int vertical) int vertical)
{ {
double range,width,pos; double range,width,pos;
@ -165,7 +165,7 @@ TRACKBAR_CalcChannel (HWND hwnd, TRACKBAR_INFO *infoPtr)
else else
cyChannel = 4; cyChannel = 4;
offsettop = (int)(infoPtr->uThumbLen/4.5); offsettop = (int)(infoPtr->uThumbLen/4.5);
offsetedge = (int)(infoPtr->uThumbLen/4.5) + 3; offsetedge = (int)(infoPtr->uThumbLen/4.5) + 3;
if (dwStyle & TBS_VERT) { if (dwStyle & TBS_VERT) {
@ -202,33 +202,33 @@ TRACKBAR_CalcThumb (HWND hwnd, TRACKBAR_INFO *infoPtr)
RECT *thumb; RECT *thumb;
int range, width, thumbdepth; int range, width, thumbdepth;
DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
thumb=&infoPtr->rcThumb; thumb=&infoPtr->rcThumb;
range=infoPtr->nRangeMax - infoPtr->nRangeMin; range=infoPtr->nRangeMax - infoPtr->nRangeMin;
thumbdepth = ((INT)((FLOAT)infoPtr->uThumbLen / 4.5) * 2) + 2; thumbdepth = ((INT)((FLOAT)infoPtr->uThumbLen / 4.5) * 2) + 2;
if (!range) return; /* FIXME: may this happen? */ if (!range) return; /* FIXME: may this happen? */
if (dwStyle & TBS_VERT) if (dwStyle & TBS_VERT)
{ {
width=infoPtr->rcChannel.bottom - infoPtr->rcChannel.top; width=infoPtr->rcChannel.bottom - infoPtr->rcChannel.top;
if (dwStyle & (TBS_BOTH | TBS_LEFT)) if (dwStyle & (TBS_BOTH | TBS_LEFT))
thumb->left = 10; thumb->left = 10;
else else
thumb-> left =2; thumb-> left =2;
thumb->right = thumb -> left + infoPtr->uThumbLen; thumb->right = thumb -> left + infoPtr->uThumbLen;
thumb->top = infoPtr->rcChannel.top + thumb->top = infoPtr->rcChannel.top +
(width*(infoPtr->nPos - infoPtr->nRangeMin))/range - (width*(infoPtr->nPos - infoPtr->nRangeMin))/range -
thumbdepth/2; thumbdepth/2;
thumb->bottom = thumb->top + thumbdepth; thumb->bottom = thumb->top + thumbdepth;
} }
else else
{ {
width=infoPtr->rcChannel.right - infoPtr->rcChannel.left; width=infoPtr->rcChannel.right - infoPtr->rcChannel.left;
thumb->left = infoPtr->rcChannel.left + thumb->left = infoPtr->rcChannel.left +
(width*(infoPtr->nPos - infoPtr->nRangeMin))/range - (width*(infoPtr->nPos - infoPtr->nRangeMin))/range -
thumbdepth/2; thumbdepth/2;
thumb->right = thumb->left + thumbdepth; thumb->right = thumb->left + thumbdepth;
if (dwStyle & (TBS_BOTH | TBS_TOP)) if (dwStyle & (TBS_BOTH | TBS_TOP))
@ -249,9 +249,9 @@ TRACKBAR_CalcSelection (HWND hwnd, TRACKBAR_INFO *infoPtr)
range=infoPtr->nRangeMax - infoPtr->nRangeMin; range=infoPtr->nRangeMax - infoPtr->nRangeMin;
width=infoPtr->rcChannel.right - infoPtr->rcChannel.left; width=infoPtr->rcChannel.right - infoPtr->rcChannel.left;
if (range <= 0) if (range <= 0)
SetRectEmpty (selection); SetRectEmpty (selection);
else else
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT) { if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT) {
selection->left = infoPtr->rcChannel.left + selection->left = infoPtr->rcChannel.left +
(width*infoPtr->nSelMin)/range; (width*infoPtr->nSelMin)/range;
@ -274,7 +274,7 @@ TRACKBAR_CalcSelection (HWND hwnd, TRACKBAR_INFO *infoPtr)
/* ticPos is in tic-units, not in pixels */ /* ticPos is in tic-units, not in pixels */
static VOID static VOID
TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
int flags, COLORREF clrTic) int flags, COLORREF clrTic)
{ {
RECT rcChannel=infoPtr->rcChannel; RECT rcChannel=infoPtr->rcChannel;
@ -292,9 +292,9 @@ TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
} }
if (flags & TIC_SELECTIONMARK) { if (flags & TIC_SELECTIONMARK) {
if (flags & TIC_SELECTIONMARKMIN) if (flags & TIC_SELECTIONMARKMIN)
x=rcChannel.left + (width*(ticPos - infoPtr->nRangeMin))/range - 1; x=rcChannel.left + (width*(ticPos - infoPtr->nRangeMin))/range - 1;
else else
x=rcChannel.left + (width*(ticPos - infoPtr->nRangeMin))/range + 1; x=rcChannel.left + (width*(ticPos - infoPtr->nRangeMin))/range + 1;
SetPixel (hdc, x,y+6*side, clrTic); SetPixel (hdc, x,y+6*side, clrTic);
@ -312,7 +312,7 @@ TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
if (flags & TIC_EDGE) { if (flags & TIC_EDGE) {
if (flags & TIC_LEFTEDGE) if (flags & TIC_LEFTEDGE)
x=rcChannel.left; x=rcChannel.left;
else else
x=rcChannel.right; x=rcChannel.right;
SetPixel (hdc, x,y+5*side, clrTic); SetPixel (hdc, x,y+5*side, clrTic);
@ -324,7 +324,7 @@ TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
} }
static VOID static VOID
TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
int flags, COLORREF clrTic) int flags, COLORREF clrTic)
{ {
RECT rcChannel=infoPtr->rcChannel; RECT rcChannel=infoPtr->rcChannel;
@ -343,9 +343,9 @@ TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
if (flags & TIC_SELECTIONMARK) { if (flags & TIC_SELECTIONMARK) {
if (flags & TIC_SELECTIONMARKMIN) if (flags & TIC_SELECTIONMARKMIN)
y=rcChannel.top + (width*(ticPos - infoPtr->nRangeMin))/range - 1; y=rcChannel.top + (width*(ticPos - infoPtr->nRangeMin))/range - 1;
else else
y=rcChannel.top + (width*(ticPos - infoPtr->nRangeMin))/range + 1; y=rcChannel.top + (width*(ticPos - infoPtr->nRangeMin))/range + 1;
SetPixel (hdc, x+6*side, y, clrTic); SetPixel (hdc, x+6*side, y, clrTic);
@ -363,7 +363,7 @@ TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
if (flags & TIC_EDGE) { if (flags & TIC_EDGE) {
if (flags & TIC_LEFTEDGE) if (flags & TIC_LEFTEDGE)
y=rcChannel.top; y=rcChannel.top;
else else
y=rcChannel.bottom; y=rcChannel.bottom;
SetPixel (hdc, x+5*side, y, clrTic); SetPixel (hdc, x+5*side, y, clrTic);
@ -376,23 +376,23 @@ TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
static VOID static VOID
TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
int flags, COLORREF clrTic) int flags, COLORREF clrTic)
{ {
if (flags & TBS_VERT) { if (flags & TBS_VERT) {
if ((flags & TBS_TOP) || (flags & TBS_BOTH)) if ((flags & TBS_TOP) || (flags & TBS_BOTH))
TRACKBAR_DrawVertTic (infoPtr, hdc, ticPos, TRACKBAR_DrawVertTic (infoPtr, hdc, ticPos,
flags | TBS_TOP , clrTic); flags | TBS_TOP , clrTic);
if (!(flags & TBS_TOP) || (flags & TBS_BOTH)) if (!(flags & TBS_TOP) || (flags & TBS_BOTH))
TRACKBAR_DrawVertTic (infoPtr, hdc, ticPos, flags, clrTic); TRACKBAR_DrawVertTic (infoPtr, hdc, ticPos, flags, clrTic);
return; return;
} }
if ((flags & TBS_TOP) || (flags & TBS_BOTH)) if ((flags & TBS_TOP) || (flags & TBS_BOTH))
TRACKBAR_DrawHorizTic (infoPtr, hdc, ticPos, flags | TBS_TOP , clrTic); TRACKBAR_DrawHorizTic (infoPtr, hdc, ticPos, flags | TBS_TOP , clrTic);
if (!(flags & TBS_TOP) || (flags & TBS_BOTH)) if (!(flags & TBS_TOP) || (flags & TBS_BOTH))
TRACKBAR_DrawHorizTic (infoPtr, hdc, ticPos, flags, clrTic); TRACKBAR_DrawHorizTic (infoPtr, hdc, ticPos, flags, clrTic);
} }
@ -411,8 +411,8 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
oldbr = SelectObject (hdc, hbr); oldbr = SelectObject (hdc, hbr);
SetPolyFillMode (hdc,WINDING); SetPolyFillMode (hdc,WINDING);
if (dwStyle & TBS_BOTH) if (dwStyle & TBS_BOTH)
{ {
points[0].x=thumb.right; points[0].x=thumb.right;
points[0].y=thumb.top; points[0].y=thumb.top;
@ -426,8 +426,8 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
points[4].y=points[0].y; points[4].y=points[0].y;
PointCount = 5; PointCount = 5;
BlackUntil = 3; BlackUntil = 3;
} }
else else
{ {
if (dwStyle & TBS_VERT) if (dwStyle & TBS_VERT)
{ {
@ -472,7 +472,7 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
points[1].x=thumb.right; points[1].x=thumb.right;
points[1].y=thumb.top + PointDepth; points[1].y=thumb.top + PointDepth;
points[2].x=thumb.right; points[2].x=thumb.right;
points[2].y=thumb.bottom; points[2].y=thumb.bottom;
points[3].x=thumb.left; points[3].x=thumb.left;
points[3].y=thumb.bottom; points[3].y=thumb.bottom;
points[4].x=thumb.left; points[4].x=thumb.left;
@ -497,7 +497,7 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
points[5].y=points[0].y; points[5].y=points[0].y;
} }
} }
} }
/* /*
@ -513,13 +513,13 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
/* /*
* Black part * Black part
*/ */
Polyline(hdc,points,BlackUntil); Polyline(hdc,points,BlackUntil);
SelectObject(hdc,oldpen); SelectObject(hdc,oldpen);
hpn = GetStockObject(WHITE_PEN); hpn = GetStockObject(WHITE_PEN);
SelectObject(hdc,hpn); SelectObject(hdc,hpn);
/* /*
* White Part * White Part
*/ */
@ -551,15 +551,15 @@ TRACKBAR_Refresh (HWND hwnd, HDC hdc)
infoPtr->nPos=infoPtr->dragPos; infoPtr->nPos=infoPtr->dragPos;
infoPtr->flags |= TB_THUMBPOSCHANGED; infoPtr->flags |= TB_THUMBPOSCHANGED;
} }
if (infoPtr->flags & TB_THUMBCHANGED) { if (infoPtr->flags & TB_THUMBCHANGED) {
TRACKBAR_CalcThumb (hwnd, infoPtr); TRACKBAR_CalcThumb (hwnd, infoPtr);
if (infoPtr->flags & TB_THUMBSIZECHANGED) if (infoPtr->flags & TB_THUMBSIZECHANGED)
TRACKBAR_CalcChannel (hwnd, infoPtr); TRACKBAR_CalcChannel (hwnd, infoPtr);
} }
if (infoPtr->flags & TB_SELECTIONCHANGED) if (infoPtr->flags & TB_SELECTIONCHANGED)
TRACKBAR_CalcSelection (hwnd, infoPtr); TRACKBAR_CalcSelection (hwnd, infoPtr);
infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED | infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED |
TB_DRAGPOSVALID); TB_DRAGPOSVALID);
/* draw channel */ /* draw channel */
@ -571,11 +571,11 @@ TRACKBAR_Refresh (HWND hwnd, HDC hdc)
if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */ if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
HBRUSH hbr = CreateSolidBrush (RGB(255,255,255)); HBRUSH hbr = CreateSolidBrush (RGB(255,255,255));
FillRect (hdc, &rcChannel, hbr); FillRect (hdc, &rcChannel, hbr);
if (((dwStyle & TBS_VERT) && if (((dwStyle & TBS_VERT) &&
(rcSelection.left!=rcSelection.right)) || (rcSelection.left!=rcSelection.right)) ||
((!(dwStyle & TBS_VERT)) && ((!(dwStyle & TBS_VERT)) &&
(rcSelection.left!=rcSelection.right))) { (rcSelection.left!=rcSelection.right))) {
hbr=CreateSolidBrush (COLOR_HIGHLIGHT); hbr=CreateSolidBrush (COLOR_HIGHLIGHT);
FillRect (hdc, &rcSelection, hbr); FillRect (hdc, &rcSelection, hbr);
} }
DeleteObject (hbr); DeleteObject (hbr);
@ -588,27 +588,27 @@ TRACKBAR_Refresh (HWND hwnd, HDC hdc)
int ticFlags = dwStyle & 0x0f; int ticFlags = dwStyle & 0x0f;
COLORREF clrTic=GetSysColor (COLOR_3DDKSHADOW); COLORREF clrTic=GetSysColor (COLOR_3DDKSHADOW);
for (i=0; i<infoPtr->uNumTics; i++) for (i=0; i<infoPtr->uNumTics; i++)
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->tics[i], TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->tics[i],
ticFlags, clrTic); ticFlags, clrTic);
TRACKBAR_DrawTics (infoPtr, hdc, 0, ticFlags | TIC_LEFTEDGE, clrTic); TRACKBAR_DrawTics (infoPtr, hdc, 0, ticFlags | TIC_LEFTEDGE, clrTic);
TRACKBAR_DrawTics (infoPtr, hdc, 0, ticFlags | TIC_RIGHTEDGE, clrTic); TRACKBAR_DrawTics (infoPtr, hdc, 0, ticFlags | TIC_RIGHTEDGE, clrTic);
if ((dwStyle & TBS_ENABLESELRANGE) && if ((dwStyle & TBS_ENABLESELRANGE) &&
(rcSelection.left!=rcSelection.right)) { (rcSelection.left!=rcSelection.right)) {
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->nSelMin, TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->nSelMin,
ticFlags | TIC_SELECTIONMARKMIN, clrTic); ticFlags | TIC_SELECTIONMARKMIN, clrTic);
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->nSelMax, TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->nSelMax,
ticFlags | TIC_SELECTIONMARKMAX, clrTic); ticFlags | TIC_SELECTIONMARKMAX, clrTic);
} }
} }
/* draw thumb */ /* draw thumb */
if (!(dwStyle & TBS_NOTHUMB)) if (!(dwStyle & TBS_NOTHUMB))
{ {
TRACKBAR_DrawThumb(infoPtr,hdc,dwStyle); TRACKBAR_DrawThumb(infoPtr,hdc,dwStyle);
} }
if (infoPtr->bFocus) if (infoPtr->bFocus)
@ -678,7 +678,7 @@ TRACKBAR_ClearSel (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nSelMax = 0; infoPtr->nSelMax = 0;
infoPtr->flags |= TB_SELECTIONCHANGED; infoPtr->flags |= TB_SELECTIONCHANGED;
if ((BOOL)wParam) if ((BOOL)wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -696,7 +696,7 @@ TRACKBAR_ClearTics (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->uNumTics = 0; infoPtr->uNumTics = 0;
} }
if (wParam) if (wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -821,7 +821,7 @@ static LRESULT
TRACKBAR_GetPTics (HWND hwnd) TRACKBAR_GetPTics (HWND hwnd)
{ {
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd); TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
return (LRESULT) infoPtr->tics; return (LRESULT) infoPtr->tics;
} }
@ -830,17 +830,17 @@ TRACKBAR_GetThumbRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd); TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
LPRECT lprc = (LPRECT)lParam; LPRECT lprc = (LPRECT)lParam;
if (lprc == NULL) if (lprc == NULL)
return 0; return 0;
lprc->left = infoPtr->rcThumb.left; lprc->left = infoPtr->rcThumb.left;
lprc->right = infoPtr->rcThumb.right; lprc->right = infoPtr->rcThumb.right;
lprc->bottom = infoPtr->rcThumb.bottom; lprc->bottom = infoPtr->rcThumb.bottom;
lprc->top = infoPtr->rcThumb.top; lprc->top = infoPtr->rcThumb.top;
return 0; return 0;
} }
static LRESULT static LRESULT
@ -850,7 +850,7 @@ TRACKBAR_GetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT iTic; INT iTic;
iTic=(INT) wParam; iTic=(INT) wParam;
if ((iTic<0) || (iTic>infoPtr->uNumTics)) if ((iTic<0) || (iTic>infoPtr->uNumTics))
return -1; return -1;
return (LRESULT) infoPtr->tics[iTic]; return (LRESULT) infoPtr->tics[iTic];
@ -863,10 +863,10 @@ TRACKBAR_GetTicPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd); TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
INT iTic, range, width, pos; INT iTic, range, width, pos;
iTic=(INT ) wParam; iTic=(INT ) wParam;
if ((iTic<0) || (iTic>infoPtr->uNumTics)) if ((iTic<0) || (iTic>infoPtr->uNumTics))
return -1; return -1;
range=infoPtr->nRangeMax - infoPtr->nRangeMin; range=infoPtr->nRangeMax - infoPtr->nRangeMin;
@ -957,7 +957,7 @@ TRACKBAR_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nPos = infoPtr->nRangeMax; infoPtr->nPos = infoPtr->nRangeMax;
infoPtr->flags |= TB_THUMBPOSCHANGED; infoPtr->flags |= TB_THUMBPOSCHANGED;
if (wParam) if (wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -1009,7 +1009,7 @@ TRACKBAR_SetRangeMax (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nPageSize = 1; infoPtr->nPageSize = 1;
TRACKBAR_RecalculateTics (infoPtr); TRACKBAR_RecalculateTics (infoPtr);
if (wParam) if (wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -1043,16 +1043,16 @@ static LRESULT
TRACKBAR_SetTicFreq (HWND hwnd, WPARAM wParam) TRACKBAR_SetTicFreq (HWND hwnd, WPARAM wParam)
{ {
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd); TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_AUTOTICKS) if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_AUTOTICKS)
infoPtr->uTicFreq=(UINT) wParam; infoPtr->uTicFreq=(UINT) wParam;
TRACKBAR_RecalculateTics (infoPtr); TRACKBAR_RecalculateTics (infoPtr);
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
} }
static LRESULT static LRESULT
@ -1072,7 +1072,7 @@ TRACKBAR_SetSel (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->nSelMax > infoPtr->nRangeMax) if (infoPtr->nSelMax > infoPtr->nRangeMax)
infoPtr->nSelMax = infoPtr->nRangeMax; infoPtr->nSelMax = infoPtr->nRangeMax;
if (wParam) if (wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
@ -1090,11 +1090,11 @@ TRACKBAR_SetSelEnd (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nSelMax = (INT)lParam; infoPtr->nSelMax = (INT)lParam;
infoPtr->flags |= TB_SELECTIONCHANGED; infoPtr->flags |= TB_SELECTIONCHANGED;
if (infoPtr->nSelMax > infoPtr->nRangeMax) if (infoPtr->nSelMax > infoPtr->nRangeMax)
infoPtr->nSelMax = infoPtr->nRangeMax; infoPtr->nSelMax = infoPtr->nRangeMax;
if (wParam) if (wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -1115,7 +1115,7 @@ TRACKBAR_SetSelStart (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->nSelMin < infoPtr->nRangeMin) if (infoPtr->nSelMin < infoPtr->nRangeMin)
infoPtr->nSelMin = infoPtr->nRangeMin; infoPtr->nSelMin = infoPtr->nRangeMin;
if (wParam) if (wParam)
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -1165,7 +1165,7 @@ TRACKBAR_SetTipSide (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT fTemp = infoPtr->fLocation; INT fTemp = infoPtr->fLocation;
infoPtr->fLocation = (INT)wParam; infoPtr->fLocation = (INT)wParam;
return fTemp; return fTemp;
} }
@ -1322,7 +1322,7 @@ TRACKBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->flags |= TB_SHOW_TOOLTIP; infoPtr->flags |= TB_SHOW_TOOLTIP;
SetCapture (hwnd); SetCapture (hwnd);
SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE, SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE,
(WPARAM)TRUE, (LPARAM)&ti); (WPARAM)TRUE, (LPARAM)&ti);
} }
return 0; return 0;
@ -1338,7 +1338,7 @@ TRACKBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
else else
clickPlace=(INT)LOWORD(lParam); clickPlace=(INT)LOWORD(lParam);
clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace, clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace,
vertical); vertical);
prevPos = infoPtr->nPos; prevPos = infoPtr->nPos;
if (clickPos > (int)prevPos) if (clickPos > (int)prevPos)
@ -1346,22 +1346,22 @@ TRACKBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nPos += infoPtr->nPageSize; infoPtr->nPos += infoPtr->nPageSize;
if (infoPtr->nPos > infoPtr->nRangeMax) if (infoPtr->nPos > infoPtr->nRangeMax)
infoPtr->nPos = infoPtr->nRangeMax; infoPtr->nPos = infoPtr->nRangeMax;
TRACKBAR_SendNotify (hwnd, TB_PAGEUP); TRACKBAR_SendNotify (hwnd, TB_PAGEUP);
} }
else else
{ {
infoPtr->nPos -= infoPtr->nPageSize; /* similar to VK_PRIOR */ infoPtr->nPos -= infoPtr->nPageSize; /* similar to VK_PRIOR */
if (infoPtr->nPos < infoPtr->nRangeMin) if (infoPtr->nPos < infoPtr->nRangeMin)
infoPtr->nPos = infoPtr->nRangeMin; infoPtr->nPos = infoPtr->nRangeMin;
TRACKBAR_SendNotify (hwnd, TB_PAGEDOWN); TRACKBAR_SendNotify (hwnd, TB_PAGEDOWN);
} }
if (prevPos!=infoPtr->nPos) { if (prevPos!=infoPtr->nPos) {
infoPtr->flags |= TB_THUMBPOSCHANGED; infoPtr->flags |= TB_THUMBPOSCHANGED;
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
} }
} }
return 0; return 0;
} }
@ -1390,7 +1390,7 @@ TRACKBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE, SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE,
(WPARAM)FALSE, (LPARAM)&ti); (WPARAM)FALSE, (LPARAM)&ti);
} }
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
return 0; return 0;
@ -1401,12 +1401,12 @@ static LRESULT
TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam) TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd); TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
if (infoPtr->flags & TB_DRAGPOSVALID) { if (infoPtr->flags & TB_DRAGPOSVALID) {
infoPtr->nPos=infoPtr->dragPos; infoPtr->nPos=infoPtr->dragPos;
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
} }
infoPtr->flags &= ~ TB_DRAGPOSVALID; infoPtr->flags &= ~ TB_DRAGPOSVALID;
TRACKBAR_SendNotify (hwnd, TB_ENDTRACK); TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
@ -1459,11 +1459,11 @@ TRACKBAR_SendNotify (HWND hwnd, UINT code)
{ {
TRACE("%x\n",code); TRACE("%x\n",code);
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT) if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_VERT)
return (BOOL) SendMessageA (GetParent (hwnd), return (BOOL) SendMessageA (GetParent (hwnd),
WM_VSCROLL, (WPARAM)code, (LPARAM)hwnd); WM_VSCROLL, (WPARAM)code, (LPARAM)hwnd);
return (BOOL) SendMessageA (GetParent (hwnd), return (BOOL) SendMessageA (GetParent (hwnd),
WM_HSCROLL, (WPARAM)code, (LPARAM)hwnd); WM_HSCROLL, (WPARAM)code, (LPARAM)hwnd);
} }
@ -1476,7 +1476,7 @@ TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
SHORT clickPlace; SHORT clickPlace;
DOUBLE dragPos; DOUBLE dragPos;
char buf[80]; char buf[80];
TRACE("%x\n",wParam); TRACE("%x\n",wParam);
if (dwStyle & TBS_VERT) if (dwStyle & TBS_VERT)
@ -1488,7 +1488,7 @@ TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
SetCapture (hwnd); SetCapture (hwnd);
dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace, dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
dwStyle & TBS_VERT); dwStyle & TBS_VERT);
if (dragPos > ((INT)dragPos) + 0.5) if (dragPos > ((INT)dragPos) + 0.5)
infoPtr->dragPos = dragPos + 1; infoPtr->dragPos = dragPos + 1;
@ -1501,7 +1501,7 @@ TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->flags & TB_SHOW_TOOLTIP) { if (infoPtr->flags & TB_SHOW_TOOLTIP) {
POINT pt; POINT pt;
TTTOOLINFOA ti; TTTOOLINFOA ti;
ti.cbSize = sizeof(TTTOOLINFOA); ti.cbSize = sizeof(TTTOOLINFOA);
ti.hwnd = hwnd; ti.hwnd = hwnd;
ti.uId = 0; ti.uId = 0;
@ -1509,12 +1509,12 @@ TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
sprintf (buf,"%d",infoPtr->nPos); sprintf (buf,"%d",infoPtr->nPos);
ti.lpszText = (LPSTR) buf; ti.lpszText = (LPSTR) buf;
GetCursorPos (&pt); GetCursorPos (&pt);
if (dwStyle & TBS_VERT) { if (dwStyle & TBS_VERT) {
SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION, SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION,
0, (LPARAM)MAKELPARAM(pt.x+5, pt.y+15)); 0, (LPARAM)MAKELPARAM(pt.x+5, pt.y+15));
} else { } else {
SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION, SendMessageA (infoPtr->hwndToolTip, TTM_TRACKPOSITION,
0, (LPARAM)MAKELPARAM(pt.x+15, pt.y+5)); 0, (LPARAM)MAKELPARAM(pt.x+15, pt.y+5));
} }
SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA, SendMessageA (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTA,
@ -1539,48 +1539,48 @@ TRACKBAR_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
pos=infoPtr->nPos; pos=infoPtr->nPos;
switch (wParam) { switch (wParam) {
case VK_LEFT: case VK_LEFT:
case VK_UP: case VK_UP:
if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE; if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE;
infoPtr->nPos -= infoPtr->nLineSize; infoPtr->nPos -= infoPtr->nLineSize;
if (infoPtr->nPos < infoPtr->nRangeMin) if (infoPtr->nPos < infoPtr->nRangeMin)
infoPtr->nPos = infoPtr->nRangeMin; infoPtr->nPos = infoPtr->nRangeMin;
TRACKBAR_SendNotify (hwnd, TB_LINEUP); TRACKBAR_SendNotify (hwnd, TB_LINEUP);
break; break;
case VK_RIGHT: case VK_RIGHT:
case VK_DOWN: case VK_DOWN:
if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE; if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE;
infoPtr->nPos += infoPtr->nLineSize; infoPtr->nPos += infoPtr->nLineSize;
if (infoPtr->nPos > infoPtr->nRangeMax) if (infoPtr->nPos > infoPtr->nRangeMax)
infoPtr->nPos = infoPtr->nRangeMax; infoPtr->nPos = infoPtr->nRangeMax;
TRACKBAR_SendNotify (hwnd, TB_LINEDOWN); TRACKBAR_SendNotify (hwnd, TB_LINEDOWN);
break; break;
case VK_NEXT: case VK_NEXT:
if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE; if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE;
infoPtr->nPos += infoPtr->nPageSize; infoPtr->nPos += infoPtr->nPageSize;
if (infoPtr->nPos > infoPtr->nRangeMax) if (infoPtr->nPos > infoPtr->nRangeMax)
infoPtr->nPos = infoPtr->nRangeMax; infoPtr->nPos = infoPtr->nRangeMax;
TRACKBAR_SendNotify (hwnd, TB_PAGEUP); TRACKBAR_SendNotify (hwnd, TB_PAGEUP);
break; break;
case VK_PRIOR: case VK_PRIOR:
if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE; if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE;
infoPtr->nPos -= infoPtr->nPageSize; infoPtr->nPos -= infoPtr->nPageSize;
if (infoPtr->nPos < infoPtr->nRangeMin) if (infoPtr->nPos < infoPtr->nRangeMin)
infoPtr->nPos = infoPtr->nRangeMin; infoPtr->nPos = infoPtr->nRangeMin;
TRACKBAR_SendNotify (hwnd, TB_PAGEDOWN); TRACKBAR_SendNotify (hwnd, TB_PAGEDOWN);
break; break;
case VK_HOME: case VK_HOME:
if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE; if (infoPtr->nPos == infoPtr->nRangeMin) return FALSE;
infoPtr->nPos = infoPtr->nRangeMin; infoPtr->nPos = infoPtr->nRangeMin;
TRACKBAR_SendNotify (hwnd, TB_TOP); TRACKBAR_SendNotify (hwnd, TB_TOP);
break; break;
case VK_END: case VK_END:
if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE; if (infoPtr->nPos == infoPtr->nRangeMax) return FALSE;
infoPtr->nPos = infoPtr->nRangeMax; infoPtr->nPos = infoPtr->nRangeMax;
TRACKBAR_SendNotify (hwnd, TB_BOTTOM); TRACKBAR_SendNotify (hwnd, TB_BOTTOM);
break; break;
} }
if (pos!=infoPtr->nPos) { if (pos!=infoPtr->nPos) {
infoPtr->flags |=TB_THUMBPOSCHANGED; infoPtr->flags |=TB_THUMBPOSCHANGED;
InvalidateRect (hwnd, NULL, FALSE); InvalidateRect (hwnd, NULL, FALSE);
} }
@ -1594,12 +1594,12 @@ TRACKBAR_KeyUp (HWND hwnd, WPARAM wParam)
{ {
switch (wParam) { switch (wParam) {
case VK_LEFT: case VK_LEFT:
case VK_UP: case VK_UP:
case VK_RIGHT: case VK_RIGHT:
case VK_DOWN: case VK_DOWN:
case VK_NEXT: case VK_NEXT:
case VK_PRIOR: case VK_PRIOR:
case VK_HOME: case VK_HOME:
case VK_END: case VK_END:
TRACKBAR_SendNotify (hwnd, TB_ENDTRACK); TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
} }
@ -1662,10 +1662,10 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case TBM_GETTIC: case TBM_GETTIC:
return TRACKBAR_GetTic (hwnd, wParam, lParam); return TRACKBAR_GetTic (hwnd, wParam, lParam);
case TBM_GETTICPOS: case TBM_GETTICPOS:
return TRACKBAR_GetTicPos (hwnd, wParam, lParam); return TRACKBAR_GetTicPos (hwnd, wParam, lParam);
case TBM_GETTOOLTIPS: case TBM_GETTOOLTIPS:
return TRACKBAR_GetToolTips (hwnd, wParam, lParam); return TRACKBAR_GetToolTips (hwnd, wParam, lParam);
@ -1738,7 +1738,7 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_KEYDOWN: case WM_KEYDOWN:
return TRACKBAR_KeyDown (hwnd, wParam, lParam); return TRACKBAR_KeyDown (hwnd, wParam, lParam);
case WM_KEYUP: case WM_KEYUP:
return TRACKBAR_KeyUp (hwnd, wParam); return TRACKBAR_KeyUp (hwnd, wParam);
@ -1789,7 +1789,7 @@ TRACKBAR_Register (void)
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA); wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wndClass.lpszClassName = TRACKBAR_CLASSA; wndClass.lpszClassName = TRACKBAR_CLASSA;
RegisterClassA (&wndClass); RegisterClassA (&wndClass);
} }

View File

@ -154,7 +154,7 @@ typedef struct tagTREEVIEW_INFO
#define TV_LDRAG 0x04 /* Lbutton pushed to start drag */ #define TV_LDRAG 0x04 /* Lbutton pushed to start drag */
#define TV_LDRAGGING 0x08 /* Lbutton pushed, mouse moved. */ #define TV_LDRAGGING 0x08 /* Lbutton pushed, mouse moved. */
#define TV_RDRAG 0x10 /* dito Rbutton */ #define TV_RDRAG 0x10 /* dito Rbutton */
#define TV_RDRAGGING 0x20 #define TV_RDRAGGING 0x20
/* bitflags for infoPtr->timer */ /* bitflags for infoPtr->timer */
@ -309,7 +309,7 @@ TREEVIEW_GetLastListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
} }
/*************************************************************************** /***************************************************************************
* This method returns the previous non-hidden item in the list not * This method returns the previous non-hidden item in the list not
* considering the tree hierarchy. * considering the tree hierarchy.
*/ */
static TREEVIEW_ITEM * static TREEVIEW_ITEM *
@ -334,7 +334,7 @@ TREEVIEW_GetPrevListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
/*************************************************************************** /***************************************************************************
* This method returns the next physical item in the treeview not * This method returns the next physical item in the treeview not
* considering the tree hierarchy. * considering the tree hierarchy.
*/ */
static TREEVIEW_ITEM * static TREEVIEW_ITEM *
@ -342,7 +342,7 @@ TREEVIEW_GetNextListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
{ {
assert(tvItem != NULL); assert(tvItem != NULL);
/* /*
* If this item has children and is expanded, return the first child * If this item has children and is expanded, return the first child
*/ */
if ((tvItem->state & TVIS_EXPANDED) && tvItem->firstChild != NULL) if ((tvItem->state & TVIS_EXPANDED) && tvItem->firstChild != NULL)
@ -372,7 +372,7 @@ TREEVIEW_GetNextListItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *tvItem)
} }
/*************************************************************************** /***************************************************************************
* This method returns the nth item starting at the given item. It returns * This method returns the nth item starting at the given item. It returns
* the last item (or first) we we run out of items. * the last item (or first) we we run out of items.
* *
* Will scroll backward if count is <0. * Will scroll backward if count is <0.
@ -687,7 +687,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
TREEVIEW_SendRealNotify(infoPtr, TREEVIEW_SendRealNotify(infoPtr,
(WPARAM)callback.hdr.idFrom, (LPARAM)&callback); (WPARAM)callback.hdr.idFrom, (LPARAM)&callback);
/* It may have changed due to a call to SetItem. */ /* It may have changed due to a call to SetItem. */
mask &= wineItem->callbackMask; mask &= wineItem->callbackMask;
if ((mask & TVIF_TEXT) && callback.item.pszText != wineItem->pszText) if ((mask & TVIF_TEXT) && callback.item.pszText != wineItem->pszText)
@ -696,7 +696,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
if (infoPtr->bNtfUnicode) { if (infoPtr->bNtfUnicode) {
LPWSTR newText; LPWSTR newText;
int buflen; int buflen;
int len = WideCharToMultiByte( CP_ACP, 0, int len = WideCharToMultiByte( CP_ACP, 0,
(LPWSTR)callback.item.pszText, -1, (LPWSTR)callback.item.pszText, -1,
NULL, 0, NULL, NULL ); NULL, 0, NULL, NULL );
buflen = max((len+1)*sizeof(WCHAR), TEXT_CALLBACK_SIZE); buflen = max((len+1)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
@ -708,16 +708,16 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
if (newText) if (newText)
{ {
wineItem->pszText = (LPSTR)newText; wineItem->pszText = (LPSTR)newText;
WideCharToMultiByte( CP_ACP, 0, WideCharToMultiByte( CP_ACP, 0,
(LPWSTR)callback.item.pszText, -1, (LPWSTR)callback.item.pszText, -1,
wineItem->pszText, buflen, wineItem->pszText, buflen,
NULL, NULL ); NULL, NULL );
wineItem->cchTextMax = buflen; wineItem->cchTextMax = buflen;
} }
/* If ReAlloc fails we have nothing to do, but keep original text */ /* If ReAlloc fails we have nothing to do, but keep original text */
} }
else { else {
int len = max(lstrlenA(callback.item.pszText) + 1, int len = max(lstrlenA(callback.item.pszText) + 1,
TEXT_CALLBACK_SIZE); TEXT_CALLBACK_SIZE);
LPSTR newText = COMCTL32_ReAlloc(wineItem->pszText, len); LPSTR newText = COMCTL32_ReAlloc(wineItem->pszText, len);
@ -739,7 +739,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
LPWSTR newText; LPWSTR newText;
LPSTR oldText = NULL; LPSTR oldText = NULL;
int buflen; int buflen;
int len = WideCharToMultiByte( CP_ACP, 0, int len = WideCharToMultiByte( CP_ACP, 0,
(LPWSTR)callback.item.pszText, -1, (LPWSTR)callback.item.pszText, -1,
NULL, 0, NULL, NULL ); NULL, 0, NULL, NULL );
buflen = max((len+1)*sizeof(WCHAR), TEXT_CALLBACK_SIZE); buflen = max((len+1)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
@ -752,7 +752,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
{ {
oldText = wineItem->pszText; oldText = wineItem->pszText;
wineItem->pszText = (LPSTR)newText; wineItem->pszText = (LPSTR)newText;
WideCharToMultiByte( CP_ACP, 0, WideCharToMultiByte( CP_ACP, 0,
(LPWSTR)callback.item.pszText, -1, (LPWSTR)callback.item.pszText, -1,
wineItem->pszText, buflen, NULL, NULL ); wineItem->pszText, buflen, NULL, NULL );
wineItem->cchTextMax = buflen; wineItem->cchTextMax = buflen;
@ -761,7 +761,7 @@ TREEVIEW_UpdateDispInfo(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
} }
} }
} }
if (mask & TVIF_IMAGE) if (mask & TVIF_IMAGE)
wineItem->iImage = callback.item.iImage; wineItem->iImage = callback.item.iImage;
@ -1240,7 +1240,7 @@ TREEVIEW_InsertItemA(TREEVIEW_INFO *infoPtr, LPARAM lParam)
/* This will help us to exit if there is no more sibling */ /* This will help us to exit if there is no more sibling */
aChild = (aChild->nextSibling == 0) aChild = (aChild->nextSibling == 0)
? NULL ? NULL
: aChild->nextSibling; : aChild->nextSibling;
/* Look at the next item */ /* Look at the next item */
@ -1248,9 +1248,9 @@ TREEVIEW_InsertItemA(TREEVIEW_INFO *infoPtr, LPARAM lParam)
} }
else if (comp == 0) else if (comp == 0)
{ {
/* /*
* An item with this name is already existing, therefore, * An item with this name is already existing, therefore,
* we add after the one we found * we add after the one we found
*/ */
TREEVIEW_InsertAfter(newItem, aChild, parentItem); TREEVIEW_InsertAfter(newItem, aChild, parentItem);
bItemInserted = TRUE; bItemInserted = TRUE;
@ -1258,7 +1258,7 @@ TREEVIEW_InsertItemA(TREEVIEW_INFO *infoPtr, LPARAM lParam)
} }
} }
/* /*
* we reach the end of the child list and the item has not * we reach the end of the child list and the item has not
* yet been inserted, therefore, insert it after the last child. * yet been inserted, therefore, insert it after the last child.
*/ */
@ -1304,7 +1304,7 @@ TREEVIEW_InsertItemA(TREEVIEW_INFO *infoPtr, LPARAM lParam)
TREEVIEW_ComputeTextWidth(infoPtr, newItem, 0); TREEVIEW_ComputeTextWidth(infoPtr, newItem, 0);
TREEVIEW_UpdateScrollBars(infoPtr); TREEVIEW_UpdateScrollBars(infoPtr);
/* /*
* if the item was inserted in a visible part of the tree, * if the item was inserted in a visible part of the tree,
* invalidate it, as well as those after it * invalidate it, as well as those after it
*/ */
for (item = newItem; for (item = newItem;
@ -1435,8 +1435,8 @@ TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem)
{ {
TRACE("%p, (%s)\n", wineItem, TREEVIEW_ItemName(wineItem)); TRACE("%p, (%s)\n", wineItem, TREEVIEW_ItemName(wineItem));
TREEVIEW_SendTreeviewNotify(infoPtr, TREEVIEW_SendTreeviewNotify(infoPtr,
(infoPtr->bNtfUnicode) ? TVN_DELETEITEMW : (infoPtr->bNtfUnicode) ? TVN_DELETEITEMW :
TVN_DELETEITEMA, TVN_DELETEITEMA,
TVIF_HANDLE | TVIF_PARAM, 0, wineItem, 0); TVIF_HANDLE | TVIF_PARAM, 0, wineItem, 0);
@ -1933,9 +1933,9 @@ TREEVIEW_GetItemRect(TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect)
if (!TREEVIEW_ValidItem(infoPtr, wineItem) || !ISVISIBLE(wineItem)) if (!TREEVIEW_ValidItem(infoPtr, wineItem) || !ISVISIBLE(wineItem))
return FALSE; return FALSE;
/* /*
* If wParam is TRUE return the text size otherwise return * If wParam is TRUE return the text size otherwise return
* the whole item size * the whole item size
*/ */
if (fTextRect) if (fTextRect)
{ {
@ -2141,7 +2141,7 @@ TREEVIEW_SetItemW(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem)
len ++; len ++;
tvItemA.pszText = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); tvItemA.pszText = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
len = WideCharToMultiByte(CP_ACP, 0, tvItem->pszText, -1, len = WideCharToMultiByte(CP_ACP, 0, tvItem->pszText, -1,
tvItemA.pszText ,len*sizeof(WCHAR), tvItemA.pszText ,len*sizeof(WCHAR),
NULL,NULL); NULL,NULL);
} }
else else
@ -2300,7 +2300,7 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
HPEN hOldPen, hNewPen; HPEN hOldPen, hNewPen;
HTREEITEM parent; HTREEITEM parent;
/* /*
* Get a dotted grey pen * Get a dotted grey pen
*/ */
hNewPen = CreatePen(PS_ALTERNATE, 0, infoPtr->clrLine); hNewPen = CreatePen(PS_ALTERNATE, 0, infoPtr->clrLine);
@ -2342,7 +2342,7 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
DeleteObject(hNewPen); DeleteObject(hNewPen);
} }
/* /*
* Display the (+/-) signs * Display the (+/-) signs
*/ */
@ -2419,7 +2419,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
centery = (wineItem->rect.top + wineItem->rect.bottom) / 2; centery = (wineItem->rect.top + wineItem->rect.bottom) / 2;
/* /*
* Display the images associated with this item * Display the images associated with this item
*/ */
{ {
@ -2439,7 +2439,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
} }
/* Now, draw the normal image; can be either selected or /* Now, draw the normal image; can be either selected or
* non-selected image. * non-selected image.
*/ */
if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage)) if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage))
@ -2465,7 +2465,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
} }
/* /*
* Display the text associated with this item * Display the text associated with this item
*/ */
@ -2813,7 +2813,7 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam)
GetObjectA(hbitmap, sizeof(BITMAP), &bitmap); GetObjectA(hbitmap, sizeof(BITMAP), &bitmap);
rc.left = 0; rc.top = 0; rc.left = 0; rc.top = 0;
rc.right = bitmap.bmWidth; rc.right = bitmap.bmWidth;
rc.bottom = bitmap.bmHeight; rc.bottom = bitmap.bmHeight;
TREEVIEW_EraseBackground(infoPtr, wParam); TREEVIEW_EraseBackground(infoPtr, wParam);
} }
} }
@ -3050,7 +3050,7 @@ TREEVIEW_SendExpanding(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
UINT action) UINT action)
{ {
return !TREEVIEW_SendTreeviewNotify(infoPtr, return !TREEVIEW_SendTreeviewNotify(infoPtr,
(infoPtr->bNtfUnicode) ? TVN_ITEMEXPANDINGW : (infoPtr->bNtfUnicode) ? TVN_ITEMEXPANDINGW :
TVN_ITEMEXPANDINGA, TVN_ITEMEXPANDINGA,
action, action,
TVIF_HANDLE | TVIF_STATE | TVIF_PARAM TVIF_HANDLE | TVIF_STATE | TVIF_PARAM
@ -3062,8 +3062,8 @@ static VOID
TREEVIEW_SendExpanded(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, TREEVIEW_SendExpanded(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
UINT action) UINT action)
{ {
TREEVIEW_SendTreeviewNotify(infoPtr, TREEVIEW_SendTreeviewNotify(infoPtr,
(infoPtr->bNtfUnicode) ? TVN_ITEMEXPANDEDW : (infoPtr->bNtfUnicode) ? TVN_ITEMEXPANDEDW :
TVN_ITEMEXPANDEDA, TVN_ITEMEXPANDEDA,
action, action,
TVIF_HANDLE | TVIF_STATE | TVIF_PARAM TVIF_HANDLE | TVIF_STATE | TVIF_PARAM
@ -3240,8 +3240,8 @@ TREEVIEW_ExpandAll(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
} }
/* Note:If the specified item is the child of a collapsed parent item, /* Note:If the specified item is the child of a collapsed parent item,
the parent's list of child items is (recursively) expanded to reveal the the parent's list of child items is (recursively) expanded to reveal the
specified item. This is mentioned for TREEVIEW_SelectItem; don't specified item. This is mentioned for TREEVIEW_SelectItem; don't
know if it also applies here. know if it also applies here.
*/ */
@ -3461,8 +3461,8 @@ TREEVIEW_Command(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{ {
case EN_UPDATE: case EN_UPDATE:
{ {
/* /*
* Adjust the edit window size * Adjust the edit window size
*/ */
char buffer[1024]; char buffer[1024];
TREEVIEW_ITEM *editItem = infoPtr->selectedItem; TREEVIEW_ITEM *editItem = infoPtr->selectedItem;
@ -3897,8 +3897,8 @@ TREEVIEW_LButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
if (TREEVIEW_SendSimpleNotify(infoPtr, NM_CLICK)) if (TREEVIEW_SendSimpleNotify(infoPtr, NM_CLICK))
goto setfocus; goto setfocus;
/* /*
* If the style allows editing and the node is already selected * If the style allows editing and the node is already selected
* and the click occurred on the item label... * and the click occurred on the item label...
*/ */
if ((infoPtr->dwStyle & TVS_EDITLABELS) && if ((infoPtr->dwStyle & TVS_EDITLABELS) &&
@ -4188,20 +4188,20 @@ TREEVIEW_SelectItem(TREEVIEW_INFO *infoPtr, INT wParam, HTREEITEM item)
/************************************************************************* /*************************************************************************
* TREEVIEW_ProcessLetterKeys * TREEVIEW_ProcessLetterKeys
* *
* Processes keyboard messages generated by pressing the letter keys * Processes keyboard messages generated by pressing the letter keys
* on the keyboard. * on the keyboard.
* What this does is perform a case insensitive search from the * What this does is perform a case insensitive search from the
* current position with the following quirks: * current position with the following quirks:
* - If two chars or more are pressed in quick succession we search * - If two chars or more are pressed in quick succession we search
* for the corresponding string (e.g. 'abc'). * for the corresponding string (e.g. 'abc').
* - If there is a delay we wipe away the current search string and * - If there is a delay we wipe away the current search string and
* restart with just that char. * restart with just that char.
* - If the user keeps pressing the same character, whether slowly or * - If the user keeps pressing the same character, whether slowly or
* fast, so that the search string is entirely composed of this * fast, so that the search string is entirely composed of this
* character ('aaaaa' for instance), then we search for first item * character ('aaaaa' for instance), then we search for first item
* that starting with that character. * that starting with that character.
* - If the user types the above character in quick succession, then * - If the user types the above character in quick succession, then
* we must also search for the corresponding string ('aaaaa'), and * we must also search for the corresponding string ('aaaaa'), and
* go to that string if there is a match. * go to that string if there is a match.
* *
* RETURNS * RETURNS
@ -4210,13 +4210,13 @@ TREEVIEW_SelectItem(TREEVIEW_INFO *infoPtr, INT wParam, HTREEITEM item)
* *
* BUGS * BUGS
* *
* - The current implementation has a list of characters it will * - The current implementation has a list of characters it will
* accept and it ignores averything else. In particular it will * accept and it ignores averything else. In particular it will
* ignore accentuated characters which seems to match what * ignore accentuated characters which seems to match what
* Windows does. But I'm not sure it makes sense to follow * Windows does. But I'm not sure it makes sense to follow
* Windows there. * Windows there.
* - We don't sound a beep when the search fails. * - We don't sound a beep when the search fails.
* - The search should start from the focused item, not from the selected * - The search should start from the focused item, not from the selected
* item. One reason for this is to allow for multiple selections in trees. * item. One reason for this is to allow for multiple selections in trees.
* But currently infoPtr->focusedItem does not seem very usable. * But currently infoPtr->focusedItem does not seem very usable.
* *
@ -4624,7 +4624,7 @@ scroll:
{ {
TREEVIEW_ITEM *item; TREEVIEW_ITEM *item;
LONG scroll_pixels = infoPtr->scrollX - scrollX; LONG scroll_pixels = infoPtr->scrollX - scrollX;
for (item = infoPtr->root->firstChild; item != NULL; for (item = infoPtr->root->firstChild; item != NULL;
item = TREEVIEW_GetNextListItem(infoPtr, item)) item = TREEVIEW_GetNextListItem(infoPtr, item))
{ {
@ -4679,14 +4679,14 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam)
static LRESULT static LRESULT
TREEVIEW_Create(HWND hwnd) TREEVIEW_Create(HWND hwnd)
{ {
RECT rcClient; RECT rcClient;
TREEVIEW_INFO *infoPtr; TREEVIEW_INFO *infoPtr;
TRACE("wnd %x, style %lx\n", hwnd, GetWindowLongA(hwnd, GWL_STYLE)); TRACE("wnd %x, style %lx\n", hwnd, GetWindowLongA(hwnd, GWL_STYLE));
infoPtr = (TREEVIEW_INFO *)COMCTL32_Alloc(sizeof(TREEVIEW_INFO)); infoPtr = (TREEVIEW_INFO *)COMCTL32_Alloc(sizeof(TREEVIEW_INFO));
if (infoPtr == NULL) if (infoPtr == NULL)
{ {
ERR("could not allocate info memory!\n"); ERR("could not allocate info memory!\n");
@ -4768,7 +4768,7 @@ TREEVIEW_Create(HWND hwnd)
/* Determine what type of notify should be issued */ /* Determine what type of notify should be issued */
/* sets infoPtr->bNtfUnicode */ /* sets infoPtr->bNtfUnicode */
TREEVIEW_NotifyFormat(infoPtr, 0, NF_REQUERY); TREEVIEW_NotifyFormat(infoPtr, 0, NF_REQUERY);
if (!(infoPtr->dwStyle & TVS_NOTOOLTIPS)) if (!(infoPtr->dwStyle & TVS_NOTOOLTIPS))
infoPtr->hwndToolTip = COMCTL32_CreateToolTip(hwnd); infoPtr->hwndToolTip = COMCTL32_CreateToolTip(hwnd);
@ -5009,12 +5009,12 @@ TREEVIEW_Notify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (lppgc->dwFlag == PGF_CALCWIDTH) { if (lppgc->dwFlag == PGF_CALCWIDTH) {
lppgc->iWidth = infoPtr->treeWidth; lppgc->iWidth = infoPtr->treeWidth;
TRACE("got PGN_CALCSIZE, returning horz size = %ld, client=%ld\n", TRACE("got PGN_CALCSIZE, returning horz size = %ld, client=%ld\n",
infoPtr->treeWidth, infoPtr->clientWidth); infoPtr->treeWidth, infoPtr->clientWidth);
} }
else { else {
lppgc->iHeight = infoPtr->treeHeight; lppgc->iHeight = infoPtr->treeHeight;
TRACE("got PGN_CALCSIZE, returning vert size = %ld, client=%ld\n", TRACE("got PGN_CALCSIZE, returning vert size = %ld, client=%ld\n",
infoPtr->treeHeight, infoPtr->clientHeight); infoPtr->treeHeight, infoPtr->clientHeight);
} }
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* /*
* Updown control * Updown control
* *
* Copyright 1997, 2002 Dimitrie O. Paun * Copyright 1997, 2002 Dimitrie O. Paun
@ -151,7 +151,7 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta)
* want to draw a sunken edge to make like we are part of that control. * want to draw a sunken edge to make like we are part of that control.
*/ */
static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr) static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr)
{ {
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
return ( ((dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) && return ( ((dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) &&
@ -181,7 +181,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
rect->left += DEFAULT_BUDDYBORDER; rect->left += DEFAULT_BUDDYBORDER;
else else
rect->right -= DEFAULT_BUDDYBORDER; rect->right -= DEFAULT_BUDDYBORDER;
InflateRect(rect, 0, -DEFAULT_BUDDYBORDER); InflateRect(rect, 0, -DEFAULT_BUDDYBORDER);
} }
@ -190,7 +190,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
if (dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER; if (dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER;
else rect->left += DEFAULT_BUDDYSPACER; else rect->left += DEFAULT_BUDDYSPACER;
} }
/* /*
* We're calculating the midpoint to figure-out where the * We're calculating the midpoint to figure-out where the
* separation between the buttons will lay. We make sure that we * separation between the buttons will lay. We make sure that we
@ -199,7 +199,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
if (dwStyle & UDS_HORZ) { if (dwStyle & UDS_HORZ) {
int len = rect->right - rect->left + 1; /* compute the width */ int len = rect->right - rect->left + 1; /* compute the width */
if (arrow & FLAG_INCR) if (arrow & FLAG_INCR)
rect->left = rect->left + len/2; rect->left = rect->left + len/2;
if (arrow & FLAG_DECR) if (arrow & FLAG_DECR)
rect->right = rect->left + len/2 - 1; rect->right = rect->left + len/2 - 1;
} else { } else {
@ -267,7 +267,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
/* we have a regular window, so will get the text */ /* we have a regular window, so will get the text */
if (!GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt))) return FALSE; if (!GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt))) return FALSE;
sep = UPDOWN_GetThousandSep(); sep = UPDOWN_GetThousandSep();
/* now get rid of the separators */ /* now get rid of the separators */
for(src = dst = txt; *src; src++) for(src = dst = txt; *src; src++)
@ -278,7 +278,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
newVal = strtolW(txt, &src, infoPtr->Base); newVal = strtolW(txt, &src, infoPtr->Base);
if(*src || !UPDOWN_InBounds (infoPtr, newVal)) return FALSE; if(*src || !UPDOWN_InBounds (infoPtr, newVal)) return FALSE;
} }
TRACE("new value(%d) from buddy (old=%d)\n", newVal, infoPtr->CurVal); TRACE("new value(%d) from buddy (old=%d)\n", newVal, infoPtr->CurVal);
infoPtr->CurVal = newVal; infoPtr->CurVal = newVal;
return TRUE; return TRUE;
@ -306,7 +306,7 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
if (UPDOWN_IsBuddyListbox(infoPtr)) { if (UPDOWN_IsBuddyListbox(infoPtr)) {
return SendMessageW(infoPtr->Buddy, LB_SETCURSEL, infoPtr->CurVal, 0) != LB_ERR; return SendMessageW(infoPtr->Buddy, LB_SETCURSEL, infoPtr->CurVal, 0) != LB_ERR;
} }
/* Regular window, so set caption to the number */ /* Regular window, so set caption to the number */
if (infoPtr->Base == 16) fmt[1] = 'X'; if (infoPtr->Base == 16) fmt[1] = 'X';
len = wsprintfW(txt, fmt, infoPtr->CurVal); len = wsprintfW(txt, fmt, infoPtr->CurVal);
@ -317,7 +317,7 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt; WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt;
WCHAR sep = UPDOWN_GetThousandSep(); WCHAR sep = UPDOWN_GetThousandSep();
int start = len % 3; int start = len % 3;
memcpy(tmp, txt, sizeof(txt)); memcpy(tmp, txt, sizeof(txt));
if (start == 0) start = 3; if (start == 0) start = 3;
dst += start; dst += start;
@ -328,9 +328,9 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
} }
*dst = 0; *dst = 0;
} }
return SetWindowTextW(infoPtr->Buddy, txt); return SetWindowTextW(infoPtr->Buddy, txt);
} }
/*********************************************************************** /***********************************************************************
* UPDOWN_Draw * UPDOWN_Draw
@ -346,16 +346,16 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
/* Draw the common border between ourselves and our buddy */ /* Draw the common border between ourselves and our buddy */
if (UPDOWN_HasBuddyBorder(infoPtr)) { if (UPDOWN_HasBuddyBorder(infoPtr)) {
GetClientRect(infoPtr->Self, &rect); GetClientRect(infoPtr->Self, &rect);
DrawEdge(hdc, &rect, EDGE_SUNKEN, DrawEdge(hdc, &rect, EDGE_SUNKEN,
BF_BOTTOM | BF_TOP | BF_BOTTOM | BF_TOP |
(dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); (dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT));
} }
/* Draw the incr button */ /* Draw the incr button */
UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR); UPDOWN_GetArrowRect (infoPtr, &rect, FLAG_INCR);
pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR); pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR);
hot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN); hot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN);
DrawFrameControl(hdc, &rect, DFC_SCROLL, DrawFrameControl(hdc, &rect, DFC_SCROLL,
(dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | (dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) |
((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) |
(pressed ? DFCS_PUSHED : 0) | (pressed ? DFCS_PUSHED : 0) |
@ -365,7 +365,7 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR);
pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR); pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR);
hot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN); hot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN);
DrawFrameControl(hdc, &rect, DFC_SCROLL, DrawFrameControl(hdc, &rect, DFC_SCROLL,
(dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | (dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) |
((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) |
(pressed ? DFCS_PUSHED : 0) | (pressed ? DFCS_PUSHED : 0) |
@ -398,11 +398,11 @@ static LRESULT UPDOWN_Paint (UPDOWN_INFO *infoPtr, HDC hdc)
static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key) static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key)
{ {
int arrow; int arrow;
if (key == VK_UP) arrow = FLAG_INCR; if (key == VK_UP) arrow = FLAG_INCR;
else if (key == VK_DOWN) arrow = FLAG_DECR; else if (key == VK_DOWN) arrow = FLAG_DECR;
else return 1; else return 1;
UPDOWN_GetBuddyInt (infoPtr); UPDOWN_GetBuddyInt (infoPtr);
infoPtr->Flags &= ~FLAG_ARROW; infoPtr->Flags &= ~FLAG_ARROW;
infoPtr->Flags |= FLAG_PRESSED | arrow; infoPtr->Flags |= FLAG_PRESSED | arrow;
@ -413,19 +413,19 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key)
} }
/*********************************************************************** /***********************************************************************
* UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy * UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy
* control. * control.
*/ */
static LRESULT CALLBACK static LRESULT CALLBACK
UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WNDPROC superClassWndProc = (WNDPROC)GetPropA(hwnd, BUDDY_SUPERCLASS_WNDPROC); WNDPROC superClassWndProc = (WNDPROC)GetPropA(hwnd, BUDDY_SUPERCLASS_WNDPROC);
TRACE("hwnd=%04x, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n", TRACE("hwnd=%04x, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n",
hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam); hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam);
if (uMsg == WM_KEYDOWN) { if (uMsg == WM_KEYDOWN) {
HWND upDownHwnd = GetPropA(hwnd, BUDDY_UPDOWN_HWND); HWND upDownHwnd = GetPropA(hwnd, BUDDY_UPDOWN_HWND);
UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam);
} }
@ -436,7 +436,7 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
* UPDOWN_SetBuddy * UPDOWN_SetBuddy
* Tests if 'bud' is a valid window handle. If not, returns FALSE. * Tests if 'bud' is a valid window handle. If not, returns FALSE.
* Else, sets it as a new Buddy. * Else, sets it as a new Buddy.
* Then, it should subclass the buddy * Then, it should subclass the buddy
* If window has the UDS_ARROWKEYS, it subcalsses the buddy window to * If window has the UDS_ARROWKEYS, it subcalsses the buddy window to
* process the UP/DOWN arrow keys. * process the UP/DOWN arrow keys.
* If window has the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style * If window has the UDS_ALIGNLEFT or UDS_ALIGNRIGHT style
@ -449,20 +449,20 @@ static BOOL UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
int x, width; /* new x position and width for the up-down */ int x, width; /* new x position and width for the up-down */
WNDPROC baseWndProc, currWndProc; WNDPROC baseWndProc, currWndProc;
CHAR buddyClass[40]; CHAR buddyClass[40];
/* Is it a valid bud? */ /* Is it a valid bud? */
if(!IsWindow(bud)) return FALSE; if(!IsWindow(bud)) return FALSE;
TRACE("(hwnd=%04x, bud=%04x)\n", infoPtr->Self, bud); TRACE("(hwnd=%04x, bud=%04x)\n", infoPtr->Self, bud);
/* there is already a body assigned */ /* there is already a body assigned */
if (infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND); if (infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
/* Store buddy window handle */ /* Store buddy window handle */
infoPtr->Buddy = bud; infoPtr->Buddy = bud;
/* keep upDown ctrl hwnd in a buddy property */ /* keep upDown ctrl hwnd in a buddy property */
SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self); SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
/* Store buddy window class type */ /* Store buddy window class type */
infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN; infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
@ -474,12 +474,12 @@ static BOOL UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
} }
if(dwStyle & UDS_ARROWKEYS){ if(dwStyle & UDS_ARROWKEYS){
/* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
when we reset the upDown ctrl buddy to another buddy because it is not when we reset the upDown ctrl buddy to another buddy because it is not
good to break the window proc chain. */ good to break the window proc chain. */
currWndProc = (WNDPROC) GetWindowLongW(bud, GWL_WNDPROC); currWndProc = (WNDPROC) GetWindowLongW(bud, GWL_WNDPROC);
if (currWndProc != UPDOWN_Buddy_SubclassProc) { if (currWndProc != UPDOWN_Buddy_SubclassProc) {
baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc); baseWndProc = (WNDPROC)SetWindowLongW(bud, GWL_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc); SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
} }
} }
@ -501,7 +501,7 @@ static BOOL UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
/* first adjust the buddy to accomodate the up/down */ /* first adjust the buddy to accomodate the up/down */
SetWindowPos(infoPtr->Buddy, 0, budRect.left, budRect.top, SetWindowPos(infoPtr->Buddy, 0, budRect.left, budRect.top,
budRect.right - budRect.left, budRect.bottom - budRect.top, budRect.right - budRect.left, budRect.bottom - budRect.top,
SWP_NOACTIVATE|SWP_NOZORDER); SWP_NOACTIVATE|SWP_NOZORDER);
/* now position the up/down */ /* now position the up/down */
@ -511,7 +511,7 @@ static BOOL UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
/* /*
* If the updown has a buddy border, it has to overlap with the buddy * If the updown has a buddy border, it has to overlap with the buddy
* to look as if it is integrated with the buddy control. * to look as if it is integrated with the buddy control.
* We nudge the control or change it size to overlap. * We nudge the control or change it size to overlap.
*/ */
if (UPDOWN_HasBuddyBorder(infoPtr)) { if (UPDOWN_HasBuddyBorder(infoPtr)) {
@ -521,18 +521,18 @@ static BOOL UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
x -= DEFAULT_BUDDYBORDER; x -= DEFAULT_BUDDYBORDER;
} }
SetWindowPos(infoPtr->Self, infoPtr->Buddy, x, SetWindowPos(infoPtr->Self, infoPtr->Buddy, x,
budRect.top - DEFAULT_ADDTOP, width, budRect.top - DEFAULT_ADDTOP, width,
budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT, budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
SWP_NOACTIVATE); SWP_NOACTIVATE);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* UPDOWN_DoAction * UPDOWN_DoAction
* *
* This function increments/decrements the CurVal by the * This function increments/decrements the CurVal by the
* 'delta' amount according to the 'action' flag which can be a * 'delta' amount according to the 'action' flag which can be a
* combination of FLAG_INCR and FLAG_DECR * combination of FLAG_INCR and FLAG_DECR
* It notifies the parent as required. * It notifies the parent as required.
@ -555,7 +555,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
ni.iDelta = delta; ni.iDelta = delta;
ni.hdr.hwndFrom = infoPtr->Self; ni.hdr.hwndFrom = infoPtr->Self;
ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID); ni.hdr.idFrom = GetWindowLongW (infoPtr->Self, GWL_ID);
ni.hdr.code = UDN_DELTAPOS; ni.hdr.code = UDN_DELTAPOS;
if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, if (!SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY,
(WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) { (WPARAM)ni.hdr.idFrom, (LPARAM)&ni)) {
/* Parent said: OK to adjust */ /* Parent said: OK to adjust */
@ -566,10 +566,10 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
} }
} }
/* Also, notify it. This message is sent in any case. */ /* Also, notify it. This message is sent in any case. */
SendMessageW( GetParent(infoPtr->Self), SendMessageW( GetParent(infoPtr->Self),
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), infoPtr->Self); MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), infoPtr->Self);
} }
@ -593,17 +593,17 @@ static BOOL UPDOWN_IsEnabled (UPDOWN_INFO *infoPtr)
* *
* Deletes any timers, releases the mouse and does redraw if necessary. * Deletes any timers, releases the mouse and does redraw if necessary.
* If the control is not in "capture" mode, it does nothing. * If the control is not in "capture" mode, it does nothing.
* If the control was not in cancel mode, it returns FALSE. * If the control was not in cancel mode, it returns FALSE.
* If the control was in cancel mode, it returns TRUE. * If the control was in cancel mode, it returns TRUE.
*/ */
static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr) static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
{ {
if (!(infoPtr->Flags & FLAG_PRESSED)) return FALSE; if (!(infoPtr->Flags & FLAG_PRESSED)) return FALSE;
KillTimer (infoPtr->Self, TIMER_AUTOREPEAT); KillTimer (infoPtr->Self, TIMER_AUTOREPEAT);
KillTimer (infoPtr->Self, TIMER_ACCEL); KillTimer (infoPtr->Self, TIMER_ACCEL);
KillTimer (infoPtr->Self, TIMER_AUTOPRESS); KillTimer (infoPtr->Self, TIMER_AUTOPRESS);
if (GetCapture() == infoPtr->Self) { if (GetCapture() == infoPtr->Self) {
NMHDR hdr; NMHDR hdr;
hdr.hwndFrom = infoPtr->Self; hdr.hwndFrom = infoPtr->Self;
@ -612,10 +612,10 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr); SendMessageW(GetParent (infoPtr->Self), WM_NOTIFY, hdr.idFrom, (LPARAM)&hdr);
ReleaseCapture(); ReleaseCapture();
} }
infoPtr->Flags &= ~FLAG_PRESSED; infoPtr->Flags &= ~FLAG_PRESSED;
InvalidateRect (infoPtr->Self, NULL, FALSE); InvalidateRect (infoPtr->Self, NULL, FALSE);
return TRUE; return TRUE;
} }
@ -624,7 +624,7 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
* *
* Handle a mouse event for the updown. * Handle a mouse event for the updown.
* 'pt' is the location of the mouse event in client or * 'pt' is the location of the mouse event in client or
* windows coordinates. * windows coordinates.
*/ */
static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINT pt) static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINT pt)
{ {
@ -646,10 +646,10 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINT pt)
/* Update the CurVal if necessary */ /* Update the CurVal if necessary */
if (dwStyle & UDS_SETBUDDYINT) UPDOWN_GetBuddyInt (infoPtr); if (dwStyle & UDS_SETBUDDYINT) UPDOWN_GetBuddyInt (infoPtr);
/* Set up the correct flags */ /* Set up the correct flags */
infoPtr->Flags |= FLAG_PRESSED; infoPtr->Flags |= FLAG_PRESSED;
/* repaint the control */ /* repaint the control */
InvalidateRect (infoPtr->Self, NULL, FALSE); InvalidateRect (infoPtr->Self, NULL, FALSE);
@ -678,7 +678,7 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINT pt)
} else { } else {
if(infoPtr->AccelIndex != -1) infoPtr->AccelIndex = 0; if(infoPtr->AccelIndex != -1) infoPtr->AccelIndex = 0;
} }
/* If state changed, redraw the control */ /* If state changed, redraw the control */
if(temp != infoPtr->Flags) if(temp != infoPtr->Flags)
InvalidateRect (infoPtr->Self, &rect, FALSE); InvalidateRect (infoPtr->Self, &rect, FALSE);
@ -699,9 +699,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
int temp; int temp;
if (!infoPtr && (message != WM_CREATE)) if (!infoPtr && (message != WM_CREATE))
return DefWindowProcW (hwnd, message, wParam, lParam); return DefWindowProcW (hwnd, message, wParam, lParam);
switch(message) switch(message)
{ {
@ -715,8 +715,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
infoPtr->AccelCount = 0; infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0; infoPtr->AccelVect = 0;
infoPtr->AccelIndex = -1; infoPtr->AccelIndex = -1;
infoPtr->CurVal = 0; infoPtr->CurVal = 0;
infoPtr->MinVal = 0; infoPtr->MinVal = 0;
infoPtr->MaxVal = 9999; infoPtr->MaxVal = 9999;
infoPtr->Base = 10; /* Default to base 10 */ infoPtr->Base = 10; /* Default to base 10 */
infoPtr->Buddy = 0; /* No buddy window yet */ infoPtr->Buddy = 0; /* No buddy window yet */
@ -725,10 +725,10 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
/* Do we pick the buddy win ourselves? */ /* Do we pick the buddy win ourselves? */
if (dwStyle & UDS_AUTOBUDDY) if (dwStyle & UDS_AUTOBUDDY)
UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV)); UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV));
TRACE("UpDown Ctrl creation, hwnd=%04x\n", hwnd); TRACE("UpDown Ctrl creation, hwnd=%04x\n", hwnd);
break; break;
case WM_DESTROY: case WM_DESTROY:
if(infoPtr->AccelVect) COMCTL32_Free (infoPtr->AccelVect); if(infoPtr->AccelVect) COMCTL32_Free (infoPtr->AccelVect);
@ -738,7 +738,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
SetWindowLongW (hwnd, 0, 0); SetWindowLongW (hwnd, 0, 0);
TRACE("UpDown Ctrl destruction, hwnd=%04x\n", hwnd); TRACE("UpDown Ctrl destruction, hwnd=%04x\n", hwnd);
break; break;
case WM_ENABLE: case WM_ENABLE:
if (dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr); if (dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr);
InvalidateRect (infoPtr->Self, NULL, FALSE); InvalidateRect (infoPtr->Self, NULL, FALSE);
@ -770,13 +770,13 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
if(infoPtr->Flags & FLAG_MOUSEIN) { if(infoPtr->Flags & FLAG_MOUSEIN) {
temp = infoPtr->AccelIndex == -1 ? 1 : infoPtr->AccelVect[infoPtr->AccelIndex].nInc; temp = infoPtr->AccelIndex == -1 ? 1 : infoPtr->AccelVect[infoPtr->AccelIndex].nInc;
UPDOWN_DoAction(infoPtr, temp, infoPtr->Flags & FLAG_ARROW); UPDOWN_DoAction(infoPtr, temp, infoPtr->Flags & FLAG_ARROW);
if(infoPtr->AccelIndex != -1 && infoPtr->AccelIndex < infoPtr->AccelCount-1) { if(infoPtr->AccelIndex != -1 && infoPtr->AccelIndex < infoPtr->AccelCount-1) {
KillTimer(hwnd, TIMER_ACCEL); KillTimer(hwnd, TIMER_ACCEL);
infoPtr->AccelIndex++; /* move to the next accel info */ infoPtr->AccelIndex++; /* move to the next accel info */
temp = infoPtr->AccelVect[infoPtr->AccelIndex].nSec * 1000 + 1; temp = infoPtr->AccelVect[infoPtr->AccelIndex].nSec * 1000 + 1;
/* make sure we have at least 1ms intervals */ /* make sure we have at least 1ms intervals */
SetTimer(hwnd, TIMER_ACCEL, temp, 0); SetTimer(hwnd, TIMER_ACCEL, temp, 0);
} }
} }
break; break;
@ -786,11 +786,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
case WM_LBUTTONUP: case WM_LBUTTONUP:
if (GetCapture() != infoPtr->Self) break; if (GetCapture() != infoPtr->Self) break;
if ( (infoPtr->Flags & FLAG_MOUSEIN) && if ( (infoPtr->Flags & FLAG_MOUSEIN) &&
(infoPtr->Flags & FLAG_ARROW) ) { (infoPtr->Flags & FLAG_ARROW) ) {
SendMessageW( GetParent(hwnd), SendMessageW( GetParent(hwnd),
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), hwnd); MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), hwnd);
if (UPDOWN_IsBuddyEdit(infoPtr)) if (UPDOWN_IsBuddyEdit(infoPtr))
@ -798,7 +798,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
} }
UPDOWN_CancelMode(infoPtr); UPDOWN_CancelMode(infoPtr);
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if(UPDOWN_IsEnabled(infoPtr)){ if(UPDOWN_IsEnabled(infoPtr)){
@ -814,10 +814,10 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
return UPDOWN_KeyPressed(infoPtr, (int)wParam); return UPDOWN_KeyPressed(infoPtr, (int)wParam);
} }
break; break;
case WM_PAINT: case WM_PAINT:
return UPDOWN_Paint (infoPtr, (HDC)wParam); return UPDOWN_Paint (infoPtr, (HDC)wParam);
case UDM_GETACCEL: case UDM_GETACCEL:
if (wParam==0 && lParam==0) return infoPtr->AccelCount; if (wParam==0 && lParam==0) return infoPtr->AccelCount;
if (wParam && lParam) { if (wParam && lParam) {
@ -883,20 +883,20 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
infoPtr->CurVal = temp; infoPtr->CurVal = temp;
if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
return wParam; /* return prev value */ return wParam; /* return prev value */
case UDM_GETRANGE: case UDM_GETRANGE:
if (wParam || lParam) UNKNOWN_PARAM(UDM_GETRANGE, wParam, lParam); if (wParam || lParam) UNKNOWN_PARAM(UDM_GETRANGE, wParam, lParam);
return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal);
case UDM_SETRANGE: case UDM_SETRANGE:
if (wParam) UNKNOWN_PARAM(UDM_SETRANGE, wParam, lParam); if (wParam) UNKNOWN_PARAM(UDM_SETRANGE, wParam, lParam);
/* we must have: */ /* we must have: */
infoPtr->MaxVal = SLOWORD(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */ infoPtr->MaxVal = SLOWORD(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */
infoPtr->MinVal = SHIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */ infoPtr->MinVal = SHIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */
/* |Max-Min| <= UD_MAXVAL */ /* |Max-Min| <= UD_MAXVAL */
TRACE("UpDown Ctrl new range(%d to %d), hwnd=%04x\n", TRACE("UpDown Ctrl new range(%d to %d), hwnd=%04x\n",
infoPtr->MinVal, infoPtr->MaxVal, hwnd); infoPtr->MinVal, infoPtr->MaxVal, hwnd);
break; break;
case UDM_GETRANGE32: case UDM_GETRANGE32:
if (wParam) *(LPINT)wParam = infoPtr->MinVal; if (wParam) *(LPINT)wParam = infoPtr->MinVal;
@ -908,7 +908,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
infoPtr->MaxVal = (INT)lParam; infoPtr->MaxVal = (INT)lParam;
if (infoPtr->MaxVal <= infoPtr->MinVal) if (infoPtr->MaxVal <= infoPtr->MinVal)
infoPtr->MaxVal = infoPtr->MinVal + 1; infoPtr->MaxVal = infoPtr->MinVal + 1;
TRACE("UpDown Ctrl new range(%d to %d), hwnd=%04x\n", TRACE("UpDown Ctrl new range(%d to %d), hwnd=%04x\n",
infoPtr->MinVal, infoPtr->MaxVal, hwnd); infoPtr->MinVal, infoPtr->MaxVal, hwnd);
break; break;
@ -937,12 +937,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
temp = infoPtr->UnicodeFormat; temp = infoPtr->UnicodeFormat;
infoPtr->UnicodeFormat = (BOOL)wParam; infoPtr->UnicodeFormat = (BOOL)wParam;
return temp; return temp;
default: default:
if (message >= WM_USER) if (message >= WM_USER)
ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam); ERR("unknown msg %04x wp=%04x lp=%08lx\n", message, wParam, lParam);
return DefWindowProcW (hwnd, message, wParam, lParam); return DefWindowProcW (hwnd, message, wParam, lParam);
} }
return 0; return 0;
} }
@ -966,7 +966,7 @@ UPDOWN_Register(void)
wndClass.hCursor = LoadCursorW( 0, IDC_ARROWW ); wndClass.hCursor = LoadCursorW( 0, IDC_ARROWW );
wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
wndClass.lpszClassName = UPDOWN_CLASSW; wndClass.lpszClassName = UPDOWN_CLASSW;
RegisterClassW( &wndClass ); RegisterClassW( &wndClass );
} }

View File

@ -70,7 +70,7 @@ typedef struct {
#define PD32_PRINTER_STATUS_READY 1536 #define PD32_PRINTER_STATUS_READY 1536
#define PD32_PRINTER_STATUS_PAUSED 1537 #define PD32_PRINTER_STATUS_PAUSED 1537
#define PD32_PRINTER_STATUS_ERROR 1538 #define PD32_PRINTER_STATUS_ERROR 1538
#define PD32_PRINTER_STATUS_PENDING_DELETION 1539 #define PD32_PRINTER_STATUS_PENDING_DELETION 1539
#define PD32_PRINTER_STATUS_PAPER_JAM 1540 #define PD32_PRINTER_STATUS_PAPER_JAM 1540
#define PD32_PRINTER_STATUS_PAPER_OUT 1541 #define PD32_PRINTER_STATUS_PAPER_OUT 1541
@ -183,7 +183,7 @@ typedef struct {
} FINDREPLACE16, *LPFINDREPLACE16; } FINDREPLACE16, *LPFINDREPLACE16;
typedef UINT16 (CALLBACK *LPCFHOOKPROC16)(HWND16,UINT16,WPARAM16,LPARAM); typedef UINT16 (CALLBACK *LPCFHOOKPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
typedef struct typedef struct
{ {
DWORD lStructSize; DWORD lStructSize;
HWND16 hwndOwner; /* caller's window handle */ HWND16 hwndOwner; /* caller's window handle */

View File

@ -89,7 +89,7 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
COMDLG32_TlsIndex = 0xffffffff; COMDLG32_TlsIndex = 0xffffffff;
SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL"); SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL");
if (!SHELL32_hInstance) if (!SHELL32_hInstance)
{ {
ERR("loading of shell32 failed\n"); ERR("loading of shell32 failed\n");
@ -102,9 +102,9 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
GPA(COMDLG32_PIDL_ILGetNext, SHELL32_hInstance, (LPCSTR)153L); GPA(COMDLG32_PIDL_ILGetNext, SHELL32_hInstance, (LPCSTR)153L);
GPA(COMDLG32_PIDL_ILClone, SHELL32_hInstance, (LPCSTR)18L); GPA(COMDLG32_PIDL_ILClone, SHELL32_hInstance, (LPCSTR)18L);
GPA(COMDLG32_PIDL_ILRemoveLastID, SHELL32_hInstance, (LPCSTR)17L); GPA(COMDLG32_PIDL_ILRemoveLastID, SHELL32_hInstance, (LPCSTR)17L);
/* SHELL */ /* SHELL */
GPA(COMDLG32_SHAlloc, SHELL32_hInstance, (LPCSTR)196L); GPA(COMDLG32_SHAlloc, SHELL32_hInstance, (LPCSTR)196L);
GPA(COMDLG32_SHFree, SHELL32_hInstance, (LPCSTR)195L); GPA(COMDLG32_SHFree, SHELL32_hInstance, (LPCSTR)195L);
/* for the first versions of shell32 SHGetFolderPathA is in SHFOLDER.DLL */ /* for the first versions of shell32 SHGetFolderPathA is in SHFOLDER.DLL */
@ -177,7 +177,7 @@ void COMDLG32_SetCommDlgExtendedError(DWORD err)
*/ */
DWORD WINAPI CommDlgExtendedError(void) DWORD WINAPI CommDlgExtendedError(void)
{ {
if (COMDLG32_TlsIndex != 0xffffffff) if (COMDLG32_TlsIndex != 0xffffffff)
return (DWORD)TlsGetValue(COMDLG32_TlsIndex); return (DWORD)TlsGetValue(COMDLG32_TlsIndex);
else else
return 0; /* we never set an error, so there isn't one */ return 0; /* we never set an error, so there isn't one */

View File

@ -69,7 +69,7 @@ struct CCPRIVATE
LPCHOOSECOLOR16 lpcc16; /* save the 16 bits pointer */ LPCHOOSECOLOR16 lpcc16; /* save the 16 bits pointer */
int nextuserdef; /* next free place in user defined color array */ int nextuserdef; /* next free place in user defined color array */
HDC hdcMem; /* color graph used for BitBlt() */ HDC hdcMem; /* color graph used for BitBlt() */
HBITMAP hbmMem; /* color graph bitmap */ HBITMAP hbmMem; /* color graph bitmap */
RECT fullsize; /* original dialog window size */ RECT fullsize; /* original dialog window size */
UINT msetrgb; /* # of SETRGBSTRING message (today not used) */ UINT msetrgb; /* # of SETRGBSTRING message (today not used) */
RECT old3angle; /* last position of l-marker */ RECT old3angle; /* last position of l-marker */
@ -459,7 +459,7 @@ static void CC_PaintTriangle( HWND hDlg, int y)
int oben; int oben;
RECT rect; RECT rect;
HWND hwnd = GetDlgItem(hDlg, 0x2be); HWND hwnd = GetDlgItem(hDlg, 0x2be);
LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER);
if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */ if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */
{ {
@ -497,7 +497,7 @@ static void CC_PaintCross( HWND hDlg, int x, int y)
HDC hDC; HDC hDC;
int w = GetDialogBaseUnits(); int w = GetDialogBaseUnits();
HWND hwnd = GetDlgItem(hDlg, 0x2c6); HWND hwnd = GetDlgItem(hDlg, 0x2c6);
LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER ); LCCPRIV lpp = (LCCPRIV)GetWindowLongA( hDlg, DWL_USER );
RECT rect; RECT rect;
POINT point, p; POINT point, p;
HPEN hPen; HPEN hPen;
@ -519,11 +519,11 @@ static void CC_PaintCross( HWND hDlg, int x, int y)
lpp->oldcross.left = point.x - w - 1; lpp->oldcross.left = point.x - w - 1;
lpp->oldcross.right = point.x + w + 1; lpp->oldcross.right = point.x + w + 1;
lpp->oldcross.top = point.y - w - 1; lpp->oldcross.top = point.y - w - 1;
lpp->oldcross.bottom = point.y + w + 1; lpp->oldcross.bottom = point.y + w + 1;
MoveToEx(hDC, point.x - w, point.y, &p); MoveToEx(hDC, point.x - w, point.y, &p);
LineTo(hDC, point.x + w, point.y); LineTo(hDC, point.x + w, point.y);
MoveToEx(hDC, point.x, point.y - w, &p); MoveToEx(hDC, point.x, point.y - w, &p);
LineTo(hDC, point.x, point.y + w); LineTo(hDC, point.x, point.y + w);
DeleteObject( SelectObject(hDC, hPen)) ; DeleteObject( SelectObject(hDC, hPen)) ;
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
@ -538,11 +538,11 @@ static void CC_PaintCross( HWND hDlg, int x, int y)
/*********************************************************************** /***********************************************************************
* CC_PrepareColorGraph [internal] * CC_PrepareColorGraph [internal]
*/ */
static void CC_PrepareColorGraph( HWND hDlg ) static void CC_PrepareColorGraph( HWND hDlg )
{ {
int sdif, hdif, xdif, ydif, r, g, b, hue, sat; int sdif, hdif, xdif, ydif, r, g, b, hue, sat;
HWND hwnd = GetDlgItem(hDlg, 0x2c6); HWND hwnd = GetDlgItem(hDlg, 0x2c6);
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
HBRUSH hbrush; HBRUSH hbrush;
HDC hdc ; HDC hdc ;
RECT rect, client; RECT rect, client;
@ -585,7 +585,7 @@ static void CC_PrepareColorGraph( HWND hDlg )
static void CC_PaintColorGraph( HWND hDlg ) static void CC_PaintColorGraph( HWND hDlg )
{ {
HWND hwnd = GetDlgItem( hDlg, 0x2c6 ); HWND hwnd = GetDlgItem( hDlg, 0x2c6 );
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
HDC hDC; HDC hDC;
RECT rect; RECT rect;
if (IsWindowVisible(hwnd)) /* if full size */ if (IsWindowVisible(hwnd)) /* if full size */
@ -645,7 +645,7 @@ static void CC_PaintLumBar( HWND hDlg, int hue, int sat )
static void CC_EditSetRGB( HWND hDlg, COLORREF cr ) static void CC_EditSetRGB( HWND hDlg, COLORREF cr )
{ {
char buffer[10]; char buffer[10];
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
int r = GetRValue(cr); int r = GetRValue(cr);
int g = GetGValue(cr); int g = GetGValue(cr);
int b = GetBValue(cr); int b = GetBValue(cr);
@ -690,8 +690,8 @@ static void CC_EditSetHSL( HWND hDlg, int h, int s, int l )
static void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect ) static void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPRECT lprect )
{ {
int i; int i;
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE); EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE);
CC_PrepareColorGraph(hDlg); CC_PrepareColorGraph(hDlg);
for (i = 0x2bf; i < 0x2c5; i++) for (i = 0x2bf; i < 0x2c5; i++)
@ -738,7 +738,7 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
FillRect(hdc, &rect, GetClassLongA(hwnd, GCL_HBRBACKGROUND)); FillRect(hdc, &rect, GetClassLongA(hwnd, GCL_HBRBACKGROUND));
for ( j = 0; j < rows; j++ ) for ( j = 0; j < rows; j++ )
{ {
for ( i = 0; i < cols; i++ ) for ( i = 0; i < cols; i++ )
{ {
hBrush = CreateSolidBrush(predefcolors[j][i]); hBrush = CreateSolidBrush(predefcolors[j][i]);
if (hBrush) if (hBrush)
@ -759,7 +759,7 @@ static void CC_PaintPredefColorArray( HWND hDlg, int rows, int cols)
} }
/*********************************************************************** /***********************************************************************
* CC_PaintUserColorArray [internal] * CC_PaintUserColorArray [internal]
* Paint the 16 user-selected colors * Paint the 16 user-selected colors
*/ */
static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr ) static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpcr )
{ {
@ -777,7 +777,7 @@ static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpc
k = rect.left; k = rect.left;
hdc = GetDC(hwnd); hdc = GetDC(hwnd);
if (hdc) if (hdc)
{ {
FillRect(hdc, &rect, GetClassLongA(hwnd, GCL_HBRBACKGROUND) ); FillRect(hdc, &rect, GetClassLongA(hwnd, GCL_HBRBACKGROUND) );
for (j = 0; j < rows; j++) for (j = 0; j < rows; j++)
@ -786,7 +786,7 @@ static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, COLORREF* lpc
{ {
hBrush = CreateSolidBrush(lpcr[i+j*cols]); hBrush = CreateSolidBrush(lpcr[i+j*cols]);
if (hBrush) if (hBrush)
{ {
hBrush = SelectObject(hdc, hBrush) ; hBrush = SelectObject(hdc, hBrush) ;
Rectangle(hdc, rect.left, rect.top, Rectangle(hdc, rect.left, rect.top,
rect.left + dx - DISTANCE, rect.top + dy - DISTANCE); rect.left + dx - DISTANCE, rect.top + dy - DISTANCE);
@ -821,15 +821,15 @@ static BOOL CC_HookCallChk( LPCHOOSECOLORW lpcc )
/*********************************************************************** /***********************************************************************
* CC_WMInitDialog [internal] * CC_WMInitDialog [internal]
*/ */
static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 ) static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
{ {
int i, res; int i, res;
int r, g, b; int r, g, b;
HWND hwnd; HWND hwnd;
RECT rect; RECT rect;
POINT point; POINT point;
LCCPRIV lpp; LCCPRIV lpp;
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) ); lpp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct CCPRIVATE) );
if (b16) if (b16)
@ -845,7 +845,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
return FALSE; return FALSE;
} }
ch32->lStructSize = sizeof(CHOOSECOLORW); ch32->lStructSize = sizeof(CHOOSECOLORW);
ch32->hwndOwner = ch16->hwndOwner; ch32->hwndOwner = ch16->hwndOwner;
ch32->hInstance = ch16->hInstance; ch32->hInstance = ch16->hInstance;
ch32->lpCustColors = MapSL(ch16->lpCustColors); ch32->lpCustColors = MapSL(ch16->lpCustColors);
ch32->lpfnHook = (LPCCHOOKPROC) ch16->lpfnHook; /* only used as flag */ ch32->lpfnHook = (LPCCHOOKPROC) ch16->lpfnHook; /* only used as flag */
@ -859,7 +859,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
EndDialog (hDlg, 0) ; EndDialog (hDlg, 0) ;
return FALSE; return FALSE;
} }
SetWindowLongA(hDlg, DWL_USER, (LONG)lpp); SetWindowLongA(hDlg, DWL_USER, (LONG)lpp);
if (!(lpp->lpcc->Flags & CC_SHOWHELP)) if (!(lpp->lpcc->Flags & CC_SHOWHELP))
ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE); ShowWindow( GetDlgItem(hDlg,0x40e), SW_HIDE);
@ -869,7 +869,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
cpos = MAKELONG(5,7); /* init */ cpos = MAKELONG(5,7); /* init */
if (lpp->lpcc->Flags & CC_RGBINIT) if (lpp->lpcc->Flags & CC_RGBINIT)
{ {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
if (predefcolors[i][j] == lpp->lpcc->rgbResult) if (predefcolors[i][j] == lpp->lpcc->rgbResult)
{ {
@ -921,7 +921,7 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
else else
res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, WM_INITDIALOG, wParam, lParam); res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, WM_INITDIALOG, wParam, lParam);
} }
/* Set the initial values of the color chooser dialog */ /* Set the initial values of the color chooser dialog */
r = GetRValue(lpp->lpcc->rgbResult); r = GetRValue(lpp->lpcc->rgbResult);
g = GetGValue(lpp->lpcc->rgbResult); g = GetGValue(lpp->lpcc->rgbResult);
@ -950,13 +950,13 @@ static LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
/*********************************************************************** /***********************************************************************
* CC_WMCommand [internal] * CC_WMCommand [internal]
*/ */
static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl ) static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notifyCode, HWND hwndCtl )
{ {
int r, g, b, i, xx; int r, g, b, i, xx;
UINT cokmsg; UINT cokmsg;
HDC hdc; HDC hdc;
COLORREF *cr; COLORREF *cr;
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam); TRACE("CC_WMCommand wParam=%x lParam=%lx\n", wParam, lParam);
switch (wParam) switch (wParam)
{ {
@ -989,7 +989,7 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif
} }
} }
break; break;
case 0x2bf: /* edit notify HSL */ case 0x2bf: /* edit notify HSL */
case 0x2c0: case 0x2c0:
case 0x2c1: case 0x2c1:
@ -1016,7 +1016,7 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif
} }
} }
break; break;
case 0x2cf: case 0x2cf:
CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, &lpp->fullsize); CC_SwitchToFullSize(hDlg, lpp->lpcc->rgbResult, &lpp->fullsize);
SetFocus( GetDlgItem(hDlg, 0x2bf)); SetFocus( GetDlgItem(hDlg, 0x2bf));
@ -1089,7 +1089,7 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif
} }
EndDialog(hDlg, 1) ; EndDialog(hDlg, 1) ;
return TRUE ; return TRUE ;
case IDCANCEL : case IDCANCEL :
EndDialog(hDlg, 0) ; EndDialog(hDlg, 0) ;
return TRUE ; return TRUE ;
@ -1101,11 +1101,11 @@ static LRESULT CC_WMCommand( HWND hDlg, WPARAM wParam, LPARAM lParam, WORD notif
/*********************************************************************** /***********************************************************************
* CC_WMPaint [internal] * CC_WMPaint [internal]
*/ */
static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam ) static LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam )
{ {
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
hdc = BeginPaint(hDlg, &ps); hdc = BeginPaint(hDlg, &ps);
/* we have to paint dialog children except text and buttons */ /* we have to paint dialog children except text and buttons */
@ -1134,7 +1134,7 @@ static LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
ReleaseCapture(); ReleaseCapture();
CC_PaintCross(hDlg, lpp->h, lpp->s); CC_PaintCross(hDlg, lpp->h, lpp->s);
return 1; return 1;
} }
return 0; return 0;
} }
@ -1142,15 +1142,15 @@ static LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam )
/*********************************************************************** /***********************************************************************
* CC_WMMouseMove [internal] * CC_WMMouseMove [internal]
*/ */
static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam ) static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
{ {
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
int r, g, b; int r, g, b;
if (lpp->capturedGraph) if (lpp->capturedGraph)
{ {
int *ptrh = NULL, *ptrs = &lpp->l; int *ptrh = NULL, *ptrs = &lpp->l;
if (lpp->capturedGraph == 0x2c6) if (lpp->capturedGraph == 0x2c6)
{ {
ptrh = &lpp->h; ptrh = &lpp->h;
ptrs = &lpp->s; ptrs = &lpp->s;
@ -1179,9 +1179,9 @@ static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam )
/*********************************************************************** /***********************************************************************
* CC_WMLButtonDown [internal] * CC_WMLButtonDown [internal]
*/ */
static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam ) static LRESULT CC_WMLButtonDown( HWND hDlg, WPARAM wParam, LPARAM lParam )
{ {
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
int r, g, b, i; int r, g, b, i;
i = 0; i = 0;
@ -1263,15 +1263,15 @@ static LRESULT WINAPI ColorDlgProc( HWND hDlg, UINT message,
case WM_INITDIALOG: case WM_INITDIALOG:
return CC_WMInitDialog(hDlg, wParam, lParam, FALSE); return CC_WMInitDialog(hDlg, wParam, lParam, FALSE);
case WM_NCDESTROY: case WM_NCDESTROY:
DeleteDC(lpp->hdcMem); DeleteDC(lpp->hdcMem);
DeleteObject(lpp->hbmMem); DeleteObject(lpp->hbmMem);
HeapFree(GetProcessHeap(), 0, lpp); HeapFree(GetProcessHeap(), 0, lpp);
SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */ SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */
break; break;
case WM_COMMAND: case WM_COMMAND:
if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam)) if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam))
return TRUE; return TRUE;
break; break;
case WM_PAINT: case WM_PAINT:
if ( CC_WMPaint(hDlg, wParam, lParam)) if ( CC_WMPaint(hDlg, wParam, lParam))
return TRUE; return TRUE;
@ -1291,7 +1291,7 @@ static LRESULT WINAPI ColorDlgProc( HWND hDlg, UINT message,
case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/ case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/
if (CC_WMLButtonDown(hDlg, wParam, lParam)) if (CC_WMLButtonDown(hDlg, wParam, lParam))
return TRUE; return TRUE;
break; break;
} }
return FALSE ; return FALSE ;
} }
@ -1303,7 +1303,7 @@ LRESULT WINAPI ColorDlgProc16( HWND16 hDlg, UINT16 message,
WPARAM16 wParam, LONG lParam ) WPARAM16 wParam, LONG lParam )
{ {
int res; int res;
LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER);
if (message != WM_INITDIALOG) if (message != WM_INITDIALOG)
{ {
if (!lpp) if (!lpp)
@ -1325,8 +1325,8 @@ LRESULT WINAPI ColorDlgProc16( HWND16 hDlg, UINT16 message,
case WM_INITDIALOG: case WM_INITDIALOG:
return CC_WMInitDialog(hDlg, wParam, lParam, TRUE); return CC_WMInitDialog(hDlg, wParam, lParam, TRUE);
case WM_NCDESTROY: case WM_NCDESTROY:
DeleteDC(lpp->hdcMem); DeleteDC(lpp->hdcMem);
DeleteObject(lpp->hbmMem); DeleteObject(lpp->hbmMem);
HeapFree(GetProcessHeap(), 0, lpp->lpcc); HeapFree(GetProcessHeap(), 0, lpp->lpcc);
HeapFree(GetProcessHeap(), 0, lpp); HeapFree(GetProcessHeap(), 0, lpp);
SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */ SetWindowLongA(hDlg, DWL_USER, 0L); /* we don't need it anymore */
@ -1334,7 +1334,7 @@ LRESULT WINAPI ColorDlgProc16( HWND16 hDlg, UINT16 message,
case WM_COMMAND: case WM_COMMAND:
if (CC_WMCommand(hDlg, wParam, lParam, HIWORD(lParam), (HWND)LOWORD(lParam))) if (CC_WMCommand(hDlg, wParam, lParam, HIWORD(lParam), (HWND)LOWORD(lParam)))
return TRUE; return TRUE;
break; break;
case WM_PAINT: case WM_PAINT:
if (CC_WMPaint(hDlg, wParam, lParam)) if (CC_WMPaint(hDlg, wParam, lParam))
return TRUE; return TRUE;
@ -1354,7 +1354,7 @@ LRESULT WINAPI ColorDlgProc16( HWND16 hDlg, UINT16 message,
case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/ case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/
if (CC_WMLButtonDown(hDlg, wParam, lParam)) if (CC_WMLButtonDown(hDlg, wParam, lParam))
return TRUE; return TRUE;
break; break;
} }
return FALSE ; return FALSE ;
} }
@ -1372,9 +1372,9 @@ BOOL16 WINAPI ChooseColor16( LPCHOOSECOLOR16 lpChCol )
BOOL16 bRet = FALSE; BOOL16 bRet = FALSE;
LPCVOID template; LPCVOID template;
FARPROC16 ptr; FARPROC16 ptr;
TRACE("ChooseColor\n"); TRACE("ChooseColor\n");
if (!lpChCol) return FALSE; if (!lpChCol) return FALSE;
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
hDlgTmpl16 = lpChCol->hInstance; hDlgTmpl16 = lpChCol->hInstance;
@ -1420,7 +1420,7 @@ BOOL16 WINAPI ChooseColor16( LPCHOOSECOLOR16 lpChCol )
return FALSE; return FALSE;
} }
template = GlobalLock16(hGlobal16); template = GlobalLock16(hGlobal16);
if (!template) if (!template)
{ {
COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE); COMDLG32_SetCommDlgExtendedError(CDERR_MEMLOCKFAILURE);
ERR("global lock failure for %x handle\n", hDlgTmpl16); ERR("global lock failure for %x handle\n", hDlgTmpl16);
@ -1456,7 +1456,7 @@ BOOL WINAPI ChooseColorW( LPCHOOSECOLORW lpChCol )
LPCVOID template; LPCVOID template;
TRACE("ChooseColor\n"); TRACE("ChooseColor\n");
if (!lpChCol) return FALSE; if (!lpChCol) return FALSE;
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
{ {

View File

@ -39,9 +39,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#include "cdlg.h" #include "cdlg.h"
#define BUFFILE 512 #define BUFFILE 512
#define BUFFILEALLOC 512 * sizeof(WCHAR) #define BUFFILEALLOC 512 * sizeof(WCHAR)
struct FSPRIVATE struct FSPRIVATE
{ {
HWND hwnd; /* file dialog window handle */ HWND hwnd; /* file dialog window handle */
BOOL hook; /* TRUE if the dialog is hooked */ BOOL hook; /* TRUE if the dialog is hooked */
@ -64,7 +64,7 @@ struct FSPRIVATE
#define LFS16 1 #define LFS16 1
#define LFS32A 2 #define LFS32A 2
#define LFS32W 3 #define LFS32W 3
static const WCHAR FILE_star[] = {'*','.','*', 0}; static const WCHAR FILE_star[] = {'*','.','*', 0};
static const WCHAR FILE_bslash[] = {'\\', 0}; static const WCHAR FILE_bslash[] = {'\\', 0};
static const WCHAR FILE_specc[] = {'%','c',':', 0}; static const WCHAR FILE_specc[] = {'%','c',':', 0};
@ -117,7 +117,7 @@ static BOOL FileDlg_Init(void)
hHDisk = LoadImageA( inst, "HDISK", IMAGE_ICON, 16, 16, LR_SHARED ); hHDisk = LoadImageA( inst, "HDISK", IMAGE_ICON, 16, 16, LR_SHARED );
hCDRom = LoadImageA( inst, "CDROM", IMAGE_ICON, 16, 16, LR_SHARED ); hCDRom = LoadImageA( inst, "CDROM", IMAGE_ICON, 16, 16, LR_SHARED );
hNet = LoadImageA( inst, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED ); hNet = LoadImageA( inst, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 || if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
hHDisk == 0 || hCDRom == 0 || hNet == 0) hHDisk == 0 || hCDRom == 0 || hNet == 0)
{ {
ERR("Error loading icons !\n"); ERR("Error loading icons !\n");
@ -174,7 +174,7 @@ BOOL Get32BitsTemplate(LFSPRIVATE lfs)
} }
} else { /* get it from internal Wine resource */ } else { /* get it from internal Wine resource */
HANDLE hResInfo; HANDLE hResInfo;
if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
lfs->open? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA))) lfs->open? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA)))
{ {
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
@ -229,7 +229,7 @@ BOOL Get16BitsTemplate(LFSPRIVATE lfs)
LPCVOID template32; LPCVOID template32;
DWORD size; DWORD size;
if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
lfs->open ? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA))) lfs->open ? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA)))
{ {
COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
@ -376,7 +376,7 @@ static LPWSTR FILEDLG_GetFileType(LPWSTR cfptr, LPWSTR fptr, WORD index)
int n, i; int n, i;
i = 0; i = 0;
if (cfptr) if (cfptr)
for ( ;(n = lstrlenW(cfptr)) != 0; i++) for ( ;(n = lstrlenW(cfptr)) != 0; i++)
{ {
cfptr += n + 1; cfptr += n + 1;
if (i == index) if (i == index)
@ -384,7 +384,7 @@ static LPWSTR FILEDLG_GetFileType(LPWSTR cfptr, LPWSTR fptr, WORD index)
cfptr += lstrlenW(cfptr) + 1; cfptr += lstrlenW(cfptr) + 1;
} }
if (fptr) if (fptr)
for ( ;(n = lstrlenW(fptr)) != 0; i++) for ( ;(n = lstrlenW(fptr)) != 0; i++)
{ {
fptr += n + 1; fptr += n + 1;
if (i == index) if (i == index)
@ -407,7 +407,7 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1) if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1)
{ {
if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) return FALSE; if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) return FALSE;
SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
(LPARAM)str); (LPARAM)str);
if ((lpdis->itemState & ODS_SELECTED) && !savedlg) if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
@ -438,7 +438,7 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
{ {
if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC)))
return FALSE; return FALSE;
SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
(LPARAM)str); (LPARAM)str);
if (lpdis->itemState & ODS_SELECTED) if (lpdis->itemState & ODS_SELECTED)
@ -467,7 +467,7 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
char root[] = "a:"; char root[] = "a:";
if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC)))
return FALSE; return FALSE;
SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID,
(LPARAM)str); (LPARAM)str);
root[0] += str[2] - 'a'; root[0] += str[2] - 'a';
switch(GetDriveTypeA(root)) switch(GetDriveTypeA(root))
@ -502,10 +502,10 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,
/*********************************************************************** /***********************************************************************
* FILEDLG_WMMeasureItem [internal] * FILEDLG_WMMeasureItem [internal]
*/ */
static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{ {
LPMEASUREITEMSTRUCT lpmeasure; LPMEASUREITEMSTRUCT lpmeasure;
lpmeasure = (LPMEASUREITEMSTRUCT)lParam; lpmeasure = (LPMEASUREITEMSTRUCT)lParam;
lpmeasure->itemHeight = fldrHeight; lpmeasure->itemHeight = fldrHeight;
return TRUE; return TRUE;
@ -514,10 +514,10 @@ static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
/*********************************************************************** /***********************************************************************
* FILEDLG_WMMeasureItem16 [internal] * FILEDLG_WMMeasureItem16 [internal]
*/ */
static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam)
{ {
LPMEASUREITEMSTRUCT16 lpmeasure; LPMEASUREITEMSTRUCT16 lpmeasure;
lpmeasure = MapSL(lParam); lpmeasure = MapSL(lParam);
lpmeasure->itemHeight = fldrHeight; lpmeasure->itemHeight = fldrHeight;
return TRUE; return TRUE;
@ -583,10 +583,10 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* set default filter */ /* set default filter */
if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL) if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL)
ofn->nFilterIndex = 1; ofn->nFilterIndex = 1;
SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0); SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0);
lstrcpynW(tmpstr, FILEDLG_GetFileType(ofn->lpstrCustomFilter, lstrcpynW(tmpstr, FILEDLG_GetFileType(ofn->lpstrCustomFilter,
(LPWSTR)ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE); (LPWSTR)ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE);
TRACE("nFilterIndex = %ld, SetText of edt1 to %s\n", TRACE("nFilterIndex = %ld, SetText of edt1 to %s\n",
ofn->nFilterIndex, debugstr_w(tmpstr)); ofn->nFilterIndex, debugstr_w(tmpstr));
SetDlgItemTextW( hWnd, edt1, tmpstr ); SetDlgItemTextW( hWnd, edt1, tmpstr );
/* get drive list */ /* get drive list */
@ -597,7 +597,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
* the OPENFILENAME structure). For example under 2000/XP any path in the * the OPENFILENAME structure). For example under 2000/XP any path in the
* lpstrFile overrides the lpstrInitialDir, but not under 95/98/ME * lpstrFile overrides the lpstrInitialDir, but not under 95/98/ME
*/ */
if (ofn->lpstrInitialDir != NULL) if (ofn->lpstrInitialDir != NULL)
{ {
int len; int len;
lstrcpynW(tmpstr, ofn->lpstrInitialDir, 511); lstrcpynW(tmpstr, ofn->lpstrInitialDir, 511);
@ -638,7 +638,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
/*********************************************************************** /***********************************************************************
* FILEDLG_UpdateResult [internal] * FILEDLG_UpdateResult [internal]
* update the displayed file name (with path) * update the displayed file name (with path)
*/ */
void FILEDLG_UpdateResult(LFSPRIVATE lfs, WCHAR *tmpstr) void FILEDLG_UpdateResult(LFSPRIVATE lfs, WCHAR *tmpstr)
{ {
@ -695,13 +695,13 @@ void FILEDLG_UpdateResult(LFSPRIVATE lfs, WCHAR *tmpstr)
/*********************************************************************** /***********************************************************************
* FILEDLG_UpdateFileTitle [internal] * FILEDLG_UpdateFileTitle [internal]
* update the displayed file name (without path) * update the displayed file name (without path)
*/ */
void FILEDLG_UpdateFileTitle(LFSPRIVATE lfs) void FILEDLG_UpdateFileTitle(LFSPRIVATE lfs)
{ {
LONG lRet; LONG lRet;
LPOPENFILENAMEW ofnW = lfs->ofnW; LPOPENFILENAMEW ofnW = lfs->ofnW;
if (ofnW->lpstrFileTitle != NULL) if (ofnW->lpstrFileTitle != NULL)
{ {
lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0); lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETTEXT, lRet, SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETTEXT, lRet,
@ -907,7 +907,7 @@ static LRESULT FILEDLG_Validate( LFSPRIVATE lfs, LPWSTR path, UINT control, INT
{ {
lRet = (BOOL)FILEDLG_CallWindowProc(lfs, lfs->fileokstring, lRet = (BOOL)FILEDLG_CallWindowProc(lfs, lfs->fileokstring,
0, lfs->lParam ); 0, lfs->lParam );
if (lRet) if (lRet)
{ {
*ofnW = ofnsav; /* restore old state */ *ofnW = ofnsav; /* restore old state */
return FALSE; return FALSE;
@ -945,7 +945,7 @@ static LRESULT FILEDLG_DiskChange( LFSPRIVATE lfs )
SendDlgItemMessageW(hWnd, cmb2, CB_GETLBTEXT, lRet, SendDlgItemMessageW(hWnd, cmb2, CB_GETLBTEXT, lRet,
(LPARAM)pstr); (LPARAM)pstr);
wsprintfW(diskname, FILE_specc, pstr[2]); wsprintfW(diskname, FILE_specc, pstr[2]);
HeapFree(GetProcessHeap(), 0, pstr); HeapFree(GetProcessHeap(), 0, pstr);
return FILEDLG_Validate( lfs, diskname, cmb2, lRet, TRUE ); return FILEDLG_Validate( lfs, diskname, cmb2, lRet, TRUE );
} }
@ -977,7 +977,7 @@ static LRESULT FILEDLG_FileTypeChange( LFSPRIVATE lfs )
* FILEDLG_WMCommand [internal] * FILEDLG_WMCommand [internal]
*/ */
static LRESULT FILEDLG_WMCommand(HWND hWnd, LPARAM lParam, UINT notification, static LRESULT FILEDLG_WMCommand(HWND hWnd, LPARAM lParam, UINT notification,
UINT control, LFSPRIVATE lfs ) UINT control, LFSPRIVATE lfs )
{ {
switch (control) switch (control)
{ {
@ -1000,7 +1000,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, LPARAM lParam, UINT notification,
break; break;
case cmb1: /* file type drop list */ case cmb1: /* file type drop list */
if (notification == CBN_SELCHANGE) if (notification == CBN_SELCHANGE)
return FILEDLG_FileTypeChange( lfs ); return FILEDLG_FileTypeChange( lfs );
break; break;
@ -1117,7 +1117,7 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open
ofnW->lpstrInitialDir = HEAP_strdupAtoW(GetProcessHeap(),0,ofnA->lpstrInitialDir); ofnW->lpstrInitialDir = HEAP_strdupAtoW(GetProcessHeap(),0,ofnA->lpstrInitialDir);
if (ofnA->lpstrTitle) if (ofnA->lpstrTitle)
str = ofnA->lpstrTitle; str = ofnA->lpstrTitle;
else else
/* Allocates default title (FIXME : get it from resource) */ /* Allocates default title (FIXME : get it from resource) */
str = open ? defaultopen:defaultsave; str = open ? defaultopen:defaultsave;
ofnW->lpstrTitle = HEAP_strdupAtoW(GetProcessHeap(),0, str); ofnW->lpstrTitle = HEAP_strdupAtoW(GetProcessHeap(),0, str);
@ -1174,7 +1174,7 @@ void FILEDLG_MapOfnStruct16(LPOPENFILENAME16 ofn16, LPOPENFILENAMEW ofnW, BOOL o
/************************************************************************ /************************************************************************
* FILEDLG_DestroyPrivate [internal] * FILEDLG_DestroyPrivate [internal]
* destroys the private object * destroys the private object
*/ */
void FILEDLG_DestroyPrivate(LFSPRIVATE lfs) void FILEDLG_DestroyPrivate(LFSPRIVATE lfs)
{ {
@ -1209,7 +1209,7 @@ void FILEDLG_DestroyPrivate(LFSPRIVATE lfs)
/************************************************************************ /************************************************************************
* FILEDLG_AllocPrivate [internal] * FILEDLG_AllocPrivate [internal]
* allocate a private object to hold 32 bits Unicode * allocate a private object to hold 32 bits Unicode
* structure that will be used throughtout the calls, while * structure that will be used throughtout the calls, while
* keeping available the original structures and a few variables * keeping available the original structures and a few variables
* On entry : type = dialog procedure type (16,32A,32W) * On entry : type = dialog procedure type (16,32A,32W)
@ -1264,7 +1264,7 @@ LFSPRIVATE FILEDLG_AllocPrivate(LPARAM lParam, int type, UINT dlgType)
if (lfs->ofnA) if (lfs->ofnA)
FILEDLG_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open); FILEDLG_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open);
} }
else else
ret = NULL; ret = NULL;
} }
if (lfs->ofn16) if (lfs->ofn16)
@ -1283,7 +1283,7 @@ LFSPRIVATE FILEDLG_AllocPrivate(LPARAM lParam, int type, UINT dlgType)
* *
* Creates a win31 style dialog box for the user to select a file to open/save. * Creates a win31 style dialog box for the user to select a file to open/save.
*/ */
BOOL WINAPI GetFileName31A( BOOL WINAPI GetFileName31A(
LPOPENFILENAMEA lpofn, /* addess of structure with data*/ LPOPENFILENAMEA lpofn, /* addess of structure with data*/
UINT dlgType /* type dialogue : open/save */ UINT dlgType /* type dialogue : open/save */
) )
@ -1298,7 +1298,7 @@ BOOL WINAPI GetFileName31A(
if (lfs) if (lfs)
{ {
hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner, bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner,
(DLGPROC) FileOpenDlgProc, (DWORD) lfs); (DLGPROC) FileOpenDlgProc, (DWORD) lfs);
FILEDLG_DestroyPrivate(lfs); FILEDLG_DestroyPrivate(lfs);
} }
@ -1313,7 +1313,7 @@ BOOL WINAPI GetFileName31A(
* *
* Creates a win31 style dialog box for the user to select a file to open/save * Creates a win31 style dialog box for the user to select a file to open/save
*/ */
BOOL WINAPI GetFileName31W( BOOL WINAPI GetFileName31W(
LPOPENFILENAMEW lpofn, /* addess of structure with data*/ LPOPENFILENAMEW lpofn, /* addess of structure with data*/
UINT dlgType /* type dialogue : open/save */ UINT dlgType /* type dialogue : open/save */
) )
@ -1328,7 +1328,7 @@ BOOL WINAPI GetFileName31W(
if (lfs) if (lfs)
{ {
hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner, bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner,
(DLGPROC) FileOpenDlgProc, (DWORD) lfs); (DLGPROC) FileOpenDlgProc, (DWORD) lfs);
FILEDLG_DestroyPrivate(lfs); FILEDLG_DestroyPrivate(lfs);
} }
@ -1345,15 +1345,15 @@ BOOL WINAPI GetFileName31W(
*/ */
LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam, LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
LPARAM lParam) LPARAM lParam)
{ {
LFSPRIVATE lfs = (LFSPRIVATE)GetPropA(hWnd,OFN_PROP); LFSPRIVATE lfs = (LFSPRIVATE)GetPropA(hWnd,OFN_PROP);
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
TRACE("msg=%x wparam=%x lParam=%lx\n", wMsg, wParam, lParam); TRACE("msg=%x wparam=%x lParam=%lx\n", wMsg, wParam, lParam);
if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook) if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook)
{ {
LRESULT lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam); LRESULT lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam);
if (lRet) if (lRet)
return lRet; /* else continue message processing */ return lRet; /* else continue message processing */
} }
switch (wMsg) switch (wMsg)
@ -1402,16 +1402,16 @@ LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
{ {
LRESULT lRet; LRESULT lRet;
lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam); lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam);
if (lRet) if (lRet)
return lRet; /* else continue message processing */ return lRet; /* else continue message processing */
} }
switch (wMsg) { switch (wMsg) {
case WM_INITDIALOG: case WM_INITDIALOG:
return FILEDLG_WMInitDialog(hWnd, wParam, lParam); return FILEDLG_WMInitDialog(hWnd, wParam, lParam);
case WM_MEASUREITEM: case WM_MEASUREITEM:
return FILEDLG_WMMeasureItem16(hWnd, wParam, lParam); return FILEDLG_WMMeasureItem16(hWnd, wParam, lParam);
case WM_DRAWITEM: case WM_DRAWITEM:
FILEDLG_MapDrawItemStruct(MapSL(lParam), &dis); FILEDLG_MapDrawItemStruct(MapSL(lParam), &dis);
return FILEDLG_WMDrawItem(hWnd, wParam, lParam, TRUE, &dis); return FILEDLG_WMDrawItem(hWnd, wParam, lParam, TRUE, &dis);
@ -1419,7 +1419,7 @@ LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
case WM_COMMAND: case WM_COMMAND:
return FILEDLG_WMCommand(hWnd, lParam, HIWORD(lParam), wParam, lfs); return FILEDLG_WMCommand(hWnd, lParam, HIWORD(lParam), wParam, lfs);
} }
/* /*
case WM_CTLCOLOR: case WM_CTLCOLOR:
SetBkColor((HDC16)wParam, 0x00C0C0C0); SetBkColor((HDC16)wParam, 0x00C0C0C0);
@ -1433,14 +1433,14 @@ LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
return hGRAYBrush; return hGRAYBrush;
} }
return FALSE; return FALSE;
*/ */
return FALSE; return FALSE;
} }
/*********************************************************************** /***********************************************************************
* FileOpenDlgProc [internal] * FileOpenDlgProc [internal]
* Used for open and save, in fact. * Used for open and save, in fact.
*/ */
static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg, static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
@ -1452,7 +1452,7 @@ static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg,
{ {
LRESULT lRet; LRESULT lRet;
lRet = (BOOL)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam); lRet = (BOOL)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam);
if (lRet) if (lRet)
return lRet; /* else continue message processing */ return lRet; /* else continue message processing */
} }
switch (wMsg) switch (wMsg)
@ -1486,7 +1486,7 @@ static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg,
return FALSE; return FALSE;
} }
/* ------------------ APIs ---------------------- */ /* ------------------ APIs ---------------------- */
/*********************************************************************** /***********************************************************************
* GetOpenFileName (COMMDLG.1) * GetOpenFileName (COMMDLG.1)
@ -1500,7 +1500,7 @@ static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg,
* BUGS * BUGS
* unknown, there are some FIXME's left. * unknown, there are some FIXME's left.
*/ */
BOOL16 WINAPI GetOpenFileName16( BOOL16 WINAPI GetOpenFileName16(
SEGPTR ofn /* [in/out] address of structure with data*/ SEGPTR ofn /* [in/out] address of structure with data*/
) )
{ {
@ -1517,7 +1517,7 @@ BOOL16 WINAPI GetOpenFileName16(
{ {
hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 6); ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 6);
bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner,
(DLGPROC16) ptr, (DWORD) lfs); (DLGPROC16) ptr, (DWORD) lfs);
FILEDLG_DestroyPrivate(lfs); FILEDLG_DestroyPrivate(lfs);
} }
@ -1538,7 +1538,7 @@ BOOL16 WINAPI GetOpenFileName16(
* BUGS * BUGS
* unknown. There are some FIXME's left. * unknown. There are some FIXME's left.
*/ */
BOOL16 WINAPI GetSaveFileName16( BOOL16 WINAPI GetSaveFileName16(
SEGPTR ofn /* [in/out] addess of structure with data*/ SEGPTR ofn /* [in/out] addess of structure with data*/
) )
{ {
@ -1555,10 +1555,10 @@ BOOL16 WINAPI GetSaveFileName16(
{ {
hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE ); hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 7); ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 7);
bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner,
(DLGPROC16) ptr, (DWORD) lfs); (DLGPROC16) ptr, (DWORD) lfs);
FILEDLG_DestroyPrivate(lfs); FILEDLG_DestroyPrivate(lfs);
} }
TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile)); TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile));
return bRet; return bRet;
@ -1650,7 +1650,7 @@ BOOL WINAPI GetSaveFileNameA(
if (newlook) if (newlook)
{ {
return GetFileDialog95A(ofn, SAVE_DIALOG); return GetFileDialog95A(ofn, SAVE_DIALOG);
} }
else else
{ {
return GetFileName31A(ofn, SAVE_DIALOG); return GetFileName31A(ofn, SAVE_DIALOG);
@ -1681,7 +1681,7 @@ BOOL WINAPI GetSaveFileNameW(
if (newlook) if (newlook)
{ {
return GetFileDialog95W(ofn, SAVE_DIALOG); return GetFileDialog95W(ofn, SAVE_DIALOG);
} }
else else
{ {
return GetFileName31W(ofn, SAVE_DIALOG); return GetFileName31W(ofn, SAVE_DIALOG);

View File

@ -92,7 +92,7 @@ typedef struct SFolder
int m_iImageIndex; /* Index of picture in image list */ int m_iImageIndex; /* Index of picture in image list */
HIMAGELIST hImgList; HIMAGELIST hImgList;
int m_iIndent; /* Indentation index */ int m_iIndent; /* Indentation index */
LPITEMIDLIST pidlItem; /* absolute pidl of the item */ LPITEMIDLIST pidlItem; /* absolute pidl of the item */
} SFOLDER,*LPSFOLDER; } SFOLDER,*LPSFOLDER;
@ -222,7 +222,7 @@ static BOOL BrowseSelectedFolder(HWND hwnd);
/*********************************************************************** /***********************************************************************
* GetFileName95 * GetFileName95
* *
* Creates an Open common dialog box that lets the user select * Creates an Open common dialog box that lets the user select
* the drive, directory, and the name of a file or set of files to open. * the drive, directory, and the name of a file or set of files to open.
* *
* IN : The FileOpenDlgInfos structure associated with the dialog * IN : The FileOpenDlgInfos structure associated with the dialog
@ -257,7 +257,7 @@ BOOL WINAPI GetFileName95(FileOpenDlgInfos *fodInfos)
COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
return FALSE; return FALSE;
} }
/* old style hook messages */ /* old style hook messages */
if (IsHooked(fodInfos)) if (IsHooked(fodInfos))
{ {
@ -266,7 +266,7 @@ BOOL WINAPI GetFileName95(FileOpenDlgInfos *fodInfos)
fodInfos->HookMsg.helpmsgstring = RegisterWindowMessageA(HELPMSGSTRINGA); fodInfos->HookMsg.helpmsgstring = RegisterWindowMessageA(HELPMSGSTRINGA);
fodInfos->HookMsg.sharevistring = RegisterWindowMessageA(SHAREVISTRINGA); fodInfos->HookMsg.sharevistring = RegisterWindowMessageA(SHAREVISTRINGA);
} }
lRes = DialogBoxIndirectParamA(COMMDLG_hInstance32, lRes = DialogBoxIndirectParamA(COMMDLG_hInstance32,
(LPDLGTEMPLATEA) template, (LPDLGTEMPLATEA) template,
fodInfos->ofnInfos->hwndOwner, fodInfos->ofnInfos->hwndOwner,
@ -276,7 +276,7 @@ BOOL WINAPI GetFileName95(FileOpenDlgInfos *fodInfos)
/* Unable to create the dialog */ /* Unable to create the dialog */
if( lRes == -1) if( lRes == -1)
return FALSE; return FALSE;
return lRes; return lRes;
} }
@ -297,14 +297,14 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
LPCSTR lpstrInitialDir = (LPCSTR)-1; LPCSTR lpstrInitialDir = (LPCSTR)-1;
LPSTR lpstrSavDir = NULL; LPSTR lpstrSavDir = NULL;
DWORD dwFlags = 0; DWORD dwFlags = 0;
/* Initialize FileOpenDlgInfos structure */ /* Initialize FileOpenDlgInfos structure */
fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos)); fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
ZeroMemory(fodInfos, sizeof(FileOpenDlgInfos)); ZeroMemory(fodInfos, sizeof(FileOpenDlgInfos));
/* Pass in the original ofn */ /* Pass in the original ofn */
fodInfos->ofnInfos = ofn; fodInfos->ofnInfos = ofn;
/* Save original hInstance value */ /* Save original hInstance value */
hInstance = ofn->hInstance; hInstance = ofn->hInstance;
fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance); fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
@ -322,7 +322,7 @@ BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
/* Initialize the dialog property */ /* Initialize the dialog property */
fodInfos->DlgInfos.dwDlgProp = 0; fodInfos->DlgInfos.dwDlgProp = 0;
fodInfos->DlgInfos.hwndCustomDlg = (HWND)NULL; fodInfos->DlgInfos.hwndCustomDlg = (HWND)NULL;
switch(iDlgType) switch(iDlgType)
{ {
case OPEN_DIALOG : case OPEN_DIALOG :
@ -402,7 +402,7 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
BOOL ret; BOOL ret;
FileOpenDlgInfos *fodInfos; FileOpenDlgInfos *fodInfos;
HINSTANCE hInstance; HINSTANCE hInstance;
/* out arguments */ /* out arguments */
LPWSTR lpstrFile = NULL; LPWSTR lpstrFile = NULL;
LPWSTR lpstrFileTitle = NULL; LPWSTR lpstrFileTitle = NULL;
@ -436,7 +436,7 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
/* filter is a list... title\0ext\0......\0\0 */ /* filter is a list... title\0ext\0......\0\0 */
s = ofn->lpstrFilter; s = ofn->lpstrFilter;
while (*s) s = s+strlenW(s)+1; while (*s) s = s+strlenW(s)+1;
s++; s++;
n = s - ofn->lpstrFilter; /* already divides by 2. ptr magic */ n = s - ofn->lpstrFilter; /* already divides by 2. ptr magic */
@ -490,7 +490,7 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
default : default :
ret = 0; ret = 0;
} }
/* restore saved IN arguments and convert OUT arguments back */ /* restore saved IN arguments and convert OUT arguments back */
ofn->Flags = dwFlags; ofn->Flags = dwFlags;
ofn->hInstance = hInstance; ofn->hInstance = hInstance;
@ -568,7 +568,7 @@ void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg)
SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, SWP_NOZORDER ); SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, SWP_NOZORDER );
SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left), SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
(rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER); (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
hwndChild = GetWindow(hwndChildDlg,GW_CHILD); hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
if(hwndStc32) if(hwndStc32)
{ {
@ -588,7 +588,7 @@ void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg)
continue; continue;
GetWindowRect(hwndChild,&rectCtrl); GetWindowRect(hwndChild,&rectCtrl);
MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2); MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
/* /*
Check the initial position of the controls relative to the initial Check the initial position of the controls relative to the initial
position and size of stc32 (before it is expanded). position and size of stc32 (before it is expanded).
@ -606,15 +606,15 @@ void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg)
{ {
rectCtrl.top += ptMoveCtl.y; rectCtrl.top += ptMoveCtl.y;
} }
SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top, SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
SWP_NOSIZE | SWP_NOZORDER ); SWP_NOSIZE | SWP_NOZORDER );
} }
} while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL); } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
} }
hwndChild = GetWindow(hwndParentDlg,GW_CHILD); hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
if(hwndStc32) if(hwndStc32)
{ {
GetWindowRect(hwndStc32,&rectStc32); GetWindowRect(hwndStc32,&rectStc32);
@ -635,12 +635,12 @@ void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg)
rectCtrl.left += ptMoveCtl.x; rectCtrl.left += ptMoveCtl.x;
rectCtrl.top += ptMoveCtl.y; rectCtrl.top += ptMoveCtl.y;
SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top, SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top, rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
SWP_NOSIZE |SWP_NOZORDER ); SWP_NOSIZE |SWP_NOZORDER );
} }
} while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL); } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
} }
} }
} }
@ -656,7 +656,7 @@ HRESULT WINAPI FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam,
switch(uMsg) switch(uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
/* Hide caption since some program may leave it */ /* Hide caption since some program may leave it */
DWORD Style = GetWindowLongA(hwnd, GWL_STYLE); DWORD Style = GetWindowLongA(hwnd, GWL_STYLE);
if (Style & WS_CAPTION) SetWindowLongA(hwnd, GWL_STYLE, Style & (~WS_CAPTION)); if (Style & WS_CAPTION) SetWindowLongA(hwnd, GWL_STYLE, Style & (~WS_CAPTION));
@ -667,14 +667,14 @@ HRESULT WINAPI FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam,
if(fodInfos && IsHooked(fodInfos)) if(fodInfos && IsHooked(fodInfos))
return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam); return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
return 0; return 0;
} }
} }
if(fodInfos && IsHooked(fodInfos)) if(fodInfos && IsHooked(fodInfos))
return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam); return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
return DefWindowProcA(hwnd,uMsg,wParam,lParam); return DefWindowProcA(hwnd,uMsg,wParam,lParam);
} }
HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
@ -716,7 +716,7 @@ HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
if(hChildDlg) if(hChildDlg)
{ {
ShowWindow(hChildDlg,SW_SHOW); ShowWindow(hChildDlg,SW_SHOW);
return hChildDlg; return hChildDlg;
} }
} }
@ -742,7 +742,7 @@ HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
} }
return (HWND)NULL; return (HWND)NULL;
} }
/*********************************************************************** /***********************************************************************
* SendCustomDlgNotificationMessage * SendCustomDlgNotificationMessage
* *
@ -794,7 +794,7 @@ HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam
case CDM_GETFILEPATH: case CDM_GETFILEPATH:
GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath)); GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath));
lpstrFileSpec = (LPSTR)PathFindFileNameA(lpstrPath); lpstrFileSpec = (LPSTR)PathFindFileNameA(lpstrPath);
if (lpstrFileSpec==lpstrPath) if (lpstrFileSpec==lpstrPath)
{ {
char lpstrCurrentDir[MAX_PATH]; char lpstrCurrentDir[MAX_PATH];
/* Prepend the current path */ /* Prepend the current path */
@ -802,8 +802,8 @@ HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam
if ((LPSTR)lParam!=NULL) if ((LPSTR)lParam!=NULL)
snprintf((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath); snprintf((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath);
reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1; reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1;
} }
else else
{ {
lstrcpynA((LPSTR)lParam,(LPSTR)lpstrPath,(int)wParam); lstrcpynA((LPSTR)lParam,(LPSTR)lpstrPath,(int)wParam);
reqSize=strlen(lpstrPath); reqSize=strlen(lpstrPath);
@ -836,7 +836,7 @@ HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam
} }
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* FileOpenDlgProc95 * FileOpenDlgProc95
* *
@ -847,18 +847,18 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
#if 0 #if 0
TRACE("0x%04x 0x%04x\n", hwnd, uMsg); TRACE("0x%04x 0x%04x\n", hwnd, uMsg);
#endif #endif
switch(uMsg) switch(uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam; FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;
/* Adds the FileOpenDlgInfos in the property list of the dialog /* Adds the FileOpenDlgInfos in the property list of the dialog
so it will be easily accessible through a GetPropA(...) */ so it will be easily accessible through a GetPropA(...) */
SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos); SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos);
fodInfos->DlgInfos.hwndCustomDlg = fodInfos->DlgInfos.hwndCustomDlg =
CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd); CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
FILEDLG95_InitControls(hwnd); FILEDLG95_InitControls(hwnd);
@ -881,7 +881,7 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
} }
} }
return FALSE; return FALSE;
case WM_GETISHELLBROWSER: case WM_GETISHELLBROWSER:
return FILEDLG95_OnWMGetIShellBrowser(hwnd); return FILEDLG95_OnWMGetIShellBrowser(hwnd);
@ -897,7 +897,7 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
/* set up the button tooltips strings */ /* set up the button tooltips strings */
if(TTN_GETDISPINFOA == lpnmh->code ) if(TTN_GETDISPINFOA == lpnmh->code )
{ {
LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam; LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam;
switch(lpnmh->idFrom ) switch(lpnmh->idFrom )
{ {
/* Up folder button */ /* Up folder button */
@ -923,7 +923,7 @@ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
default: default:
stringId = 0; stringId = 0;
} }
lpdi->hinst = COMMDLG_hInstance32; lpdi->hinst = COMMDLG_hInstance32;
lpdi->lpszText = (LPSTR) stringId; lpdi->lpszText = (LPSTR) stringId;
} }
return FALSE; return FALSE;
@ -959,9 +959,9 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
{ HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR }, { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR },
{ COMDLG32_hInstance, 800 } /* desktop icon */ { COMDLG32_hInstance, 800 } /* desktop icon */
}; };
RECT rectTB; RECT rectTB;
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
TRACE("%p\n", fodInfos); TRACE("%p\n", fodInfos);
@ -975,11 +975,11 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
GetWindowRect(GetDlgItem(hwnd,IDC_TOOLBARSTATIC),&rectTB); GetWindowRect(GetDlgItem(hwnd,IDC_TOOLBARSTATIC),&rectTB);
MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2); MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL, fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL,
WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE, WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
0, 0, 150, 26, hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL); 0, 0, 150, 26, hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL);
SetWindowPos(fodInfos->DlgInfos.hwndTB, 0, SetWindowPos(fodInfos->DlgInfos.hwndTB, 0,
rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top, rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
@ -991,7 +991,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 1, (LPARAM) &tba[1]); SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 1, (LPARAM) &tba[1]);
SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 9,(LPARAM) &tbb); SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 9,(LPARAM) &tbb);
SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0); SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
/* Set the window text with the text specified in the OPENFILENAME structure */ /* Set the window text with the text specified in the OPENFILENAME structure */
if(fodInfos->ofnInfos->lpstrTitle) if(fodInfos->ofnInfos->lpstrTitle)
@ -1031,7 +1031,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
/* Resize the height, if open as read only checkbox ad help button /* Resize the height, if open as read only checkbox ad help button
are hidden and we are not using a custom template */ are hidden and we are not using a custom template */
if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) && if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) &&
(!(fodInfos->ofnInfos->Flags & (!(fodInfos->ofnInfos->Flags &
(OFN_SHOWHELP|OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)))) (OFN_SHOWHELP|OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))))
{ {
RECT rectDlg, rectHelp, rectCancel; RECT rectDlg, rectHelp, rectCancel;
@ -1040,8 +1040,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel); GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
/* subtract the height of the help button plus the space between /* subtract the height of the help button plus the space between
the help button and the cancel button to the height of the dialog */ the help button and the cancel button to the height of the dialog */
SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left, SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
(rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom), (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
} }
@ -1062,10 +1062,10 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
LPITEMIDLIST pidlItemId = NULL; LPITEMIDLIST pidlItemId = NULL;
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam; FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
TRACE("dir=%s file=%s\n", TRACE("dir=%s file=%s\n",
fodInfos->ofnInfos->lpstrInitialDir, fodInfos->ofnInfos->lpstrFile); fodInfos->ofnInfos->lpstrInitialDir, fodInfos->ofnInfos->lpstrFile);
/* Get the initial directory pidl */ /* Get the initial directory pidl */
@ -1165,7 +1165,7 @@ static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
/* Do not use the listview selection anymore */ /* Do not use the listview selection anymore */
fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
return 0; return 0;
} }
/*********************************************************************** /***********************************************************************
@ -1182,13 +1182,13 @@ static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd)
SetWindowLongA(hwnd,DWL_MSGRESULT,(LONG)fodInfos->Shell.FOIShellBrowser); SetWindowLongA(hwnd,DWL_MSGRESULT,(LONG)fodInfos->Shell.FOIShellBrowser);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* FILEDLG95_OnOpenMultipleFiles * FILEDLG95_OnOpenMultipleFiles
* *
* Handles the opening of multiple files. * Handles the opening of multiple files.
* *
* FIXME * FIXME
@ -1205,13 +1205,13 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCou
lpstrFile = fodInfos->ofnInfos->lpstrFile; lpstrFile = fodInfos->ofnInfos->lpstrFile;
lpstrFile[0] = '\0'; lpstrFile[0] = '\0';
SHGetPathFromIDListA( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec ); SHGetPathFromIDListA( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
if ( !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) && if ( !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE) &&
( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST)) ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST))
{ {
LPSTR lpstrTemp = lpstrFileList; LPSTR lpstrTemp = lpstrFileList;
for ( nCount = 0; nCount < nFileCount; nCount++ ) for ( nCount = 0; nCount < nFileCount; nCount++ )
{ {
@ -1236,7 +1236,7 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCou
MessageBoxA(hwnd, tmp, fodInfos->ofnInfos->lpstrTitle, MB_OK | MB_ICONEXCLAMATION); MessageBoxA(hwnd, tmp, fodInfos->ofnInfos->lpstrTitle, MB_OK | MB_ICONEXCLAMATION);
return FALSE; return FALSE;
} }
/* move to the next file in the list of files */ /* move to the next file in the list of files */
lpstrTemp += strlen(lpstrTemp) + 1; lpstrTemp += strlen(lpstrTemp) + 1;
COMDLG32_SHFree(pidl); COMDLG32_SHFree(pidl);
@ -1259,7 +1259,7 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCou
* FILEDLG95_OnOpen * FILEDLG95_OnOpen
* *
* Ok button WM_COMMAND message handler * Ok button WM_COMMAND message handler
* *
* If the function succeeds, the return value is nonzero. * If the function succeeds, the return value is nonzero.
*/ */
#define ONOPEN_BROWSE 1 #define ONOPEN_BROWSE 1
@ -1300,7 +1300,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
BrowseSelectedFolder(hwnd); BrowseSelectedFolder(hwnd);
return FALSE; return FALSE;
} }
if(nFileCount > 1) if(nFileCount > 1)
{ {
ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed); ret = FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
@ -1359,7 +1359,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
We have to parse the path step by step to see if we have to browse We have to parse the path step by step to see if we have to browse
to a folder if the path points to a directory or the last to a folder if the path points to a directory or the last
valid element is a directory. valid element is a directory.
valid variables: valid variables:
lpstrPathAndFile: cleaned up path lpstrPathAndFile: cleaned up path
*/ */
@ -1381,7 +1381,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
} }
if (FAILED (SHGetDesktopFolder(&lpsf))) return FALSE; if (FAILED (SHGetDesktopFolder(&lpsf))) return FALSE;
lpszTemp1 = lpszTemp = lpstrPathAndFile; lpszTemp1 = lpszTemp = lpstrPathAndFile;
while (lpszTemp1) while (lpszTemp1)
{ {
@ -1537,12 +1537,12 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{ {
int PathLength; int PathLength;
PathLength = strlen(lpstrPathAndFile); PathLength = strlen(lpstrPathAndFile);
strcat(lpstrPathAndFile, "."); strcat(lpstrPathAndFile, ".");
strcat(lpstrPathAndFile, fodInfos->ofnInfos->lpstrDefExt); strcat(lpstrPathAndFile, fodInfos->ofnInfos->lpstrDefExt);
/* if file does not exist try without extension */ /* if file does not exist try without extension */
if (!PathFileExistsA(lpstrPathAndFile)) if (!PathFileExistsA(lpstrPathAndFile))
lpstrPathAndFile[PathLength] = '\0'; lpstrPathAndFile[PathLength] = '\0';
} }
} }
@ -1554,7 +1554,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0)) ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
{ {
LPSTR lpszTemp; LPSTR lpszTemp;
/* fill destination buffer */ /* fill destination buffer */
strcpy(fodInfos->ofnInfos->lpstrFile, lpstrPathAndFile); strcpy(fodInfos->ofnInfos->lpstrFile, lpstrPathAndFile);
if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
@ -1564,11 +1564,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
/* set filename offset */ /* set filename offset */
lpszTemp = PathFindFileNameA(lpstrPathAndFile); lpszTemp = PathFindFileNameA(lpstrPathAndFile);
fodInfos->ofnInfos->nFileOffset = lpszTemp - lpstrPathAndFile; fodInfos->ofnInfos->nFileOffset = lpszTemp - lpstrPathAndFile;
/* set extension offset */ /* set extension offset */
lpszTemp = PathFindExtensionA(lpstrPathAndFile); lpszTemp = PathFindExtensionA(lpstrPathAndFile);
fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? lpszTemp - lpstrPathAndFile + 1 : 0; fodInfos->ofnInfos->nFileExtension = (*lpszTemp) ? lpszTemp - lpstrPathAndFile + 1 : 0;
/* set the lpstrFileTitle */ /* set the lpstrFileTitle */
if(fodInfos->ofnInfos->lpstrFileTitle) if(fodInfos->ofnInfos->lpstrFileTitle)
{ {
@ -1627,7 +1627,7 @@ static HRESULT FILEDLG95_SHELL_Init(HWND hwnd)
TRACE("\n"); TRACE("\n");
/* /*
* Initialisation of the FileOpenDialogInfos structure * Initialisation of the FileOpenDialogInfos structure
*/ */
/* Shell */ /* Shell */
@ -1638,7 +1638,7 @@ static HRESULT FILEDLG95_SHELL_Init(HWND hwnd)
/* Disable multi-select if flag not set */ /* Disable multi-select if flag not set */
if (!(fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)) if (!(fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT))
{ {
fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL; fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL;
} }
fodInfos->ShellInfos.folderSettings.fFlags |= FWF_AUTOARRANGE | FWF_ALIGNLEFT; fodInfos->ShellInfos.folderSettings.fFlags |= FWF_AUTOARRANGE | FWF_ALIGNLEFT;
fodInfos->ShellInfos.folderSettings.ViewMode = FVM_LIST; fodInfos->ShellInfos.folderSettings.ViewMode = FVM_LIST;
@ -1648,8 +1648,8 @@ static HRESULT FILEDLG95_SHELL_Init(HWND hwnd)
ScreenToClient(hwnd,(LPPOINT)&fodInfos->ShellInfos.rectView.right); ScreenToClient(hwnd,(LPPOINT)&fodInfos->ShellInfos.rectView.right);
/* Construct the IShellBrowser interface */ /* Construct the IShellBrowser interface */
fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd); fodInfos->Shell.FOIShellBrowser = IShellBrowserImpl_Construct(hwnd);
return NOERROR; return NOERROR;
} }
@ -1716,7 +1716,7 @@ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd)
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl); SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl);
@ -1749,7 +1749,7 @@ static void FILEDLG95_SHELL_Clean(HWND hwnd)
/*********************************************************************** /***********************************************************************
* FILEDLG95_FILETYPE_Init * FILEDLG95_FILETYPE_Init
* *
* Initialisation of the file type combo box * Initialisation of the file type combo box
*/ */
static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd) static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
{ {
@ -1765,7 +1765,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
for(;;) for(;;)
{ {
/* filter is a list... title\0ext\0......\0\0 /* filter is a list... title\0ext\0......\0\0
* Set the combo item text to the title and the item data * Set the combo item text to the title and the item data
* to the ext * to the ext
*/ */
@ -1782,7 +1782,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
if (!(lpstrExt = (LPSTR) MemAlloc(strlen(lpstrPos)+1))) return E_FAIL; if (!(lpstrExt = (LPSTR) MemAlloc(strlen(lpstrPos)+1))) return E_FAIL;
strcpy(lpstrExt,lpstrPos); strcpy(lpstrExt,lpstrPos);
lpstrPos += strlen(lpstrPos) + 1; lpstrPos += strlen(lpstrPos) + 1;
/* Add the item at the end of the combo */ /* Add the item at the end of the combo */
CBAddString(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay); CBAddString(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters, lpstrExt); CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters, lpstrExt);
@ -1793,7 +1793,7 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
* in the initialisation structure * in the initialisation structure
* FIXME: lpstrCustomFilter not handled at all * FIXME: lpstrCustomFilter not handled at all
*/ */
/* set default filter index */ /* set default filter index */
if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->ofnInfos->lpstrCustomFilter == NULL) if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->ofnInfos->lpstrCustomFilter == NULL)
fodInfos->ofnInfos->nFilterIndex = 1; fodInfos->ofnInfos->nFilterIndex = 1;
@ -1801,16 +1801,16 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
/* First, check to make sure our index isn't out of bounds. */ /* First, check to make sure our index isn't out of bounds. */
if ( fodInfos->ofnInfos->nFilterIndex > nFilters ) if ( fodInfos->ofnInfos->nFilterIndex > nFilters )
fodInfos->ofnInfos->nFilterIndex = nFilters; fodInfos->ofnInfos->nFilterIndex = nFilters;
/* Set the current index selection. */ /* Set the current index selection. */
CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, fodInfos->ofnInfos->nFilterIndex-1); CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, fodInfos->ofnInfos->nFilterIndex-1);
/* Get the corresponding text string from the combo box. */ /* Get the corresponding text string from the combo box. */
lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
fodInfos->ofnInfos->nFilterIndex-1); fodInfos->ofnInfos->nFilterIndex-1);
if ((INT)lpstrFilter == CB_ERR) /* control is empty */ if ((INT)lpstrFilter == CB_ERR) /* control is empty */
lpstrFilter = NULL; lpstrFilter = NULL;
if(lpstrFilter) if(lpstrFilter)
{ {
@ -1919,11 +1919,11 @@ static void FILEDLG95_FILETYPE_Clean(HWND hwnd)
MemFree(fodInfos->ShellInfos.lpstrCurrentFilter); MemFree(fodInfos->ShellInfos.lpstrCurrentFilter);
} }
/*********************************************************************** /***********************************************************************
* FILEDLG95_LOOKIN_Init * FILEDLG95_LOOKIN_Init
* *
* Initialisation of the look in combo box * Initialisation of the look in combo box
*/ */
static HRESULT FILEDLG95_LOOKIN_Init(HWND hwndCombo) static HRESULT FILEDLG95_LOOKIN_Init(HWND hwndCombo)
{ {
@ -2026,21 +2026,21 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
if(pDIStruct->itemID == liInfos->uSelectedItem) if(pDIStruct->itemID == liInfos->uSelectedItem)
{ {
ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
0, 0,
&sfi, &sfi,
sizeof (SHFILEINFOA), sizeof (SHFILEINFOA),
SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_PIDL | SHGFI_SMALLICON |
SHGFI_OPENICON | SHGFI_SYSICONINDEX | SHGFI_OPENICON | SHGFI_SYSICONINDEX |
SHGFI_DISPLAYNAME ); SHGFI_DISPLAYNAME );
} }
else else
{ {
ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
0, 0,
&sfi, &sfi,
sizeof (SHFILEINFOA), sizeof (SHFILEINFOA),
SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_PIDL | SHGFI_SMALLICON |
SHGFI_SYSICONINDEX | SHGFI_SYSICONINDEX |
SHGFI_DISPLAYNAME); SHGFI_DISPLAYNAME);
} }
@ -2063,10 +2063,10 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
{ {
iIndentation = 0; iIndentation = 0;
ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem, ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
0, 0,
&sfi, &sfi,
sizeof (SHFILEINFOA), sizeof (SHFILEINFOA),
SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON
| SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME ); | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME );
} }
@ -2090,14 +2090,14 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
rectText.right = pDIStruct->rcItem.right + XTEXTOFFSET; rectText.right = pDIStruct->rcItem.right + XTEXTOFFSET;
rectText.bottom = rectText.bottom =
(pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2; (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
/* Draw the icon from the image list */ /* Draw the icon from the image list */
ImageList_Draw(ilItemImage, ImageList_Draw(ilItemImage,
sfi.iIcon, sfi.iIcon,
pDIStruct->hDC, pDIStruct->hDC,
rectIcon.left, rectIcon.left,
rectIcon.top, rectIcon.top,
ILD_TRANSPARENT ); ILD_TRANSPARENT );
/* Draw the associated text */ /* Draw the associated text */
if(sfi.szDisplayName) if(sfi.szDisplayName)
@ -2124,7 +2124,7 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode)
case CBN_SELENDOK: case CBN_SELENDOK:
{ {
LPSFOLDER tmpFolder; LPSFOLDER tmpFolder;
int iItem; int iItem;
iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB);
@ -2141,7 +2141,7 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode)
} }
break; break;
} }
} }
return FALSE; return FALSE;
} }
@ -2166,7 +2166,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr))) if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr)))
return -1; return -1;
tmpFolder = MemAlloc(sizeof(SFOLDER)); tmpFolder = MemAlloc(sizeof(SFOLDER));
tmpFolder->m_iIndent = 0; tmpFolder->m_iIndent = 0;
@ -2181,13 +2181,13 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
if(tmpFolder->m_iIndent > liInfos->iMaxIndentation) if(tmpFolder->m_iIndent > liInfos->iMaxIndentation)
liInfos->iMaxIndentation = tmpFolder->m_iIndent; liInfos->iMaxIndentation = tmpFolder->m_iIndent;
sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM; sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
SHGetFileInfoA((LPSTR)pidl, SHGetFileInfoA((LPSTR)pidl,
0, 0,
&sfi, &sfi,
sizeof(sfi), sizeof(sfi),
SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX
| SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED); | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED);
TRACE("-- Add %s attr=%08lx\n", sfi.szDisplayName, sfi.dwAttributes); TRACE("-- Add %s attr=%08lx\n", sfi.szDisplayName, sfi.dwAttributes);
@ -2195,7 +2195,7 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM)) if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
{ {
int iItemID; int iItemID;
TRACE("-- Add %s at %u\n", sfi.szDisplayName, tmpFolder->m_iIndent); TRACE("-- Add %s at %u\n", sfi.szDisplayName, tmpFolder->m_iIndent);
/* Add the item at the end of the list */ /* Add the item at the end of the list */
@ -2221,11 +2221,11 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
/*********************************************************************** /***********************************************************************
* FILEDLG95_LOOKIN_InsertItemAfterParent * FILEDLG95_LOOKIN_InsertItemAfterParent
* *
* Insert an item below its parent * Insert an item below its parent
*/ */
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl) static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd,LPITEMIDLIST pidl)
{ {
LPITEMIDLIST pidlParent = GetParentPidl(pidl); LPITEMIDLIST pidlParent = GetParentPidl(pidl);
int iParentPos; int iParentPos;
@ -2280,7 +2280,7 @@ int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl)
iItemPos--; iItemPos--;
} }
} }
CBSetCurSel(hwnd,iItemPos); CBSetCurSel(hwnd,iItemPos);
liInfos->uSelectedItem = iItemPos; liInfos->uSelectedItem = iItemPos;
@ -2402,7 +2402,7 @@ void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd)
for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ ) for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ )
{ {
pidl = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, nFileToOpen+1 ); pidl = GetPidlFromDataObject( fodInfos->Shell.FOIDataObject, nFileToOpen+1 );
if (pidl) if (pidl)
{ {
/* get the total length of the selected file names*/ /* get the total length of the selected file names*/
@ -2514,7 +2514,7 @@ int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPSTR * lpstrFileList, UINT * si
GetDlgItemTextA(hwnd, IDC_FILENAME, lpstrEdit, nStrLen+1); GetDlgItemTextA(hwnd, IDC_FILENAME, lpstrEdit, nStrLen+1);
TRACE("nStrLen=%u str=%s\n", nStrLen, lpstrEdit); TRACE("nStrLen=%u str=%s\n", nStrLen, lpstrEdit);
/* we might get single filename without any '"', /* we might get single filename without any '"',
* so we need nStrLen + terminating \0 + end-of-list \0 */ * so we need nStrLen + terminating \0 + end-of-list \0 */
*lpstrFileList = MemAlloc(nStrLen+2); *lpstrFileList = MemAlloc(nStrLen+2);
@ -2535,7 +2535,7 @@ int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPSTR * lpstrFileList, UINT * si
(*lpstrFileList)[nFileIndex++] = '\0'; (*lpstrFileList)[nFileIndex++] = '\0';
(*sizeUsed)++; (*sizeUsed)++;
nFileCount++; nFileCount++;
} }
nStrCharCount++; nStrCharCount++;
} }
@ -2596,13 +2596,13 @@ static void COMCTL32_ReleaseStgMedium (STGMEDIUM medium)
*/ */
LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex) LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex)
{ {
STGMEDIUM medium; STGMEDIUM medium;
FORMATETC formatetc; FORMATETC formatetc;
LPITEMIDLIST pidl = NULL; LPITEMIDLIST pidl = NULL;
TRACE("sv=%p index=%u\n", doSelected, nPidlIndex); TRACE("sv=%p index=%u\n", doSelected, nPidlIndex);
/* Set the FORMATETC structure*/ /* Set the FORMATETC structure*/
SETDefFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); SETDefFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
@ -2656,9 +2656,9 @@ UINT GetNumSelected( IDataObject *doSelected )
/*********************************************************************** /***********************************************************************
* GetName * GetName
* *
* Get the pidl's display name (relative to folder) and * Get the pidl's display name (relative to folder) and
* put it in lpstrFileName. * put it in lpstrFileName.
* *
* Return NOERROR on success, * Return NOERROR on success,
* E_FAIL otherwise * E_FAIL otherwise
*/ */
@ -2690,7 +2690,7 @@ HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrF
/*********************************************************************** /***********************************************************************
* GetShellFolderFromPidl * GetShellFolderFromPidl
* *
* pidlRel is the item pidl relative * pidlRel is the item pidl relative
* Return the IShellFolder of the absolute pidl * Return the IShellFolder of the absolute pidl
*/ */
IShellFolder *GetShellFolderFromPidl(LPITEMIDLIST pidlAbs) IShellFolder *GetShellFolderFromPidl(LPITEMIDLIST pidlAbs)
@ -2726,17 +2726,17 @@ LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl)
LPITEMIDLIST pidlParent; LPITEMIDLIST pidlParent;
TRACE("%p\n", pidl); TRACE("%p\n", pidl);
pidlParent = COMDLG32_PIDL_ILClone(pidl); pidlParent = COMDLG32_PIDL_ILClone(pidl);
COMDLG32_PIDL_ILRemoveLastID(pidlParent); COMDLG32_PIDL_ILRemoveLastID(pidlParent);
return pidlParent; return pidlParent;
} }
/*********************************************************************** /***********************************************************************
* GetPidlFromName * GetPidlFromName
* *
* returns the pidl of the file name relative to folder * returns the pidl of the file name relative to folder
* NULL if an error occurred * NULL if an error occurred
*/ */
LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName) LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName)
@ -2750,7 +2750,7 @@ LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName)
if(!lpcstrFileName) return NULL; if(!lpcstrFileName) return NULL;
if(!*lpcstrFileName) return NULL; if(!*lpcstrFileName) return NULL;
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH); MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH);
if(!lpsf) if(!lpsf)
{ {
@ -2760,7 +2760,7 @@ LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPCSTR lpcstrFileName)
} }
else else
{ {
IShellFolder_ParseDisplayName(lpsf, 0, NULL, (LPWSTR)lpwstrDirName, &ulEaten, &pidl, NULL); IShellFolder_ParseDisplayName(lpsf, 0, NULL, (LPWSTR)lpwstrDirName, &ulEaten, &pidl, NULL);
} }
return pidl; return pidl;
} }
@ -2771,11 +2771,11 @@ BOOL IsPidlFolder (LPSHELLFOLDER psf, LPITEMIDLIST pidl)
{ {
ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
HRESULT ret; HRESULT ret;
TRACE("%p, %p\n", psf, pidl); TRACE("%p, %p\n", psf, pidl);
ret = IShellFolder_GetAttributesOf( psf, 1, &pidl, &uAttr ); ret = IShellFolder_GetAttributesOf( psf, 1, &pidl, &uAttr );
TRACE("-- 0x%08lx 0x%08lx\n", uAttr, ret); TRACE("-- 0x%08lx 0x%08lx\n", uAttr, ret);
/* see documentation shell 4.1*/ /* see documentation shell 4.1*/
return uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER); return uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER);
@ -2812,7 +2812,7 @@ static BOOL BrowseSelectedFolder(HWND hwnd)
} }
return bBrowseSelFolder; return bBrowseSelFolder;
} }
/* /*
* Memory allocation methods */ * Memory allocation methods */

View File

@ -1,6 +1,6 @@
/* /*
* Implementation of IShellBrowser for the File Open common dialog * Implementation of IShellBrowser for the File Open common dialog
* *
* Copyright 1999 Francois Boisvert * Copyright 1999 Francois Boisvert
* Copyright 1999, 2000 Juergen Schmied * Copyright 1999, 2000 Juergen Schmied
* *
@ -69,7 +69,7 @@ LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
/************************************************************************** /**************************************************************************
* External Prototypes * External Prototypes
*/ */
extern const char *FileOpenDlgInfosStr; extern const char *FileOpenDlgInfosStr;
extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName); extern HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
extern HRESULT GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName); extern HRESULT GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
@ -137,7 +137,7 @@ static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPI
/* /*
* IShellBrowser * IShellBrowser
*/ */
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_Construct * IShellBrowserImpl_Construct
*/ */
@ -168,7 +168,7 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
* IShellBrowserImpl_QueryInterface * IShellBrowserImpl_QueryInterface
*/ */
HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -178,7 +178,7 @@ HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = This; { *ppvObj = This;
} }
else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/ else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/
{ *ppvObj = (IOleWindow*)This; { *ppvObj = (IOleWindow*)This;
@ -225,8 +225,8 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
if (!--(This->ref)) if (!--(This->ref))
{ {
HeapFree(GetProcessHeap(),0, This); HeapFree(GetProcessHeap(),0, This);
return 0; return 0;
} }
@ -245,9 +245,9 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
* See Windows documentation for more details * See Windows documentation for more details
* *
* Note : We will never be window less in the File Open dialog * Note : We will never be window less in the File Open dialog
* *
*/ */
HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
HWND * phwnd) HWND * phwnd)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -259,7 +259,7 @@ HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
*phwnd = This->hwndOwner; *phwnd = This->hwndOwner;
return (*phwnd) ? S_OK : E_UNEXPECTED; return (*phwnd) ? S_OK : E_UNEXPECTED;
} }
@ -286,11 +286,11 @@ HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
* *
* See Windows documentation on IShellBrowser::BrowseObject for more details * See Windows documentation on IShellBrowser::BrowseObject for more details
* *
* This function will override user specified flags and will always * This function will override user specified flags and will always
* use SBSP_DEFBROWSER and SBSP_DEFMODE. * use SBSP_DEFBROWSER and SBSP_DEFMODE.
*/ */
HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
LPCITEMIDLIST pidl, LPCITEMIDLIST pidl,
UINT wFlags) UINT wFlags)
{ {
HRESULT hRes; HRESULT hRes;
@ -311,7 +311,7 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
/* Format the pidl according to its parameter's category */ /* Format the pidl according to its parameter's category */
if(wFlags & SBSP_RELATIVE) if(wFlags & SBSP_RELATIVE)
{ {
/* SBSP_RELATIVE A relative pidl (relative from the current folder) */ /* SBSP_RELATIVE A relative pidl (relative from the current folder) */
if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder, if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp))) pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
@ -336,14 +336,14 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl); pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
psfTmp = GetShellFolderFromPidl(pidlTmp); psfTmp = GetShellFolderFromPidl(pidlTmp);
} }
if(!psfTmp) if(!psfTmp)
{ {
ERR("could not browse to folder\n"); ERR("could not browse to folder\n");
return E_FAIL; return E_FAIL;
} }
/* If the pidl to browse to is equal to the actual pidl ... /* If the pidl to browse to is equal to the actual pidl ...
do nothing and pretend you did it*/ do nothing and pretend you did it*/
if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent)) if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
{ {
@ -405,14 +405,14 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent); FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
/* changes the tab order of the ListView to reflect the window's File Dialog */ /* changes the tab order of the ListView to reflect the window's File Dialog */
hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
/* Since we destroyed the old view if it had focus set focus to the newly created view */ /* Since we destroyed the old view if it had focus set focus to the newly created view */
if (bViewHasFocus) if (bViewHasFocus)
SetFocus(fodInfos->ShellInfos.hwndView); SetFocus(fodInfos->ShellInfos.hwndView);
return hRes; return hRes;
error: error:
ERR("Failed with error 0x%08lx\n", hRes); ERR("Failed with error 0x%08lx\n", hRes);
return hRes; return hRes;
@ -421,9 +421,9 @@ error:
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_EnableModelessSB * IShellBrowserImpl_EnableModelessSB
*/ */
HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
BOOL fEnable) BOOL fEnable)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -436,10 +436,10 @@ HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_GetControlWindow * IShellBrowserImpl_GetControlWindow
*/ */
HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
UINT id, UINT id,
HWND *lphwnd) HWND *lphwnd)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -452,9 +452,9 @@ HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
* IShellBrowserImpl_GetViewStateStream * IShellBrowserImpl_GetViewStateStream
*/ */
HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
DWORD grfMode, DWORD grfMode,
LPSTREAM *ppStrm) LPSTREAM *ppStrm)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -462,14 +462,14 @@ HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
/* Feature not implemented */ /* Feature not implemented */
return E_NOTIMPL; return E_NOTIMPL;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_InsertMenusSB * IShellBrowserImpl_InsertMenusSB
*/ */
HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
HMENU hmenuShared, HMENU hmenuShared,
LPOLEMENUGROUPWIDTHS lpMenuWidths) LPOLEMENUGROUPWIDTHS lpMenuWidths)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -483,7 +483,7 @@ HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
*/ */
HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
IShellView *ppshv) IShellView *ppshv)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -491,13 +491,13 @@ HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
/* Feature not implemented */ /* Feature not implemented */
return E_NOTIMPL; return E_NOTIMPL;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_QueryActiveShellView * IShellBrowserImpl_QueryActiveShellView
*/ */
HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
IShellView **ppshv) IShellView **ppshv)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -513,13 +513,13 @@ HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
} }
IShellView_AddRef(fodInfos->Shell.FOIShellView); IShellView_AddRef(fodInfos->Shell.FOIShellView);
return NOERROR; return NOERROR;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_RemoveMenusSB * IShellBrowserImpl_RemoveMenusSB
*/ */
HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
HMENU hmenuShared) HMENU hmenuShared)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -527,21 +527,21 @@ HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
/* Feature not implemented */ /* Feature not implemented */
return E_NOTIMPL; return E_NOTIMPL;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_SendControlMsg * IShellBrowserImpl_SendControlMsg
*/ */
HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
UINT id, UINT id,
UINT uMsg, UINT uMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam, LPARAM lParam,
LRESULT *pret) LRESULT *pret)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
LRESULT lres; LRESULT lres;
TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret); TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
switch (id) switch (id)
@ -560,10 +560,10 @@ HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
* IShellBrowserImpl_SetMenuSB * IShellBrowserImpl_SetMenuSB
*/ */
HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
HMENU hmenuShared, HMENU hmenuShared,
HOLEMENU holemenuReserved, HOLEMENU holemenuReserved,
HWND hwndActiveObject) HWND hwndActiveObject)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -571,13 +571,13 @@ HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
/* Feature not implemented */ /* Feature not implemented */
return E_NOTIMPL; return E_NOTIMPL;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_SetStatusTextSB * IShellBrowserImpl_SetStatusTextSB
*/ */
HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
LPCOLESTR lpszStatusText) LPCOLESTR lpszStatusText)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -585,15 +585,15 @@ HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
/* Feature not implemented */ /* Feature not implemented */
return E_NOTIMPL; return E_NOTIMPL;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_SetToolbarItems * IShellBrowserImpl_SetToolbarItems
*/ */
HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
LPTBBUTTON lpButtons, LPTBBUTTON lpButtons,
UINT nButtons, UINT nButtons,
UINT uFlags) UINT uFlags)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -601,14 +601,14 @@ HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
/* Feature not implemented */ /* Feature not implemented */
return E_NOTIMPL; return E_NOTIMPL;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_TranslateAcceleratorSB * IShellBrowserImpl_TranslateAcceleratorSB
*/ */
HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface, HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
LPMSG lpmsg, LPMSG lpmsg,
WORD wID) WORD wID)
{ {
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
@ -655,7 +655,7 @@ static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
*/ */
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface( HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
ICommDlgBrowser *iface, ICommDlgBrowser *iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
_ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface); _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
@ -703,8 +703,8 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowse
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
/* If the selected object is not a folder, send a IDOK command to parent window */ /* If the selected object is not a folder, send a IDOK command to parent window */
if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
{ {
@ -753,7 +753,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0); SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
break; break;
case CDBOSC_KILLFOCUS: case CDBOSC_KILLFOCUS:
{ {
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
@ -767,13 +767,13 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
break; break;
} }
return NOERROR; return NOERROR;
} }
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_IncludeObject * IShellBrowserImpl_ICommDlgBrowser_IncludeObject
*/ */
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
IShellView * ppshv, IShellView * ppshv,
LPCITEMIDLIST pidl) LPCITEMIDLIST pidl)
{ {
@ -790,13 +790,13 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
if( (ulAttr & SFGAO_HIDDEN) /* hidden */ if( (ulAttr & SFGAO_HIDDEN) /* hidden */
| !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */ | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
return S_FALSE; return S_FALSE;
/* always include directories and links */ /* always include directories and links */
if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
return S_OK; return S_OK;
/* Check if there is a mask to apply if not */ /* Check if there is a mask to apply if not */
@ -817,7 +817,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
/************************************************************************** /**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_OnSelChange * IShellBrowserImpl_ICommDlgBrowser_OnSelChange
*/ */
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
{ {
FileOpenDlgInfos *fodInfos; FileOpenDlgInfos *fodInfos;
@ -826,16 +826,16 @@ HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IS
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView); TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView);
/* release old selections */ /* release old selections */
if (fodInfos->Shell.FOIDataObject) if (fodInfos->Shell.FOIDataObject)
IDataObject_Release(fodInfos->Shell.FOIDataObject); IDataObject_Release(fodInfos->Shell.FOIDataObject);
/* get a new DataObject from the ShellView */ /* get a new DataObject from the ShellView */
if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION, if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
&IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject))) &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
return E_FAIL; return E_FAIL;
FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner); FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE); SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
@ -867,7 +867,7 @@ static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
*/ */
HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface( HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
IServiceProvider *iface, IServiceProvider *iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
_ICOM_THIS_FromIServiceProvider(IShellBrowser,iface); _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
@ -905,7 +905,7 @@ ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface
* IShellBrowserImpl_IServiceProvider_Release * IShellBrowserImpl_IServiceProvider_Release
* *
* NOTES * NOTES
* the w2k shellview asks for * the w2k shellview asks for
* guidService = SID_STopLevelBrowser * guidService = SID_STopLevelBrowser
* riid = IShellBrowser * riid = IShellBrowser
* *

View File

@ -1,6 +1,6 @@
/* /*
* Implementation of IShellBrowser for the File Open common dialog * Implementation of IShellBrowser for the File Open common dialog
* *
* Copyright 1999 Francois Boisvert * Copyright 1999 Francois Boisvert
* Copyright 1999, 2000 Juergen Schmied * Copyright 1999, 2000 Juergen Schmied
* *
@ -39,7 +39,7 @@
/* dialog internal property */ /* dialog internal property */
#define FODPROP_SAVEDLG 0x0001 /* File dialog is a Save file dialog */ #define FODPROP_SAVEDLG 0x0001 /* File dialog is a Save file dialog */
#define FODPROP_USEVIEW 0x0002 /* Indicates the user selection must be taken #define FODPROP_USEVIEW 0x0002 /* Indicates the user selection must be taken
from the IShellView */ from the IShellView */
/*********************************************************************** /***********************************************************************
@ -49,10 +49,10 @@
typedef struct typedef struct
{ {
LPOPENFILENAMEA ofnInfos; LPOPENFILENAMEA ofnInfos;
struct { struct {
IShellBrowser *FOIShellBrowser; IShellBrowser *FOIShellBrowser;
IShellFolder *FOIShellFolder; IShellFolder *FOIShellFolder;
IShellView *FOIShellView; IShellView *FOIShellView;
IDataObject *FOIDataObject; IDataObject *FOIDataObject;

View File

@ -71,7 +71,7 @@ short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
i++; i++;
TRACE("---> '%s' \n", &lpFile[i]); TRACE("---> '%s' \n", &lpFile[i]);
len = strlen(lpFile+i)+1; len = strlen(lpFile+i)+1;
if(cbBuf < len) if(cbBuf < len)
return len; return len;

View File

@ -33,7 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#include "cdlg.h" #include "cdlg.h"
struct FRPRIVATE struct FRPRIVATE
{ {
HANDLE16 hDlgTmpl16; /* handle for resource 16 */ HANDLE16 hDlgTmpl16; /* handle for resource 16 */
HANDLE16 hResource16; /* handle for allocated resource 16 */ HANDLE16 hResource16; /* handle for allocated resource 16 */
@ -101,7 +101,7 @@ BOOL FINDDLG_Get16BitsTemplate(LFRPRIVATE lfr)
DWORD size; DWORD size;
HGLOBAL16 hGlobal16; HGLOBAL16 hGlobal16;
if (!(hResInfo = FindResourceA(COMMDLG_hInstance32, if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
lfr->find ? lfr->find ?
MAKEINTRESOURCEA(FINDDLGORD):MAKEINTRESOURCEA(REPLACEDLGORD), MAKEINTRESOURCEA(FINDDLGORD):MAKEINTRESOURCEA(REPLACEDLGORD),
RT_DIALOGA))) RT_DIALOGA)))
@ -142,7 +142,7 @@ BOOL FINDDLG_Get16BitsTemplate(LFRPRIVATE lfr)
/*********************************************************************** /***********************************************************************
* FINDDLG_FreeResources [internal] * FINDDLG_FreeResources [internal]
* *
* Free resources allocated * Free resources allocated
*/ */
void FINDDLG_FreeResources(LFRPRIVATE lfr) void FINDDLG_FreeResources(LFRPRIVATE lfr)
{ {
@ -259,15 +259,15 @@ static LRESULT FINDDLG_WMInitDialog(HWND hWnd, LPARAM lParam, LPDWORD lpFlags,
} }
ShowWindow(hWnd, SW_SHOWNORMAL); ShowWindow(hWnd, SW_SHOWNORMAL);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* FINDDLG_WMCommand [internal] * FINDDLG_WMCommand [internal]
*/ */
static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam, static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam,
HWND hwndOwner, LPDWORD lpFlags, HWND hwndOwner, LPDWORD lpFlags,
LPSTR lpstrFindWhat, WORD wFindWhatLen, LPSTR lpstrFindWhat, WORD wFindWhatLen,
BOOL fUnicode) BOOL fUnicode)
{ {
int uFindReplaceMessage = RegisterWindowMessageA( FINDMSGSTRINGA ); int uFindReplaceMessage = RegisterWindowMessageA( FINDMSGSTRINGA );
@ -275,17 +275,17 @@ static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam,
switch (wParam) { switch (wParam) {
case IDOK: case IDOK:
if (fUnicode) if (fUnicode)
GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2); GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2);
else GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen); else GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen);
if (IsDlgButtonChecked(hWnd, rad2)) if (IsDlgButtonChecked(hWnd, rad2))
*lpFlags |= FR_DOWN; *lpFlags |= FR_DOWN;
else *lpFlags &= ~FR_DOWN; else *lpFlags &= ~FR_DOWN;
if (IsDlgButtonChecked(hWnd, chx1)) if (IsDlgButtonChecked(hWnd, chx1))
*lpFlags |= FR_WHOLEWORD; *lpFlags |= FR_WHOLEWORD;
else *lpFlags &= ~FR_WHOLEWORD; else *lpFlags &= ~FR_WHOLEWORD;
if (IsDlgButtonChecked(hWnd, chx2)) if (IsDlgButtonChecked(hWnd, chx2))
*lpFlags |= FR_MATCHCASE; *lpFlags |= FR_MATCHCASE;
else *lpFlags &= ~FR_MATCHCASE; else *lpFlags &= ~FR_MATCHCASE;
*lpFlags &= ~(FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM); *lpFlags &= ~(FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM);
*lpFlags |= FR_FINDNEXT; *lpFlags |= FR_FINDNEXT;
@ -305,7 +305,7 @@ static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam,
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
/*********************************************************************** /***********************************************************************
@ -334,7 +334,7 @@ LRESULT WINAPI FindTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
* REPLACEDLG_WMInitDialog [internal] * REPLACEDLG_WMInitDialog [internal]
*/ */
static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, LPARAM lParam, static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, LPARAM lParam,
LPDWORD lpFlags, LPSTR lpstrFindWhat, LPDWORD lpFlags, LPSTR lpstrFindWhat,
LPSTR lpstrReplaceWith, BOOL fUnicode) LPSTR lpstrReplaceWith, BOOL fUnicode)
{ {
SetWindowLongA(hWnd, DWL_USER, lParam); SetWindowLongA(hWnd, DWL_USER, lParam);
@ -344,7 +344,7 @@ static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, LPARAM lParam,
* Replace / ReplaceAll buttons. Only after typing some text, the buttons should be * Replace / ReplaceAll buttons. Only after typing some text, the buttons should be
* enabled. * enabled.
*/ */
if (fUnicode) if (fUnicode)
{ {
SetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat); SetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat);
SetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith); SetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith);
@ -369,7 +369,7 @@ static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, LPARAM lParam,
} }
ShowWindow(hWnd, SW_SHOWNORMAL); ShowWindow(hWnd, SW_SHOWNORMAL);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
@ -396,10 +396,10 @@ static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM16 wParam,
GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen); GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen);
} }
if (IsDlgButtonChecked(hWnd, chx1)) if (IsDlgButtonChecked(hWnd, chx1))
*lpFlags |= FR_WHOLEWORD; *lpFlags |= FR_WHOLEWORD;
else *lpFlags &= ~FR_WHOLEWORD; else *lpFlags &= ~FR_WHOLEWORD;
if (IsDlgButtonChecked(hWnd, chx2)) if (IsDlgButtonChecked(hWnd, chx2))
*lpFlags |= FR_MATCHCASE; *lpFlags |= FR_MATCHCASE;
else *lpFlags &= ~FR_MATCHCASE; else *lpFlags &= ~FR_MATCHCASE;
*lpFlags &= ~(FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM); *lpFlags &= ~(FR_REPLACE | FR_REPLACEALL | FR_DIALOGTERM);
*lpFlags |= FR_FINDNEXT; *lpFlags |= FR_FINDNEXT;
@ -419,15 +419,15 @@ static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM16 wParam,
GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2); GetDlgItemTextW(hWnd, edt1, (LPWSTR)lpstrFindWhat, wFindWhatLen/2);
GetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith, wReplaceWithLen/2); GetDlgItemTextW(hWnd, edt2, (LPWSTR)lpstrReplaceWith, wReplaceWithLen/2);
} else } else
{ {
GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen); GetDlgItemTextA(hWnd, edt1, lpstrFindWhat, wFindWhatLen);
GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen); GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen);
} }
if (IsDlgButtonChecked(hWnd, chx1)) if (IsDlgButtonChecked(hWnd, chx1))
*lpFlags |= FR_WHOLEWORD; *lpFlags |= FR_WHOLEWORD;
else *lpFlags &= ~FR_WHOLEWORD; else *lpFlags &= ~FR_WHOLEWORD;
if (IsDlgButtonChecked(hWnd, chx2)) if (IsDlgButtonChecked(hWnd, chx2))
*lpFlags |= FR_MATCHCASE; *lpFlags |= FR_MATCHCASE;
else *lpFlags &= ~FR_MATCHCASE; else *lpFlags &= ~FR_MATCHCASE;
*lpFlags &= ~(FR_FINDNEXT | FR_REPLACEALL | FR_DIALOGTERM); *lpFlags &= ~(FR_FINDNEXT | FR_REPLACEALL | FR_DIALOGTERM);
*lpFlags |= FR_REPLACE; *lpFlags |= FR_REPLACE;
@ -445,10 +445,10 @@ static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM16 wParam,
GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen); GetDlgItemTextA(hWnd, edt2, lpstrReplaceWith, wReplaceWithLen);
} }
if (IsDlgButtonChecked(hWnd, chx1)) if (IsDlgButtonChecked(hWnd, chx1))
*lpFlags |= FR_WHOLEWORD; *lpFlags |= FR_WHOLEWORD;
else *lpFlags &= ~FR_WHOLEWORD; else *lpFlags &= ~FR_WHOLEWORD;
if (IsDlgButtonChecked(hWnd, chx2)) if (IsDlgButtonChecked(hWnd, chx2))
*lpFlags |= FR_MATCHCASE; *lpFlags |= FR_MATCHCASE;
else *lpFlags &= ~FR_MATCHCASE; else *lpFlags &= ~FR_MATCHCASE;
*lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_DIALOGTERM); *lpFlags &= ~(FR_FINDNEXT | FR_REPLACE | FR_DIALOGTERM);
*lpFlags |= FR_REPLACEALL; *lpFlags |= FR_REPLACEALL;
@ -461,7 +461,7 @@ static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM16 wParam,
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
/*********************************************************************** /***********************************************************************
@ -479,7 +479,7 @@ LRESULT WINAPI ReplaceTextDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
MapSL(lpfr->lpstrReplaceWith), FALSE); MapSL(lpfr->lpstrReplaceWith), FALSE);
case WM_COMMAND: case WM_COMMAND:
lpfr=MapSL(GetWindowLongA(hWnd, DWL_USER)); lpfr=MapSL(GetWindowLongA(hWnd, DWL_USER));
return REPLACEDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner, return REPLACEDLG_WMCommand(hWnd, wParam, lpfr->hwndOwner,
&lpfr->Flags, MapSL(lpfr->lpstrFindWhat), &lpfr->Flags, MapSL(lpfr->lpstrFindWhat),
lpfr->wFindWhatLen, MapSL(lpfr->lpstrReplaceWith), lpfr->wFindWhatLen, MapSL(lpfr->lpstrReplaceWith),
lpfr->wReplaceWithLen, FALSE); lpfr->wReplaceWithLen, FALSE);

View File

@ -175,7 +175,7 @@ Replace:
static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{ {
COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom); COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
BOOL retval = TRUE;; BOOL retval = TRUE;
if(iMsg == WM_INITDIALOG) if(iMsg == WM_INITDIALOG)
{ {

View File

@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#include "cdlg.h" #include "cdlg.h"
static HBITMAP16 hBitmapTT = 0; static HBITMAP16 hBitmapTT = 0;
LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
@ -132,7 +132,7 @@ _dump_cf_flags(DWORD cflags) {
/*********************************************************************** /***********************************************************************
* ChooseFont (COMMDLG.15) * ChooseFont (COMMDLG.15)
*/ */
BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont) BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
{ {
@ -146,12 +146,12 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
LOGFONTA lf32a; LOGFONTA lf32a;
LOGFONT16 *font16; LOGFONT16 *font16;
SEGPTR lpTemplateName; SEGPTR lpTemplateName;
cf32a.lpLogFont=&lf32a; cf32a.lpLogFont=&lf32a;
CFn_CHOOSEFONT16to32A(lpChFont, &cf32a); CFn_CHOOSEFONT16to32A(lpChFont, &cf32a);
TRACE("ChooseFont\n"); TRACE("ChooseFont\n");
if (!lpChFont) return FALSE; if (!lpChFont) return FALSE;
if (TRACE_ON(commdlg)) if (TRACE_ON(commdlg))
_dump_cf_flags(lpChFont->Flags); _dump_cf_flags(lpChFont->Flags);
@ -214,7 +214,7 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
return FALSE; return FALSE;
} }
ConvertDialog32To16((LPVOID)template32, size, (LPVOID)template); ConvertDialog32To16((LPVOID)template32, size, (LPVOID)template);
hDlgTmpl16 = hGlobal16; hDlgTmpl16 = hGlobal16;
} }
@ -278,7 +278,7 @@ BOOL WINAPI ChooseFontA(LPCHOOSEFONTA lpChFont)
if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE | if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS | CF_ENABLETEMPLATE |
CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n"); CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
return DialogBoxIndirectParamA(COMMDLG_hInstance32, template, return DialogBoxIndirectParamA(COMMDLG_hInstance32, template,
lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcA, (LPARAM)lpChFont ); lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcA, (LPARAM)lpChFont );
} }
@ -320,9 +320,9 @@ static BOOL ChooseFontWtoA(const CHOOSEFONTW *cfw, CHOOSEFONTA *cfa)
memcpy(cfa, cfw, sizeof(CHOOSEFONTA)); memcpy(cfa, cfw, sizeof(CHOOSEFONTA));
cfa->lpLogFont = lpLogFont; cfa->lpLogFont = lpLogFont;
cfa->lpszStyle = lpszStyle; cfa->lpszStyle = lpszStyle;
LogFontWtoA(cfw->lpLogFont, lpLogFont); LogFontWtoA(cfw->lpLogFont, lpLogFont);
if (cfw->lpTemplateName != NULL) if (cfw->lpTemplateName != NULL)
{ {
cfa->lpTemplateName = HEAP_strdupWtoA(GetProcessHeap(), 0, cfa->lpTemplateName = HEAP_strdupWtoA(GetProcessHeap(), 0,
@ -330,14 +330,14 @@ static BOOL ChooseFontWtoA(const CHOOSEFONTW *cfw, CHOOSEFONTA *cfa)
if (cfa->lpTemplateName == NULL) if (cfa->lpTemplateName == NULL)
return FALSE; return FALSE;
} }
if ((cfw->Flags & CF_USESTYLE) != 0 && cfw->lpszStyle != NULL) if ((cfw->Flags & CF_USESTYLE) != 0 && cfw->lpszStyle != NULL)
{ {
WideCharToMultiByte(CP_ACP, 0, cfw->lpszStyle, -1, cfa->lpszStyle, WideCharToMultiByte(CP_ACP, 0, cfw->lpszStyle, -1, cfa->lpszStyle,
LF_FACESIZE, NULL, NULL); LF_FACESIZE, NULL, NULL);
cfa->lpszStyle[LF_FACESIZE - 1] = '\0'; cfa->lpszStyle[LF_FACESIZE - 1] = '\0';
} }
return TRUE; return TRUE;
} }
@ -351,12 +351,12 @@ static VOID ChooseFontAtoW(const CHOOSEFONTA *cfa, CHOOSEFONTW *cfw)
cfw->lpLogFont = lpLogFont; cfw->lpLogFont = lpLogFont;
cfw->lpszStyle = lpszStyle; cfw->lpszStyle = lpszStyle;
cfw->lpTemplateName = lpTemplateName; cfw->lpTemplateName = lpTemplateName;
LogFontAtoW(cfa->lpLogFont, lpLogFont); LogFontAtoW(cfa->lpLogFont, lpLogFont);
if (cfa->lpTemplateName != NULL) if (cfa->lpTemplateName != NULL)
HeapFree(GetProcessHeap(), 0, (LPSTR)(cfa->lpTemplateName)); HeapFree(GetProcessHeap(), 0, (LPSTR)(cfa->lpTemplateName));
if ((cfa->Flags & CF_USESTYLE) != 0 && cfa->lpszStyle != NULL) if ((cfa->Flags & CF_USESTYLE) != 0 && cfa->lpszStyle != NULL)
{ {
MultiByteToWideChar(CP_ACP, 0, cfa->lpszStyle, -1, cfw->lpszStyle, MultiByteToWideChar(CP_ACP, 0, cfa->lpszStyle, -1, cfw->lpszStyle,
@ -370,25 +370,25 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
CHOOSEFONTA cf_a; CHOOSEFONTA cf_a;
LOGFONTA lf_a; LOGFONTA lf_a;
CHAR style_a[LF_FACESIZE]; CHAR style_a[LF_FACESIZE];
cf_a.lpLogFont = &lf_a; cf_a.lpLogFont = &lf_a;
cf_a.lpszStyle = style_a; cf_a.lpszStyle = style_a;
if (ChooseFontWtoA(lpChFont, &cf_a) == FALSE) if (ChooseFontWtoA(lpChFont, &cf_a) == FALSE)
{ {
COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE); COMDLG32_SetCommDlgExtendedError(CDERR_MEMALLOCFAILURE);
return FALSE; return FALSE;
} }
if (ChooseFontA(&cf_a) == FALSE) if (ChooseFontA(&cf_a) == FALSE)
{ {
if (cf_a.lpTemplateName != NULL) if (cf_a.lpTemplateName != NULL)
HeapFree(GetProcessHeap(), 0, (LPSTR)(cf_a.lpTemplateName)); HeapFree(GetProcessHeap(), 0, (LPSTR)(cf_a.lpTemplateName));
return FALSE; return FALSE;
} }
ChooseFontAtoW(&cf_a, lpChFont); ChooseFontAtoW(&cf_a, lpChFont);
return TRUE; return TRUE;
} }
@ -430,7 +430,7 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
cf32a.lpLogFont=&lf32a; cf32a.lpLogFont=&lf32a;
cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle); cf32a.lpszStyle=HEAP_strdupWtoA(GetProcessHeap(), 0, lpChFont->lpszStyle);
lpChFont->lpTemplateName=(LPWSTR)&cf32a; lpChFont->lpTemplateName=(LPWSTR)&cf32a;
bRet = DialogBoxIndirectParamW(COMMDLG_hInstance32, template, bRet = DialogBoxIndirectParamW(COMMDLG_hInstance32, template,
lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcW, (LPARAM)lpChFont ); lpChFont->hwndOwner, (DLGPROC)FormatCharDlgProcW, (LPARAM)lpChFont );
HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle); HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle);
lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName; lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName;
@ -488,7 +488,7 @@ typedef struct
/************************************************************************* /*************************************************************************
* AddFontFamily [internal] * AddFontFamily [internal]
*/ */
static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType, static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e) LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e)
{ {
int i; int i;
@ -504,7 +504,7 @@ static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
return 1; return 1;
if (lpcf->Flags & CF_TTONLY) if (lpcf->Flags & CF_TTONLY)
if (!(nFontType & TRUETYPE_FONTTYPE)) if (!(nFontType & TRUETYPE_FONTTYPE))
return 1; return 1;
if (e) e->added++; if (e) e->added++;
@ -522,7 +522,7 @@ static INT AddFontFamily(const LOGFONTA *lplf, UINT nFontType,
/************************************************************************* /*************************************************************************
* FontFamilyEnumProc32 [internal] * FontFamilyEnumProc32 [internal]
*/ */
static INT WINAPI FontFamilyEnumProc(const LOGFONTA *lpLogFont, static INT WINAPI FontFamilyEnumProc(const LOGFONTA *lpLogFont,
const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam) const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam)
{ {
LPCFn_ENUMSTRUCT e; LPCFn_ENUMSTRUCT e;
@ -538,7 +538,7 @@ INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics,
{ {
HWND16 hwnd=LOWORD(lParam); HWND16 hwnd=LOWORD(lParam);
HWND hDlg=GetParent(hwnd); HWND hDlg=GetParent(hwnd);
LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
LOGFONT16 *lplf = MapSL( logfont ); LOGFONT16 *lplf = MapSL( logfont );
LOGFONTA lf32a; LOGFONTA lf32a;
FONT_LogFont16To32A(lplf, &lf32a); FONT_LogFont16To32A(lplf, &lf32a);
@ -555,10 +555,10 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf)
{ {
#define FSTYLES 4 #define FSTYLES 4
struct FONTSTYLE struct FONTSTYLE
{ int italic; { int italic;
int weight; int weight;
char stname[20]; }; char stname[20]; };
static struct FONTSTYLE fontstyles[FSTYLES]={ static struct FONTSTYLE fontstyles[FSTYLES]={
{ 0,FW_NORMAL,"Regular"},{0,FW_BOLD,"Bold"}, { 0,FW_NORMAL,"Regular"},{0,FW_BOLD,"Bold"},
{ 1,FW_NORMAL,"Italic"}, {1,FW_BOLD,"Bold Italic"}}; { 1,FW_NORMAL,"Italic"}, {1,FW_BOLD,"Bold Italic"}};
HFONT hf; HFONT hf;
@ -585,9 +585,9 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf)
if (j==CB_ERR) return 1; if (j==CB_ERR) return 1;
j=SendMessageA(hwnd, CB_SETITEMDATA, j, j=SendMessageA(hwnd, CB_SETITEMDATA, j,
MAKELONG(fontstyles[i].weight,fontstyles[i].italic)); MAKELONG(fontstyles[i].weight,fontstyles[i].italic));
if (j==CB_ERR) return 1; if (j==CB_ERR) return 1;
} }
} }
return 0; return 0;
} }
@ -606,14 +606,14 @@ static int AddFontSizeToCombo3(HWND hwnd, UINT h, LPCHOOSEFONTA lpcf)
j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
if (j==CB_ERR) if (j==CB_ERR)
{ {
j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer);
if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h); if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h);
if (j==CB_ERR) return 1; if (j==CB_ERR) return 1;
} }
} }
return 0; return 0;
} }
/************************************************************************* /*************************************************************************
* SetFontSizesToCombo3 [internal] * SetFontSizesToCombo3 [internal]
*/ */
@ -630,11 +630,11 @@ static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf)
/*********************************************************************** /***********************************************************************
* AddFontStyle [internal] * AddFontStyle [internal]
*/ */
static INT AddFontStyle(const LOGFONTA *lplf, UINT nFontType, static INT AddFontStyle(const LOGFONTA *lplf, UINT nFontType,
LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg) LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
{ {
int i; int i;
TRACE("(nFontType=%d)\n",nFontType); TRACE("(nFontType=%d)\n",nFontType);
TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d" TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d"
" ch=%d op=%d cp=%d q=%d pf=%xh\n", " ch=%d op=%d cp=%d q=%d pf=%xh\n",
@ -659,7 +659,7 @@ static INT AddFontStyle(const LOGFONTA *lplf, UINT nFontType,
} }
return 1 ; return 1 ;
} }
/*********************************************************************** /***********************************************************************
* FontStyleEnumProc (COMMDLG.18) * FontStyleEnumProc (COMMDLG.18)
@ -670,7 +670,7 @@ INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
HWND16 hcmb2=LOWORD(lParam); HWND16 hcmb2=LOWORD(lParam);
HWND16 hcmb3=HIWORD(lParam); HWND16 hcmb3=HIWORD(lParam);
HWND hDlg=GetParent(hcmb3); HWND hDlg=GetParent(hcmb3);
LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
LOGFONT16 *lplf = MapSL(logfont); LOGFONT16 *lplf = MapSL(logfont);
LOGFONTA lf32a; LOGFONTA lf32a;
FONT_LogFont16To32A(lplf, &lf32a); FONT_LogFont16To32A(lplf, &lf32a);
@ -681,7 +681,7 @@ INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics,
/*********************************************************************** /***********************************************************************
* FontStyleEnumProc32 [internal] * FontStyleEnumProc32 [internal]
*/ */
static INT WINAPI FontStyleEnumProc( const LOGFONTA *lpFont, static INT WINAPI FontStyleEnumProc( const LOGFONTA *lpFont,
const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam ) const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam )
{ {
LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam; LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam;
@ -704,14 +704,14 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
LPLOGFONTA lpxx; LPLOGFONTA lpxx;
HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA)); HCURSOR hcursor=SetCursor(LoadCursorA(0,IDC_WAITA));
SetWindowLongA(hDlg, DWL_USER, lParam); SetWindowLongA(hDlg, DWL_USER, lParam);
lpxx=lpcf->lpLogFont; lpxx=lpcf->lpLogFont;
TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); TRACE("WM_INITDIALOG lParam=%08lX\n", lParam);
if (lpcf->lStructSize != sizeof(CHOOSEFONTA)) if (lpcf->lStructSize != sizeof(CHOOSEFONTA))
{ {
ERR("structure size failure !!!\n"); ERR("structure size failure !!!\n");
EndDialog (hDlg, 0); EndDialog (hDlg, 0);
return FALSE; return FALSE;
} }
if (!hBitmapTT) if (!hBitmapTT)
@ -720,7 +720,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
/* This font will be deleted by WM_COMMAND */ /* This font will be deleted by WM_COMMAND */
SendDlgItemMessageA(hDlg,stc6,WM_SETFONT, SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,
CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL),FALSE); CreateFontA(0, 0, 1, 1, 400, 0, 0, 0, 0, 0, 0, 0, 0, NULL),FALSE);
if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner)) if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE); ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
if (!(lpcf->Flags & CF_APPLY)) if (!(lpcf->Flags & CF_APPLY))
@ -791,7 +791,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
if (l==SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0)) if (l==SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0))
SendDlgItemMessageA(hDlg, cmb2, CB_SETCURSEL, i, 0); SendDlgItemMessageA(hDlg, cmb2, CB_SETCURSEL, i, 0);
} }
/* look for fitting font size in combobox3 */ /* look for fitting font size in combobox3 */
j=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0); j=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0);
for (i=0;i<j;i++) for (i=0;i<j;i++)
@ -806,7 +806,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0); SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0);
SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE),
GetDlgItem(hDlg,cmb1)); GetDlgItem(hDlg,cmb1));
} }
if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle) if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle)
{ {
j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle); j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle);
@ -821,13 +821,13 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
else else
{ {
WARN("HDC failure !!!\n"); WARN("HDC failure !!!\n");
EndDialog (hDlg, 0); EndDialog (hDlg, 0);
return FALSE; return FALSE;
} }
if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC)) if (!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC))
ReleaseDC(hDlg,hdc); ReleaseDC(hDlg,hdc);
SetCursor(hcursor); SetCursor(hcursor);
return TRUE; return TRUE;
} }
@ -858,11 +858,11 @@ static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
BITMAP bm; BITMAP bm;
COLORREF cr, oldText=0, oldBk=0; COLORREF cr, oldText=0, oldBk=0;
RECT rect; RECT rect;
#if 0 #if 0
HDC hMemDC; HDC hMemDC;
int nFontType; int nFontType;
HBITMAP hBitmap; /* for later TT usage */ HBITMAP hBitmap; /* for later TT usage */
#endif #endif
LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam; LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)lParam;
if (lpdi->itemID == (UINT)-1) /* got no items */ if (lpdi->itemID == (UINT)-1) /* got no items */
@ -891,7 +891,7 @@ static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
{ {
case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */ case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */
SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID,
(LPARAM)buffer); (LPARAM)buffer);
GetObjectA( hBitmapTT, sizeof(bm), &bm ); GetObjectA( hBitmapTT, sizeof(bm), &bm );
TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10, TextOutA(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10,
lpdi->rcItem.top, buffer, strlen(buffer)); lpdi->rcItem.top, buffer, strlen(buffer));
@ -976,7 +976,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
long l; long l;
HDC hdc; HDC hdc;
LPLOGFONTA lpxx=lpcf->lpLogFont; LPLOGFONTA lpxx=lpcf->lpLogFont;
TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam); TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam);
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
@ -985,7 +985,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
hdc=((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg); hdc=((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : GetDC(hDlg);
if (hdc) if (hdc)
{ {
SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0); SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT16, 0, 0);
SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0); SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT16, 0, 0);
i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0); i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL16, 0, 0);
if (i!=CB_ERR) if (i!=CB_ERR)
@ -1010,7 +1010,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
else else
{ {
WARN("HDC failure !!!\n"); WARN("HDC failure !!!\n");
EndDialog (hDlg, 0); EndDialog (hDlg, 0);
return TRUE; return TRUE;
} }
} }
@ -1063,7 +1063,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
hFont=CreateFontIndirectA(lpxx); hFont=CreateFontIndirectA(lpxx);
if (hFont) if (hFont)
{ {
HFONT oldFont=SendDlgItemMessageA(hDlg, stc6, HFONT oldFont=SendDlgItemMessageA(hDlg, stc6,
WM_GETFONT, 0, 0); WM_GETFONT, 0, 0);
SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,hFont,TRUE); SendDlgItemMessageA(hDlg,stc6,WM_SETFONT,hFont,TRUE);
DeleteObject(oldFont); DeleteObject(oldFont);
@ -1078,7 +1078,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
InvalidateRect( GetDlgItem(hDlg,stc6), NULL, 0 ); InvalidateRect( GetDlgItem(hDlg,stc6), NULL, 0 );
} }
break; break;
case psh15:i=RegisterWindowMessageA( HELPMSGSTRINGA ); case psh15:i=RegisterWindowMessageA( HELPMSGSTRINGA );
if (lpcf->hwndOwner) if (lpcf->hwndOwner)
SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER)); SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetWindowLongA(hDlg, DWL_USER));
@ -1087,8 +1087,8 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
break; break;
case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) || case IDOK:if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
( (lpcf->Flags & CF_LIMITSIZE) && ( (lpcf->Flags & CF_LIMITSIZE) &&
(-lpxx->lfHeight >= lpcf->nSizeMin) && (-lpxx->lfHeight >= lpcf->nSizeMin) &&
(-lpxx->lfHeight <= lpcf->nSizeMax))) (-lpxx->lfHeight <= lpcf->nSizeMax)))
EndDialog(hDlg, TRUE); EndDialog(hDlg, TRUE);
else else
@ -1097,7 +1097,7 @@ static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
sprintf(buffer,"Select a font size between %d and %d points.", sprintf(buffer,"Select a font size between %d and %d points.",
lpcf->nSizeMin,lpcf->nSizeMax); lpcf->nSizeMin,lpcf->nSizeMax);
MessageBoxA(hDlg, buffer, NULL, MB_OK); MessageBoxA(hDlg, buffer, NULL, MB_OK);
} }
return(TRUE); return(TRUE);
case IDCANCEL:EndDialog(hDlg, FALSE); case IDCANCEL:EndDialog(hDlg, FALSE);
return(TRUE); return(TRUE);
@ -1123,10 +1123,10 @@ LRESULT WINAPI FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam,
{ {
LPCHOOSEFONT16 lpcf; LPCHOOSEFONT16 lpcf;
LPCHOOSEFONTA lpcf32a; LPCHOOSEFONTA lpcf32a;
LRESULT res=0; LRESULT res=0;
if (message!=WM_INITDIALOG) if (message!=WM_INITDIALOG)
{ {
lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER);
if (!lpcf) if (!lpcf)
return FALSE; return FALSE;
if (CFn_HookCallChk(lpcf)) if (CFn_HookCallChk(lpcf))
@ -1138,11 +1138,11 @@ LRESULT WINAPI FormatCharDlgProc16(HWND16 hDlg, UINT16 message, WPARAM16 wParam,
{ {
lpcf=(LPCHOOSEFONT16)lParam; lpcf=(LPCHOOSEFONT16)lParam;
lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName; lpcf32a=(LPCHOOSEFONTA)lpcf->lpTemplateName;
if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a)) if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
{ {
TRACE("CFn_WMInitDialog returned FALSE\n"); TRACE("CFn_WMInitDialog returned FALSE\n");
return FALSE; return FALSE;
} }
if (CFn_HookCallChk(lpcf)) if (CFn_HookCallChk(lpcf))
return CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); return CallWindowProc16((WNDPROC16)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
} }
@ -1208,7 +1208,7 @@ LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
LRESULT res=FALSE; LRESULT res=FALSE;
if (uMsg!=WM_INITDIALOG) if (uMsg!=WM_INITDIALOG)
{ {
lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER); lpcf=(LPCHOOSEFONTA)GetWindowLongA(hDlg, DWL_USER);
if (!lpcf) if (!lpcf)
return FALSE; return FALSE;
if (CFn_HookCallChk32(lpcf)) if (CFn_HookCallChk32(lpcf))
@ -1219,11 +1219,11 @@ LRESULT WINAPI FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
else else
{ {
lpcf=(LPCHOOSEFONTA)lParam; lpcf=(LPCHOOSEFONTA)lParam;
if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf)) if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf))
{ {
TRACE("CFn_WMInitDialog returned FALSE\n"); TRACE("CFn_WMInitDialog returned FALSE\n");
return FALSE; return FALSE;
} }
if (CFn_HookCallChk32(lpcf)) if (CFn_HookCallChk32(lpcf))
return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
} }
@ -1259,7 +1259,7 @@ LRESULT WINAPI FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
LRESULT res=FALSE; LRESULT res=FALSE;
if (uMsg!=WM_INITDIALOG) if (uMsg!=WM_INITDIALOG)
{ {
lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER); lpcf32w=(LPCHOOSEFONTW)GetWindowLongA(hDlg, DWL_USER);
if (!lpcf32w) if (!lpcf32w)
return FALSE; return FALSE;
if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
@ -1271,11 +1271,11 @@ LRESULT WINAPI FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
{ {
lpcf32w=(LPCHOOSEFONTW)lParam; lpcf32w=(LPCHOOSEFONTW)lParam;
lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName; lpcf32a=(LPCHOOSEFONTA)lpcf32w->lpTemplateName;
if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a)) if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf32a))
{ {
TRACE("CFn_WMInitDialog returned FALSE\n"); TRACE("CFn_WMInitDialog returned FALSE\n");
return FALSE; return FALSE;
} }
if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w))
return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam);
} }
@ -1292,7 +1292,7 @@ LRESULT WINAPI FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
return CFn_WMCommand(hDlg, wParam, lParam, lpcf32a); return CFn_WMCommand(hDlg, wParam, lParam, lpcf32a);
case WM_DESTROY: case WM_DESTROY:
return CFn_WMDestroy(hDlg, wParam, lParam); return CFn_WMDestroy(hDlg, wParam, lParam);
case WM_CHOOSEFONT_GETLOGFONT: case WM_CHOOSEFONT_GETLOGFONT:
TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n",
lParam); lParam);
FIXME("current logfont back to caller\n"); FIXME("current logfont back to caller\n");

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* /*
* Implementation of DCIMAN32 - DCI Manager * Implementation of DCIMAN32 - DCI Manager
* "Device Context Interface" ? * "Device Context Interface" ?
* *
* Copyright 2000 Marcus Meissner * Copyright 2000 Marcus Meissner
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or

View File

@ -38,7 +38,7 @@ static void pixel_convert_16_to_8(void *src, void *dst, DWORD width, DWORD heigh
/* gcc generates slightly inefficient code for the the copy/lookup, /* gcc generates slightly inefficient code for the the copy/lookup,
* it generates one excess memory access (to pal) per pixel. Since * it generates one excess memory access (to pal) per pixel. Since
* we know that pal is not modified by the memory write we can * we know that pal is not modified by the memory write we can
* put it into a register and reduce the number of memory accesses * put it into a register and reduce the number of memory accesses
* from 4 to 3 pp. There are two xor eax,eax to avoid pipeline * from 4 to 3 pp. There are two xor eax,eax to avoid pipeline
* stalls. (This is not guaranteed to be the fastest method.) * stalls. (This is not guaranteed to be the fastest method.)
*/ */

View File

@ -108,7 +108,7 @@ extern HRESULT WINAPI IDirect3DImpl_FindDevice(
LPDIRECT3D iface, LPD3DFINDDEVICESEARCH lpfinddevsrc, LPDIRECT3D iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst) LPD3DFINDDEVICERESULT lpfinddevrst)
; ;
extern HRESULT WINAPI IDirect3D2Impl_QueryInterface(LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj); extern HRESULT WINAPI IDirect3D2Impl_QueryInterface(LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj);
extern ULONG WINAPI IDirect3D2Impl_AddRef(LPDIRECT3D2 iface); extern ULONG WINAPI IDirect3D2Impl_AddRef(LPDIRECT3D2 iface);
extern ULONG WINAPI IDirect3D2Impl_Release(LPDIRECT3D2 iface); extern ULONG WINAPI IDirect3D2Impl_Release(LPDIRECT3D2 iface);
extern HRESULT WINAPI IDirect3D2Impl_EnumDevices( extern HRESULT WINAPI IDirect3D2Impl_EnumDevices(
@ -144,7 +144,7 @@ struct IDirect3DLightImpl
IDirect3D2Impl* d3d2; IDirect3D2Impl* d3d2;
} d3d; } d3d;
int type; int type;
D3DLIGHT2 light; D3DLIGHT2 light;
/* Chained list used for adding / removing from viewports */ /* Chained list used for adding / removing from viewports */
@ -153,7 +153,7 @@ struct IDirect3DLightImpl
/* Activation function */ /* Activation function */
void (*activate)(IDirect3DLightImpl*); void (*activate)(IDirect3DLightImpl*);
int is_active; int is_active;
LPVOID private; LPVOID private;
}; };
@ -250,13 +250,13 @@ struct IDirect3DViewport2Impl
/* Activation function */ /* Activation function */
void (*activate)(IDirect3DViewport2Impl*); void (*activate)(IDirect3DViewport2Impl*);
/* Field used to chain viewports together */ /* Field used to chain viewports together */
IDirect3DViewport2Impl* next; IDirect3DViewport2Impl* next;
/* Lights list */ /* Lights list */
IDirect3DLightImpl* lights; IDirect3DLightImpl* lights;
LPVOID private; LPVOID private;
}; };

View File

@ -1,6 +1,6 @@
/* Direct3D Device /* Direct3D Device
* Copyright (c) 1998 Lionel ULMER * Copyright (c) 1998 Lionel ULMER
* *
* This file contains all the common stuff for D3D devices. * This file contains all the common stuff for D3D devices.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -379,12 +379,12 @@ HRESULT WINAPI IDirect3DDevice2Impl_DrawPrimitive(
LPVOID lpvertex, DWORD vertcount, DWORD dwFlags LPVOID lpvertex, DWORD vertcount, DWORD dwFlags
) { ) {
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
TRACE("(%p)->(%d,%d,%p,%ld,%08lx): stub\n", This, d3dp, d3dv, lpvertex, vertcount, dwFlags); TRACE("(%p)->(%d,%d,%p,%ld,%08lx): stub\n", This, d3dp, d3dv, lpvertex, vertcount, dwFlags);
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IDirect3DDevice2Impl_DrawIndexedPrimitive( HRESULT WINAPI IDirect3DDevice2Impl_DrawIndexedPrimitive(
LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv, LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv,
LPVOID lpvertex, DWORD vertcount, LPWORD lpindexes, DWORD indexcount, LPVOID lpvertex, DWORD vertcount, LPWORD lpindexes, DWORD indexcount,
@ -670,7 +670,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_EndScene(LPDIRECT3DDEVICE iface)
{ {
ICOM_THIS(IDirect3DDeviceImpl,iface); ICOM_THIS(IDirect3DDeviceImpl,iface);
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
return DD_OK; return DD_OK;
} }
HRESULT WINAPI IDirect3DDeviceImpl_GetDirect3D( HRESULT WINAPI IDirect3DDeviceImpl_GetDirect3D(
@ -685,7 +685,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_GetDirect3D(
/******************************************************************************* /*******************************************************************************
* Direct3DDevice VTable * Direct3DDevice VTable
*/ */
static ICOM_VTABLE(IDirect3DDevice) WINE_UNUSED d3d_d3ddevice_vtbl = static ICOM_VTABLE(IDirect3DDevice) WINE_UNUSED d3d_d3ddevice_vtbl =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirect3DDeviceImpl_QueryInterface, IDirect3DDeviceImpl_QueryInterface,

View File

@ -1,6 +1,6 @@
/* Direct3D Device /* Direct3D Device
* Copyright (c) 1998 Lionel ULMER * Copyright (c) 1998 Lionel ULMER
* *
* This file contains the MESA implementation of all the D3D devices that * This file contains the MESA implementation of all the D3D devices that
* Wine supports. * Wine supports.
* *
@ -98,7 +98,7 @@ static void fill_opengl_primcaps(D3DPRIMCAPS *pc)
static void fill_opengl_caps(D3DDEVICEDESC *d1, D3DDEVICEDESC *d2) static void fill_opengl_caps(D3DDEVICEDESC *d1, D3DDEVICEDESC *d2)
{ {
/* GLint maxlight; */ /* GLint maxlight; */
d1->dwSize = sizeof(*d1); d1->dwSize = sizeof(*d1);
d1->dwFlags = D3DDD_DEVCAPS | D3DDD_BCLIPPING | D3DDD_COLORMODEL | D3DDD_DEVICERENDERBITDEPTH | D3DDD_DEVICEZBUFFERBITDEPTH d1->dwFlags = D3DDD_DEVCAPS | D3DDD_BCLIPPING | D3DDD_COLORMODEL | D3DDD_DEVICERENDERBITDEPTH | D3DDD_DEVICEZBUFFERBITDEPTH
| D3DDD_LIGHTINGCAPS | D3DDD_LINECAPS | D3DDD_MAXBUFFERSIZE | D3DDD_MAXVERTEXCOUNT | D3DDD_TRANSFORMCAPS | D3DDD_TRICAPS; | D3DDD_LIGHTINGCAPS | D3DDD_LINECAPS | D3DDD_MAXBUFFERSIZE | D3DDD_MAXVERTEXCOUNT | D3DDD_TRANSFORMCAPS | D3DDD_TRICAPS;
@ -114,7 +114,7 @@ static void fill_opengl_caps(D3DDEVICEDESC *d1, D3DDEVICEDESC *d2)
d1->dlcLightingCaps.dwLightingModel = D3DLIGHTINGMODEL_RGB; d1->dlcLightingCaps.dwLightingModel = D3DLIGHTINGMODEL_RGB;
d1->dlcLightingCaps.dwNumLights = 16; /* glGetIntegerv(GL_MAX_LIGHTS, &maxlight); d1->dlcLightingCaps.dwNumLights = maxlight; */ d1->dlcLightingCaps.dwNumLights = 16; /* glGetIntegerv(GL_MAX_LIGHTS, &maxlight); d1->dlcLightingCaps.dwNumLights = maxlight; */
fill_opengl_primcaps(&(d1->dpcLineCaps)); fill_opengl_primcaps(&(d1->dpcLineCaps));
fill_opengl_primcaps(&(d1->dpcTriCaps)); fill_opengl_primcaps(&(d1->dpcTriCaps));
d1->dwDeviceRenderBitDepth = DDBD_16; d1->dwDeviceRenderBitDepth = DDBD_16;
d1->dwDeviceZBufferBitDepth = DDBD_16; d1->dwDeviceZBufferBitDepth = DDBD_16;
d1->dwMaxBufferSize = 0; d1->dwMaxBufferSize = 0;
@ -137,10 +137,10 @@ static void fill_device_capabilities(IDirectDrawImpl* ddraw) {
x11_dd_private *private = (x11_dd_private *) ddraw->d->private; x11_dd_private *private = (x11_dd_private *) ddraw->d->private;
const char *ext_string; const char *ext_string;
Mesa_DeviceCapabilities *devcap; Mesa_DeviceCapabilities *devcap;
private->device_capabilities = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Mesa_DeviceCapabilities)); private->device_capabilities = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(Mesa_DeviceCapabilities));
devcap = (Mesa_DeviceCapabilities *) private->device_capabilities; devcap = (Mesa_DeviceCapabilities *) private->device_capabilities;
ENTER_GL(); ENTER_GL();
ext_string = glGetString(GL_EXTENSIONS); ext_string = glGetString(GL_EXTENSIONS);
/* Query for the ColorTable Extension */ /* Query for the ColorTable Extension */
@ -174,7 +174,7 @@ is_OpenGL(
(!memcmp(&IID_IDirect3DHALDevice,rguid,sizeof(IID_IDirect3DHALDevice))) || (!memcmp(&IID_IDirect3DHALDevice,rguid,sizeof(IID_IDirect3DHALDevice))) ||
/* OpenGL Device */ /* OpenGL Device */
(!memcmp(&IID_D3DDEVICE2_OpenGL,rguid,sizeof(IID_D3DDEVICE2_OpenGL)))) { (!memcmp(&IID_D3DDEVICE2_OpenGL,rguid,sizeof(IID_D3DDEVICE2_OpenGL)))) {
*device = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DDevice2Impl)); *device = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DDevice2Impl));
(*device)->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dd_private)); (*device)->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dd_private));
odev = (mesa_d3dd_private*)(*device)->private; odev = (mesa_d3dd_private*)(*device)->private;
@ -185,7 +185,7 @@ is_OpenGL(
(*device)->viewport_list = NULL; (*device)->viewport_list = NULL;
(*device)->current_viewport = NULL; (*device)->current_viewport = NULL;
(*device)->set_context = set_context; (*device)->set_context = set_context;
TRACE("Creating OpenGL device for surface %p\n", surface); TRACE("Creating OpenGL device for surface %p\n", surface);
/* Create the OpenGL context */ /* Create the OpenGL context */
#if COMPILABLE #if COMPILABLE
@ -203,12 +203,12 @@ is_OpenGL(
odev->ctx = glXCreateContext(gdi_display, vis, odev->ctx = glXCreateContext(gdi_display, vis,
NULL, GL_TRUE); NULL, GL_TRUE);
} }
if (odev->ctx == NULL) if (odev->ctx == NULL)
ERR("Error in context creation !\n"); ERR("Error in context creation !\n");
else else
TRACE("Context created (%p)\n", odev->ctx); TRACE("Context created (%p)\n", odev->ctx);
/* Now override the surface's Flip method (if in double buffering) */ /* Now override the surface's Flip method (if in double buffering) */
((x11_ds_private *) surface->private)->opengl_flip = TRUE; ((x11_ds_private *) surface->private)->opengl_flip = TRUE;
{ {
@ -230,7 +230,7 @@ is_OpenGL(
odev->world_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); odev->world_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float));
odev->view_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); odev->view_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float));
odev->proj_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); odev->proj_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float));
memcpy(odev->world_mat, id_mat, 16 * sizeof(float)); memcpy(odev->world_mat, id_mat, 16 * sizeof(float));
memcpy(odev->view_mat , id_mat, 16 * sizeof(float)); memcpy(odev->view_mat , id_mat, 16 * sizeof(float));
memcpy(odev->proj_mat , id_mat, 16 * sizeof(float)); memcpy(odev->proj_mat , id_mat, 16 * sizeof(float));
@ -244,7 +244,7 @@ is_OpenGL(
LEAVE_GL(); LEAVE_GL();
fill_device_capabilities(d3d->ddraw); fill_device_capabilities(d3d->ddraw);
TRACE("OpenGL device created \n"); TRACE("OpenGL device created \n");
return 1; return 1;
} }
@ -260,7 +260,7 @@ static ULONG WINAPI MESA_IDirect3DDevice2Impl_Release(LPDIRECT3DDEVICE2 iface)
{ {
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
#if 0 /* broken for now */ #if 0 /* broken for now */
D3DDPRIVATE(This); D3DDPRIVATE(This);
@ -298,7 +298,7 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb,
pformat = &(sdesc.ddpfPixelFormat); pformat = &(sdesc.ddpfPixelFormat);
pformat->dwSize = sizeof(DDPIXELFORMAT); pformat->dwSize = sizeof(DDPIXELFORMAT);
pformat->dwFourCC = 0; pformat->dwFourCC = 0;
TRACE("Enumerating GL_RGBA unpacked (32)\n"); TRACE("Enumerating GL_RGBA unpacked (32)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 32; pformat->u1.dwRGBBitCount = 32;
@ -371,8 +371,8 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb,
pformat->u4.dwBBitMask = 0x0000001F; pformat->u4.dwBBitMask = 0x0000001F;
pformat->u5.dwRGBAlphaBitMask = 0x00008000; pformat->u5.dwRGBAlphaBitMask = 0x00008000;
if (cb(&sdesc, context) == 0) if (cb(&sdesc, context) == 0)
return DD_OK; return DD_OK;
TRACE("Enumerating Paletted (8)\n"); TRACE("Enumerating Paletted (8)\n");
pformat->dwFlags = DDPF_PALETTEINDEXED8; pformat->dwFlags = DDPF_PALETTEINDEXED8;
pformat->u1.dwRGBBitCount = 8; pformat->u1.dwRGBBitCount = 8;
@ -382,9 +382,9 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb,
pformat->u5.dwRGBAlphaBitMask = 0x00000000; pformat->u5.dwRGBAlphaBitMask = 0x00000000;
if (cb(&sdesc, context) == 0) if (cb(&sdesc, context) == 0)
return DD_OK; return DD_OK;
TRACE("End of enumeration\n"); TRACE("End of enumeration\n");
return DD_OK; return DD_OK;
} }
@ -393,7 +393,7 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_EnumTextureFormats(
) { ) {
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, cb, context); FIXME("(%p)->(%p,%p): stub\n", This, cb, context);
return enum_texture_format_OpenGL(cb, context); return enum_texture_format_OpenGL(cb, context);
} }
@ -401,12 +401,12 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_BeginScene(
LPDIRECT3DDEVICE2 iface LPDIRECT3DDEVICE2 iface
) { ) {
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
/* Here, we should get the DDraw surface and 'copy it' to the /* Here, we should get the DDraw surface and 'copy it' to the
OpenGL surface.... */ OpenGL surface.... */
return DD_OK; return DD_OK;
} }
@ -416,7 +416,7 @@ HRESULT WINAPI MESA_IDirect3DDevice2Impl_EndScene(LPDIRECT3DDEVICE2 iface) {
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
/* No need to do anything here... */ /* No need to do anything here... */
return DD_OK; return DD_OK;
} }
@ -428,10 +428,10 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetRenderState(
D3DDPRIVATE(This); D3DDPRIVATE(This);
TRACE("(%p)->(%d,%ld)\n", This, dwRenderStateType, dwRenderState); TRACE("(%p)->(%d,%ld)\n", This, dwRenderStateType, dwRenderState);
/* Call the render state functions */ /* Call the render state functions */
set_render_state(dwRenderStateType, dwRenderState, &(odev->rs)); set_render_state(dwRenderStateType, dwRenderState, &(odev->rs));
return DD_OK; return DD_OK;
} }
@ -441,11 +441,11 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetLightState(
) { ) {
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
FIXME("(%p)->(%d,%08lx): stub\n", This, dwLightStateType, dwLightState); FIXME("(%p)->(%d,%08lx): stub\n", This, dwLightStateType, dwLightState);
switch (dwLightStateType) { switch (dwLightStateType) {
case D3DLIGHTSTATE_MATERIAL: { /* 1 */ case D3DLIGHTSTATE_MATERIAL: { /* 1 */
IDirect3DMaterial2Impl* mat = (IDirect3DMaterial2Impl*) dwLightState; IDirect3DMaterial2Impl* mat = (IDirect3DMaterial2Impl*) dwLightState;
if (mat != NULL) { if (mat != NULL) {
ENTER_GL(); ENTER_GL();
mat->activate(mat); mat->activate(mat);
@ -454,10 +454,10 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetLightState(
TRACE("Zoups !!!\n"); TRACE("Zoups !!!\n");
} }
} break; } break;
case D3DLIGHTSTATE_AMBIENT: { /* 2 */ case D3DLIGHTSTATE_AMBIENT: { /* 2 */
float light[4]; float light[4];
light[0] = ((dwLightState >> 16) & 0xFF) / 255.0; light[0] = ((dwLightState >> 16) & 0xFF) / 255.0;
light[1] = ((dwLightState >> 8) & 0xFF) / 255.0; light[1] = ((dwLightState >> 8) & 0xFF) / 255.0;
light[2] = ((dwLightState >> 0) & 0xFF) / 255.0; light[2] = ((dwLightState >> 0) & 0xFF) / 255.0;
@ -478,7 +478,7 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetLightState(
TRACE("Unexpected Light State Type\n"); TRACE("Unexpected Light State Type\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
return DD_OK; return DD_OK;
} }
@ -488,12 +488,12 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetTransform(
) { ) {
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
D3DDPRIVATE(This); D3DDPRIVATE(This);
FIXME("(%p)->(%d,%p): stub\n", This, d3dts, lpmatrix); FIXME("(%p)->(%d,%p): stub\n", This, d3dts, lpmatrix);
ENTER_GL(); ENTER_GL();
/* Using a trial and failure approach, I found that the order of /* Using a trial and failure approach, I found that the order of
Direct3D transformations that works best is : Direct3D transformations that works best is :
ScreenCoord = ProjectionMat * ViewMat * WorldMat * ObjectCoord ScreenCoord = ProjectionMat * ViewMat * WorldMat * ObjectCoord
@ -504,7 +504,7 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetTransform(
If anyone has a good explanation of the three different matrices in If anyone has a good explanation of the three different matrices in
the SDK online documentation, feel free to point it to me. For example, the SDK online documentation, feel free to point it to me. For example,
which matrices transform lights ? In OpenGL only the PROJECTION matrix which matrices transform lights ? In OpenGL only the PROJECTION matrix
transform the lights, not the MODELVIEW. Using the matrix names, I transform the lights, not the MODELVIEW. Using the matrix names, I
supposed that PROJECTION and VIEW (all 'camera' related names) do supposed that PROJECTION and VIEW (all 'camera' related names) do
transform lights, but WORLD do not. It may be wrong though... */ transform lights, but WORLD do not. It may be wrong though... */
@ -530,21 +530,21 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_SetTransform(
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadMatrixf((float *) odev->world_mat); glLoadMatrixf((float *) odev->world_mat);
} break; } break;
case D3DTRANSFORMSTATE_VIEW: { case D3DTRANSFORMSTATE_VIEW: {
conv_mat(lpmatrix, odev->view_mat); conv_mat(lpmatrix, odev->view_mat);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadMatrixf((float *) odev->proj_mat); glLoadMatrixf((float *) odev->proj_mat);
glMultMatrixf((float *) odev->view_mat); glMultMatrixf((float *) odev->view_mat);
} break; } break;
case D3DTRANSFORMSTATE_PROJECTION: { case D3DTRANSFORMSTATE_PROJECTION: {
conv_mat(lpmatrix, odev->proj_mat); conv_mat(lpmatrix, odev->proj_mat);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadMatrixf((float *) odev->proj_mat); glLoadMatrixf((float *) odev->proj_mat);
glMultMatrixf((float *) odev->view_mat); glMultMatrixf((float *) odev->view_mat);
} break; } break;
default: default:
break; break;
} }
@ -720,16 +720,16 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_DrawPrimitive(
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
D3DDPRIVATE(This); D3DDPRIVATE(This);
int vx_index; int vx_index;
TRACE("(%p)->(%d,%d,%p,%ld,%08lx): stub\n", This, d3dp, d3dv, lpvertex, vertcount, dwFlags); TRACE("(%p)->(%d,%d,%p,%ld,%08lx): stub\n", This, d3dp, d3dv, lpvertex, vertcount, dwFlags);
ENTER_GL(); ENTER_GL();
DRAW_PRIMITIVE(vertcount, vx_index); DRAW_PRIMITIVE(vertcount, vx_index);
LEAVE_GL(); LEAVE_GL();
return D3D_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3DDevice2Impl_DrawIndexedPrimitive( static HRESULT WINAPI MESA_IDirect3DDevice2Impl_DrawIndexedPrimitive(
LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv, LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv,
LPVOID lpvertex, DWORD vertcount, LPWORD lpindexes, DWORD indexcount, LPVOID lpvertex, DWORD vertcount, LPWORD lpindexes, DWORD indexcount,
@ -738,13 +738,13 @@ static HRESULT WINAPI MESA_IDirect3DDevice2Impl_DrawIndexedPrimitive(
ICOM_THIS(IDirect3DDevice2Impl,iface); ICOM_THIS(IDirect3DDevice2Impl,iface);
D3DDPRIVATE(This); D3DDPRIVATE(This);
int vx_index; int vx_index;
TRACE("(%p)->(%d,%d,%p,%ld,%p,%ld,%08lx): stub\n", This, d3dp, d3dv, lpvertex, vertcount, lpindexes, indexcount, dwFlags); TRACE("(%p)->(%d,%d,%p,%ld,%p,%ld,%08lx): stub\n", This, d3dp, d3dv, lpvertex, vertcount, lpindexes, indexcount, dwFlags);
ENTER_GL(); ENTER_GL();
DRAW_PRIMITIVE(indexcount, lpindexes[vx_index]); DRAW_PRIMITIVE(indexcount, lpindexes[vx_index]);
LEAVE_GL(); LEAVE_GL();
return D3D_OK; return D3D_OK;
} }
@ -767,7 +767,7 @@ static HRESULT WINAPI MESA_IDirect3DDeviceImpl_CreateExecuteBuffer(
* OpenGL-specific VTable * OpenGL-specific VTable
*/ */
ICOM_VTABLE(IDirect3DDevice2) OpenGL_vtable = ICOM_VTABLE(IDirect3DDevice2) OpenGL_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirect3DDevice2Impl_QueryInterface, IDirect3DDevice2Impl_QueryInterface,
@ -784,20 +784,20 @@ ICOM_VTABLE(IDirect3DDevice2) OpenGL_vtable =
MESA_IDirect3DDevice2Impl_BeginScene, MESA_IDirect3DDevice2Impl_BeginScene,
MESA_IDirect3DDevice2Impl_EndScene, MESA_IDirect3DDevice2Impl_EndScene,
IDirect3DDevice2Impl_GetDirect3D, IDirect3DDevice2Impl_GetDirect3D,
/*** DrawPrimitive API ***/ /*** DrawPrimitive API ***/
IDirect3DDevice2Impl_SetCurrentViewport, IDirect3DDevice2Impl_SetCurrentViewport,
IDirect3DDevice2Impl_GetCurrentViewport, IDirect3DDevice2Impl_GetCurrentViewport,
IDirect3DDevice2Impl_SetRenderTarget, IDirect3DDevice2Impl_SetRenderTarget,
IDirect3DDevice2Impl_GetRenderTarget, IDirect3DDevice2Impl_GetRenderTarget,
IDirect3DDevice2Impl_Begin, IDirect3DDevice2Impl_Begin,
IDirect3DDevice2Impl_BeginIndexed, IDirect3DDevice2Impl_BeginIndexed,
IDirect3DDevice2Impl_Vertex, IDirect3DDevice2Impl_Vertex,
IDirect3DDevice2Impl_Index, IDirect3DDevice2Impl_Index,
IDirect3DDevice2Impl_End, IDirect3DDevice2Impl_End,
IDirect3DDevice2Impl_GetRenderState, IDirect3DDevice2Impl_GetRenderState,
MESA_IDirect3DDevice2Impl_SetRenderState, MESA_IDirect3DDevice2Impl_SetRenderState,
IDirect3DDevice2Impl_GetLightState, IDirect3DDevice2Impl_GetLightState,
@ -805,10 +805,10 @@ ICOM_VTABLE(IDirect3DDevice2) OpenGL_vtable =
MESA_IDirect3DDevice2Impl_SetTransform, MESA_IDirect3DDevice2Impl_SetTransform,
IDirect3DDevice2Impl_GetTransform, IDirect3DDevice2Impl_GetTransform,
IDirect3DDevice2Impl_MultiplyTransform, IDirect3DDevice2Impl_MultiplyTransform,
MESA_IDirect3DDevice2Impl_DrawPrimitive, MESA_IDirect3DDevice2Impl_DrawPrimitive,
MESA_IDirect3DDevice2Impl_DrawIndexedPrimitive, MESA_IDirect3DDevice2Impl_DrawIndexedPrimitive,
IDirect3DDevice2Impl_SetClipStatus, IDirect3DDevice2Impl_SetClipStatus,
IDirect3DDevice2Impl_GetClipStatus, IDirect3DDevice2Impl_GetClipStatus,
}; };
@ -818,11 +818,11 @@ ICOM_VTABLE(IDirect3DDevice2) OpenGL_vtable =
*/ */
int d3d_OpenGL_dx3(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) { int d3d_OpenGL_dx3(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) {
D3DDEVICEDESC d1,d2; D3DDEVICEDESC d1,d2;
TRACE(" Enumerating OpenGL D3D device (IID %s).\n", debugstr_guid(&IID_D3DDEVICE_OpenGL)); TRACE(" Enumerating OpenGL D3D device (IID %s).\n", debugstr_guid(&IID_D3DDEVICE_OpenGL));
fill_opengl_caps(&d1, &d2); fill_opengl_caps(&d1, &d2);
return cb((void*)&IID_D3DDEVICE_OpenGL,"WINE Direct3D using OpenGL","direct3d",&d1,&d2,context); return cb((void*)&IID_D3DDEVICE_OpenGL,"WINE Direct3D using OpenGL","direct3d",&d1,&d2,context);
} }
@ -834,7 +834,7 @@ int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevi
int attributeList[]={ GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None }; int attributeList[]={ GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None };
XVisualInfo *xvis; XVisualInfo *xvis;
#endif #endif
*device = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DDeviceImpl)); *device = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DDeviceImpl));
(*device)->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dd_private)); (*device)->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dd_private));
odev = (mesa_d3dd_private*)(*device)->private; odev = (mesa_d3dd_private*)(*device)->private;
@ -842,14 +842,14 @@ int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevi
ICOM_VTBL(*device) = &OpenGL_vtable_dx3; ICOM_VTBL(*device) = &OpenGL_vtable_dx3;
(*device)->d3d = NULL; (*device)->d3d = NULL;
(*device)->surface = surface; (*device)->surface = surface;
(*device)->viewport_list = NULL; (*device)->viewport_list = NULL;
(*device)->current_viewport = NULL; (*device)->current_viewport = NULL;
(*device)->set_context = (void*)set_context; (*device)->set_context = (void*)set_context;
TRACE("OpenGL device created \n"); TRACE("OpenGL device created \n");
/* Create the OpenGL context */ /* Create the OpenGL context */
/* First get the correct visual */ /* First get the correct visual */
/* if (surface->s.backbuffer == NULL) /* if (surface->s.backbuffer == NULL)
@ -869,7 +869,7 @@ int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevi
NULL, NULL,
GL_TRUE); GL_TRUE);
TRACE("Context created\n"); TRACE("Context created\n");
/* Now override the surface's Flip method (if in double buffering) */ /* Now override the surface's Flip method (if in double buffering) */
surface->s.d3d_device = (void *) odev; surface->s.d3d_device = (void *) odev;
{ {
@ -893,12 +893,12 @@ int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevi
(*device)->set_context(*device); (*device)->set_context(*device);
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
glColor3f(1.0, 1.0, 1.0); glColor3f(1.0, 1.0, 1.0);
fill_device_capabilities((IDirectDrawImpl *) surface->ddraw_owner); fill_device_capabilities((IDirectDrawImpl *) surface->ddraw_owner);
return 1; return 1;
} }
/* This is not the OpenGL UID */ /* This is not the OpenGL UID */
return DD_OK; return DD_OK;
} }
@ -907,7 +907,7 @@ static ULONG WINAPI MESA_IDirect3DDeviceImpl_Release(LPDIRECT3DDEVICE iface)
{ {
ICOM_THIS(IDirect3DDeviceImpl,iface); ICOM_THIS(IDirect3DDeviceImpl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
#if 0 /* broken for now */ #if 0 /* broken for now */
D3DDPRIVATE(This); D3DDPRIVATE(This);
@ -928,7 +928,7 @@ static HRESULT WINAPI MESA_IDirect3DDeviceImpl_EnumTextureFormats(
{ {
ICOM_THIS(IDirect3DDeviceImpl,iface); ICOM_THIS(IDirect3DDeviceImpl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lpd3dEnumTextureProc, lpArg); TRACE("(%p)->(%p,%p): stub\n", This, lpd3dEnumTextureProc, lpArg);
return enum_texture_format_OpenGL(lpd3dEnumTextureProc, lpArg); return enum_texture_format_OpenGL(lpd3dEnumTextureProc, lpArg);
} }
@ -937,12 +937,12 @@ static HRESULT WINAPI MESA_IDirect3DDeviceImpl_BeginScene(LPDIRECT3DDEVICE iface
{ {
ICOM_THIS(IDirect3DDeviceImpl,iface); ICOM_THIS(IDirect3DDeviceImpl,iface);
/* OpenGL_IDirect3DDevice *odev = (OpenGL_IDirect3DDevice *) This; */ /* OpenGL_IDirect3DDevice *odev = (OpenGL_IDirect3DDevice *) This; */
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
/* We get the pointer to the surface (should be done on flip) */ /* We get the pointer to the surface (should be done on flip) */
/* odev->zb->pbuf = This->surface->s.surface_desc.u2.lpSurface; */ /* odev->zb->pbuf = This->surface->s.surface_desc.u2.lpSurface; */
return DD_OK; return DD_OK;
} }
@ -952,18 +952,18 @@ static HRESULT WINAPI MESA_IDirect3DDeviceImpl_BeginScene(LPDIRECT3DDEVICE iface
static HRESULT WINAPI MESA_IDirect3DDeviceImpl_EndScene(LPDIRECT3DDEVICE iface) static HRESULT WINAPI MESA_IDirect3DDeviceImpl_EndScene(LPDIRECT3DDEVICE iface)
{ {
ICOM_THIS(IDirect3DDeviceImpl,iface); ICOM_THIS(IDirect3DDeviceImpl,iface);
FIXME("(%p)->(): stub\n", This); FIXME("(%p)->(): stub\n", This);
/* No need to do anything here... */ /* No need to do anything here... */
return DD_OK; return DD_OK;
} }
/******************************************************************************* /*******************************************************************************
* Direct3DDevice VTable * Direct3DDevice VTable
*/ */
ICOM_VTABLE(IDirect3DDevice) OpenGL_vtable_dx3 = ICOM_VTABLE(IDirect3DDevice) OpenGL_vtable_dx3 =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirect3DDeviceImpl_QueryInterface, IDirect3DDeviceImpl_QueryInterface,

View File

@ -69,7 +69,7 @@ static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable;
* ExecuteBuffer static functions * ExecuteBuffer static functions
*/ */
void _dump_d3dstatus(LPD3DSTATUS lpStatus) { void _dump_d3dstatus(LPD3DSTATUS lpStatus) {
} }
void _dump_executedata(LPD3DEXECUTEDATA lpData) { void _dump_executedata(LPD3DEXECUTEDATA lpData) {
@ -193,16 +193,16 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
/* DWORD vc = ilpBuff->data.dwVertexCount; */ /* DWORD vc = ilpBuff->data.dwVertexCount; */
DWORD is = ilpBuff->data.dwInstructionOffset; DWORD is = ilpBuff->data.dwInstructionOffset;
/* DWORD il = ilpBuff->data.dwInstructionLength; */ /* DWORD il = ilpBuff->data.dwInstructionLength; */
void *instr = ilpBuff->desc.lpData + is; void *instr = ilpBuff->desc.lpData + is;
D3DDPRIVATE((IDirect3DDeviceImpl*)dev); D3DDPRIVATE((IDirect3DDeviceImpl*)dev);
TRACE("ExecuteData : \n"); TRACE("ExecuteData : \n");
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
_dump_executedata(&(ilpBuff->data)); _dump_executedata(&(ilpBuff->data));
ENTER_GL(); ENTER_GL();
while (1) { while (1) {
LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr; LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr;
BYTE size; BYTE size;
@ -211,20 +211,20 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
count = current->wCount; count = current->wCount;
size = current->bSize; size = current->bSize;
instr += sizeof(D3DINSTRUCTION); instr += sizeof(D3DINSTRUCTION);
switch (current->bOpcode) { switch (current->bOpcode) {
case D3DOP_POINT: { case D3DOP_POINT: {
TRACE("POINT-s (%d)\n", count); TRACE("POINT-s (%d)\n", count);
instr += count * size; instr += count * size;
} break; } break;
case D3DOP_LINE: { case D3DOP_LINE: {
TRACE("LINE-s (%d)\n", count); TRACE("LINE-s (%d)\n", count);
instr += count * size; instr += count * size;
} break; } break;
case D3DOP_TRIANGLE: { case D3DOP_TRIANGLE: {
int i; int i;
float z_inv_matrix[16] = { float z_inv_matrix[16] = {
@ -233,18 +233,18 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0,
0.0, 0.0, 1.0, 1.0 0.0, 0.0, 1.0, 1.0
}; };
OGL_Vertex *vx = (OGL_Vertex *) ilpBuff->vertex_data; OGL_Vertex *vx = (OGL_Vertex *) ilpBuff->vertex_data;
OGL_LVertex *l_vx = (OGL_LVertex *) ilpBuff->vertex_data; OGL_LVertex *l_vx = (OGL_LVertex *) ilpBuff->vertex_data;
D3DTLVERTEX *tl_vx = (D3DTLVERTEX *) ilpBuff->vertex_data; D3DTLVERTEX *tl_vx = (D3DTLVERTEX *) ilpBuff->vertex_data;
TRACE("TRIANGLE (%d)\n", count); TRACE("TRIANGLE (%d)\n", count);
switch (ilpBuff->vertex_type) { switch (ilpBuff->vertex_type) {
case D3DVT_VERTEX: case D3DVT_VERTEX:
/* This time, there is lighting */ /* This time, there is lighting */
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
/* Use given matrixes */ /* Use given matrixes */
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); /* The model transformation was done during the glLoadIdentity(); /* The model transformation was done during the
@ -282,16 +282,16 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
case D3DVT_TLVERTEX: { case D3DVT_TLVERTEX: {
GLdouble height, width, minZ, maxZ; GLdouble height, width, minZ, maxZ;
/* First, disable lighting */ /* First, disable lighting */
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
/* Then do not put any transformation matrixes */ /* Then do not put any transformation matrixes */
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
if (ivp == NULL) { if (ivp == NULL) {
ERR("No current viewport !\n"); ERR("No current viewport !\n");
/* Using standard values */ /* Using standard values */
@ -314,7 +314,7 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
glOrtho(0.0, width, height, 0.0, -minZ, -maxZ); glOrtho(0.0, width, height, 0.0, -minZ, -maxZ);
} break; } break;
default: default:
ERR("Unhandled vertex type !\n"); ERR("Unhandled vertex type !\n");
break; break;
@ -324,27 +324,27 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
case D3DVT_VERTEX: case D3DVT_VERTEX:
TRIANGLE_LOOP(DO_VERTEX); TRIANGLE_LOOP(DO_VERTEX);
break; break;
case D3DVT_LVERTEX: case D3DVT_LVERTEX:
TRIANGLE_LOOP(DO_LVERTEX); TRIANGLE_LOOP(DO_LVERTEX);
break; break;
case D3DVT_TLVERTEX: case D3DVT_TLVERTEX:
TRIANGLE_LOOP(DO_TLVERTEX); TRIANGLE_LOOP(DO_TLVERTEX);
break; break;
default: default:
ERR("Unhandled vertex type !\n"); ERR("Unhandled vertex type !\n");
} }
} break; } break;
case D3DOP_MATRIXLOAD: { case D3DOP_MATRIXLOAD: {
TRACE("MATRIXLOAD-s (%d)\n", count); TRACE("MATRIXLOAD-s (%d)\n", count);
instr += count * size; instr += count * size;
} break; } break;
case D3DOP_MATRIXMULTIPLY: { case D3DOP_MATRIXMULTIPLY: {
int i; int i;
TRACE("MATRIXMULTIPLY (%d)\n", count); TRACE("MATRIXMULTIPLY (%d)\n", count);
@ -354,7 +354,7 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
LPD3DMATRIX a = (LPD3DMATRIX) ci->hDestMatrix; LPD3DMATRIX a = (LPD3DMATRIX) ci->hDestMatrix;
LPD3DMATRIX b = (LPD3DMATRIX) ci->hSrcMatrix1; LPD3DMATRIX b = (LPD3DMATRIX) ci->hSrcMatrix1;
LPD3DMATRIX c = (LPD3DMATRIX) ci->hSrcMatrix2; LPD3DMATRIX c = (LPD3DMATRIX) ci->hSrcMatrix2;
TRACE(" Dest : %08lx Src1 : %08lx Src2 : %08lx\n", TRACE(" Dest : %08lx Src1 : %08lx Src2 : %08lx\n",
ci->hDestMatrix, ci->hSrcMatrix1, ci->hSrcMatrix2); ci->hDestMatrix, ci->hSrcMatrix1, ci->hSrcMatrix2);
@ -369,11 +369,11 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
glGetFloatv(GL_PROJECTION_MATRIX, (float *) a); glGetFloatv(GL_PROJECTION_MATRIX, (float *) a);
/* Restore the current matrix */ /* Restore the current matrix */
glPopMatrix(); glPopMatrix();
instr += size; instr += size;
} }
} break; } break;
case D3DOP_STATETRANSFORM: { case D3DOP_STATETRANSFORM: {
int i; int i;
TRACE("STATETRANSFORM (%d)\n", count); TRACE("STATETRANSFORM (%d)\n", count);
@ -401,38 +401,38 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
default: default:
ERR(" Unhandled state transformation !! (%d)\n", (int) ci->u1.dtstTransformStateType); ERR(" Unhandled state transformation !! (%d)\n", (int) ci->u1.dtstTransformStateType);
break; break;
} }
instr += size; instr += size;
} }
} break; } break;
case D3DOP_STATELIGHT: { case D3DOP_STATELIGHT: {
int i; int i;
TRACE("STATELIGHT (%d)\n", count); TRACE("STATELIGHT (%d)\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DSTATE ci = (LPD3DSTATE) instr; LPD3DSTATE ci = (LPD3DSTATE) instr;
/* Handle the state transform */ /* Handle the state transform */
switch (ci->u1.dlstLightStateType) { switch (ci->u1.dlstLightStateType) {
case D3DLIGHTSTATE_MATERIAL: { case D3DLIGHTSTATE_MATERIAL: {
IDirect3DMaterial2Impl* mat = (IDirect3DMaterial2Impl*) ci->u2.dwArg[0]; IDirect3DMaterial2Impl* mat = (IDirect3DMaterial2Impl*) ci->u2.dwArg[0];
TRACE(" MATERIAL\n"); TRACE(" MATERIAL\n");
if (mat != NULL) { if (mat != NULL) {
mat->activate(mat); mat->activate(mat);
} else { } else {
TRACE(" bad Material Handle\n"); TRACE(" bad Material Handle\n");
} }
} break ; } break ;
case D3DLIGHTSTATE_AMBIENT: { case D3DLIGHTSTATE_AMBIENT: {
float light[4]; float light[4];
DWORD dwLightState = ci->u2.dwArg[0]; DWORD dwLightState = ci->u2.dwArg[0];
TRACE(" AMBIENT\n"); TRACE(" AMBIENT\n");
light[0] = ((dwLightState >> 16) & 0xFF) / 255.0; light[0] = ((dwLightState >> 16) & 0xFF) / 255.0;
light[1] = ((dwLightState >> 8) & 0xFF) / 255.0; light[1] = ((dwLightState >> 8) & 0xFF) / 255.0;
light[2] = ((dwLightState >> 0) & 0xFF) / 255.0; light[2] = ((dwLightState >> 0) & 0xFF) / 255.0;
@ -445,27 +445,27 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
((dwLightState >> 0) & 0xFF), ((dwLightState >> 0) & 0xFF),
((dwLightState >> 24) & 0xFF)); ((dwLightState >> 24) & 0xFF));
} break ; } break ;
case D3DLIGHTSTATE_COLORMODEL: { case D3DLIGHTSTATE_COLORMODEL: {
TRACE(" COLORMODEL\n"); TRACE(" COLORMODEL\n");
} break ; } break ;
case D3DLIGHTSTATE_FOGMODE: { case D3DLIGHTSTATE_FOGMODE: {
TRACE(" FOGMODE\n"); TRACE(" FOGMODE\n");
} break ; } break ;
case D3DLIGHTSTATE_FOGSTART: { case D3DLIGHTSTATE_FOGSTART: {
TRACE(" FOGSTART\n"); TRACE(" FOGSTART\n");
} break ; } break ;
case D3DLIGHTSTATE_FOGEND: { case D3DLIGHTSTATE_FOGEND: {
TRACE(" FOGEND\n"); TRACE(" FOGEND\n");
} break ; } break ;
case D3DLIGHTSTATE_FOGDENSITY: { case D3DLIGHTSTATE_FOGDENSITY: {
TRACE(" FOGDENSITY\n"); TRACE(" FOGDENSITY\n");
} break ; } break ;
default: default:
ERR(" Unhandled light state !! (%d)\n", (int) ci->u1.dlstLightStateType); ERR(" Unhandled light state !! (%d)\n", (int) ci->u1.dlstLightStateType);
break; break;
@ -473,28 +473,28 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
instr += size; instr += size;
} }
} break; } break;
case D3DOP_STATERENDER: { case D3DOP_STATERENDER: {
int i; int i;
TRACE("STATERENDER (%d)\n", count); TRACE("STATERENDER (%d)\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DSTATE ci = (LPD3DSTATE) instr; LPD3DSTATE ci = (LPD3DSTATE) instr;
/* Handle the state transform */ /* Handle the state transform */
set_render_state(ci->u1.drstRenderStateType, ci->u2.dwArg[0], &(odev->rs)); set_render_state(ci->u1.drstRenderStateType, ci->u2.dwArg[0], &(odev->rs));
instr += size; instr += size;
} }
} break; } break;
case D3DOP_PROCESSVERTICES: { case D3DOP_PROCESSVERTICES: {
int i; int i;
TRACE("PROCESSVERTICES (%d)\n", count); TRACE("PROCESSVERTICES (%d)\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr; LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr;
TRACE(" Start : %d Dest : %d Count : %ld\n", TRACE(" Start : %d Dest : %d Count : %ld\n",
ci->wStart, ci->wDest, ci->dwCount); ci->wStart, ci->wDest, ci->dwCount);
TRACE(" Flags : "); TRACE(" Flags : ");
@ -523,13 +523,13 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
In this implementation, I will emulate only ONE thing : each In this implementation, I will emulate only ONE thing : each
vertex can have its own "WORLD" transformation (this is used in the vertex can have its own "WORLD" transformation (this is used in the
TWIST.EXE demo of the 5.2 SDK). I suppose that all vertices of the TWIST.EXE demo of the 5.2 SDK). I suppose that all vertices of the
execute buffer use the same state. execute buffer use the same state.
If I find applications that change other states, I will try to do a If I find applications that change other states, I will try to do a
more 'fine-tuned' state emulation (but I may become quite tricky if more 'fine-tuned' state emulation (but I may become quite tricky if
it changes a light position in the middle of a triangle). it changes a light position in the middle of a triangle).
In this case, a 'direct' approach (i.e. without using OpenGL, but In this case, a 'direct' approach (i.e. without using OpenGL, but
writing our own 3D rasterizer) would be easier. */ writing our own 3D rasterizer) would be easier. */
@ -551,13 +551,13 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
dump_mat(mat); dump_mat(mat);
ilpBuff->vertex_type = D3DVT_VERTEX; ilpBuff->vertex_type = D3DVT_VERTEX;
for (nb = 0; nb < ci->dwCount; nb++) { for (nb = 0; nb < ci->dwCount; nb++) {
/* For the moment, no normal transformation... */ /* For the moment, no normal transformation... */
dst->nx = src->u4.nx; dst->nx = src->u4.nx;
dst->ny = src->u5.ny; dst->ny = src->u5.ny;
dst->nz = src->u6.nz; dst->nz = src->u6.nz;
dst->u = src->u7.tu; dst->u = src->u7.tu;
dst->v = src->u8.tv; dst->v = src->u8.tv;
@ -566,7 +566,7 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
dst->y = (src->u1.x * mat->_12) + (src->u2.y * mat->_22) + (src->u3.z * mat->_32) + (1.0 * mat->_42); dst->y = (src->u1.x * mat->_12) + (src->u2.y * mat->_22) + (src->u3.z * mat->_32) + (1.0 * mat->_42);
dst->z = (src->u1.x * mat->_13) + (src->u2.y * mat->_23) + (src->u3.z * mat->_33) + (1.0 * mat->_43); dst->z = (src->u1.x * mat->_13) + (src->u2.y * mat->_23) + (src->u3.z * mat->_33) + (1.0 * mat->_43);
dst->w = (src->u1.x * mat->_14) + (src->u2.y * mat->_24) + (src->u3.z * mat->_34) + (1.0 * mat->_44); dst->w = (src->u1.x * mat->_14) + (src->u2.y * mat->_24) + (src->u3.z * mat->_34) + (1.0 * mat->_44);
src++; src++;
dst++; dst++;
} }
@ -580,7 +580,7 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
dump_mat(mat); dump_mat(mat);
ilpBuff->vertex_type = D3DVT_LVERTEX; ilpBuff->vertex_type = D3DVT_LVERTEX;
for (nb = 0; nb < ci->dwCount; nb++) { for (nb = 0; nb < ci->dwCount; nb++) {
dst->c = src->u4.color; dst->c = src->u4.color;
dst->sc = src->u5.specular; dst->sc = src->u5.specular;
@ -592,7 +592,7 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
dst->y = (src->u1.x * mat->_12) + (src->u2.y * mat->_22) + (src->u3.z * mat->_32) + (1.0 * mat->_42); dst->y = (src->u1.x * mat->_12) + (src->u2.y * mat->_22) + (src->u3.z * mat->_32) + (1.0 * mat->_42);
dst->z = (src->u1.x * mat->_13) + (src->u2.y * mat->_23) + (src->u3.z * mat->_33) + (1.0 * mat->_43); dst->z = (src->u1.x * mat->_13) + (src->u2.y * mat->_23) + (src->u3.z * mat->_33) + (1.0 * mat->_43);
dst->w = (src->u1.x * mat->_14) + (src->u2.y * mat->_24) + (src->u3.z * mat->_34) + (1.0 * mat->_44); dst->w = (src->u1.x * mat->_14) + (src->u2.y * mat->_24) + (src->u3.z * mat->_34) + (1.0 * mat->_44);
src++; src++;
dst++; dst++;
} }
@ -601,22 +601,22 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (ilpBuff->vertex_data)) + ci->wDest; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (ilpBuff->vertex_data)) + ci->wDest;
ilpBuff->vertex_type = D3DVT_TLVERTEX; ilpBuff->vertex_type = D3DVT_TLVERTEX;
memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX)); memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX));
} else { } else {
ERR("Unhandled vertex processing !\n"); ERR("Unhandled vertex processing !\n");
} }
instr += size; instr += size;
} }
} break; } break;
case D3DOP_TEXTURELOAD: { case D3DOP_TEXTURELOAD: {
TRACE("TEXTURELOAD-s (%d)\n", count); TRACE("TEXTURELOAD-s (%d)\n", count);
instr += count * size; instr += count * size;
} break; } break;
case D3DOP_EXIT: { case D3DOP_EXIT: {
TRACE("EXIT (%d)\n", count); TRACE("EXIT (%d)\n", count);
/* We did this instruction */ /* We did this instruction */
@ -624,14 +624,14 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
/* Exit this loop */ /* Exit this loop */
goto end_of_buffer; goto end_of_buffer;
} break; } break;
case D3DOP_BRANCHFORWARD: { case D3DOP_BRANCHFORWARD: {
int i; int i;
TRACE("BRANCHFORWARD (%d)\n", count); TRACE("BRANCHFORWARD (%d)\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DBRANCH ci = (LPD3DBRANCH) instr; LPD3DBRANCH ci = (LPD3DBRANCH) instr;
if ((ilpBuff->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) { if ((ilpBuff->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) {
if (!ci->bNegate) { if (!ci->bNegate) {
TRACE(" Should branch to %ld\n", ci->dwOffset); TRACE(" Should branch to %ld\n", ci->dwOffset);
@ -645,22 +645,22 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
instr += size; instr += size;
} }
} break; } break;
case D3DOP_SPAN: { case D3DOP_SPAN: {
TRACE("SPAN-s (%d)\n", count); TRACE("SPAN-s (%d)\n", count);
instr += count * size; instr += count * size;
} break; } break;
case D3DOP_SETSTATUS: { case D3DOP_SETSTATUS: {
int i; int i;
TRACE("SETSTATUS (%d)\n", count); TRACE("SETSTATUS (%d)\n", count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
LPD3DSTATUS ci = (LPD3DSTATUS) instr; LPD3DSTATUS ci = (LPD3DSTATUS) instr;
ilpBuff->data.dsStatus = *ci; ilpBuff->data.dsStatus = *ci;
instr += size; instr += size;
} }
} break; } break;
@ -683,7 +683,7 @@ static void execute(LPDIRECT3DEXECUTEBUFFER lpBuff,
LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc) LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc)
{ {
IDirect3DExecuteBufferImpl* eb; IDirect3DExecuteBufferImpl* eb;
eb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DExecuteBufferImpl)); eb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DExecuteBufferImpl));
eb->ref = 1; eb->ref = 1;
ICOM_VTBL(eb) = &executebuffer_vtable; ICOM_VTBL(eb) = &executebuffer_vtable;
@ -707,14 +707,14 @@ LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD
} else { } else {
eb->need_free = FALSE; eb->need_free = FALSE;
} }
/* No vertices for the moment */ /* No vertices for the moment */
eb->vertex_data = NULL; eb->vertex_data = NULL;
eb->desc.dwFlags |= D3DDEB_LPDATA; eb->desc.dwFlags |= D3DDEB_LPDATA;
eb->execute = execute; eb->execute = execute;
return (LPDIRECT3DEXECUTEBUFFER)eb; return (LPDIRECT3DEXECUTEBUFFER)eb;
} }
@ -727,9 +727,9 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_QueryInterface(LPDIRECT3DEXECUT
LPVOID* ppvObj) LPVOID* ppvObj)
{ {
ICOM_THIS(IDirect3DExecuteBufferImpl,iface); ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj); FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK; return S_OK;
} }
@ -739,7 +739,7 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_AddRef(LPDIRECT3DEXECUTEBUFFER if
{ {
ICOM_THIS(IDirect3DExecuteBufferImpl,iface); ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref ); TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref); return ++(This->ref);
} }
@ -749,7 +749,7 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(LPDIRECT3DEXECUTEBUFFER i
{ {
ICOM_THIS(IDirect3DExecuteBufferImpl,iface); ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
if ((This->desc.lpData != NULL) && This->need_free) if ((This->desc.lpData != NULL) && This->need_free)
HeapFree(GetProcessHeap(),0,This->desc.lpData); HeapFree(GetProcessHeap(),0,This->desc.lpData);
@ -760,7 +760,7 @@ static ULONG WINAPI IDirect3DExecuteBufferImpl_Release(LPDIRECT3DEXECUTEBUFFER i
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return This->ref; return This->ref;
} }
@ -770,7 +770,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Initialize(LPDIRECT3DEXECUTEBUF
{ {
ICOM_THIS(IDirect3DExecuteBufferImpl,iface); ICOM_THIS(IDirect3DExecuteBufferImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpDirect3DDevice, lpDesc); FIXME("(%p)->(%p,%p): stub\n", This, lpDirect3DDevice, lpDesc);
return DD_OK; return DD_OK;
} }
@ -782,7 +782,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Lock(LPDIRECT3DEXECUTEBUFFER if
/* Copies the buffer description */ /* Copies the buffer description */
*lpDesc = This->desc; *lpDesc = This->desc;
return DD_OK; return DD_OK;
} }
@ -806,7 +806,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(LPDIRECT3DEXECUT
/* Get the number of vertices in the execute buffer */ /* Get the number of vertices in the execute buffer */
nbvert = This->data.dwVertexCount; nbvert = This->data.dwVertexCount;
/* Prepares the transformed vertex buffer */ /* Prepares the transformed vertex buffer */
if (This->vertex_data != NULL) if (This->vertex_data != NULL)
HeapFree(GetProcessHeap(), 0, This->vertex_data); HeapFree(GetProcessHeap(), 0, This->vertex_data);
@ -816,7 +816,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_SetExecuteData(LPDIRECT3DEXECUT
if (TRACE_ON(ddraw)) { if (TRACE_ON(ddraw)) {
_dump_executedata(lpData); _dump_executedata(lpData);
} }
return DD_OK; return DD_OK;
} }
@ -827,7 +827,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_GetExecuteData(LPDIRECT3DEXECUT
TRACE("(%p)->(%p): stub\n", This, lpData); TRACE("(%p)->(%p): stub\n", This, lpData);
*lpData = This->data; *lpData = This->data;
return DD_OK; return DD_OK;
} }
@ -856,7 +856,7 @@ static HRESULT WINAPI IDirect3DExecuteBufferImpl_Optimize(LPDIRECT3DEXECUTEBUFFE
/******************************************************************************* /*******************************************************************************
* IDirect3DLight VTable * IDirect3DLight VTable
*/ */
static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable = static ICOM_VTABLE(IDirect3DExecuteBuffer) executebuffer_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/

View File

@ -29,7 +29,7 @@
#include "mesa_private.h" #include "mesa_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw); WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#define D3DLPRIVATE(x) mesa_d3dl_private*dlpriv=((mesa_d3dl_private*)x->private) #define D3DLPRIVATE(x) mesa_d3dl_private*dlpriv=((mesa_d3dl_private*)x->private)
static ICOM_VTABLE(IDirect3DLight) light_vtable; static ICOM_VTABLE(IDirect3DLight) light_vtable;
@ -52,14 +52,14 @@ static void update(IDirect3DLightImpl* This) {
case D3DLIGHT_POINT: /* 1 */ case D3DLIGHT_POINT: /* 1 */
TRACE("Activating POINT\n"); TRACE("Activating POINT\n");
break; break;
case D3DLIGHT_SPOT: /* 2 */ case D3DLIGHT_SPOT: /* 2 */
TRACE("Activating SPOT\n"); TRACE("Activating SPOT\n");
break; break;
case D3DLIGHT_DIRECTIONAL: { /* 3 */ case D3DLIGHT_DIRECTIONAL: { /* 3 */
float direction[4]; float direction[4];
TRACE("Activating DIRECTIONAL\n"); TRACE("Activating DIRECTIONAL\n");
TRACE(" direction : %f %f %f\n", TRACE(" direction : %f %f %f\n",
This->light.dvDirection.u1.x, This->light.dvDirection.u1.x,
@ -77,7 +77,7 @@ static void update(IDirect3DLightImpl* This) {
glLightfv(dlpriv->light_num, GL_POSITION, (float *) direction); glLightfv(dlpriv->light_num, GL_POSITION, (float *) direction);
} break; } break;
case D3DLIGHT_PARALLELPOINT: /* 4 */ case D3DLIGHT_PARALLELPOINT: /* 4 */
TRACE("Activating PARRALLEL-POINT\n"); TRACE("Activating PARRALLEL-POINT\n");
break; break;
@ -109,7 +109,7 @@ static void activate(IDirect3DLightImpl* This) {
LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2) LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2)
{ {
IDirect3DLightImpl* light; IDirect3DLightImpl* light;
light = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DLightImpl)); light = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DLightImpl));
light->ref = 1; light->ref = 1;
ICOM_VTBL(light) = &light_vtable; ICOM_VTBL(light) = &light_vtable;
@ -120,26 +120,26 @@ LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2)
light->prev = NULL; light->prev = NULL;
light->activate = activate; light->activate = activate;
light->is_active = 0; light->is_active = 0;
return (LPDIRECT3DLIGHT)light; return (LPDIRECT3DLIGHT)light;
} }
LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1) LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1)
{ {
IDirect3DLightImpl* light; IDirect3DLightImpl* light;
light = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DLightImpl)); light = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DLightImpl));
light->ref = 1; light->ref = 1;
ICOM_VTBL(light) = &light_vtable; ICOM_VTBL(light) = &light_vtable;
light->d3d.d3d1 = d3d1; light->d3d.d3d1 = d3d1;
light->type = D3D_1; light->type = D3D_1;
light->next = NULL; light->next = NULL;
light->prev = NULL; light->prev = NULL;
light->activate = activate; light->activate = activate;
light->is_active = 0; light->is_active = 0;
return (LPDIRECT3DLIGHT)light; return (LPDIRECT3DLIGHT)light;
} }
@ -152,9 +152,9 @@ static HRESULT WINAPI IDirect3DLightImpl_QueryInterface(LPDIRECT3DLIGHT iface,
LPVOID* ppvObj) LPVOID* ppvObj)
{ {
ICOM_THIS(IDirect3DLightImpl,iface); ICOM_THIS(IDirect3DLightImpl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj); FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK; return S_OK;
} }
@ -164,7 +164,7 @@ static ULONG WINAPI IDirect3DLightImpl_AddRef(LPDIRECT3DLIGHT iface)
{ {
ICOM_THIS(IDirect3DLightImpl,iface); ICOM_THIS(IDirect3DLightImpl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref ); TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref); return ++(This->ref);
} }
@ -174,12 +174,12 @@ static ULONG WINAPI IDirect3DLightImpl_Release(LPDIRECT3DLIGHT iface)
{ {
ICOM_THIS(IDirect3DLightImpl,iface); ICOM_THIS(IDirect3DLightImpl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return This->ref; return This->ref;
} }
@ -196,7 +196,7 @@ static HRESULT WINAPI IDirect3DLightImpl_GetLight(LPDIRECT3DLIGHT iface,
TRACE("(%p)->(%p)\n", This, lpLight); TRACE("(%p)->(%p)\n", This, lpLight);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
dump_light(lpLight); dump_light(lpLight);
/* Copies the light structure */ /* Copies the light structure */
switch (This->type) { switch (This->type) {
case D3D_1: case D3D_1:
@ -206,7 +206,7 @@ static HRESULT WINAPI IDirect3DLightImpl_GetLight(LPDIRECT3DLIGHT iface,
*((LPD3DLIGHT2)lpLight) = *((LPD3DLIGHT2) &(This->light)); *((LPD3DLIGHT2)lpLight) = *((LPD3DLIGHT2) &(This->light));
break; break;
} }
return DD_OK; return DD_OK;
} }
@ -217,7 +217,7 @@ static HRESULT WINAPI IDirect3DLightImpl_SetLight(LPDIRECT3DLIGHT iface,
TRACE("(%p)->(%p)\n", This, lpLight); TRACE("(%p)->(%p)\n", This, lpLight);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
dump_light(lpLight); dump_light(lpLight);
/* Stores the light */ /* Stores the light */
switch (This->type) { switch (This->type) {
case D3D_1: case D3D_1:
@ -227,12 +227,12 @@ static HRESULT WINAPI IDirect3DLightImpl_SetLight(LPDIRECT3DLIGHT iface,
*((LPD3DLIGHT2) &(This->light)) = *((LPD3DLIGHT2)lpLight); *((LPD3DLIGHT2) &(This->light)) = *((LPD3DLIGHT2)lpLight);
break; break;
} }
ENTER_GL(); ENTER_GL();
if (This->is_active) if (This->is_active)
update(This); update(This);
LEAVE_GL(); LEAVE_GL();
return DD_OK; return DD_OK;
} }
@ -250,7 +250,7 @@ static HRESULT WINAPI IDirect3DLightImpl_Initialize(LPDIRECT3DLIGHT iface,
/******************************************************************************* /*******************************************************************************
* IDirect3DLight VTable * IDirect3DLight VTable
*/ */
static ICOM_VTABLE(IDirect3DLight) light_vtable = static ICOM_VTABLE(IDirect3DLight) light_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/

View File

@ -38,7 +38,7 @@ static ICOM_VTABLE(IDirect3DMaterial) material_vtable;
*/ */
static void activate(IDirect3DMaterial2Impl* This) { static void activate(IDirect3DMaterial2Impl* This) {
TRACE("Activating material %p\n", This); TRACE("Activating material %p\n", This);
ENTER_GL(); ENTER_GL();
/* First, set the rendering context */ /* First, set the rendering context */
if (This->use_d3d2) if (This->use_d3d2)
@ -63,13 +63,13 @@ static void activate(IDirect3DMaterial2Impl* This) {
glMaterialfv(GL_FRONT, glMaterialfv(GL_FRONT,
GL_EMISSION, GL_EMISSION,
(float *) &(This->mat.u3.emissive)); (float *) &(This->mat.u3.emissive));
TRACE("Size : %ld\n", This->mat.dwSize); TRACE("Size : %ld\n", This->mat.dwSize);
TRACE("Power : %f\n", This->mat.u4.power); TRACE("Power : %f\n", This->mat.u4.power);
TRACE("Texture handle : %08lx\n", (DWORD)This->mat.hTexture); TRACE("Texture handle : %08lx\n", (DWORD)This->mat.hTexture);
LEAVE_GL(); LEAVE_GL();
return ; return ;
} }
@ -79,7 +79,7 @@ static void activate(IDirect3DMaterial2Impl* This) {
LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2) LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2)
{ {
IDirect3DMaterial2Impl* mat; IDirect3DMaterial2Impl* mat;
mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DMaterial2Impl)); mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DMaterial2Impl));
mat->ref = 1; mat->ref = 1;
ICOM_VTBL(mat) = &material2_vtable; ICOM_VTBL(mat) = &material2_vtable;
@ -88,14 +88,14 @@ LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2)
mat->d3d.d3d2 = d3d2; mat->d3d.d3d2 = d3d2;
mat->activate = activate; mat->activate = activate;
return (LPDIRECT3DMATERIAL2)mat; return (LPDIRECT3DMATERIAL2)mat;
} }
LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1) LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1)
{ {
IDirect3DMaterial2Impl* mat; IDirect3DMaterial2Impl* mat;
mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DMaterial2Impl)); mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DMaterial2Impl));
mat->ref = 1; mat->ref = 1;
ICOM_VTBL(mat) = (ICOM_VTABLE(IDirect3DMaterial2)*)&material_vtable; ICOM_VTBL(mat) = (ICOM_VTABLE(IDirect3DMaterial2)*)&material_vtable;
@ -104,7 +104,7 @@ LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1)
mat->d3d.d3d1 = d3d1; mat->d3d.d3d1 = d3d1;
mat->activate = activate; mat->activate = activate;
return (LPDIRECT3DMATERIAL) mat; return (LPDIRECT3DMATERIAL) mat;
} }
@ -117,9 +117,9 @@ static HRESULT WINAPI IDirect3DMaterial2Impl_QueryInterface(LPDIRECT3DMATERIAL2
LPVOID* ppvObj) LPVOID* ppvObj)
{ {
ICOM_THIS(IDirect3DMaterial2Impl,iface); ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj); FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK; return S_OK;
} }
@ -129,7 +129,7 @@ static ULONG WINAPI IDirect3DMaterial2Impl_AddRef(LPDIRECT3DMATERIAL2 iface)
{ {
ICOM_THIS(IDirect3DMaterial2Impl,iface); ICOM_THIS(IDirect3DMaterial2Impl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref ); TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref); return ++(This->ref);
} }
@ -139,12 +139,12 @@ static ULONG WINAPI IDirect3DMaterial2Impl_Release(LPDIRECT3DMATERIAL2 iface)
{ {
ICOM_THIS(IDirect3DMaterial2Impl,iface); ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return This->ref; return This->ref;
} }
@ -161,10 +161,10 @@ static HRESULT WINAPI IDirect3DMaterial2Impl_GetMaterial(LPDIRECT3DMATERIAL2 ifa
TRACE("(%p)->(%p)\n", This, lpMat); TRACE("(%p)->(%p)\n", This, lpMat);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
dump_material(lpMat); dump_material(lpMat);
/* Copies the material structure */ /* Copies the material structure */
*lpMat = This->mat; *lpMat = This->mat;
return DD_OK; return DD_OK;
} }
@ -175,10 +175,10 @@ static HRESULT WINAPI IDirect3DMaterial2Impl_SetMaterial(LPDIRECT3DMATERIAL2 ifa
TRACE("(%p)->(%p)\n", This, lpMat); TRACE("(%p)->(%p)\n", This, lpMat);
if (TRACE_ON(ddraw)) if (TRACE_ON(ddraw))
dump_material(lpMat); dump_material(lpMat);
/* Stores the material */ /* Stores the material */
This->mat = *lpMat; This->mat = *lpMat;
return DD_OK; return DD_OK;
} }
@ -194,9 +194,9 @@ static HRESULT WINAPI IDirect3DMaterial2Impl_GetHandle(LPDIRECT3DMATERIAL2 iface
This->device.active_device2 = (IDirect3DDevice2Impl*)lpD3DDevice2; This->device.active_device2 = (IDirect3DDevice2Impl*)lpD3DDevice2;
else else
This->device.active_device1 = (IDirect3DDeviceImpl*)lpD3DDevice2; This->device.active_device1 = (IDirect3DDeviceImpl*)lpD3DDevice2;
*lpMatHandle = (DWORD) This; /* lpD3DDevice2->store_material(This); */ *lpMatHandle = (DWORD) This; /* lpD3DDevice2->store_material(This); */
return DD_OK; return DD_OK;
} }
@ -207,7 +207,7 @@ static HRESULT WINAPI IDirect3DMaterialImpl_Reserve(LPDIRECT3DMATERIAL iface)
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
static HRESULT WINAPI IDirect3DMaterialImpl_Unreserve(LPDIRECT3DMATERIAL iface) static HRESULT WINAPI IDirect3DMaterialImpl_Unreserve(LPDIRECT3DMATERIAL iface)
{ {
ICOM_THIS(IDirect3DMaterial2Impl,iface); ICOM_THIS(IDirect3DMaterial2Impl,iface);
@ -222,7 +222,7 @@ static HRESULT WINAPI IDirect3DMaterialImpl_Initialize(LPDIRECT3DMATERIAL iface,
{ {
ICOM_THIS(IDirect3DMaterial2Impl,iface); ICOM_THIS(IDirect3DMaterial2Impl,iface);
TRACE("(%p)->(%p)\n", This, lpDirect3D); TRACE("(%p)->(%p)\n", This, lpDirect3D);
return DDERR_ALREADYINITIALIZED; return DDERR_ALREADYINITIALIZED;
} }
@ -236,7 +236,7 @@ static HRESULT WINAPI IDirect3DMaterialImpl_Initialize(LPDIRECT3DMATERIAL iface,
# define XCAST(fun) (void*) # define XCAST(fun) (void*)
#endif #endif
static ICOM_VTABLE(IDirect3DMaterial) material_vtable = static ICOM_VTABLE(IDirect3DMaterial) material_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/
@ -259,7 +259,7 @@ static ICOM_VTABLE(IDirect3DMaterial) material_vtable =
/******************************************************************************* /*******************************************************************************
* IDirect3DMaterial2 VTable * IDirect3DMaterial2 VTable
*/ */
static ICOM_VTABLE(IDirect3DMaterial2) material2_vtable = static ICOM_VTABLE(IDirect3DMaterial2) material2_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/

View File

@ -43,7 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#ifdef TEXTURE_SNOOP #ifdef TEXTURE_SNOOP
#include <stdio.h> #include <stdio.h>
#define SNOOP_PALETTED() \ #define SNOOP_PALETTED() \
{ \ { \
FILE *f; \ FILE *f; \
@ -118,14 +118,14 @@ extern ICOM_VTABLE(IDirect3DTexture) mesa_texture_vtable;
LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf) LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf)
{ {
IDirect3DTexture2Impl* tex; IDirect3DTexture2Impl* tex;
tex = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2Impl)); tex = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2Impl));
tex->ref = 1; tex->ref = 1;
ICOM_VTBL(tex) = &mesa_texture2_vtable; ICOM_VTBL(tex) = &mesa_texture2_vtable;
tex->surface = surf; tex->surface = surf;
tex->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dt_private)); tex->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dt_private));
return (LPDIRECT3DTEXTURE2)tex; return (LPDIRECT3DTEXTURE2)tex;
} }
@ -135,14 +135,14 @@ LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf)
LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurfaceImpl* surf) LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurfaceImpl* surf)
{ {
IDirect3DTexture2Impl* tex; IDirect3DTexture2Impl* tex;
tex = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2Impl)); tex = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2Impl));
tex->ref = 1; tex->ref = 1;
ICOM_VTBL(tex) = (ICOM_VTABLE(IDirect3DTexture2)*)&mesa_texture_vtable; ICOM_VTBL(tex) = (ICOM_VTABLE(IDirect3DTexture2)*)&mesa_texture_vtable;
tex->surface = surf; tex->surface = surf;
tex->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dt_private)); tex->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dt_private));
return (LPDIRECT3DTEXTURE)tex; return (LPDIRECT3DTEXTURE)tex;
} }
@ -155,7 +155,7 @@ HRESULT WINAPI SetColorKey_cb(IDirect3DTexture2Impl *texture, DWORD dwFlags, LP
D3DTPRIVATE(texture); D3DTPRIVATE(texture);
int bpp; int bpp;
GLuint current_texture; GLuint current_texture;
TRACE("(%p) : colorkey callback\n", texture); TRACE("(%p) : colorkey callback\n", texture);
/* Get the texture description */ /* Get the texture description */
@ -163,7 +163,7 @@ HRESULT WINAPI SetColorKey_cb(IDirect3DTexture2Impl *texture, DWORD dwFlags, LP
bpp = (tex_d->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8 ? bpp = (tex_d->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8 ?
1 /* 8 bit of palette index */: 1 /* 8 bit of palette index */:
tex_d->ddpfPixelFormat.u1.dwRGBBitCount / 8 /* RGB bits for each colors */ ); tex_d->ddpfPixelFormat.u1.dwRGBBitCount / 8 /* RGB bits for each colors */ );
/* Now, save the current texture */ /* Now, save the current texture */
ENTER_GL(); ENTER_GL();
glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture); glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
@ -193,13 +193,13 @@ HRESULT WINAPI SetColorKey_cb(IDirect3DTexture2Impl *texture, DWORD dwFlags, LP
for (y = 0; y < tex_d->dwHeight; y++) { for (y = 0; y < tex_d->dwHeight; y++) {
for (x = 0; x < tex_d->dwWidth; x++) { for (x = 0; x < tex_d->dwWidth; x++) {
unsigned short cpixel = src[x + y * tex_d->dwWidth]; unsigned short cpixel = src[x + y * tex_d->dwWidth];
if ((dwFlags & DDCKEY_SRCBLT) && if ((dwFlags & DDCKEY_SRCBLT) &&
(cpixel >= ckey->dwColorSpaceLowValue) && (cpixel >= ckey->dwColorSpaceLowValue) &&
(cpixel <= ckey->dwColorSpaceHighValue)) /* No alpha bit => this pixel is transparent */ (cpixel <= ckey->dwColorSpaceHighValue)) /* No alpha bit => this pixel is transparent */
dest[x + y * tex_d->dwWidth] = (cpixel & ~0x003F) | ((cpixel & 0x001F) << 1) | 0x0000; dest[x + y * tex_d->dwWidth] = (cpixel & ~0x003F) | ((cpixel & 0x001F) << 1) | 0x0000;
else /* Alpha bit is set => this pixel will be seen */ else /* Alpha bit is set => this pixel will be seen */
dest[x + y * tex_d->dwWidth] = (cpixel & ~0x003F) | ((cpixel & 0x001F) << 1) | 0x0001; dest[x + y * tex_d->dwWidth] = (cpixel & ~0x003F) | ((cpixel & 0x001F) << 1) | 0x0001;
} }
} }
@ -245,9 +245,9 @@ HRESULT WINAPI IDirect3DTexture2Impl_QueryInterface(LPDIRECT3DTEXTURE2 iface,
LPVOID* ppvObj) LPVOID* ppvObj)
{ {
ICOM_THIS(IDirect3DTexture2Impl,iface); ICOM_THIS(IDirect3DTexture2Impl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj); FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK; return S_OK;
} }
@ -257,7 +257,7 @@ ULONG WINAPI IDirect3DTexture2Impl_AddRef(LPDIRECT3DTEXTURE2 iface)
{ {
ICOM_THIS(IDirect3DTexture2Impl,iface); ICOM_THIS(IDirect3DTexture2Impl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref ); TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref); return ++(This->ref);
} }
@ -268,20 +268,20 @@ ULONG WINAPI IDirect3DTexture2Impl_Release(LPDIRECT3DTEXTURE2 iface)
ICOM_THIS(IDirect3DTexture2Impl,iface); ICOM_THIS(IDirect3DTexture2Impl,iface);
D3DTPRIVATE(This); D3DTPRIVATE(This);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
/* Delete texture from OpenGL */ /* Delete texture from OpenGL */
ENTER_GL(); ENTER_GL();
glDeleteTextures(1, &(dtpriv->tex_name)); glDeleteTextures(1, &(dtpriv->tex_name));
LEAVE_GL(); LEAVE_GL();
/* Release surface */ /* Release surface */
IDirectDrawSurface4_Release((IDirectDrawSurface4*)This->surface); IDirectDrawSurface4_Release((IDirectDrawSurface4*)This->surface);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return This->ref; return This->ref;
} }
@ -392,7 +392,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
/* Install the callbacks to the destination surface */ /* Install the callbacks to the destination surface */
This->surface->texture = This; This->surface->texture = This;
This->surface->SetColorKey_cb = SetColorKey_cb; This->surface->SetColorKey_cb = SetColorKey_cb;
if ((src_d->dwWidth != dst_d->dwWidth) || (src_d->dwHeight != dst_d->dwHeight)) { if ((src_d->dwWidth != dst_d->dwWidth) || (src_d->dwHeight != dst_d->dwHeight)) {
/* Should also check for same pixel format, lPitch, ... */ /* Should also check for same pixel format, lPitch, ... */
ERR("Error in surface sizes\n"); ERR("Error in surface sizes\n");
@ -410,7 +410,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
memcpy(dst_d->lpSurface, src_d->lpSurface, src_d->dwWidth * src_d->dwHeight * bpp); memcpy(dst_d->lpSurface, src_d->lpSurface, src_d->dwWidth * src_d->dwHeight * bpp);
ENTER_GL(); ENTER_GL();
/* Now, load the texture */ /* Now, load the texture */
/* d3dd->set_context(d3dd); We need to set the context somehow.... */ /* d3dd->set_context(d3dd); We need to set the context somehow.... */
glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture); glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
@ -434,7 +434,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
((Mesa_DeviceCapabilities *) ((x11_dd_private *) This->surface->s.ddraw->d->private)->device_capabilities)->ptr_ColorTableEXT; ((Mesa_DeviceCapabilities *) ((x11_dd_private *) This->surface->s.ddraw->d->private)->device_capabilities)->ptr_ColorTableEXT;
} }
#endif #endif
if (pal == NULL) { if (pal == NULL) {
ERR("Palettized texture Loading with a NULL palette !\n"); ERR("Palettized texture Loading with a NULL palette !\n");
LEAVE_GL(); LEAVE_GL();
@ -453,7 +453,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
else else
table[i][3] = 0xFF; table[i][3] = 0xFF;
} }
/* Texture snooping */ /* Texture snooping */
SNOOP_PALETTED(); SNOOP_PALETTED();
@ -465,7 +465,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
GL_RGBA, /* table format */ GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */ GL_UNSIGNED_BYTE, /* table type */
table); /* the color table */ table); /* the color table */
glTexImage2D(GL_TEXTURE_2D, /* target */ glTexImage2D(GL_TEXTURE_2D, /* target */
0, /* level */ 0, /* level */
GL_COLOR_INDEX8_EXT, /* internal format */ GL_COLOR_INDEX8_EXT, /* internal format */
@ -478,7 +478,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
DWORD *surface = (DWORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(DWORD)); DWORD *surface = (DWORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(DWORD));
DWORD i; DWORD i;
BYTE *src = (BYTE *) src_d->lpSurface, *dst = (BYTE *) surface; BYTE *src = (BYTE *) src_d->lpSurface, *dst = (BYTE *) surface;
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) { for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
BYTE color = *src++; BYTE color = *src++;
*dst++ = table[color][0]; *dst++ = table[color][0];
@ -486,7 +486,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
*dst++ = table[color][2]; *dst++ = table[color][2];
*dst++ = table[color][3]; *dst++ = table[color][3];
} }
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
GL_RGBA, GL_RGBA,
@ -495,7 +495,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
surface); surface);
HeapFree(GetProcessHeap(), 0, surface); HeapFree(GetProcessHeap(), 0, surface);
} }
} else if (src_d->ddpfPixelFormat.dwFlags & DDPF_RGB) { } else if (src_d->ddpfPixelFormat.dwFlags & DDPF_RGB) {
@ -504,7 +504,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
************ */ ************ */
if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 8) { if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 8) {
/* ********************** /* **********************
GL_UNSIGNED_BYTE_3_3_2 GL_UNSIGNED_BYTE_3_3_2
********************** */ ********************** */
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
@ -516,10 +516,10 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
src_d->lpSurface); src_d->lpSurface);
} else if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 16) { } else if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 16) {
if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000000) { if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000000) {
/* Texture snooping */ /* Texture snooping */
SNOOP_5650(); SNOOP_5650();
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
GL_RGB, GL_RGB,
@ -531,7 +531,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
} else if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000001) { } else if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000001) {
/* Texture snooping */ /* Texture snooping */
SNOOP_5551(); SNOOP_5551();
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
GL_RGBA, GL_RGBA,
@ -560,7 +560,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
((*src & 0x7FFF) << 1)); ((*src & 0x7FFF) << 1));
src++; src++;
} }
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
GL_RGBA, GL_RGBA,
@ -569,8 +569,8 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
GL_RGBA, GL_RGBA,
GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_5_5_5_1,
surface); surface);
HeapFree(GetProcessHeap(), 0, surface); HeapFree(GetProcessHeap(), 0, surface);
} else { } else {
ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n"); ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n");
} }
@ -603,7 +603,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
LEAVE_GL(); LEAVE_GL();
} }
return D3D_OK; return D3D_OK;
} }
@ -611,7 +611,7 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
/******************************************************************************* /*******************************************************************************
* IDirect3DTexture2 VTable * IDirect3DTexture2 VTable
*/ */
ICOM_VTABLE(IDirect3DTexture2) mesa_texture2_vtable = ICOM_VTABLE(IDirect3DTexture2) mesa_texture2_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/
@ -633,7 +633,7 @@ ICOM_VTABLE(IDirect3DTexture2) mesa_texture2_vtable =
# define XCAST(fun) (void*) # define XCAST(fun) (void*)
#endif #endif
ICOM_VTABLE(IDirect3DTexture) mesa_texture_vtable = ICOM_VTABLE(IDirect3DTexture) mesa_texture_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/

View File

@ -43,7 +43,7 @@ static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable;
*/ */
static void activate(IDirect3DViewport2Impl* This) { static void activate(IDirect3DViewport2Impl* This) {
IDirect3DLightImpl* l; IDirect3DLightImpl* l;
/* Activate all the lights associated with this context */ /* Activate all the lights associated with this context */
l = This->lights; l = This->lights;
@ -59,7 +59,7 @@ static void activate(IDirect3DViewport2Impl* This) {
LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2) LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2)
{ {
IDirect3DViewport2Impl* vp; IDirect3DViewport2Impl* vp;
vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl)); vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl));
vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private)); vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private));
vp->ref = 1; vp->ref = 1;
@ -73,14 +73,14 @@ LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2)
vp->lights = NULL; vp->lights = NULL;
((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0; ((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0;
return (LPDIRECT3DVIEWPORT2)vp; return (LPDIRECT3DVIEWPORT2)vp;
} }
LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1) LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1)
{ {
IDirect3DViewport2Impl* vp; IDirect3DViewport2Impl* vp;
vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl)); vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl));
vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private)); vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private));
vp->ref = 1; vp->ref = 1;
@ -94,7 +94,7 @@ LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1)
vp->lights = NULL; vp->lights = NULL;
((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0; ((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0;
return (LPDIRECT3DVIEWPORT) vp; return (LPDIRECT3DVIEWPORT) vp;
} }
@ -107,9 +107,9 @@ HRESULT WINAPI IDirect3DViewport2Impl_QueryInterface(LPDIRECT3DVIEWPORT2 iface,
LPVOID* ppvObj) LPVOID* ppvObj)
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj); FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK; return S_OK;
} }
@ -119,7 +119,7 @@ ULONG WINAPI IDirect3DViewport2Impl_AddRef(LPDIRECT3DVIEWPORT2 iface)
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref ); TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref); return ++(This->ref);
} }
@ -129,12 +129,12 @@ ULONG WINAPI IDirect3DViewport2Impl_Release(LPDIRECT3DVIEWPORT2 iface)
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref ); FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) { if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return This->ref; return This->ref;
} }
@ -144,7 +144,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_Initialize(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, d3d); FIXME("(%p)->(%p): stub\n", This, d3d);
return DD_OK; return DD_OK;
} }
@ -153,12 +153,12 @@ HRESULT WINAPI IDirect3DViewport2Impl_GetViewport(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, lpvp); FIXME("(%p)->(%p): stub\n", This, lpvp);
if (This->use_vp2 != 0) if (This->use_vp2 != 0)
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
*lpvp = This->viewport.vp1; *lpvp = This->viewport.vp1;
return DD_OK; return DD_OK;
} }
@ -170,7 +170,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(LPDIRECT3DVIEWPORT2 iface,
This->use_vp2 = 0; This->use_vp2 = 0;
This->viewport.vp1 = *lpvp; This->viewport.vp1 = *lpvp;
TRACE("dwSize = %ld dwX = %ld dwY = %ld\n", TRACE("dwSize = %ld dwX = %ld dwY = %ld\n",
lpvp->dwSize, lpvp->dwX, lpvp->dwY); lpvp->dwSize, lpvp->dwX, lpvp->dwY);
TRACE("dwWidth = %ld dwHeight = %ld\n", TRACE("dwWidth = %ld dwHeight = %ld\n",
@ -182,7 +182,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(LPDIRECT3DVIEWPORT2 iface,
TRACE("dvMinZ = %f dvMaxZ = %f\n", TRACE("dvMinZ = %f dvMaxZ = %f\n",
lpvp->dvMinZ, lpvp->dvMaxZ); lpvp->dvMinZ, lpvp->dvMaxZ);
return DD_OK; return DD_OK;
} }
@ -195,7 +195,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_TransformVertices(LPDIRECT3DVIEWPORT2 ifac
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%8ld,%p,%08lx,%p): stub\n", FIXME("(%p)->(%8ld,%p,%08lx,%p): stub\n",
This, dwVertexCount, lpData, dwFlags, lpOffScreen); This, dwVertexCount, lpData, dwFlags, lpOffScreen);
return DD_OK; return DD_OK;
} }
@ -205,7 +205,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_LightElements(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%8ld,%p): stub\n", This, dwElementCount, lpData); FIXME("(%p)->(%8ld,%p): stub\n", This, dwElementCount, lpData);
return DD_OK; return DD_OK;
} }
@ -214,7 +214,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_SetBackground(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%08lx): stub\n", This, (DWORD) hMat); FIXME("(%p)->(%08lx): stub\n", This, (DWORD) hMat);
return DD_OK; return DD_OK;
} }
@ -224,7 +224,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_GetBackground(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lphMat, lpValid); FIXME("(%p)->(%p,%p): stub\n", This, lphMat, lpValid);
return DD_OK; return DD_OK;
} }
@ -233,7 +233,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_SetBackgroundDepth(LPDIRECT3DVIEWPORT2 ifa
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, lpDDSurface); FIXME("(%p)->(%p): stub\n", This, lpDDSurface);
return DD_OK; return DD_OK;
} }
@ -243,7 +243,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_GetBackgroundDepth(LPDIRECT3DVIEWPORT2 ifa
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lplpDDSurface, lpValid); FIXME("(%p)->(%p,%p): stub\n", This, lplpDDSurface, lpValid);
return DD_OK; return DD_OK;
} }
@ -272,7 +272,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_Clear(LPDIRECT3DVIEWPORT2 iface,
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthMask(ztest); glDepthMask(ztest);
LEAVE_GL(); LEAVE_GL();
return DD_OK; return DD_OK;
} }
@ -291,18 +291,18 @@ HRESULT WINAPI IDirect3DViewport2Impl_AddLight(LPDIRECT3DVIEWPORT2 iface,
if (This->device.active_device1 != NULL) { if (This->device.active_device1 != NULL) {
D3DVPRIVATE(This); D3DVPRIVATE(This);
D3DLPRIVATE(ilpLight); D3DLPRIVATE(ilpLight);
/* Get the rendering context */ /* Get the rendering context */
if (This->use_d3d2) if (This->use_d3d2)
This->device.active_device2->set_context(This->device.active_device2); This->device.active_device2->set_context(This->device.active_device2);
else else
This->device.active_device1->set_context(This->device.active_device1); This->device.active_device1->set_context(This->device.active_device1);
/* Activate the light */ /* Activate the light */
dlpriv->light_num = dvpriv->nextlight++; dlpriv->light_num = dvpriv->nextlight++;
ilpLight->activate(ilpLight); ilpLight->activate(ilpLight);
} }
return DD_OK; return DD_OK;
} }
@ -311,7 +311,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_DeleteLight(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, lpLight); FIXME("(%p)->(%p): stub\n", This, lpLight);
return DD_OK; return DD_OK;
} }
@ -322,7 +322,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_NextLight(LPDIRECT3DVIEWPORT2 iface,
{ {
ICOM_THIS(IDirect3DViewport2Impl,iface); ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p,%p,%08lx): stub\n", This, lpLight, lplpLight, dwFlags); FIXME("(%p)->(%p,%p,%08lx): stub\n", This, lpLight, lplpLight, dwFlags);
return DD_OK; return DD_OK;
} }
@ -337,7 +337,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_GetViewport2(LPDIRECT3DVIEWPORT2 iface,
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
*lpViewport2 = This->viewport.vp2; *lpViewport2 = This->viewport.vp2;
return DD_OK; return DD_OK;
} }
@ -360,7 +360,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_SetViewport2(LPDIRECT3DVIEWPORT2 iface,
This->viewport.vp2 = *lpViewport2; This->viewport.vp2 = *lpViewport2;
This->use_vp2 = 1; This->use_vp2 = 1;
return DD_OK; return DD_OK;
} }
@ -368,7 +368,7 @@ HRESULT WINAPI IDirect3DViewport2Impl_SetViewport2(LPDIRECT3DVIEWPORT2 iface,
/******************************************************************************* /*******************************************************************************
* IDirect3DViewport1/2 VTable * IDirect3DViewport1/2 VTable
*/ */
static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable = static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/ /*** IUnknown methods ***/

View File

@ -54,7 +54,7 @@ HRESULT WINAPI DirectDrawCreateClipper(
ICOM_INIT_INTERFACE(This, IDirectDrawClipper, DDRAW_Clipper_VTable); ICOM_INIT_INTERFACE(This, IDirectDrawClipper, DDRAW_Clipper_VTable);
This->ref = 1; This->ref = 1;
This->hWnd = 0; This->hWnd = 0;
This->ddraw_owner = NULL; This->ddraw_owner = NULL;
*lplpDDClipper = ICOM_INTERFACE(This, IDirectDrawClipper); *lplpDDClipper = ICOM_INTERFACE(This, IDirectDrawClipper);
@ -87,7 +87,7 @@ HRESULT WINAPI Main_DirectDrawClipper_SetHwnd(
TRACE("(%p)->SetHwnd(0x%08lx,0x%08lx)\n",This,dwFlags,(DWORD)hWnd); TRACE("(%p)->SetHwnd(0x%08lx,0x%08lx)\n",This,dwFlags,(DWORD)hWnd);
if( dwFlags ) { if( dwFlags ) {
FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags); FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags);
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
This->hWnd = hWnd; This->hWnd = hWnd;
@ -170,7 +170,7 @@ HRESULT WINAPI Main_DirectDrawClipper_GetHWnd(
ICOM_THIS(IDirectDrawClipperImpl,iface); ICOM_THIS(IDirectDrawClipperImpl,iface);
FIXME("(%p)->(%p),stub!\n",This,hWndPtr); FIXME("(%p)->(%p),stub!\n",This,hWndPtr);
*hWndPtr = This->hWnd; *hWndPtr = This->hWnd;
return DD_OK; return DD_OK;
} }

View File

@ -47,7 +47,7 @@ static DDVERSIONDATA hal_version;
static DD32BITDRIVERDATA hal_driverdata; static DD32BITDRIVERDATA hal_driverdata;
static HINSTANCE hal_instance; static HINSTANCE hal_instance;
static const DDDEVICEIDENTIFIER2 hal_device = static const DDDEVICEIDENTIFIER2 hal_device =
{ {
"display", "display",
"DirectDraw HAL", "DirectDraw HAL",
@ -501,7 +501,7 @@ HAL_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
TRACE("(%p)->(%ldx%ldx%ld,%ld Hz,%08lx)\n",This,dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags); TRACE("(%p)->(%ldx%ldx%ld,%ld Hz,%08lx)\n",This,dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
hr = User_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, hr = User_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP,
dwRefreshRate, dwFlags); dwRefreshRate, dwFlags);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
if (!(dd_gbl.dwFlags & DDRAWI_MODECHANGED)) dd_gbl.dwModeIndexOrig = dd_gbl.dwModeIndex; if (!(dd_gbl.dwFlags & DDRAWI_MODECHANGED)) dd_gbl.dwModeIndexOrig = dd_gbl.dwModeIndex;

View File

@ -50,11 +50,11 @@ HRESULT HAL_DirectDraw_create_texture(IDirectDrawImpl* This,
LPDIRECTDRAWSURFACE7* ppSurf, LPDIRECTDRAWSURFACE7* ppSurf,
LPUNKNOWN pOuter, LPUNKNOWN pOuter,
DWORD dwMipMapLevel); DWORD dwMipMapLevel);
HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex); HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex);
HRESULT HAL_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface, HRESULT HAL_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex); IUnknown* pUnkOuter, BOOL ex);
HRESULT WINAPI HRESULT WINAPI
HAL_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface, HAL_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,

View File

@ -915,11 +915,11 @@ Main_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd,
return DD_OK; return DD_OK;
/* XXX "It cannot be reset while the process has surfaces or palettes /* XXX "It cannot be reset while the process has surfaces or palettes
* created." Otherwise the window can be changed??? * created." Otherwise the window can be changed???
* *
* This appears to be wrong - comment it out for now. * This appears to be wrong - comment it out for now.
if (This->window) if (This->window)
return DDERR_HWNDALREADYSET; return DDERR_HWNDALREADYSET;
*/ */
if (!(cooplevel & (DDSCL_EXCLUSIVE|DDSCL_NORMAL))) if (!(cooplevel & (DDSCL_EXCLUSIVE|DDSCL_NORMAL)))
@ -965,7 +965,7 @@ Main_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
{ {
short screenX; short screenX;
short screenY; short screenY;
ICOM_THIS(IDirectDrawImpl,iface); ICOM_THIS(IDirectDrawImpl,iface);
TRACE("(%p)->SetDisplayMode(%ld,%ld)\n",This,dwWidth,dwHeight); TRACE("(%p)->SetDisplayMode(%ld,%ld)\n",This,dwWidth,dwHeight);
@ -980,14 +980,14 @@ Main_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
screenX = GetSystemMetrics(SM_CXSCREEN); screenX = GetSystemMetrics(SM_CXSCREEN);
screenY = GetSystemMetrics(SM_CYSCREEN); screenY = GetSystemMetrics(SM_CYSCREEN);
This->width = dwWidth; This->width = dwWidth;
This->height = dwHeight; This->height = dwHeight;
This->pitch = lPitch; This->pitch = lPitch;
This->pixelformat = *pixelformat; This->pixelformat = *pixelformat;
/* Position the window in the center of the screen - don't center for now */ /* Position the window in the center of the screen - don't center for now */
/* MoveWindow(This->window, (screenX-dwWidth)/2, (screenY-dwHeight)/2, /* MoveWindow(This->window, (screenX-dwWidth)/2, (screenY-dwHeight)/2,
dwWidth, dwHeight, TRUE);*/ dwWidth, dwHeight, TRUE);*/
MoveWindow(This->window, 0, 0, dwWidth, dwHeight, TRUE); MoveWindow(This->window, 0, 0, dwWidth, dwHeight, TRUE);
@ -1208,7 +1208,7 @@ LosePrimarySurface(IDirectDrawImpl *This)
/****************************************************************************** /******************************************************************************
* Uninitialised DirectDraw functions * Uninitialised DirectDraw functions
* *
* This vtable is used when a DirectDraw object is created with * This vtable is used when a DirectDraw object is created with
* CoCreateInstance. The only usable method is Initialize. * CoCreateInstance. The only usable method is Initialize.
*/ */

View File

@ -202,7 +202,7 @@ IDirectDrawImpl_CreateSurface(LPDIRECTDRAW This, LPDDSURFACEDESC pSDesc,
LPDIRECTDRAWSURFACE7 pSurface7; LPDIRECTDRAWSURFACE7 pSurface7;
HRESULT hr; HRESULT hr;
/* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok, /* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
* since the data layout is the same */ * since the data layout is the same */
hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl, hr = IDirectDraw7_CreateSurface(COM_INTERFACE_CAST(IDirectDrawImpl,
IDirectDraw, IDirectDraw,
@ -387,7 +387,7 @@ EnumSurfacesCallbackThunk(LPDIRECTDRAWSURFACE7 pSurf, LPDDSURFACEDESC2 pDDSD,
/* This coercion is safe, since the IDirectDrawSurface3 vtable has the /* This coercion is safe, since the IDirectDrawSurface3 vtable has the
* IDirectDrawSurface vtable layout at the beginning */ * IDirectDrawSurface vtable layout at the beginning */
return cbcontext->func((LPDIRECTDRAWSURFACE) return cbcontext->func((LPDIRECTDRAWSURFACE)
COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, COM_INTERFACE_CAST(IDirectDrawSurfaceImpl,
IDirectDrawSurface7, IDirectDrawSurface7,
IDirectDrawSurface3, pSurf), IDirectDrawSurface3, pSurf),

View File

@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirectDraw7) User_DirectDraw_VTable; static ICOM_VTABLE(IDirectDraw7) User_DirectDraw_VTable;
static const DDDEVICEIDENTIFIER2 user_device = static const DDDEVICEIDENTIFIER2 user_device =
{ {
"display", "display",
"User (and GDI)", "User (and GDI)",
@ -48,7 +48,7 @@ static const DDDEVICEIDENTIFIER2 user_device =
0 0
}; };
static const DDPIXELFORMAT pixelformats[] = static const DDPIXELFORMAT pixelformats[] =
{ {
/* 8bpp paletted */ /* 8bpp paletted */
{ sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED8, 0, { 8 } }, { sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED8, 0, { 8 } },
@ -409,7 +409,7 @@ User_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
#define ROPS { 0, } #define ROPS { 0, }
#endif #endif
static const DDCAPS caps = static const DDCAPS caps =
{ sizeof(DDCAPS), { sizeof(DDCAPS),
DDCAPS_3D | DDCAPS_GDI | DDCAPS_PALETTE | BLIT_CAPS, DDCAPS_3D | DDCAPS_GDI | DDCAPS_PALETTE | BLIT_CAPS,
DDCAPS2_CANMANAGETEXTURE | DDCAPS2_CANRENDERWINDOWED | DDCAPS2_CERTIFIED DDCAPS2_CANMANAGETEXTURE | DDCAPS2_CANRENDERWINDOWED | DDCAPS2_CERTIFIED
@ -484,7 +484,7 @@ User_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
#undef ROPS #undef ROPS
ICOM_THIS(IDirectDrawImpl, iface); ICOM_THIS(IDirectDrawImpl, iface);
TRACE("(%p)->(%p,%p)\n",This,pDriverCaps,pHELCaps); TRACE("(%p)->(%p,%p)\n",This,pDriverCaps,pHELCaps);
if (pDriverCaps != NULL) if (pDriverCaps != NULL)

View File

@ -139,7 +139,7 @@ struct IDirectDrawImpl
HRESULT (*create_zbuffer)(IDirectDrawImpl* This, HRESULT (*create_zbuffer)(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD, const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter); LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter);
LPVOID private; LPVOID private;
/* Everything below here is still questionable. */ /* Everything below here is still questionable. */
@ -281,7 +281,7 @@ struct IDirectDrawSurfaceImpl
BOOL (*aux_flip)(LPVOID ctx, LPVOID data); BOOL (*aux_flip)(LPVOID ctx, LPVOID data);
void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect); void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect);
struct IDirect3DTexture2Impl* texture; struct IDirect3DTexture2Impl* texture;
HRESULT (WINAPI *SetColorKey_cb)(struct IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ; HRESULT (WINAPI *SetColorKey_cb)(struct IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
}; };
/***************************************************************************** /*****************************************************************************

View File

@ -167,7 +167,7 @@ static ICOM_VTABLE(IDirect3D) WINE_UNUSED d3dvt = {
* IDirect3D2 * IDirect3D2
*/ */
HRESULT WINAPI IDirect3D2Impl_QueryInterface( HRESULT WINAPI IDirect3D2Impl_QueryInterface(
LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) { LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IDirect3D2Impl,iface); ICOM_THIS(IDirect3D2Impl,iface);
/* FIXME: Not sure if this is correct */ /* FIXME: Not sure if this is correct */
@ -180,7 +180,7 @@ HRESULT WINAPI IDirect3D2Impl_QueryInterface(
IDirect3D2_AddRef(iface); IDirect3D2_AddRef(iface);
TRACE(" Creating IDirectDrawX interface (%p)\n", *obj); TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) || if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) ||
@ -280,7 +280,7 @@ HRESULT WINAPI IDirect3D2Impl_CreateDevice(
/* This is for checking the correctness of the prototypes/functions. /* This is for checking the correctness of the prototypes/functions.
* Do not remove. * Do not remove.
*/ */
static ICOM_VTABLE(IDirect3D2) WINE_UNUSED d3d2vt = static ICOM_VTABLE(IDirect3D2) WINE_UNUSED d3d2vt =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirect3D2Impl_QueryInterface, IDirect3D2Impl_QueryInterface,

View File

@ -148,7 +148,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice(
return D3D_OK; return D3D_OK;
} }
ICOM_VTABLE(IDirect3D) mesa_d3dvt = ICOM_VTABLE(IDirect3D) mesa_d3dvt =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
MESA_IDirect3DImpl_QueryInterface, MESA_IDirect3DImpl_QueryInterface,
@ -166,7 +166,7 @@ ICOM_VTABLE(IDirect3D) mesa_d3dvt =
* IDirect3D2 * IDirect3D2
*/ */
static HRESULT WINAPI MESA_IDirect3D2Impl_QueryInterface( static HRESULT WINAPI MESA_IDirect3D2Impl_QueryInterface(
LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) { LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IDirect3D2Impl,iface); ICOM_THIS(IDirect3D2Impl,iface);
/* FIXME: Not sure if this is correct */ /* FIXME: Not sure if this is correct */
@ -179,7 +179,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_QueryInterface(
IDirect3D2_AddRef(iface); IDirect3D2_AddRef(iface);
TRACE(" Creating IDirectDrawX interface (%p)\n", *obj); TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) || if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) ||
@ -292,7 +292,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateDevice(
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
ICOM_VTABLE(IDirect3D2) mesa_d3d2vt = ICOM_VTABLE(IDirect3D2) mesa_d3d2vt =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
MESA_IDirect3D2Impl_QueryInterface, MESA_IDirect3D2Impl_QueryInterface,
@ -405,7 +405,7 @@ HRESULT create_direct3d3(LPVOID *obj,IDirectDrawImpl* ddraw) {
*obj = (LPUNKNOWN)d3d; *obj = (LPUNKNOWN)d3d;
TRACE(" Creating IDirect3D3 interface (%p)\n", *obj); TRACE(" Creating IDirect3D3 interface (%p)\n", *obj);
return S_OK; return S_OK;
} }

View File

@ -194,7 +194,7 @@ static void Main_DirectDrawPalette_Destroy(IDirectDrawPaletteImpl* This)
if (This->private != This+1) if (This->private != This+1)
HeapFree(GetProcessHeap(), 0, This->private); HeapFree(GetProcessHeap(), 0, This->private);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
} }
@ -244,7 +244,7 @@ Main_DirectDrawPalette_GetCaps(LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps)
*lpdwCaps = This->flags; *lpdwCaps = This->flags;
return DD_OK; return DD_OK;
} }
HRESULT WINAPI HRESULT WINAPI
Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface, Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface,

View File

@ -455,7 +455,7 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
break; break;
case SRCCOPY: /* well, we do that below ? */ case SRCCOPY: /* well, we do that below ? */
break; break;
default: default:
FIXME("Unsupported raster op: %08lx Pattern: %p\n", lpbltfx->dwROP, lpbltfx->u5.lpDDSPattern); FIXME("Unsupported raster op: %08lx Pattern: %p\n", lpbltfx->dwROP, lpbltfx->u5.lpDDSPattern);
goto error; goto error;
} }
@ -623,7 +623,7 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
else else
FIXME(" srcrect: NULL\n"); FIXME(" srcrect: NULL\n");
} }
/* We need to lock the surfaces, or we won't get refreshes when done. */ /* We need to lock the surfaces, or we won't get refreshes when done. */
sdesc.dwSize = sizeof(sdesc); sdesc.dwSize = sizeof(sdesc);
IDirectDrawSurface7_Lock(src, NULL,&sdesc,DDLOCK_READONLY, 0); IDirectDrawSurface7_Lock(src, NULL,&sdesc,DDLOCK_READONLY, 0);
@ -824,7 +824,7 @@ DIB_DirectDrawSurface_Restore(LPDIRECTDRAWSURFACE7 iface)
/* SetOverlayPosition: generic */ /* SetOverlayPosition: generic */
void DIB_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This, void DIB_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal) IDirectDrawPaletteImpl* pal)
{ {
if (!pal) return; if (!pal) return;
if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)

View File

@ -36,7 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static HRESULT WINAPI static HRESULT WINAPI
DirectDrawGammaControl_QueryInterface(LPDIRECTDRAWGAMMACONTROL iface, REFIID riid, DirectDrawGammaControl_QueryInterface(LPDIRECTDRAWGAMMACONTROL iface, REFIID riid,
LPVOID *ppObj) LPVOID *ppObj)
{ {
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ppObj); TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ppObj);
return E_NOINTERFACE; return E_NOINTERFACE;
@ -47,13 +47,13 @@ DirectDrawGammaControl_AddRef(LPDIRECTDRAWGAMMACONTROL iface)
{ {
return IDirectDrawSurface7_AddRef(CONVERT(iface)); return IDirectDrawSurface7_AddRef(CONVERT(iface));
} }
static ULONG WINAPI static ULONG WINAPI
DirectDrawGammaControl_Release(LPDIRECTDRAWGAMMACONTROL iface) DirectDrawGammaControl_Release(LPDIRECTDRAWGAMMACONTROL iface)
{ {
return IDirectDrawSurface7_Release(CONVERT(iface)); return IDirectDrawSurface7_Release(CONVERT(iface));
} }
static HRESULT WINAPI static HRESULT WINAPI
DirectDrawGammaControl_GetGammaRamp(LPDIRECTDRAWGAMMACONTROL iface, DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp) DirectDrawGammaControl_GetGammaRamp(LPDIRECTDRAWGAMMACONTROL iface, DWORD dwFlags, LPDDGAMMARAMP lpGammaRamp)
{ {

View File

@ -107,7 +107,7 @@ HAL_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl* This,
/* the driver may want to dereference these pointers */ /* the driver may want to dereference these pointers */
This->local.lpSurfMore = &This->more; This->local.lpSurfMore = &This->more;
This->local.lpGbl = &This->global; This->local.lpGbl = &This->global;
This->gmore = &This->global_more; This->gmore = &This->global_more;
if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) { if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) {
@ -229,7 +229,7 @@ HRESULT HAL_DirectDrawSurface_late_allocate(IDirectDrawSurfaceImpl* This)
} }
void HAL_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This, void HAL_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal) IDirectDrawPaletteImpl* pal)
{ {
LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->more.lpDD_lcl->lpGbl; LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->more.lpDD_lcl->lpGbl;
DDHAL_SETPALETTEDATA data; DDHAL_SETPALETTEDATA data;

View File

@ -480,7 +480,7 @@ Main_DirectDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface,
/* MSDN: "The method fails if the specified [override] surface is not /* MSDN: "The method fails if the specified [override] surface is not
* a member of the flipping chain." */ * a member of the flipping chain." */
/* Verify that override is on this flip chain. We assume that /* Verify that override is on this flip chain. We assume that
* surf is the head of the flipping chain, because it's the front * surf is the head of the flipping chain, because it's the front
* buffer. */ * buffer. */
@ -575,8 +575,8 @@ Main_DirectDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
if (found != NULL) if (found != NULL)
{ {
FIXME("More than one attached surface matches requested caps. What should we do here?\n"); FIXME("More than one attached surface matches requested caps. What should we do here?\n");
/* Previous code returned 'DDERR_NOTFOUND'. That appears not /* Previous code returned 'DDERR_NOTFOUND'. That appears not
to be correct, given what 3DMark expects from MipMapped surfaces. to be correct, given what 3DMark expects from MipMapped surfaces.
We shall just continue instead. */ We shall just continue instead. */
} }
@ -846,12 +846,12 @@ Main_DirectDrawSurface_GetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
ICOM_THIS(IDirectDrawSurfaceImpl, iface); ICOM_THIS(IDirectDrawSurfaceImpl, iface);
TRACE("(%p)->(%p)\n",This,pDDSD); TRACE("(%p)->(%p)\n",This,pDDSD);
if ((pDDSD->dwSize < sizeof(DDSURFACEDESC)) || if ((pDDSD->dwSize < sizeof(DDSURFACEDESC)) ||
(pDDSD->dwSize > sizeof(DDSURFACEDESC2))) { (pDDSD->dwSize > sizeof(DDSURFACEDESC2))) {
ERR("Impossible/Strange struct size %ld.\n",pDDSD->dwSize); ERR("Impossible/Strange struct size %ld.\n",pDDSD->dwSize);
return DDERR_GENERIC; return DDERR_GENERIC;
} }
DD_STRUCT_COPY_BYSIZE(pDDSD,&This->surface_desc); DD_STRUCT_COPY_BYSIZE(pDDSD,&This->surface_desc);
return DD_OK; return DD_OK;
} }
@ -920,7 +920,7 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
} }
This->lock_update(This, prect, flags); This->lock_update(This, prect, flags);
pDDSD->lpSurface = (char *)This->surface_desc.lpSurface pDDSD->lpSurface = (char *)This->surface_desc.lpSurface
+ prect->top * This->surface_desc.u1.lPitch + prect->top * This->surface_desc.u1.lPitch
+ prect->left * GET_BPP(This->surface_desc); + prect->left * GET_BPP(This->surface_desc);

View File

@ -210,7 +210,7 @@ void User_DirectDrawSurface_unlock_update(IDirectDrawSurfaceImpl* This,
} }
void User_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This, void User_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal) IDirectDrawPaletteImpl* pal)
{ {
USER_PRIV_VAR(priv, This); USER_PRIV_VAR(priv, This);

View File

@ -153,7 +153,7 @@ void DDRAW_dump_DDBLT(DWORD flagmask)
void DDRAW_dump_DDSCAPS(const DDSCAPS2 *in) void DDRAW_dump_DDSCAPS(const DDSCAPS2 *in)
{ {
static const flag_info flags[] = static const flag_info flags[] =
{ {
FE(DDSCAPS_RESERVED1), FE(DDSCAPS_RESERVED1),
FE(DDSCAPS_ALPHA), FE(DDSCAPS_ALPHA),

View File

@ -49,7 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
typedef struct { typedef struct {
LPVOID lpCallback; LPVOID lpCallback;
LPVOID lpContext; LPVOID lpContext;
} DirectDrawEnumerateProcData; } DirectDrawEnumerateProcData;
/*********************************************************************** /***********************************************************************
@ -104,7 +104,7 @@ HRESULT WINAPI DirectDrawEnumerateExA(
*/ */
static BOOL CALLBACK DirectDrawEnumerateExProcW( static BOOL CALLBACK DirectDrawEnumerateExProcW(
GUID *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, GUID *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName,
LPVOID lpContext, HMONITOR hm) LPVOID lpContext, HMONITOR hm)
{ {
INT len; INT len;
@ -143,7 +143,7 @@ HRESULT WINAPI DirectDrawEnumerateExW(
*/ */
static BOOL CALLBACK DirectDrawEnumerateProcA( static BOOL CALLBACK DirectDrawEnumerateProcA(
GUID *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, GUID *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName,
LPVOID lpContext, HMONITOR hm) LPVOID lpContext, HMONITOR hm)
{ {
DirectDrawEnumerateProcData *pEPD = (DirectDrawEnumerateProcData*)lpContext; DirectDrawEnumerateProcData *pEPD = (DirectDrawEnumerateProcData*)lpContext;
@ -153,9 +153,9 @@ static BOOL CALLBACK DirectDrawEnumerateProcA(
} }
HRESULT WINAPI DirectDrawEnumerateA( HRESULT WINAPI DirectDrawEnumerateA(
LPDDENUMCALLBACKA lpCallback, LPVOID lpContext) LPDDENUMCALLBACKA lpCallback, LPVOID lpContext)
{ {
DirectDrawEnumerateProcData epd; DirectDrawEnumerateProcData epd;
epd.lpCallback = (LPVOID) lpCallback; epd.lpCallback = (LPVOID) lpCallback;
epd.lpContext = lpContext; epd.lpContext = lpContext;
@ -167,17 +167,17 @@ HRESULT WINAPI DirectDrawEnumerateA(
*/ */
static BOOL WINAPI DirectDrawEnumerateProcW( static BOOL WINAPI DirectDrawEnumerateProcW(
GUID *lpGUID, LPWSTR lpDriverDescription, LPWSTR lpDriverName, GUID *lpGUID, LPWSTR lpDriverDescription, LPWSTR lpDriverName,
LPVOID lpContext, HMONITOR hm) LPVOID lpContext, HMONITOR hm)
{ {
DirectDrawEnumerateProcData *pEPD = (DirectDrawEnumerateProcData*)lpContext; DirectDrawEnumerateProcData *pEPD = (DirectDrawEnumerateProcData*)lpContext;
return ((LPDDENUMCALLBACKW) pEPD->lpCallback)( return ((LPDDENUMCALLBACKW) pEPD->lpCallback)(
lpGUID, lpDriverDescription, lpDriverName, pEPD->lpContext); lpGUID, lpDriverDescription, lpDriverName, pEPD->lpContext);
} }
HRESULT WINAPI DirectDrawEnumerateW( HRESULT WINAPI DirectDrawEnumerateW(
LPDDENUMCALLBACKW lpCallback, LPVOID lpContext) LPDDENUMCALLBACKW lpCallback, LPVOID lpContext)
{ {
DirectDrawEnumerateProcData epd; DirectDrawEnumerateProcData epd;
epd.lpCallback = (LPVOID) lpCallback; epd.lpCallback = (LPVOID) lpCallback;
@ -341,7 +341,7 @@ static const struct object_creation_info object_creation[] =
{ &CLSID_DirectDrawClipper, DDRAW_CreateDirectDrawClipper } { &CLSID_DirectDrawClipper, DDRAW_CreateDirectDrawClipper }
}; };
static HRESULT WINAPI static HRESULT WINAPI
DDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) DDCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{ {
ICOM_THIS(IClassFactoryImpl,iface); ICOM_THIS(IClassFactoryImpl,iface);
@ -391,7 +391,7 @@ static HRESULT WINAPI DDCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
return S_OK; return S_OK;
} }
static ICOM_VTABLE(IClassFactory) DDCF_Vtbl = static ICOM_VTABLE(IClassFactory) DDCF_Vtbl =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
DDCF_QueryInterface, DDCF_QueryInterface,

View File

@ -29,7 +29,7 @@
#include "mesa_private.h" #include "mesa_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw); WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#define D3DTPRIVATE(x) mesa_d3dt_private *dtpriv = (mesa_d3dt_private*)(x)->private #define D3DTPRIVATE(x) mesa_d3dt_private *dtpriv = (mesa_d3dt_private*)(x)->private
void set_render_state(D3DRENDERSTATETYPE dwRenderStateType, void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
@ -40,25 +40,25 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
_dump_renderstate(dwRenderStateType, dwRenderState); _dump_renderstate(dwRenderStateType, dwRenderState);
/* First, all the stipple patterns */ /* First, all the stipple patterns */
if ((dwRenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00) && if ((dwRenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00) &&
(dwRenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31)) { (dwRenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31)) {
ERR("Unhandled dwRenderStateType stipple %d!\n",dwRenderStateType); ERR("Unhandled dwRenderStateType stipple %d!\n",dwRenderStateType);
} else { } else {
ENTER_GL(); ENTER_GL();
/* All others state variables */ /* All others state variables */
switch (dwRenderStateType) { switch (dwRenderStateType) {
case D3DRENDERSTATE_TEXTUREHANDLE: { /* 1 */ case D3DRENDERSTATE_TEXTUREHANDLE: { /* 1 */
IDirect3DTexture2Impl* tex = (IDirect3DTexture2Impl*) dwRenderState; IDirect3DTexture2Impl* tex = (IDirect3DTexture2Impl*) dwRenderState;
if (tex == NULL) { if (tex == NULL) {
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
TRACE("disabling texturing\n"); TRACE("disabling texturing\n");
} else { } else {
D3DTPRIVATE(tex); D3DTPRIVATE(tex);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
/* Default parameters */ /* Default parameters */
glBindTexture(GL_TEXTURE_2D, dtpriv->tex_name); glBindTexture(GL_TEXTURE_2D, dtpriv->tex_name);
@ -76,14 +76,14 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
else else
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
break; break;
case D3DRENDERSTATE_ZENABLE: /* 7 */ case D3DRENDERSTATE_ZENABLE: /* 7 */
if (dwRenderState) if (dwRenderState)
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
else else
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
break; break;
case D3DRENDERSTATE_FILLMODE: /* 8 */ case D3DRENDERSTATE_FILLMODE: /* 8 */
switch ((D3DFILLMODE) dwRenderState) { switch ((D3DFILLMODE) dwRenderState) {
case D3DFILL_SOLID: case D3DFILL_SOLID:
@ -108,24 +108,24 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
ERR("Unhandled shade mode !\n"); ERR("Unhandled shade mode !\n");
} }
break; break;
case D3DRENDERSTATE_ZWRITEENABLE: /* 14 */ case D3DRENDERSTATE_ZWRITEENABLE: /* 14 */
if (dwRenderState) if (dwRenderState)
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
else else
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
break; break;
case D3DRENDERSTATE_TEXTUREMAG: /* 17 */ case D3DRENDERSTATE_TEXTUREMAG: /* 17 */
switch ((D3DTEXTUREFILTER) dwRenderState) { switch ((D3DTEXTUREFILTER) dwRenderState) {
case D3DFILTER_NEAREST: case D3DFILTER_NEAREST:
rs->mag = GL_NEAREST; rs->mag = GL_NEAREST;
break; break;
case D3DFILTER_LINEAR: case D3DFILTER_LINEAR:
rs->mag = GL_LINEAR; rs->mag = GL_LINEAR;
break; break;
default: default:
ERR("Unhandled texture mag !\n"); ERR("Unhandled texture mag !\n");
} }
@ -136,16 +136,16 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
case D3DFILTER_NEAREST: case D3DFILTER_NEAREST:
rs->min = GL_NEAREST; rs->min = GL_NEAREST;
break; break;
case D3DFILTER_LINEAR: case D3DFILTER_LINEAR:
rs->mag = GL_LINEAR; rs->mag = GL_LINEAR;
break; break;
default: default:
ERR("Unhandled texture min !\n"); ERR("Unhandled texture min !\n");
} }
break; break;
case D3DRENDERSTATE_SRCBLEND: /* 19 */ case D3DRENDERSTATE_SRCBLEND: /* 19 */
switch ((D3DBLEND) dwRenderState) { switch ((D3DBLEND) dwRenderState) {
case D3DBLEND_SRCALPHA: case D3DBLEND_SRCALPHA:
@ -155,20 +155,20 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
default: default:
ERR("Unhandled blend mode !\n"); ERR("Unhandled blend mode !\n");
} }
glBlendFunc(rs->src, rs->dst); glBlendFunc(rs->src, rs->dst);
break; break;
case D3DRENDERSTATE_DESTBLEND: /* 20 */ case D3DRENDERSTATE_DESTBLEND: /* 20 */
switch ((D3DBLEND) dwRenderState) { switch ((D3DBLEND) dwRenderState) {
case D3DBLEND_INVSRCALPHA: case D3DBLEND_INVSRCALPHA:
rs->dst = GL_ONE_MINUS_SRC_ALPHA; rs->dst = GL_ONE_MINUS_SRC_ALPHA;
break; break;
default: default:
ERR("Unhandled blend mode !\n"); ERR("Unhandled blend mode !\n");
} }
glBlendFunc(rs->src, rs->dst); glBlendFunc(rs->src, rs->dst);
break; break;
@ -183,28 +183,28 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
ERR("Unhandled texture environment !\n"); ERR("Unhandled texture environment !\n");
} }
break; break;
case D3DRENDERSTATE_CULLMODE: /* 22 */ case D3DRENDERSTATE_CULLMODE: /* 22 */
switch ((D3DCULL) dwRenderState) { switch ((D3DCULL) dwRenderState) {
case D3DCULL_NONE: case D3DCULL_NONE:
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
break; break;
case D3DCULL_CW: case D3DCULL_CW:
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glFrontFace(GL_CW); glFrontFace(GL_CW);
break; break;
case D3DCULL_CCW: case D3DCULL_CCW:
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
break; break;
default: default:
ERR("Unhandled cull mode !\n"); ERR("Unhandled cull mode !\n");
} }
break; break;
case D3DRENDERSTATE_ZFUNC: /* 23 */ case D3DRENDERSTATE_ZFUNC: /* 23 */
switch ((D3DCMPFUNC) dwRenderState) { switch ((D3DCMPFUNC) dwRenderState) {
case D3DCMP_NEVER: case D3DCMP_NEVER:
@ -236,14 +236,14 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
ERR("Unexpected value\n"); ERR("Unexpected value\n");
} }
break; break;
case D3DRENDERSTATE_DITHERENABLE: /* 26 */ case D3DRENDERSTATE_DITHERENABLE: /* 26 */
if (dwRenderState) if (dwRenderState)
glEnable(GL_DITHER); glEnable(GL_DITHER);
else else
glDisable(GL_DITHER); glDisable(GL_DITHER);
break; break;
case D3DRENDERSTATE_ALPHABLENDENABLE: /* 27 */ case D3DRENDERSTATE_ALPHABLENDENABLE: /* 27 */
if (dwRenderState) if (dwRenderState)
glEnable(GL_BLEND); glEnable(GL_BLEND);
@ -260,7 +260,7 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
case D3DRENDERSTATE_FLUSHBATCH: /* 50 */ case D3DRENDERSTATE_FLUSHBATCH: /* 50 */
break; break;
default: default:
ERR("Unhandled dwRenderStateType %d!\n",dwRenderStateType); ERR("Unhandled dwRenderStateType %d!\n",dwRenderStateType);
break; break;

View File

@ -125,19 +125,19 @@ void fill_DataFormat(void *out, void *in, DataFormat *df) {
df->dt[i].offset_out, df->dt[i].offset_in, *((char *) (in_c + df->dt[i].offset_in))); df->dt[i].offset_out, df->dt[i].offset_in, *((char *) (in_c + df->dt[i].offset_in)));
*((char *) (out_c + df->dt[i].offset_out)) = *((char *) (in_c + df->dt[i].offset_in)); *((char *) (out_c + df->dt[i].offset_out)) = *((char *) (in_c + df->dt[i].offset_in));
break; break;
case 2: case 2:
TRACE("Copying (s) to %d from %d (value %d)\n", TRACE("Copying (s) to %d from %d (value %d)\n",
df->dt[i].offset_out, df->dt[i].offset_in, *((short *) (in_c + df->dt[i].offset_in))); df->dt[i].offset_out, df->dt[i].offset_in, *((short *) (in_c + df->dt[i].offset_in)));
*((short *) (out_c + df->dt[i].offset_out)) = *((short *) (in_c + df->dt[i].offset_in)); *((short *) (out_c + df->dt[i].offset_out)) = *((short *) (in_c + df->dt[i].offset_in));
break; break;
case 4: case 4:
TRACE("Copying (i) to %d from %d (value %d)\n", TRACE("Copying (i) to %d from %d (value %d)\n",
df->dt[i].offset_out, df->dt[i].offset_in, *((int *) (in_c + df->dt[i].offset_in))); df->dt[i].offset_out, df->dt[i].offset_in, *((int *) (in_c + df->dt[i].offset_in)));
*((int *) (out_c + df->dt[i].offset_out)) = *((int *) (in_c + df->dt[i].offset_in)); *((int *) (out_c + df->dt[i].offset_out)) = *((int *) (in_c + df->dt[i].offset_in));
break; break;
default: default:
memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size); memcpy((out_c + df->dt[i].offset_out), (in_c + df->dt[i].offset_in), df->dt[i].size);
} }
@ -148,19 +148,19 @@ void fill_DataFormat(void *out, void *in, DataFormat *df) {
df->dt[i].offset_out, df->dt[i].value); df->dt[i].offset_out, df->dt[i].value);
*((char *) (out_c + df->dt[i].offset_out)) = (char) df->dt[i].value; *((char *) (out_c + df->dt[i].offset_out)) = (char) df->dt[i].value;
break; break;
case 2: case 2:
TRACE("Copying (s) to %d default value %d\n", TRACE("Copying (s) to %d default value %d\n",
df->dt[i].offset_out, df->dt[i].value); df->dt[i].offset_out, df->dt[i].value);
*((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value; *((short *) (out_c + df->dt[i].offset_out)) = (short) df->dt[i].value;
break; break;
case 4: case 4:
TRACE("Copying (i) to %d default value %d\n", TRACE("Copying (i) to %d default value %d\n",
df->dt[i].offset_out, df->dt[i].value); df->dt[i].offset_out, df->dt[i].value);
*((int *) (out_c + df->dt[i].offset_out)) = (int) df->dt[i].value; *((int *) (out_c + df->dt[i].offset_out)) = (int) df->dt[i].value;
break; break;
default: default:
memset((out_c + df->dt[i].offset_out), df->dt[i].size, 0); memset((out_c + df->dt[i].offset_out), df->dt[i].size, 0);
} }
@ -176,40 +176,40 @@ DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_f
int same = 1; int same = 1;
int *done; int *done;
int index = 0; int index = 0;
ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs); done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
memset(done, 0, sizeof(int) * asked_format->dwNumObjs); memset(done, 0, sizeof(int) * asked_format->dwNumObjs);
dt = (DataTransform *) HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform)); dt = (DataTransform *) HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
TRACE("Creating DataTransform : \n"); TRACE("Creating DataTransform : \n");
for (i = 0; i < wine_format->dwNumObjs; i++) { for (i = 0; i < wine_format->dwNumObjs; i++) {
offset[i] = -1; offset[i] = -1;
for (j = 0; j < asked_format->dwNumObjs; j++) { for (j = 0; j < asked_format->dwNumObjs; j++) {
if (done[j] == 1) if (done[j] == 1)
continue; continue;
if (((asked_format->rgodf[j].pguid == NULL) || (IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid))) if (((asked_format->rgodf[j].pguid == NULL) || (IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
&& &&
(wine_format->rgodf[i].dwType & asked_format->rgodf[j].dwType)) { (wine_format->rgodf[i].dwType & asked_format->rgodf[j].dwType)) {
done[j] = 1; done[j] = 1;
TRACE("Matching : \n"); TRACE("Matching : \n");
TRACE(" - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n", TRACE(" - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
j, debugstr_guid(asked_format->rgodf[j].pguid), j, debugstr_guid(asked_format->rgodf[j].pguid),
asked_format->rgodf[j].dwOfs, asked_format->rgodf[j].dwOfs,
DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType)); DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType));
TRACE(" - Wine (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n", TRACE(" - Wine (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
j, debugstr_guid(wine_format->rgodf[i].pguid), j, debugstr_guid(wine_format->rgodf[i].pguid),
wine_format->rgodf[i].dwOfs, wine_format->rgodf[i].dwOfs,
DIDFT_GETTYPE(wine_format->rgodf[i].dwType), DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType)); DIDFT_GETTYPE(wine_format->rgodf[i].dwType), DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType));
if (wine_format->rgodf[i].dwType & DIDFT_BUTTON) if (wine_format->rgodf[i].dwType & DIDFT_BUTTON)
dt[index].size = sizeof(BYTE); dt[index].size = sizeof(BYTE);
else else
@ -218,7 +218,7 @@ DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_f
dt[index].offset_out = asked_format->rgodf[j].dwOfs; dt[index].offset_out = asked_format->rgodf[j].dwOfs;
dt[index].value = 0; dt[index].value = 0;
index++; index++;
if (wine_format->rgodf[i].dwOfs != asked_format->rgodf[j].dwOfs) if (wine_format->rgodf[i].dwOfs != asked_format->rgodf[j].dwOfs)
same = 0; same = 0;
@ -235,11 +235,11 @@ DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_f
for (j = 0; j < asked_format->dwNumObjs; j++) { for (j = 0; j < asked_format->dwNumObjs; j++) {
if (done[j] == 0) { if (done[j] == 0) {
TRACE(" - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n", TRACE(" - Asked (%d) : %s - Ofs = %3ld - (Type = 0x%02x | Instance = %04x)\n",
j, debugstr_guid(asked_format->rgodf[j].pguid), j, debugstr_guid(asked_format->rgodf[j].pguid),
asked_format->rgodf[j].dwOfs, asked_format->rgodf[j].dwOfs,
DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType)); DIDFT_GETTYPE(asked_format->rgodf[j].dwType), DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType));
if (asked_format->rgodf[j].dwType & DIDFT_BUTTON) if (asked_format->rgodf[j].dwType & DIDFT_BUTTON)
dt[index].size = sizeof(BYTE); dt[index].size = sizeof(BYTE);
else else
@ -261,7 +261,7 @@ DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_f
} else { } else {
ret->dt = dt; ret->dt = dt;
} }
HeapFree(GetProcessHeap(), 0, done); HeapFree(GetProcessHeap(), 0, done);
return ret; return ret;
@ -278,13 +278,13 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SetDataFormat(
ICOM_THIS(IDirectInputDevice2AImpl,iface); ICOM_THIS(IDirectInputDevice2AImpl,iface);
TRACE("(this=%p,%p)\n",This,df); TRACE("(this=%p,%p)\n",This,df);
TRACE("df.dwSize=%ld\n",df->dwSize); TRACE("df.dwSize=%ld\n",df->dwSize);
TRACE("(df.dwObjsize=%ld)\n",df->dwObjSize); TRACE("(df.dwObjsize=%ld)\n",df->dwObjSize);
TRACE("(df.dwFlags=0x%08lx)\n",df->dwFlags); TRACE("(df.dwFlags=0x%08lx)\n",df->dwFlags);
TRACE("(df.dwDataSize=%ld)\n",df->dwDataSize); TRACE("(df.dwDataSize=%ld)\n",df->dwDataSize);
TRACE("(df.dwNumObjs=%ld)\n",df->dwNumObjs); TRACE("(df.dwNumObjs=%ld)\n",df->dwNumObjs);
for (i=0;i<df->dwNumObjs;i++) { for (i=0;i<df->dwNumObjs;i++) {
TRACE("df.rgodf[%d].guid %s\n",i,debugstr_guid(df->rgodf[i].pguid)); TRACE("df.rgodf[%d].guid %s\n",i,debugstr_guid(df->rgodf[i].pguid));
TRACE("df.rgodf[%d].dwOfs %ld\n",i,df->rgodf[i].dwOfs); TRACE("df.rgodf[%d].dwOfs %ld\n",i,df->rgodf[i].dwOfs);
@ -367,10 +367,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumObjects(
_dump_EnumObjects_flags(dwFlags); _dump_EnumObjects_flags(dwFlags);
DPRINTF("\n"); DPRINTF("\n");
} }
return DI_OK; return DI_OK;
} }
HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty( HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
LPDIRECTINPUTDEVICE2A iface, LPDIRECTINPUTDEVICE2A iface,
REFGUID rguid, REFGUID rguid,
@ -378,10 +378,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetProperty(
{ {
FIXME("(this=%p,%s,%p): stub!\n", FIXME("(this=%p,%s,%p): stub!\n",
iface, debugstr_guid(rguid), pdiph); iface, debugstr_guid(rguid), pdiph);
if (TRACE_ON(dinput)) if (TRACE_ON(dinput))
_dump_DIPROPHEADER(pdiph); _dump_DIPROPHEADER(pdiph);
return DI_OK; return DI_OK;
} }
@ -393,20 +393,20 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo(
{ {
FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n", FIXME("(this=%p,%p,%ld,0x%08lx): stub!\n",
iface, pdidoi, dwObj, dwHow); iface, pdidoi, dwObj, dwHow);
return DI_OK; return DI_OK;
} }
HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo( HRESULT WINAPI IDirectInputDevice2AImpl_GetDeviceInfo(
LPDIRECTINPUTDEVICE2A iface, LPDIRECTINPUTDEVICE2A iface,
LPDIDEVICEINSTANCEA pdidi) LPDIDEVICEINSTANCEA pdidi)
{ {
FIXME("(this=%p,%p): stub!\n", FIXME("(this=%p,%p): stub!\n",
iface, pdidi); iface, pdidi);
return DI_OK; return DI_OK;
} }
HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel( HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
LPDIRECTINPUTDEVICE2A iface, LPDIRECTINPUTDEVICE2A iface,
HWND hwndOwner, HWND hwndOwner,
@ -414,10 +414,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_RunControlPanel(
{ {
FIXME("(this=%p,0x%08x,0x%08lx): stub!\n", FIXME("(this=%p,0x%08x,0x%08lx): stub!\n",
iface, hwndOwner, dwFlags); iface, hwndOwner, dwFlags);
return DI_OK; return DI_OK;
} }
HRESULT WINAPI IDirectInputDevice2AImpl_Initialize( HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
LPDIRECTINPUTDEVICE2A iface, LPDIRECTINPUTDEVICE2A iface,
HINSTANCE hinst, HINSTANCE hinst,
@ -428,7 +428,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Initialize(
iface, hinst, dwVersion, debugstr_guid(rguid)); iface, hinst, dwVersion, debugstr_guid(rguid));
return DI_OK; return DI_OK;
} }
/****************************************************************************** /******************************************************************************
* IDirectInputDevice2A * IDirectInputDevice2A
*/ */
@ -453,7 +453,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_EnumEffects(
{ {
FIXME("(this=%p,%p,%p,0x%08lx): stub!\n", FIXME("(this=%p,%p,%p,0x%08lx): stub!\n",
iface, lpCallback, lpvRef, dwFlags); iface, lpCallback, lpvRef, dwFlags);
if (lpCallback) if (lpCallback)
lpCallback(NULL, lpvRef); lpCallback(NULL, lpvRef);
return DI_OK; return DI_OK;
@ -525,7 +525,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SendDeviceData(
{ {
FIXME("(this=%p,0x%08lx,%p,%p,0x%08lx): stub!\n", FIXME("(this=%p,0x%08lx,%p,%p,0x%08lx): stub!\n",
iface, cbObjectData, rgdod, pdwInOut, dwFlags); iface, cbObjectData, rgdod, pdwInOut, dwFlags);
return DI_OK; return DI_OK;
} }
@ -547,6 +547,6 @@ HRESULT WINAPI IDirectInputDevice7AImpl_WriteEffectToFile(LPDIRECTINPUTDEVICE7A
DWORD dwFlags) DWORD dwFlags)
{ {
FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags); FIXME("(%p)->(%s,%08lx,%p,%08lx): stub !\n", iface, lpszFileName, dwEntries, rgDiFileEft, dwFlags);
return DI_OK; return DI_OK;
} }

Some files were not shown because too many files have changed in this diff Show More