Use old bitmap on low-bpp displays
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7300 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
0302344430
commit
aca76bc307
4 changed files with 16 additions and 12 deletions
|
@ -56,12 +56,9 @@ int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int
|
|||
if (SDDA) ((BOOL(WINAPI*)(LPCSTR))SDDA)(""); // Remove the current directory from the default DLL search order
|
||||
|
||||
// Try to register the SysLink class
|
||||
DWORD iccestruct[2] = { 8, 0x8000 }; // ICC_LINK_CLASS (ComCtl32v6)
|
||||
BOOL suppw95 = SupportsW95();
|
||||
FARPROC icce = suppw95 ? GetSysProcAddr("COMCTL32", "InitCommonControlsEx") : (FARPROC) InitCommonControlsEx;
|
||||
BOOL succ = (!suppw95 || icce) && ((BOOL(WINAPI*)(const void*))icce)(iccestruct);
|
||||
enum { icc_link_class = 0x8000 }; // ComCtl32v6
|
||||
#if (!defined(_MSC_VER) && !defined(_WIN64)) || (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_IA64))) // x86 or Itanium
|
||||
if (!succ && (sizeof(void*) > 4 || LOBYTE(GetVersion()) >= 5)) // Must check the version because older shell32 versions have a incompatible function at the same ordinal
|
||||
if (!InitCCEx(icc_link_class) && (sizeof(void*) > 4 || LOBYTE(GetVersion()) >= 5)) // Must check the version because older shell32 versions have a incompatible function at the same ordinal
|
||||
{
|
||||
FARPROC lwrc = GetSysProcAddr("SHELL32", (LPCSTR) 258); // LinkWindow_RegisterClass
|
||||
if (lwrc) ((BOOL(WINAPI*)())lwrc)();
|
||||
|
@ -72,8 +69,6 @@ int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int
|
|||
RegisterClass(&wc); // Superclass the old link window class if SysLink is not available
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (succ) {} // Unreferenced variable
|
||||
#endif
|
||||
|
||||
memset(&g_sdata,0,sizeof(NSCRIPTDATA));
|
||||
|
@ -972,7 +967,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
|||
else
|
||||
{
|
||||
dd.AnimPos = finalpos;
|
||||
SetTimer(hwndDlg, ABOUTDLGDATA::TID_HEADER, INFINITE, NULL);
|
||||
KillTimer(hwndDlg, ABOUTDLGDATA::TID_HEADER);
|
||||
}
|
||||
InvalidateRect(GetDlgItem(hwndDlg, IDC_ABOUTHEADER), NULL, false);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,8 @@ static void LoadToolBarImages()
|
|||
else
|
||||
imgsize = 16, iloffs = 0 * iltypecount;
|
||||
|
||||
if (hasCC4_70)
|
||||
UINT dispbpp = GetScreenBPP(hTB);
|
||||
if (hasCC4_70 && dispbpp > 8)
|
||||
{
|
||||
// Version 4.70 => Modern toolbar, 24-bit bitmaps
|
||||
g_toolbar.imagelist = ImageList_LoadImage(g_sdata.hInstance, MAKEINTRESOURCE(g_TBIL[iloffs+0]), imgsize, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
||||
|
@ -111,9 +112,6 @@ static void LoadToolBarImages()
|
|||
SendMessage(hTB, TB_SETIMAGELIST, 0, (LPARAM) g_toolbar.imagelist);
|
||||
SendMessage(hTB, TB_SETDISABLEDIMAGELIST, 0, (LPARAM) g_toolbar.imagelistd);
|
||||
SendMessage(hTB, TB_SETHOTIMAGELIST, 0, (LPARAM) g_toolbar.imagelisth);
|
||||
|
||||
if (hasCC4_71)
|
||||
SendMessage(hTB, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -123,6 +121,7 @@ static void LoadToolBarImages()
|
|||
tbBitmap.nID = IDB_TOOLBAR;
|
||||
SendMessage(hTB, TB_ADDBITMAP, IMAGECOUNT, (LPARAM) &tbBitmap);
|
||||
}
|
||||
if (hasCC4_71) SendMessage(hTB, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
|
||||
}
|
||||
|
||||
void UpdateToolBarCompressorButton()
|
||||
|
@ -200,7 +199,9 @@ static void ShowToolbarDropdownMenu(const NMTOOLBAR&nmtb, HWND hNotifyWnd, HMENU
|
|||
POINT pt;
|
||||
HMENU hMenu = SubMenuId == static_cast<UINT>(-1) ? hParentMenu : FindSubMenu(hParentMenu, SubMenuId);
|
||||
UINT tpmf = GetToolbarDropdownMenuPos(nmtb.hdr.hwndFrom, nmtb.iItem, pt);
|
||||
SendMessage(g_tip.tip, TTM_ACTIVATE, false, 0);
|
||||
TrackPopupMenu(hMenu, tpmf, pt.x, pt.y, 0, hNotifyWnd, NULL);
|
||||
SendMessage(g_tip.tip, TTM_ACTIVATE, true, 0);
|
||||
}
|
||||
|
||||
void ShowCompressorToolbarDropdownMenu(const NMTOOLBAR&nmtb)
|
||||
|
|
|
@ -86,6 +86,13 @@ BOOL InitCCExHelper(UINT icc) {
|
|||
return (!suppw95 || icce) && ((BOOL(WINAPI*)(const INITCOMMONCONTROLSEX*))icce)(&icx);
|
||||
}
|
||||
|
||||
UINT GetScreenBPP(HWND hWnd) {
|
||||
HDC hDc = GetDC(hWnd);
|
||||
UINT bpp = GetDeviceCaps(hDc, BITSPIXEL) * GetDeviceCaps(hDc, PLANES); // TODO: COLORRES if RASTERCAPS&RC_PALETTE?
|
||||
ReleaseDC(hWnd, hDc);
|
||||
return bpp;
|
||||
}
|
||||
|
||||
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv) {
|
||||
const TCHAR *p;
|
||||
TCHAR *arg, *argSpace;
|
||||
|
|
|
@ -58,6 +58,7 @@ BOOL InitCCExHelper(UINT icc);
|
|||
static inline BOOL InitCCEx(UINT icc) { return icc > 0xff ? InitCCExHelper(icc) : true; }
|
||||
static inline UINT SizeOfStruct(const TOOLINFO&x) { return FIELD_OFFSET(TOOLINFO, lParam); }
|
||||
static inline UINT SizeOfStruct(const OPENFILENAME&x) { return sizeof(void*) < 8 ? 76 : sizeof(x); }
|
||||
UINT GetScreenBPP(HWND hWnd = NULL);
|
||||
|
||||
void FreeSpawn(PROCESS_INFORMATION *pPI, HANDLE hRd, HANDLE hWr);
|
||||
BOOL InitSpawn(STARTUPINFO &si, HANDLE &hRd, HANDLE &hWr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue