Support TopDown CheckBitmap
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7084 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
788620866d
commit
40451b29d7
5 changed files with 8 additions and 4 deletions
|
@ -75,7 +75,7 @@ If HWND is a window, Gotos jump_if_window, otherwise, Gotos jump_if_not_window (
|
|||
|
||||
\c [/EXERESOURCE] [/STRINGID] [/RESIZETOFIT[WIDTH|HEIGHT]] ctrl imagetype lrflags image
|
||||
|
||||
Loads and sets a image on a static control. \cw{ctrl} is the handle of the control. \cw{imagetype} must 0 for bitmaps and 1 for icons (and the control style must match the image type). \cw{lrflags} must be 0x10 to load from a file or 0 to load from a resource. \cw{image} specifies the file path or resource name. Use \cw{/EXERESOURCE} to load a resource from the installer .EXE. Use \cw{/STRINGID} if \cw{image} is a string, otherwise it is interpreted as a number. Use \cw{/RESIZETOFIT[WIDTH|HEIGHT]} to resize the image to the dimensions of the control.
|
||||
Loads and sets a image on a static control. \cw{ctrl} is the handle of the control. \cw{imagetype} must 0 for bitmaps and 1 for icons (and the control style must match the image type). \cw{lrflags} should be 0x10 to load from a file or 0 to load from a resource. \cw{image} specifies the file path or resource name. Use \cw{/EXERESOURCE} to load a resource from the installer .EXE. Use \cw{/STRINGID} if \cw{image} is a string, otherwise it is interpreted as a number. Use \cw{/RESIZETOFIT[WIDTH|HEIGHT]} to resize the image to the dimensions of the control.
|
||||
|
||||
\c LoadAndSetImage /EXERESOURCE $hIconStatic 1 0 103
|
||||
\c LoadAndSetImage /STRINGID /RESIZETOFITWIDTH $hBmpStatic 0 0x10 "$PluginsDir\myimg.bmp"
|
||||
|
|
|
@ -461,7 +461,8 @@ DWORD GetDIBHeaderInfo(const void*pData, size_t DataSize, GENERICIMAGEINFO&Info)
|
|||
}
|
||||
if (size >= 16) // OS22XBITMAPHEADER/BITMAPINFOHEADER/BITMAPV*HEADER
|
||||
{
|
||||
Info.Width = LE2HE32(p32[1]), Info.Height = (INT32) LE2HE32(p32[2]);
|
||||
Info.Width = LE2HE32(p32[1]), Info.RawHeight = (INT32) LE2HE32(p32[2]);
|
||||
Info.Height = abs(Info.RawHeight);
|
||||
Info.Planes = LE2HE16(p16[6+0]), Info.BPP = LE2HE16(p16[6+1]);
|
||||
return size;
|
||||
}
|
||||
|
@ -475,7 +476,7 @@ DWORD IsBMPFile(const void*pData, size_t DataSize, GENERICIMAGEINFO*pInfo)
|
|||
if (DataSize >= 14+12 && p8[0] == 'B' && p8[1] == 'M')
|
||||
{
|
||||
DWORD *p32 = (DWORD*) (&p8[2]), fsize = LE2HE32(p32[0]), bitsoffs = LE2HE32(p32[2]);
|
||||
if ((!fsize || fsize > 14+12) && (!bitsoffs || bitsoffs > 14+12))
|
||||
if ((!fsize || fsize > 14+12) && (!bitsoffs || bitsoffs >= 14+12))
|
||||
{
|
||||
GENERICIMAGEINFO info;
|
||||
return GetDIBHeaderInfo(p8 + 14, DataSize - 14, pInfo ? *pInfo : info);
|
||||
|
|
|
@ -29,6 +29,7 @@ bool GetDLLVersion(const TCHAR *filepath, DWORD &high, DWORD &low);
|
|||
|
||||
typedef struct {
|
||||
UINT32 Width, Height;
|
||||
INT32 RawHeight;
|
||||
WORD BPP, Planes;
|
||||
} GENERICIMAGEINFO;
|
||||
|
||||
|
|
|
@ -770,6 +770,8 @@ bool CResourceEditor::AddExtraIconFromFile(const WINWCHAR* Type, WINWCHAR* Name,
|
|||
GENERICIMAGEINFO info;
|
||||
if (/*!IsPNGFile(pImg, imgSize, &info) &&*/ !GetDIBHeaderInfo(pImg, imgSize, info)) // Are PNG cursor images allowed?
|
||||
goto fail;
|
||||
//if (info.RawHeight != info.Height && isDib)
|
||||
// goto fail; // Are TopDown DIBs allowed? Probably not but we play it safe.
|
||||
|
||||
typedef struct { WORD x, y; } CURSORIMGHDR; //msdn.microsoft.com/en-us/library/windows/desktop/ms648017(v=vs.85).aspx
|
||||
pCursor = new BYTE[imgSize + 4];
|
||||
|
|
|
@ -1342,7 +1342,7 @@ static INT_PTR CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
|
||||
hTreeItems=(HTREEITEM*)GlobalAlloc(GPTR,sizeof(HTREEITEM)*num_sections);
|
||||
|
||||
hBMcheck1=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
|
||||
hBMcheck1=LoadImage(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); // LR_CREATEDIBSECTION required to load TopDown bitmaps
|
||||
|
||||
last_selected_tree_item=-1;
|
||||
oldTreeWndProc=(WNDPROC)SetWindowLongPtr(hwndTree1,GWLP_WNDPROC,(LONG_PTR)newTreeWndProc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue