diff --git a/reactos/dll/win32/comctl32/comboex.c b/reactos/dll/win32/comctl32/comboex.c index 2f95b1ad555..25c2dbff824 100644 --- a/reactos/dll/win32/comctl32/comboex.c +++ b/reactos/dll/win32/comctl32/comboex.c @@ -1669,6 +1669,14 @@ static LRESULT COMBOEX_Size (COMBOEX_INFO *infoPtr, INT width, INT height) } +static LRESULT COMBOEX_SetRedraw(COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +{ + LRESULT ret = DefWindowProcW( infoPtr->hwndSelf, WM_SETREDRAW, wParam, lParam ); + if (wParam) RedrawWindow( infoPtr->hwndSelf, NULL, 0, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN ); + return ret; +} + + static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp) { RECT cbx_wrect, cbx_crect, cb_wrect; @@ -2302,6 +2310,9 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_SIZE: return COMBOEX_Size (infoPtr, LOWORD(lParam), HIWORD(lParam)); + case WM_SETREDRAW: + return COMBOEX_SetRedraw(infoPtr, wParam, lParam); + case WM_WINDOWPOSCHANGING: return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam); diff --git a/reactos/dll/win32/comctl32/imagelist.c b/reactos/dll/win32/comctl32/imagelist.c index 72e7608e8a3..84971f70e01 100644 --- a/reactos/dll/win32/comctl32/imagelist.c +++ b/reactos/dll/win32/comctl32/imagelist.c @@ -155,7 +155,7 @@ static inline void imagelist_copy_images( HIMAGELIST himl, HDC hdcSrc, HDC hdcDe * This function CANNOT be used to reduce the number of images. */ static void -IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cy) +IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy) { HDC hdcBitmap; HBITMAP hbmNewBitmap, hbmNull; @@ -166,14 +166,15 @@ IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cy) && (himl->cy >= cy)) return; + if (cx == 0) cx = himl->cx; nNewCount = himl->cCurImage + nImageCount + himl->cGrow; - imagelist_get_bitmap_size(himl, nNewCount, himl->cx, &sz); + imagelist_get_bitmap_size(himl, nNewCount, cx, &sz); TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, sz.cx, cy, nNewCount); hdcBitmap = CreateCompatibleDC (0); - hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, himl->cx); + hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, cx); if (hbmNewBitmap == 0) ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, cy); @@ -247,7 +248,7 @@ ImageList_Add (HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask) nImageCount = bmp.bmWidth / himl->cx; - IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight); + IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight); hdcBitmap = CreateCompatibleDC(0); @@ -349,7 +350,7 @@ ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask) else nImageCount = 0; - IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight); + IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight); nIndex = himl->cCurImage; himl->cCurImage += nImageCount; @@ -2303,7 +2304,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT nIndex, HICON hIcon) if (nIndex == -1) { if (himl->cCurImage + 1 > himl->cMaxImage) - IMAGELIST_InternalExpandBitmaps (himl, 1, 0); + IMAGELIST_InternalExpandBitmaps (himl, 1, 0, 0); nIndex = himl->cCurImage; himl->cCurImage++; diff --git a/reactos/dll/win32/comctl32/ipaddress.c b/reactos/dll/win32/comctl32/ipaddress.c index 15d39f57fd5..a90f6e99365 100644 --- a/reactos/dll/win32/comctl32/ipaddress.c +++ b/reactos/dll/win32/comctl32/ipaddress.c @@ -77,6 +77,29 @@ static const WCHAR IP_SUBCLASS_PROP[] = static LRESULT CALLBACK IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +static void IPADDRESS_UpdateText (const IPADDRESS_INFO *infoPtr) +{ + static const WCHAR zero[2] = {'0', 0}; + static const WCHAR dot[2] = {'.', 0}; + WCHAR field[4]; + WCHAR ip[16]; + INT i; + + ip[0] = 0; + + for (i = 0; i < 4; i++) { + if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) + strcatW(ip, field); + else + /* empty edit treated as zero */ + strcatW(ip, zero); + if (i != 3) + strcatW(ip, dot); + } + + SetWindowTextW(infoPtr->Self, ip); +} + static LRESULT IPADDRESS_Notify (const IPADDRESS_INFO *infoPtr, UINT command) { HWND hwnd = infoPtr->Self; @@ -219,6 +242,8 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) EnableWindow(part->EditHwnd, infoPtr->Enabled); } + IPADDRESS_UpdateText (infoPtr); + return 0; } @@ -483,7 +508,7 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return return_val; } else if (len == 3 && startsel==endsel && endsel==len) IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL); - else if (len < 3) break; + else if (len < 3 || startsel != endsel) break; } else if(c == '.' || c == ' ') { if(len && startsel==endsel && startsel != 0) { IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); @@ -561,6 +586,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch(wParam >> 16) { case EN_CHANGE: + IPADDRESS_UpdateText(infoPtr); IPADDRESS_Notify(infoPtr, EN_CHANGE); break; case EN_KILLFOCUS: diff --git a/reactos/dll/win32/comctl32/tab.c b/reactos/dll/win32/comctl32/tab.c index 3880cebdd86..c2ab01e240d 100644 --- a/reactos/dll/win32/comctl32/tab.c +++ b/reactos/dll/win32/comctl32/tab.c @@ -32,7 +32,7 @@ * TODO: * * Styles: - * TCS_MULTISELECT + * TCS_MULTISELECT - implement for VK_SPACE selection * TCS_RIGHT * TCS_RIGHTJUSTIFY * TCS_SCROLLOPPOSITE @@ -40,24 +40,14 @@ * TCIF_RTLREADING * * Extended Styles: - * TCS_EX_FLATSEPARATORS * TCS_EX_REGISTERDROP * - * States: - * TCIS_BUTTONPRESSED - * * Notifications: * NM_RELEASEDCAPTURE * TCN_FOCUSCHANGE * TCN_GETOBJECT * TCN_KEYDOWN * - * Messages: - * TCM_REMOVEIMAGE - * TCM_DESELECTALL - * TCM_GETEXTENDEDSTYLE - * TCM_SETEXTENDEDSTYLE - * * Macros: * TabCtrl_AdjustRect * @@ -127,6 +117,9 @@ typedef struct BOOL bUnicode; /* Unicode control? */ HWND hwndUpDown; /* Updown control used for scrolling */ INT cbInfo; /* Number of bytes of caller supplied info per tab */ + + DWORD exStyle; /* Extended style used, currently: + TCS_EX_FLATSEPARATORS, TCS_EX_REGISTERDROP */ } TAB_INFO; /****************************************************************************** @@ -166,6 +159,7 @@ static const WCHAR themeClass[] = { 'T','a','b',0 }; static void TAB_InvalidateTabArea(const TAB_INFO *); static void TAB_EnsureSelectionVisible(TAB_INFO *); static void TAB_DrawItemInterior(const TAB_INFO *, HDC, INT, RECT*); +static LRESULT TAB_DeselectAll(TAB_INFO *, BOOL); static BOOL TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code) @@ -253,6 +247,9 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem) return -1; else { if (infoPtr->iSelected != iItem) { + TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED; + TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED; + infoPtr->iSelected=iItem; infoPtr->uFocus=iItem; TAB_EnsureSelectionVisible(infoPtr); @@ -490,12 +487,8 @@ static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode) { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + TAB_SetCurSel(infoPtr, newItem); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - TAB_InvalidateTabArea(infoPtr); } } @@ -592,6 +585,7 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) POINT pt; INT newItem; UINT dummy; + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); if (infoPtr->hwndToolTip) TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd, @@ -612,19 +606,43 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) TRACE("On Tab, item %d\n", newItem); - if (newItem != -1 && infoPtr->iSelected != newItem) + if ((newItem != -1) && (infoPtr->iSelected != newItem)) { - if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) + if ((lStyle & TCS_BUTTONS) && (lStyle & TCS_MULTISELECT) && + (wParam & MK_CONTROL)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + RECT r; + + /* toggle multiselection */ + TAB_GetItem(infoPtr, newItem)->dwState ^= TCIS_BUTTONPRESSED; + if (TAB_InternalGetItemRect (infoPtr, newItem, &r, NULL)) + InvalidateRect (infoPtr->hwnd, &r, TRUE); + } + else + { + INT i; + BOOL pressed = FALSE; + + /* any button pressed ? */ + for (i = 0; i < infoPtr->uNumItem; i++) + if ((TAB_GetItem (infoPtr, i)->dwState & TCIS_BUTTONPRESSED) && + (infoPtr->iSelected != i)) + { + pressed = TRUE; + break; + } + + TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING); + + if (pressed) + TAB_DeselectAll (infoPtr, FALSE); + else + TAB_SetCurSel(infoPtr, newItem); + TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - - TAB_InvalidateTabArea(infoPtr); } } + return 0; } @@ -1434,7 +1452,6 @@ TAB_EraseTabInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect BOOL deleteBrush = TRUE; RECT rTemp = *drawRect; - InflateRect(&rTemp, -2, -2); if (lStyle & TCS_BUTTONS) { if (iItem == infoPtr->iSelected) @@ -1463,9 +1480,10 @@ TAB_EraseTabInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect { if (lStyle & TCS_FLATBUTTONS) { - FillRect(hdc, drawRect, hbr); + InflateRect(&rTemp, 2, 2); + FillRect(hdc, &rTemp, hbr); if (iItem == infoPtr->iHotTracked) - DrawEdge(hdc, drawRect, EDGE_RAISED, BF_SOFT|BF_RECT); + DrawEdge(hdc, &rTemp, BDR_RAISEDINNER, BF_RECT); } else FillRect(hdc, &rTemp, hbr); @@ -1474,10 +1492,23 @@ TAB_EraseTabInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect } else /* !TCS_BUTTONS */ { + InflateRect(&rTemp, -2, -2); if (!GetWindowTheme (infoPtr->hwnd)) FillRect(hdc, &rTemp, hbr); } + /* highlighting is drawn on top of previous fills */ + if (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED) + { + if (deleteBrush) + { + DeleteObject(hbr); + deleteBrush = FALSE; + } + hbr = GetSysColorBrush(COLOR_HIGHLIGHT); + FillRect(hdc, &rTemp, hbr); + } + /* Cleanup */ if (deleteBrush) DeleteObject(hbr); } @@ -1536,7 +1567,22 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect drawRect->left += 4; drawRect->top += 4; drawRect->right -= 4; - drawRect->bottom -= 1; + + if (lStyle & TCS_VERTICAL) + { + if (!(lStyle & TCS_BOTTOM)) drawRect->right += 1; + drawRect->bottom -= 4; + } + else + { + if (lStyle & TCS_BOTTOM) + { + drawRect->top -= 2; + drawRect->bottom -= 4; + } + else + drawRect->bottom -= 1; + } } else { @@ -1631,10 +1677,15 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect */ oldBkMode = SetBkMode(hdc, TRANSPARENT); if (!GetWindowTheme (infoPtr->hwnd) || (lStyle & TCS_BUTTONS)) - SetTextColor(hdc, (((lStyle & TCS_HOTTRACK) && (iItem == infoPtr->iHotTracked) - && !(lStyle & TCS_FLATBUTTONS)) - | (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED)) ? - comctl32_color.clrHighlight : comctl32_color.clrBtnText); + { + if ((lStyle & TCS_HOTTRACK) && (iItem == infoPtr->iHotTracked) && + !(lStyle & TCS_FLATBUTTONS)) + SetTextColor(hdc, comctl32_color.clrHighlight); + else if (TAB_GetItem(infoPtr, iItem)->dwState & TCIS_HIGHLIGHTED) + SetTextColor(hdc, comctl32_color.clrHighlightText); + else + SetTextColor(hdc, comctl32_color.clrBtnText); + } /* * if owner draw, tell the owner to draw @@ -1948,7 +1999,7 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem) r = itemRect; /* Separators between flat buttons */ - if (lStyle & TCS_FLATBUTTONS) + if ((lStyle & TCS_FLATBUTTONS) && (infoPtr->exStyle & TCS_EX_FLATSEPARATORS)) { r1 = r; r1.right += (FLAT_BTN_SPACINGX -2); @@ -1963,8 +2014,13 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem) } else /* ! selected */ { - if (!(lStyle & TCS_FLATBUTTONS)) - DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); + DWORD state = TAB_GetItem(infoPtr, iItem)->dwState; + + if (state & TCIS_BUTTONPRESSED) + DrawEdge(hdc, &r, EDGE_SUNKEN, BF_SOFT|BF_RECT); + else + if (!(lStyle & TCS_FLATBUTTONS)) + DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); } } else /* !TCS_BUTTONS */ @@ -2675,6 +2731,8 @@ static inline LRESULT TAB_HighlightItem (TAB_INFO *infoPtr, INT iItem, BOOL fHighlight) { LPDWORD lpState; + DWORD oldState; + RECT r; TRACE("(%p,%d,%s)\n", infoPtr, iItem, fHighlight ? "true" : "false"); @@ -2682,12 +2740,16 @@ TAB_HighlightItem (TAB_INFO *infoPtr, INT iItem, BOOL fHighlight) return FALSE; lpState = &TAB_GetItem(infoPtr, iItem)->dwState; + oldState = *lpState; if (fHighlight) *lpState |= TCIS_HIGHLIGHTED; else *lpState &= ~TCIS_HIGHLIGHTED; + if ((oldState != *lpState) && TAB_InternalGetItemRect (infoPtr, iItem, &r, NULL)) + InvalidateRect (infoPtr->hwnd, &r, TRUE); + return TRUE; } @@ -2715,7 +2777,8 @@ TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) FIXME("TCIF_RTLREADING\n"); if (tabItem->mask & TCIF_STATE) - wineItem->dwState = tabItem->dwState; + wineItem->dwState = (wineItem->dwState & ~tabItem->dwStateMask) | + ( tabItem->dwState & tabItem->dwStateMask); if (tabItem->mask & TCIF_TEXT) { @@ -2762,7 +2825,7 @@ TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) FIXME("TCIF_RTLREADING\n"); if (tabItem->mask & TCIF_STATE) - tabItem->dwState = wineItem->dwState; + tabItem->dwState = wineItem->dwState & tabItem->dwStateMask; if (tabItem->mask & TCIF_TEXT) { @@ -2979,6 +3042,8 @@ static LRESULT TAB_Create (HWND hwnd, LPARAM lParam) dwStyle = GetWindowLongW(hwnd, GWL_STYLE); SetWindowLongW(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS); + infoPtr->exStyle = (dwStyle & TCS_FLATBUTTONS) ? TCS_EX_FLATSEPARATORS : 0; + if (dwStyle & TCS_TOOLTIPS) { /* Create tooltip control */ infoPtr->hwndToolTip = @@ -3099,6 +3164,103 @@ TAB_SetItemExtra (TAB_INFO *infoPtr, INT cbInfo) return TRUE; } +static LRESULT TAB_RemoveImage (TAB_INFO *infoPtr, INT image) +{ + if (!infoPtr) + return 0; + + if (ImageList_Remove (infoPtr->himl, image)) + { + INT i, *idx; + RECT r; + + /* shift indices, repaint items if needed */ + for (i = 0; i < infoPtr->uNumItem; i++) + { + idx = &TAB_GetItem(infoPtr, i)->iImage; + if (*idx >= image) + { + if (*idx == image) + *idx = -1; + else + (*idx)--; + + /* repaint item */ + if (TAB_InternalGetItemRect (infoPtr, i, &r, NULL)) + InvalidateRect (infoPtr->hwnd, &r, TRUE); + } + } + } + + return 0; +} + +static LRESULT +TAB_SetExtendedStyle (TAB_INFO *infoPtr, DWORD exMask, DWORD exStyle) +{ + DWORD prevstyle = infoPtr->exStyle; + + /* zero mask means all styles */ + if (exMask == 0) exMask = ~0; + + if (exMask & TCS_EX_REGISTERDROP) + { + FIXME("TCS_EX_REGISTERDROP style unimplemented\n"); + exMask &= ~TCS_EX_REGISTERDROP; + exStyle &= ~TCS_EX_REGISTERDROP; + } + + if (exMask & TCS_EX_FLATSEPARATORS) + { + if ((prevstyle ^ exStyle) & TCS_EX_FLATSEPARATORS) + { + infoPtr->exStyle ^= TCS_EX_FLATSEPARATORS; + TAB_InvalidateTabArea(infoPtr); + } + } + + return prevstyle; +} + +static inline LRESULT +TAB_GetExtendedStyle (TAB_INFO *infoPtr) +{ + return infoPtr->exStyle; +} + +static LRESULT +TAB_DeselectAll (TAB_INFO *infoPtr, BOOL excludesel) +{ + LONG style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); + BOOL paint = FALSE; + INT i, selected = infoPtr->iSelected; + + if (!(style & TCS_BUTTONS)) + return 0; + + for (i = 0; i < infoPtr->uNumItem; i++) + { + if ((TAB_GetItem(infoPtr, i)->dwState & TCIS_BUTTONPRESSED) && + (selected != i)) + { + TAB_GetItem(infoPtr, i)->dwState &= ~TCIS_BUTTONPRESSED; + paint = TRUE; + } + } + + if (!excludesel && (selected != -1)) + { + TAB_GetItem(infoPtr, selected)->dwState &= ~TCIS_BUTTONPRESSED; + infoPtr->iSelected = -1; + paint = TRUE; + } + + if (paint) + TAB_InvalidateTabArea (infoPtr); + + return 0; +} + static LRESULT WINAPI TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -3159,8 +3321,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TAB_SetItemSize (infoPtr, lParam); case TCM_REMOVEIMAGE: - FIXME("Unimplemented msg TCM_REMOVEIMAGE\n"); - return 0; + return TAB_RemoveImage (infoPtr, wParam); case TCM_SETPADDING: return TAB_SetPadding (infoPtr, lParam); @@ -3193,16 +3354,13 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TAB_SetMinTabWidth(infoPtr, (INT)lParam); case TCM_DESELECTALL: - FIXME("Unimplemented msg TCM_DESELECTALL\n"); - return 0; + return TAB_DeselectAll (infoPtr, (BOOL)wParam); case TCM_GETEXTENDEDSTYLE: - FIXME("Unimplemented msg TCM_GETEXTENDEDSTYLE\n"); - return 0; + return TAB_GetExtendedStyle (infoPtr); case TCM_SETEXTENDEDSTYLE: - FIXME("Unimplemented msg TCM_SETEXTENDEDSTYLE\n"); - return 0; + return TAB_SetExtendedStyle (infoPtr, wParam, lParam); case WM_GETFONT: return TAB_GetFont (infoPtr); diff --git a/reactos/dll/win32/comctl32/toolbar.c b/reactos/dll/win32/comctl32/toolbar.c index 5ef701d5f23..c3add7777e5 100644 --- a/reactos/dll/win32/comctl32/toolbar.c +++ b/reactos/dll/win32/comctl32/toolbar.c @@ -492,9 +492,9 @@ TOOLBAR_DrawFlatSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *info /*********************************************************************** -* TOOLBAR_DrawDDFlatSeparator +* TOOLBAR_DrawFlatHorizontalSeparator * -* This function draws the separator that was flagged as BTNS_DROPDOWN. +* This function draws horizontal separator for toolbars having CCS_VERT style. * In this case, the separator is a pixel high line of COLOR_BTNSHADOW, * followed by a pixel high line of COLOR_BTNHIGHLIGHT. These separators * are horizontal as opposed to the vertical separators for not dropdown @@ -503,7 +503,7 @@ TOOLBAR_DrawFlatSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *info * FIXME: It is possible that the height of each line is really SM_CYBORDER. */ static void -TOOLBAR_DrawDDFlatSeparator (const RECT *lpRect, HDC hdc, +TOOLBAR_DrawFlatHorizontalSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr) { RECT myrect; @@ -855,8 +855,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr /* empirical tests show that iBitmap can/will be non-zero */ /* when drawing the vertical bar... */ if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) { - if (btnPtr->fsStyle & BTNS_DROPDOWN) - TOOLBAR_DrawDDFlatSeparator (&rc, hdc, infoPtr); + if (dwStyle & CCS_VERT) + TOOLBAR_DrawFlatHorizontalSeparator (&rc, hdc, infoPtr); else TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr); } @@ -1326,18 +1326,14 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle ) if (btnPtr[i].fsState & TBSTATE_HIDDEN) continue; - /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ - /* it is the actual width of the separator. This is used for */ - /* custom controls in toolbars. */ - /* */ - /* BTNS_DROPDOWN separators are treated as buttons for */ - /* width. - GA 8/01 */ - if ((btnPtr[i].fsStyle & BTNS_SEP) && - !(btnPtr[i].fsStyle & BTNS_DROPDOWN)) - cx = (btnPtr[i].iBitmap > 0) ? - btnPtr[i].iBitmap : SEPARATOR_WIDTH; + if (btnPtr[i].cx > 0) + cx = btnPtr[i].cx; + /* horizontal separators are treated as buttons for width */ + else if ((btnPtr[i].fsStyle & BTNS_SEP) && + !(infoPtr->dwStyle & CCS_VERT)) + cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH; else - cx = (btnPtr[i].cx) ? btnPtr[i].cx : infoPtr->nButtonWidth; + cx = infoPtr->nButtonWidth; /* Two or more adjacent separators form a separator group. */ /* The first separator in a group should be wrapped to the */ @@ -1685,18 +1681,14 @@ TOOLBAR_LayoutToolbar(HWND hwnd) cy = infoPtr->nButtonHeight; - /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ - /* it is the actual width of the separator. This is used for */ - /* custom controls in toolbars. */ if (btnPtr->fsStyle & BTNS_SEP) { - if (btnPtr->fsStyle & BTNS_DROPDOWN) { - cy = (btnPtr->iBitmap > 0) ? - btnPtr->iBitmap : SEPARATOR_WIDTH; - cx = infoPtr->nButtonWidth; + if (infoPtr->dwStyle & CCS_VERT) { + cy = (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; + cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nWidth; } else - cx = (btnPtr->iBitmap > 0) ? - btnPtr->iBitmap : SEPARATOR_WIDTH; + cx = (btnPtr->cx > 0) ? btnPtr->cx : + (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; } else { @@ -1759,12 +1751,9 @@ TOOLBAR_LayoutToolbar(HWND hwnd) y += cy; else { - /* UNDOCUMENTED: If a separator has a non zero bitmap index, */ - /* it is the actual width of the separator. This is used for */ - /* custom controls in toolbars. */ - if ( !(btnPtr->fsStyle & BTNS_DROPDOWN)) - y += cy + ( (btnPtr->iBitmap > 0 ) ? - btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 /3; + if ( !(infoPtr->dwStyle & CCS_VERT)) + y += cy + ( (btnPtr->cx > 0 ) ? + btnPtr->cx : SEPARATOR_WIDTH) * 2 /3; else y += cy; @@ -1843,9 +1832,10 @@ TOOLBAR_InternalInsertButtonsT(TOOLBAR_INFO *infoPtr, INT iIndex, UINT nAddButto for (iButton = 0; iButton < nAddButtons; iButton++) { TBUTTON_INFO *btnPtr = &infoPtr->buttons[iIndex + iButton]; - TOOLBAR_DumpTBButton(lpTbb, fUnicode); + TOOLBAR_DumpTBButton(lpTbb + iButton, fUnicode); ZeroMemory(btnPtr, sizeof(*btnPtr)); + btnPtr->iBitmap = lpTbb[iButton].iBitmap; btnPtr->idCommand = lpTbb[iButton].idCommand; btnPtr->fsState = lpTbb[iButton].fsState; @@ -3401,7 +3391,11 @@ TOOLBAR_GetButtonInfoT(HWND hwnd, WPARAM wParam, LPARAM lParam, BOOL bUnicode) if (lpTbInfo->dwMask & TBIF_LPARAM) lpTbInfo->lParam = btnPtr->dwData; if (lpTbInfo->dwMask & TBIF_SIZE) - lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); + /* tests show that for separators TBIF_SIZE returns not calculated width, + but cx property, that differs from 0 only if application have + specifically set it */ + lpTbInfo->cx = (btnPtr->fsStyle & BTNS_SEP) + ? btnPtr->cx : (WORD)(btnPtr->rect.right - btnPtr->rect.left); if (lpTbInfo->dwMask & TBIF_STATE) lpTbInfo->fsState = btnPtr->fsState; if (lpTbInfo->dwMask & TBIF_STYLE) @@ -4241,7 +4235,9 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave) { /* separator */ nmtbr.tbButton.fsStyle = TBSTYLE_SEP; - nmtbr.tbButton.iBitmap = SEPARATOR_WIDTH; + /* when inserting separators, iBitmap controls it's size. + 0 sets default size (width) */ + nmtbr.tbButton.iBitmap = 0; } else if (*nmtbr.pCurrent == (DWORD)-2) /* hidden button */ @@ -4535,7 +4531,7 @@ TOOLBAR_SetButtonSize (HWND hwnd, LPARAM lParam) * 22 high. Demonstarted in ControlSpy Toolbar. GLA 3/02 */ if (cx == 0) cx = 24; - if (cy == 0) cx = 22; + if (cy == 0) cy = 22; cx = max(cx, infoPtr->szPadding.cx + infoPtr->nBitmapWidth); cy = max(cy, infoPtr->szPadding.cy + infoPtr->nBitmapHeight); @@ -4781,6 +4777,8 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) HIMAGELIST himlTemp; HIMAGELIST himl = (HIMAGELIST)lParam; INT oldButtonWidth = infoPtr->nButtonWidth; + INT oldBitmapWidth = infoPtr->nBitmapWidth; + INT oldBitmapHeight = infoPtr->nBitmapHeight; INT i, id = 0; if (infoPtr->iVersion >= 5) @@ -4799,9 +4797,12 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->nBitmapWidth = 1; infoPtr->nBitmapHeight = 1; } - TOOLBAR_CalcToolbar(hwnd); - if (infoPtr->nButtonWidth < oldButtonWidth) - TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight)); + if ((oldBitmapWidth != infoPtr->nBitmapWidth) || (oldBitmapHeight != infoPtr->nBitmapHeight)) + { + TOOLBAR_CalcToolbar(hwnd); + if (infoPtr->nButtonWidth < oldButtonWidth) + TOOLBAR_SetButtonSize(hwnd, MAKELONG(oldButtonWidth, infoPtr->nButtonHeight)); + } TRACE("hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d\n", hwnd, infoPtr->himlDef, id, infoPtr->nNumBitmaps, diff --git a/reactos/dll/win32/comctl32/trackbar.c b/reactos/dll/win32/comctl32/trackbar.c index 3424333e2e2..849ebcd627d 100644 --- a/reactos/dll/win32/comctl32/trackbar.c +++ b/reactos/dll/win32/comctl32/trackbar.c @@ -81,6 +81,8 @@ typedef struct #define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */ +#define TB_DEFAULTPAGESIZE 20 + /* Used by TRACKBAR_Refresh to find out which parts of the control need to be recalculated */ @@ -1128,7 +1130,10 @@ TRACKBAR_SetPageSize (TRACKBAR_INFO *infoPtr, LONG lPageSize) { LONG lTemp = infoPtr->lPageSize; - infoPtr->lPageSize = lPageSize; + if (lPageSize != -1) + infoPtr->lPageSize = lPageSize; + else + infoPtr->lPageSize = TB_DEFAULTPAGESIZE; return lTemp; } @@ -1405,7 +1410,7 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr->lRangeMin = 0; infoPtr->lRangeMax = 100; infoPtr->lLineSize = 1; - infoPtr->lPageSize = 20; + infoPtr->lPageSize = TB_DEFAULTPAGESIZE; infoPtr->lSelMin = 0; infoPtr->lSelMax = 0; infoPtr->lPos = 0; diff --git a/reactos/dll/win32/comctl32/treeview.c b/reactos/dll/win32/comctl32/treeview.c index 2b883483b3f..093b416e0d8 100644 --- a/reactos/dll/win32/comctl32/treeview.c +++ b/reactos/dll/win32/comctl32/treeview.c @@ -2837,7 +2837,7 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc) } // - // This is correct, but it causes an infinite loop of WM_PAINT messages, resulting + // This is correct, but is causes and infinite loop of WM_PAINT messages, resulting // in continuous painting of the scroll bar in reactos. Comment out until the real // bug is found // @@ -3297,56 +3297,59 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, if (bExpandPartial) FIXME("TVE_EXPANDPARTIAL not implemented\n"); - TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem); - TREEVIEW_UpdateSubTree(infoPtr, wineItem); - TREEVIEW_UpdateScrollBars(infoPtr); - - scrollRect.left = 0; - scrollRect.bottom = infoPtr->treeHeight; - scrollRect.right = infoPtr->clientWidth; - if (nextItem) + if (ISVISIBLE(wineItem)) { - scrollDist = nextItem->rect.top - orgNextTop; - scrollRect.top = orgNextTop; + TREEVIEW_RecalculateVisibleOrder(infoPtr, wineItem); + TREEVIEW_UpdateSubTree(infoPtr, wineItem); + TREEVIEW_UpdateScrollBars(infoPtr); - ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL, - NULL, NULL, SW_ERASE | SW_INVALIDATE); - TREEVIEW_Invalidate (infoPtr, wineItem); - } else { - scrollRect.top = wineItem->rect.top; - InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE); - } + scrollRect.left = 0; + scrollRect.bottom = infoPtr->treeHeight; + scrollRect.right = infoPtr->clientWidth; + if (nextItem) + { + scrollDist = nextItem->rect.top - orgNextTop; + scrollRect.top = orgNextTop; - /* Scroll up so that as many children as possible are visible. - * This fails when expanding causes an HScroll bar to appear, but we - * don't know that yet, so the last item is obscured. */ - if (wineItem->firstChild != NULL) - { - int nChildren = wineItem->lastChild->visibleOrder - - wineItem->firstChild->visibleOrder + 1; + ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL, + NULL, NULL, SW_ERASE | SW_INVALIDATE); + TREEVIEW_Invalidate (infoPtr, wineItem); + } else { + scrollRect.top = wineItem->rect.top; + InvalidateRect(infoPtr->hwnd, &scrollRect, FALSE); + } - int visible_pos = wineItem->visibleOrder - - infoPtr->firstVisible->visibleOrder; + /* Scroll up so that as many children as possible are visible. + * This fails when expanding causes an HScroll bar to appear, but we + * don't know that yet, so the last item is obscured. */ + if (wineItem->firstChild != NULL) + { + int nChildren = wineItem->lastChild->visibleOrder + - wineItem->firstChild->visibleOrder + 1; - int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1; + int visible_pos = wineItem->visibleOrder + - infoPtr->firstVisible->visibleOrder; - if (visible_pos > 0 && nChildren > rows_below) - { - int scroll = nChildren - rows_below; + int rows_below = TREEVIEW_GetVisibleCount(infoPtr) - visible_pos - 1; - if (scroll > visible_pos) - scroll = visible_pos; + if (visible_pos > 0 && nChildren > rows_below) + { + int scroll = nChildren - rows_below; - if (scroll > 0) - { - TREEVIEW_ITEM *newFirstVisible - = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible, - scroll); + if (scroll > visible_pos) + scroll = visible_pos; + + if (scroll > 0) + { + TREEVIEW_ITEM *newFirstVisible + = TREEVIEW_GetListItem(infoPtr, infoPtr->firstVisible, + scroll); - TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE); - } - } + TREEVIEW_SetFirstVisible(infoPtr, newFirstVisible, TRUE); + } + } + } } return TRUE; diff --git a/reactos/dll/win32/comctl32/updown.c b/reactos/dll/win32/comctl32/updown.c index abe5f956951..a4b9271b270 100644 --- a/reactos/dll/win32/comctl32/updown.c +++ b/reactos/dll/win32/comctl32/updown.c @@ -469,6 +469,27 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key) return 0; } +/*********************************************************************** + * UPDOWN_SetRange + * + * Handle UDM_SETRANGE, UDM_SETRANGE32 + * + * FIXME: handle Max == Min properly: + * - arrows should be disabled (without WS_DISABLED set), + * visually they can't be pressed and don't respond; + * - all input messages should still pass in. + */ +static LRESULT UPDOWN_SetRange(UPDOWN_INFO *infoPtr, INT Max, INT Min) +{ + infoPtr->MaxVal = Max; + infoPtr->MinVal = Min; + + TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", + infoPtr->MinVal, infoPtr->MaxVal, infoPtr->Self); + + return 0; +} + /*********************************************************************** * UPDOWN_MouseWheel * @@ -507,6 +528,7 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); + if ((wParam == VK_UP) || (wParam == VK_DOWN)) return 0; } else if (uMsg == WM_MOUSEWHEEL) { HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); @@ -1044,12 +1066,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); case UDM_SETRANGE: - /* we must have: */ - infoPtr->MaxVal = (short)(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */ - infoPtr->MinVal = (short)HIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */ - /* |Max-Min| <= UD_MAXVAL */ - TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", - infoPtr->MinVal, infoPtr->MaxVal, hwnd); + /* we must have: + UD_MINVAL <= Max <= UD_MAXVAL + UD_MINVAL <= Min <= UD_MAXVAL + |Max-Min| <= UD_MAXVAL */ + UPDOWN_SetRange(infoPtr, (short)lParam, (short)HIWORD(lParam)); break; case UDM_GETRANGE32: @@ -1058,12 +1079,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L break; case UDM_SETRANGE32: - infoPtr->MinVal = (INT)wParam; - infoPtr->MaxVal = (INT)lParam; - if (infoPtr->MaxVal <= infoPtr->MinVal) - infoPtr->MaxVal = infoPtr->MinVal + 1; - TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", - infoPtr->MinVal, infoPtr->MaxVal, hwnd); + UPDOWN_SetRange(infoPtr, (INT)lParam, (INT)wParam); break; case UDM_GETPOS32: diff --git a/reactos/dll/win32/comdlg32/cdlg_Lt.rc b/reactos/dll/win32/comdlg32/cdlg_Lt.rc index f551925a660..1610413ce7a 100644 --- a/reactos/dll/win32/comdlg32/cdlg_Lt.rc +++ b/reactos/dll/win32/comdlg32/cdlg_Lt.rc @@ -186,10 +186,10 @@ FONT 8, "MS Shell Dlg" FINDDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 236, 62 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rasti" +CAPTION "Ieškoti" FONT 8, "MS Shell Dlg" { - LTEXT "&Ieškoti ko:", -1, 4, 8, 42, 8 + LTEXT "Ko &ieškoti:", -1, 4, 8, 42, 8 EDITTEXT edt1, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "Tenkina tik &visas žodis", chx1, 4, 26, 82, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "Skirti raidžių &dydį", chx2, 4, 42, 70, 12, BS_AUTOCHECKBOX | WS_TABSTOP @@ -197,7 +197,7 @@ FONT 8, "MS Shell Dlg" CONTROL "&Aukštyn", rad1, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 93, 38, 40, 12 CONTROL "&Žemyn", rad2, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 134, 38, 36, 12 - DEFPUSHBUTTON "&Rasti kitą", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + DEFPUSHBUTTON "Ieškoti &kito", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Atsisakyti", IDCANCEL , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "&Žinynas", pshHelp , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP } @@ -208,14 +208,14 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Pakeisti" FONT 8, "MS Shell Dlg" { - LTEXT "&Ieškoti ko:", -1, 4, 9, 48, 8 + LTEXT "Ko &ieškoti:", -1, 4, 9, 48, 8 EDITTEXT edt1, 54, 7, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "Pa&keisti kuo:", -1, 4, 26, 48, 8 + LTEXT "Kuo pa&keisti:", -1, 4, 26, 48, 8 EDITTEXT edt2, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "Tenkina tik &visas žodis", chx1, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "Skirti raidžių &dydį", chx2, 5, 62, 70, 12, BS_AUTOCHECKBOX | WS_TABSTOP - DEFPUSHBUTTON "&Rasti kitą", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + DEFPUSHBUTTON "Ieškoti &kito", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "&Pakeisti", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "P&akeisti visus", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "Atsisakyti", IDCANCEL , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP diff --git a/reactos/dll/win32/comdlg32/cdlg_Sk.rc b/reactos/dll/win32/comdlg32/cdlg_Sk.rc index 36d2a2a7633..7fbc5a9c66e 100644 --- a/reactos/dll/win32/comdlg32/cdlg_Sk.rc +++ b/reactos/dll/win32/comdlg32/cdlg_Sk.rc @@ -316,13 +316,13 @@ BEGIN AUTORADIOBUTTON "&Landscape", rad2, 16, 190, 52, 12, BS_AUTORADIOBUTTON GROUPBOX "Borders", grp4, 80, 156, 152, 56, BS_GROUPBOX LTEXT "L&eft:", stc15, 88, 172, 21, 8 - EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER LTEXT "&Right:", stc16, 159, 172, 27, 8 - EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER LTEXT "T&op:", stc17, 88, 192, 21, 8 - EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER LTEXT "&Bottom:", stc18, 159, 192, 23, 8 - EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER|ES_NUMBER + EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER DEFPUSHBUTTON "OK", IDOK, 71, 220, 50, 14, BS_PUSHBUTTON PUSHBUTTON "Zrui", IDCANCEL, 126, 220, 50, 14 PUSHBUTTON "P&rinter...", psh3, 184, 220, 48, 14 diff --git a/reactos/dll/win32/comdlg32/filedlg.c b/reactos/dll/win32/comdlg32/filedlg.c index a2826c8103c..8c8e230ea68 100644 --- a/reactos/dll/win32/comdlg32/filedlg.c +++ b/reactos/dll/win32/comdlg32/filedlg.c @@ -37,7 +37,7 @@ * FIXME: add to recent docs * * FIXME: flags not implemented: OFN_DONTADDTORECENT, - * OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, + * OFN_ENABLESIZING, * OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN, * OFN_NOTESTFILECREATE, OFN_USEMONIKERS * @@ -82,8 +82,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #define UNIMPLEMENTED_FLAGS \ -(OFN_DONTADDTORECENT |\ -OFN_ENABLEINCLUDENOTIFY | OFN_ENABLESIZING |\ +(OFN_DONTADDTORECENT | OFN_ENABLESIZING |\ OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\ OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/) @@ -2788,6 +2787,8 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode) iItem = CBGetCurSel(fodInfos->DlgInfos.hwndLookInCB); + if( iItem == CB_ERR) return FALSE; + if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(fodInfos->DlgInfos.hwndLookInCB, iItem))) return FALSE; diff --git a/reactos/dll/win32/comdlg32/filedlgbrowser.c b/reactos/dll/win32/comdlg32/filedlgbrowser.c index 704fb98352a..f630f14781b 100644 --- a/reactos/dll/win32/comdlg32/filedlgbrowser.c +++ b/reactos/dll/win32/comdlg32/filedlgbrowser.c @@ -846,6 +846,47 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBr return NOERROR; } +/* send_includeitem_notification + * + * Sends a CDN_INCLUDEITEM notification for "pidl" to hwndParentDlg + */ +static LRESULT send_includeitem_notification(HWND hwndParentDlg, LPCITEMIDLIST pidl) +{ + LRESULT hook_result = 0; + FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg, FileOpenDlgInfosStr); + + if(!fodInfos) return 0; + + if(fodInfos->DlgInfos.hwndCustomDlg) + { + TRACE("call notify CDN_INCLUDEITEM for pidl=%p\n", pidl); + if(fodInfos->unicode) + { + OFNOTIFYEXW ofnNotify; + ofnNotify.psf = fodInfos->Shell.FOIShellFolder; + ofnNotify.pidl = (LPITEMIDLIST)pidl; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = CDN_INCLUDEITEM; + ofnNotify.lpOFN = fodInfos->ofnInfos; + hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify); + } + else + { + OFNOTIFYEXA ofnNotify; + ofnNotify.psf = fodInfos->Shell.FOIShellFolder; + ofnNotify.pidl = (LPITEMIDLIST)pidl; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = CDN_INCLUDEITEM; + ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; + hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify); + } + } + TRACE("Retval: 0x%08lx\n", hook_result); + return hook_result; +} + /************************************************************************** * IShellBrowserImpl_ICommDlgBrowser_IncludeObject */ @@ -875,6 +916,11 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBr if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) return S_OK; + /* if the application takes care of including the item we are done */ + if(fodInfos->ofnInfos->Flags & OFN_ENABLEINCLUDENOTIFY && + send_includeitem_notification(This->hwndOwner, pidl)) + return S_OK; + /* Check if there is a mask to apply if not */ if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter)) return S_OK; diff --git a/reactos/dll/win32/comdlg32/printdlg.c b/reactos/dll/win32/comdlg32/printdlg.c index b8f4e63e098..6c6109daef6 100644 --- a/reactos/dll/win32/comdlg32/printdlg.c +++ b/reactos/dll/win32/comdlg32/printdlg.c @@ -3414,8 +3414,7 @@ PRINTDLG_PagePaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) */ static LRESULT CALLBACK pagesetup_margin_editproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - switch(msg) - case WM_CHAR: + if (msg == WM_CHAR) { WCHAR decimal = get_decimal_sep(); WCHAR wc = (WCHAR)wparam;