Fix Bugzilla Bug 676: dynamic explorer start menu sidebar size Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.h _____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp --- trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp 2005-09-30 16:33:06 UTC (rev 18171) +++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp 2005-09-30 18:48:14 UTC (rev 18172) @@ -1555,12 +1555,18 @@
// ignore exception and don't show additional shortcuts }
+ ReadLogoSize(); +} + +void StartMenuRoot::ReadLogoSize() +{ // read size of logo bitmap BITMAP bmp_hdr; - GetObject(ResBitmap(IDB_LOGOV), sizeof(BITMAP), &bmp_hdr); + GetObject(ResBitmap(GetLogoResId()), sizeof(BITMAP), &bmp_hdr); _logo_size.cx = bmp_hdr.bmWidth; _logo_size.cy = bmp_hdr.bmHeight;
+ // cache logo width _border_left = _logo_size.cx + 1; }
@@ -1776,6 +1782,11 @@ Paint(canvas); break;}
+ case WM_DISPLAYCHANGE: + // re-evaluate logo size using the correct color depth + ReadLogoSize(); + break; + default: return super::WndProc(nmsg, wparam, lparam); } @@ -1785,11 +1796,8 @@
void StartMenuRoot::Paint(PaintCanvas& canvas) { - int clr_bits; - {WindowCanvas dc(_hwnd); clr_bits=GetDeviceCaps(dc, BITSPIXEL);} - MemCanvas mem_dc; - ResBitmap bmp(clr_bits<=8? clr_bits<=4? IDB_LOGOV16: IDB_LOGOV256: IDB_LOGOV); + ResBitmap bmp(GetLogoResId()); BitmapSelection sel(mem_dc, bmp);
ClientRect clnt(_hwnd); @@ -1807,7 +1815,21 @@ super::Paint(canvas); }
+UINT StartMenuRoot::GetLogoResId() +{ + WindowCanvas dc(_hwnd);
+ int clr_bits = GetDeviceCaps(dc, BITSPIXEL); + + if (clr_bits > 8) + return IDB_LOGOV; + else if (clr_bits > 4) + return IDB_LOGOV256; + else + return IDB_LOGOV16; +} + + void StartMenuRoot::CloseStartMenu(int id) { if (_submenu) _____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.h --- trunk/reactos/subsys/system/explorer/taskbar/startmenu.h 2005-09-30 16:33:06 UTC (rev 18171) +++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.h 2005-09-30 18:48:14 UTC (rev 18172) @@ -377,6 +377,9 @@
void Paint(PaintCanvas& canvas); void CloseStartMenu(int id=0); + + void ReadLogoSize(); + UINT GetLogoResId(); };