- links can now spread across several elements
- link information is now shared between file & presentation - first try at handling metafiles
This commit is contained in:
parent
d1ae001774
commit
ddaacaa0d8
|
@ -257,7 +257,8 @@ int main(int argc, char **argv)
|
||||||
if (paragraph->u.text.wFont)
|
if (paragraph->u.text.wFont)
|
||||||
printf(format.end_boldface);
|
printf(format.end_boldface);
|
||||||
break;
|
break;
|
||||||
case para_image:
|
case para_bitmap:
|
||||||
|
case para_metafile:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,11 +333,26 @@ HBITMAP WINAPI CreateDIBitmap(HDC hdc, CONST BITMAPINFOHEADER* bih, DWORD a, CON
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HMETAFILE WINAPI SetMetaFileBitsEx(UINT cbBuffer, CONST BYTE *lpbBuffer)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI DeleteMetaFile(HMETAFILE h)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
HDC WINAPI GetDC(HWND h)
|
HDC WINAPI GetDC(HWND h)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WINAPI ReleaseDC(HWND h, HDC hdc)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL WINAPI DeleteObject(HGDIOBJ h)
|
BOOL WINAPI DeleteObject(HGDIOBJ h)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -30,12 +30,20 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
|
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
|
||||||
|
|
||||||
#define GET_USHORT(buffer, i)\
|
static inline unsigned short GET_USHORT(const BYTE* buffer, unsigned i)
|
||||||
(((BYTE)((buffer)[(i)]) + 0x100 * (BYTE)((buffer)[(i)+1])))
|
{
|
||||||
#define GET_SHORT(buffer, i)\
|
return (BYTE)buffer[i] + 0x100 * (BYTE)buffer[i + 1];
|
||||||
(((BYTE)((buffer)[(i)]) + 0x100 * (signed char)((buffer)[(i)+1])))
|
}
|
||||||
#define GET_UINT(buffer, i)\
|
|
||||||
GET_USHORT(buffer, i) + 0x10000 * GET_USHORT(buffer, i+2)
|
static inline short GET_SHORT(const BYTE* buffer, unsigned i)
|
||||||
|
{
|
||||||
|
return (BYTE)buffer[i] + 0x100 * (signed char)buffer[i+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned GET_UINT(const BYTE* buffer, unsigned i)
|
||||||
|
{
|
||||||
|
return GET_USHORT(buffer, i) + 0x10000 * GET_USHORT(buffer, i + 2);
|
||||||
|
}
|
||||||
|
|
||||||
static HLPFILE *first_hlpfile = 0;
|
static HLPFILE *first_hlpfile = 0;
|
||||||
static BYTE *file_buffer;
|
static BYTE *file_buffer;
|
||||||
|
@ -56,15 +64,11 @@ static struct
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
UINT bDebug;
|
|
||||||
UINT wFont;
|
UINT wFont;
|
||||||
UINT wIndent;
|
UINT wIndent;
|
||||||
UINT wHSpace;
|
UINT wHSpace;
|
||||||
UINT wVSpace;
|
UINT wVSpace;
|
||||||
UINT wVBackSpace;
|
HLPFILE_LINK* link;
|
||||||
HLPFILE_LINK link;
|
|
||||||
HBITMAP hBitmap;
|
|
||||||
UINT bmpPos;
|
|
||||||
} attributes;
|
} attributes;
|
||||||
|
|
||||||
static BOOL HLPFILE_DoReadHlpFile(HLPFILE*, LPCSTR);
|
static BOOL HLPFILE_DoReadHlpFile(HLPFILE*, LPCSTR);
|
||||||
|
@ -99,6 +103,8 @@ HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
|
||||||
|
|
||||||
for (page = hlpfile->first_page; page && wNum; page = page->next) wNum--;
|
for (page = hlpfile->first_page; page && wNum; page = page->next) wNum--;
|
||||||
|
|
||||||
|
/* HLPFILE_FreeHlpFile(lpszPath); */
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +215,7 @@ HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath)
|
||||||
|
|
||||||
for (hlpfile = first_hlpfile; hlpfile; hlpfile = hlpfile->next)
|
for (hlpfile = first_hlpfile; hlpfile; hlpfile = hlpfile->next)
|
||||||
{
|
{
|
||||||
if (!lstrcmp(hlpfile->lpszPath, lpszPath))
|
if (!strcmp(lpszPath, hlpfile->lpszPath))
|
||||||
{
|
{
|
||||||
hlpfile->wRefCount++;
|
hlpfile->wRefCount++;
|
||||||
return hlpfile;
|
return hlpfile;
|
||||||
|
@ -500,44 +506,79 @@ static unsigned short fetch_ushort(BYTE** ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* HLPFILE_LoadPictureByAddr
|
* HLPFILE_DecompressGfx
|
||||||
|
*
|
||||||
|
* Decompress the data part of a bitmap or a metafile
|
||||||
|
*/
|
||||||
|
static BYTE* HLPFILE_DecompressGfx(BYTE* src, unsigned csz, unsigned sz, BYTE packing)
|
||||||
|
{
|
||||||
|
BYTE* dst;
|
||||||
|
BYTE* tmp;
|
||||||
|
BYTE* tmp2;
|
||||||
|
unsigned sz77;
|
||||||
|
|
||||||
|
WINE_TRACE("Unpacking (%d) from %u bytes to %u bytes\n", packing, csz, sz);
|
||||||
|
|
||||||
|
switch (packing)
|
||||||
|
{
|
||||||
|
case 0: /* uncompressed */
|
||||||
|
if (sz != csz)
|
||||||
|
WINE_WARN("Bogus gfx sizes: %u / %u\n", sz, csz);
|
||||||
|
dst = src;
|
||||||
|
break;
|
||||||
|
case 1: /* RunLen */
|
||||||
|
tmp = dst = HeapAlloc(GetProcessHeap(), 0, sz);
|
||||||
|
if (!dst) return NULL;
|
||||||
|
HLPFILE_UncompressRLE(src, csz, &tmp);
|
||||||
|
if (tmp - dst != sz)
|
||||||
|
WINE_FIXME("Bogus gfx sizes: %u/%u\n", tmp - dst, sz);
|
||||||
|
break;
|
||||||
|
case 2: /* LZ77 */
|
||||||
|
sz77 = HLPFILE_UncompressedLZ77_Size(src, src + csz);
|
||||||
|
dst = HeapAlloc(GetProcessHeap(), 0, sz77);
|
||||||
|
if (!dst) return NULL;
|
||||||
|
HLPFILE_UncompressLZ77(src, src + csz, dst);
|
||||||
|
if (sz77 != sz)
|
||||||
|
WINE_WARN("Bogus gfx sizes: %u / %u\n", sz77, sz);
|
||||||
|
break;
|
||||||
|
case 3: /* LZ77 then RLE */
|
||||||
|
sz77 = HLPFILE_UncompressedLZ77_Size(src, src + csz);
|
||||||
|
tmp = HeapAlloc(GetProcessHeap(), 0, sz/*sz77*/);
|
||||||
|
if (!tmp) return FALSE;
|
||||||
|
HLPFILE_UncompressLZ77(src, src + csz, tmp);
|
||||||
|
dst = tmp2 = HeapAlloc(GetProcessHeap(), 0, sz);
|
||||||
|
if (!dst) return FALSE;
|
||||||
|
HLPFILE_UncompressRLE(tmp, sz77, &tmp2);
|
||||||
|
if (tmp2 - dst != sz)
|
||||||
|
WINE_WARN("Bogus gfx: %u / %u\n", tmp2 - dst, sz);
|
||||||
|
HeapFree(GetProcessHeap(), 0, tmp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WINE_FIXME("Unsupported packing %u\n", packing);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* HLPFILE_LoadBitmap
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static BOOL HLPFILE_LoadPictureByAddr(HLPFILE *hlpfile, char* ref,
|
static BOOL HLPFILE_LoadBitmap(BYTE* beg, BYTE type, BYTE pack,
|
||||||
unsigned long size, unsigned pos)
|
HLPFILE_PARAGRAPH* paragraph)
|
||||||
{
|
{
|
||||||
unsigned i, numpict;
|
BYTE* ptr;
|
||||||
|
BYTE* pict_beg;
|
||||||
numpict = *(unsigned short*)(ref + 2);
|
|
||||||
WINE_TRACE("Got picture magic=%04x #=%d\n",
|
|
||||||
*(unsigned short*)ref, numpict);
|
|
||||||
|
|
||||||
for (i = 0; i < numpict; i++)
|
|
||||||
{
|
|
||||||
BYTE *beg, *ptr;
|
|
||||||
BYTE *pict_beg;
|
|
||||||
BYTE type, pack;
|
|
||||||
BITMAPINFO* bi;
|
BITMAPINFO* bi;
|
||||||
unsigned long off, sz;
|
unsigned long off, csz;
|
||||||
|
HDC hdc;
|
||||||
WINE_TRACE("Offset[%d] = %lx\n", i, ((unsigned long*)ref)[1 + i]);
|
|
||||||
ptr = beg = ref + ((unsigned long*)ref)[1 + i];
|
|
||||||
|
|
||||||
type = *ptr++;
|
|
||||||
pack = *ptr++;
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case 5: /* device dependent bmp */ break;
|
|
||||||
case 6: /* device independent bmp */ break;
|
|
||||||
case 8: WINE_FIXME("Unsupported metafile\n"); return FALSE;
|
|
||||||
default: WINE_FIXME("Unknown type %u\n", type); return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bi = HeapAlloc(GetProcessHeap(), 0, sizeof(*bi));
|
bi = HeapAlloc(GetProcessHeap(), 0, sizeof(*bi));
|
||||||
if (!bi) return FALSE;
|
if (!bi) return FALSE;
|
||||||
|
|
||||||
|
ptr = beg + 2; /* for type and pack */
|
||||||
|
|
||||||
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
|
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
|
||||||
bi->bmiHeader.biXPelsPerMeter = fetch_ulong(&ptr);
|
bi->bmiHeader.biXPelsPerMeter = fetch_ulong(&ptr);
|
||||||
bi->bmiHeader.biYPelsPerMeter = fetch_ulong(&ptr);
|
bi->bmiHeader.biYPelsPerMeter = fetch_ulong(&ptr);
|
||||||
|
@ -552,11 +593,11 @@ static BOOL HLPFILE_LoadPictureByAddr(HLPFILE *hlpfile, char* ref,
|
||||||
if (bi->bmiHeader.biPlanes != 1) WINE_FIXME("Unsupported planes %u\n", bi->bmiHeader.biPlanes);
|
if (bi->bmiHeader.biPlanes != 1) WINE_FIXME("Unsupported planes %u\n", bi->bmiHeader.biPlanes);
|
||||||
bi->bmiHeader.biSizeImage = (((bi->bmiHeader.biWidth * bi->bmiHeader.biBitCount + 31) & ~31) / 8) * bi->bmiHeader.biHeight;
|
bi->bmiHeader.biSizeImage = (((bi->bmiHeader.biWidth * bi->bmiHeader.biBitCount + 31) & ~31) / 8) * bi->bmiHeader.biHeight;
|
||||||
|
|
||||||
sz = fetch_ulong(&ptr);
|
csz = fetch_ulong(&ptr);
|
||||||
fetch_ulong(&ptr); /* hotspot size */
|
fetch_ulong(&ptr); /* hotspot size */
|
||||||
|
|
||||||
off = *(unsigned long*)ptr; ptr += 4;
|
off = GET_UINT(ptr, 0); ptr += 4;
|
||||||
/* *(unsigned long*)ptr; hotspot offset */ ptr += 4;
|
/* GET_UINT(ptr, 0); hotspot offset */ ptr += 4;
|
||||||
|
|
||||||
/* now read palette info */
|
/* now read palette info */
|
||||||
if (type == 0x06)
|
if (type == 0x06)
|
||||||
|
@ -579,77 +620,115 @@ static BOOL HLPFILE_LoadPictureByAddr(HLPFILE *hlpfile, char* ref,
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pict_beg = HLPFILE_DecompressGfx(beg + off, csz, bi->bmiHeader.biSizeImage, pack);
|
||||||
|
|
||||||
switch (pack)
|
paragraph->u.gfx.u.bmp.hBitmap = CreateDIBitmap(hdc = GetDC(0), &bi->bmiHeader,
|
||||||
{
|
CBM_INIT, pict_beg,
|
||||||
case 0: /* uncompressed */
|
bi, DIB_RGB_COLORS);
|
||||||
pict_beg = beg + off;
|
ReleaseDC(0, hdc);
|
||||||
if (sz != bi->bmiHeader.biSizeImage)
|
if (!paragraph->u.gfx.u.bmp.hBitmap)
|
||||||
WINE_WARN("Bogus image sizes: %lu / %lu [sz=(%lu,%lu) bc=%u pl=%u]\n",
|
|
||||||
sz, bi->bmiHeader.biSizeImage,
|
|
||||||
bi->bmiHeader.biWidth, bi->bmiHeader.biHeight,
|
|
||||||
bi->bmiHeader.biBitCount, bi->bmiHeader.biPlanes);
|
|
||||||
break;
|
|
||||||
case 1: /* RunLen */
|
|
||||||
{
|
|
||||||
BYTE* dst;
|
|
||||||
|
|
||||||
dst = pict_beg = HeapAlloc(GetProcessHeap(), 0, bi->bmiHeader.biSizeImage);
|
|
||||||
if (!pict_beg) return FALSE;
|
|
||||||
HLPFILE_UncompressRLE(beg + off, sz, &dst);
|
|
||||||
if (dst - pict_beg != bi->bmiHeader.biSizeImage)
|
|
||||||
WINE_FIXME("buffer XXX-flow (%u/%lu)\n", dst - pict_beg, bi->bmiHeader.biSizeImage);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2: /* LZ77 */
|
|
||||||
{
|
|
||||||
unsigned long esz;
|
|
||||||
esz = HLPFILE_UncompressedLZ77_Size(beg + off, beg + off + sz);
|
|
||||||
pict_beg = HeapAlloc(GetProcessHeap(), 0, esz);
|
|
||||||
if (!pict_beg) return FALSE;
|
|
||||||
HLPFILE_UncompressLZ77(beg + off, beg + off + sz, pict_beg);
|
|
||||||
if (esz != bi->bmiHeader.biSizeImage)
|
|
||||||
WINE_WARN("Bogus image sizes: %lu / %lu [sz=(%lu,%lu) bc=%u pl=%u]\n",
|
|
||||||
esz, bi->bmiHeader.biSizeImage,
|
|
||||||
bi->bmiHeader.biWidth, bi->bmiHeader.biHeight,
|
|
||||||
bi->bmiHeader.biBitCount, bi->bmiHeader.biPlanes);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3: /* LZ77 then RLE */
|
|
||||||
{
|
|
||||||
BYTE* tmp;
|
|
||||||
unsigned long sz77;
|
|
||||||
BYTE* dst;
|
|
||||||
|
|
||||||
sz77 = HLPFILE_UncompressedLZ77_Size(beg + off, beg + off + sz);
|
|
||||||
tmp = HeapAlloc(GetProcessHeap(), 0, bi->bmiHeader.biSizeImage);
|
|
||||||
if (!tmp) return FALSE;
|
|
||||||
HLPFILE_UncompressLZ77(beg + off, beg + off + sz, tmp);
|
|
||||||
pict_beg = dst = HeapAlloc(GetProcessHeap(), 0, bi->bmiHeader.biSizeImage);
|
|
||||||
if (!pict_beg) return FALSE;
|
|
||||||
HLPFILE_UncompressRLE(tmp, sz77, &dst);
|
|
||||||
if (dst - pict_beg != bi->bmiHeader.biSizeImage)
|
|
||||||
WINE_WARN("Bogus image sizes: %u / %lu [sz=(%lu,%lu) bc=%u pl=%u]\n",
|
|
||||||
dst - pict_beg, bi->bmiHeader.biSizeImage,
|
|
||||||
bi->bmiHeader.biWidth, bi->bmiHeader.biHeight,
|
|
||||||
bi->bmiHeader.biBitCount, bi->bmiHeader.biPlanes);
|
|
||||||
HeapFree(GetProcessHeap(), 0, tmp);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
WINE_FIXME("Unsupported packing %u\n", pack);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes.hBitmap = CreateDIBitmap(GetDC(0), &bi->bmiHeader, CBM_INIT,
|
|
||||||
pict_beg, bi, DIB_RGB_COLORS);
|
|
||||||
if (!attributes.hBitmap)
|
|
||||||
WINE_ERR("Couldn't create bitmap\n");
|
WINE_ERR("Couldn't create bitmap\n");
|
||||||
attributes.bmpPos = pos;
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, bi);
|
HeapFree(GetProcessHeap(), 0, bi);
|
||||||
if (pict_beg != beg + off) HeapFree(GetProcessHeap(), 0, pict_beg);
|
if (pict_beg != beg + off) HeapFree(GetProcessHeap(), 0, pict_beg);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* HLPFILE_LoadMetaFile
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* paragraph)
|
||||||
|
{
|
||||||
|
BYTE* ptr;
|
||||||
|
unsigned long size, csize;
|
||||||
|
unsigned long off, hsoff;
|
||||||
|
BYTE* bits;
|
||||||
|
METAFILEPICT mfp;
|
||||||
|
|
||||||
|
WINE_TRACE("Loading metafile\n");
|
||||||
|
|
||||||
|
ptr = beg + 2; /* for type and pack */
|
||||||
|
|
||||||
|
mfp.mm = fetch_ushort(&ptr); /* mapping mode */
|
||||||
|
|
||||||
|
mfp.xExt = GET_USHORT(ptr, 0);
|
||||||
|
mfp.yExt = GET_USHORT(ptr, 2);
|
||||||
|
ptr += 4;
|
||||||
|
|
||||||
|
size = fetch_ulong(&ptr); /* decompressed size */
|
||||||
|
csize = fetch_ulong(&ptr); /* compressed size */
|
||||||
|
fetch_ulong(&ptr); /* hotspot size */
|
||||||
|
off = GET_UINT(ptr, 0);
|
||||||
|
hsoff = GET_UINT(ptr, 4);
|
||||||
|
ptr += 8;
|
||||||
|
|
||||||
|
WINE_FIXME("sz=%lu csz=%lu (%ld,%ld) offs=%lu/%u,%lu\n",
|
||||||
|
size, csize, mfp.xExt, mfp.yExt, off, ptr - beg, hsoff);
|
||||||
|
|
||||||
|
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
|
||||||
|
if (!bits) return FALSE;
|
||||||
|
|
||||||
|
paragraph->cookie = para_metafile;
|
||||||
|
|
||||||
|
mfp.hMF = NULL;
|
||||||
|
|
||||||
|
paragraph->u.gfx.u.mf.hMetaFile = SetMetaFileBitsEx(size, bits);
|
||||||
|
|
||||||
|
if (!paragraph->u.gfx.u.mf.hMetaFile)
|
||||||
|
WINE_FIXME("Couldn't load metafile\n");
|
||||||
|
|
||||||
|
if (bits != beg + off) HeapFree(GetProcessHeap(), 0, bits);
|
||||||
|
|
||||||
|
paragraph->u.gfx.u.mf.mfSize.cx = mfp.xExt;
|
||||||
|
paragraph->u.gfx.u.mf.mfSize.cy = mfp.yExt;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* HLPFILE_LoadGfxByAddr
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static BOOL HLPFILE_LoadGfxByAddr(HLPFILE *hlpfile, BYTE* ref,
|
||||||
|
unsigned long size,
|
||||||
|
HLPFILE_PARAGRAPH* paragraph)
|
||||||
|
{
|
||||||
|
unsigned i, numpict;
|
||||||
|
|
||||||
|
numpict = GET_USHORT(ref, 2);
|
||||||
|
WINE_TRACE("Got picture magic=%04x #=%d\n",
|
||||||
|
GET_USHORT(ref, 0), numpict);
|
||||||
|
|
||||||
|
for (i = 0; i < numpict; i++)
|
||||||
|
{
|
||||||
|
BYTE* beg;
|
||||||
|
BYTE* ptr;
|
||||||
|
BYTE type, pack;
|
||||||
|
|
||||||
|
WINE_TRACE("Offset[%d] = %x\n", i, GET_UINT(ref, (1 + i) * 4));
|
||||||
|
beg = ptr = ref + GET_UINT(ref, (1 + i) * 4);
|
||||||
|
|
||||||
|
type = *ptr++;
|
||||||
|
pack = *ptr++;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 5: /* device dependent bmp */
|
||||||
|
case 6: /* device independent bmp */
|
||||||
|
HLPFILE_LoadBitmap(beg, type, pack, paragraph);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
HLPFILE_LoadMetaFile(beg, pack, paragraph);
|
||||||
|
break;
|
||||||
|
default: WINE_FIXME("Unknown type %u\n", type); return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: hotspots */
|
||||||
|
|
||||||
/* FIXME: implement support for multiple picture format */
|
/* FIXME: implement support for multiple picture format */
|
||||||
if (numpict != 1) WINE_FIXME("Supporting only one bitmap format per logical bitmap (for now). Using first format\n");
|
if (numpict != 1) WINE_FIXME("Supporting only one bitmap format per logical bitmap (for now). Using first format\n");
|
||||||
break;
|
break;
|
||||||
|
@ -658,21 +737,22 @@ static BOOL HLPFILE_LoadPictureByAddr(HLPFILE *hlpfile, char* ref,
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* HLPFILE_LoadPictureByIndex
|
* HLPFILE_LoadGfxByIndex
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static BOOL HLPFILE_LoadPictureByIndex(HLPFILE *hlpfile, unsigned index, unsigned pos)
|
static BOOL HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
|
||||||
|
HLPFILE_PARAGRAPH* paragraph)
|
||||||
{
|
{
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
BYTE *ref, *end;
|
BYTE *ref, *end;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
WINE_TRACE("Loading picture #%d\n", index);
|
WINE_TRACE("Loading picture #%d\n", index);
|
||||||
|
|
||||||
if (index < hlpfile->numBmps && hlpfile->bmps[index] != NULL)
|
if (index < hlpfile->numBmps && hlpfile->bmps[index] != NULL)
|
||||||
{
|
{
|
||||||
attributes.hBitmap = hlpfile->bmps[index];
|
paragraph->u.gfx.u.bmp.hBitmap = hlpfile->bmps[index];
|
||||||
attributes.bmpPos = pos;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,10 +762,10 @@ static BOOL HLPFILE_LoadPictureByIndex(HLPFILE *hlpfile, unsigned index, uns
|
||||||
|
|
||||||
ref += 9;
|
ref += 9;
|
||||||
|
|
||||||
ret = HLPFILE_LoadPictureByAddr(hlpfile, ref, end - ref, pos);
|
ret = HLPFILE_LoadGfxByAddr(hlpfile, ref, end - ref, paragraph);
|
||||||
|
|
||||||
/* cache bitmap */
|
/* cache bitmap */
|
||||||
if (ret)
|
if (ret && paragraph->cookie == para_bitmap)
|
||||||
{
|
{
|
||||||
if (index >= hlpfile->numBmps)
|
if (index >= hlpfile->numBmps)
|
||||||
{
|
{
|
||||||
|
@ -693,11 +773,41 @@ static BOOL HLPFILE_LoadPictureByIndex(HLPFILE *hlpfile, unsigned index, uns
|
||||||
hlpfile->bmps = HeapReAlloc(GetProcessHeap(), 0, hlpfile->bmps,
|
hlpfile->bmps = HeapReAlloc(GetProcessHeap(), 0, hlpfile->bmps,
|
||||||
hlpfile->numBmps * sizeof(hlpfile->bmps[0]));
|
hlpfile->numBmps * sizeof(hlpfile->bmps[0]));
|
||||||
}
|
}
|
||||||
hlpfile->bmps[index] = attributes.hBitmap;
|
hlpfile->bmps[index] = paragraph->u.gfx.u.bmp.hBitmap;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* HLPFILE_AllocLink
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static HLPFILE_LINK* HLPFILE_AllocLink(int cookie, const char* str, LONG hash,
|
||||||
|
BOOL clrChange, unsigned wnd)
|
||||||
|
{
|
||||||
|
HLPFILE_LINK* link;
|
||||||
|
|
||||||
|
/* FIXME: should build a string table for the attributes.link.lpszPath
|
||||||
|
* they are reallocated for each link
|
||||||
|
*/
|
||||||
|
link = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_LINK) + strlen(str) + 1);
|
||||||
|
if (!link) return NULL;
|
||||||
|
|
||||||
|
link->cookie = cookie;
|
||||||
|
link->lpszString = (char*)link + sizeof(HLPFILE_LINK);
|
||||||
|
strcpy((char*)link->lpszString, str);
|
||||||
|
link->lHash = hash;
|
||||||
|
link->bClrChange = clrChange ? 1 : 0;
|
||||||
|
link->window = wnd;
|
||||||
|
link->wRefCount = 1;
|
||||||
|
|
||||||
|
WINE_TRACE("Link[%d] to %s@%08lx:%d\n",
|
||||||
|
link->cookie, link->lpszString,
|
||||||
|
link->lHash, link->window);
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* HLPFILE_AddParagraph
|
* HLPFILE_AddParagraph
|
||||||
|
@ -766,7 +876,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
if (buf[0x14] == 0x23)
|
if (buf[0x14] == 0x23)
|
||||||
format += 5;
|
format += 5;
|
||||||
format += 4;
|
format += 4;
|
||||||
bits = *(unsigned short*)format; format += 2;
|
bits = GET_USHORT(format, 0); format += 2;
|
||||||
if (bits & 0x0001) fetch_long(&format);
|
if (bits & 0x0001) fetch_long(&format);
|
||||||
if (bits & 0x0002) fetch_short(&format);
|
if (bits & 0x0002) fetch_short(&format);
|
||||||
if (bits & 0x0004) fetch_short(&format);
|
if (bits & 0x0004) fetch_short(&format);
|
||||||
|
@ -794,7 +904,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
{
|
{
|
||||||
WINE_TRACE("Got text: '%s' (%p/%p - %p/%p)\n", text, text, text_end, format, format_end);
|
WINE_TRACE("Got text: '%s' (%p/%p - %p/%p)\n", text, text, text_end, format, format_end);
|
||||||
textsize = strlen(text) + 1;
|
textsize = strlen(text) + 1;
|
||||||
if (textsize > 1 || attributes.hBitmap)
|
if (textsize > 1)
|
||||||
{
|
{
|
||||||
paragraph = HeapAlloc(GetProcessHeap(), 0,
|
paragraph = HeapAlloc(GetProcessHeap(), 0,
|
||||||
sizeof(HLPFILE_PARAGRAPH) + textsize);
|
sizeof(HLPFILE_PARAGRAPH) + textsize);
|
||||||
|
@ -803,54 +913,18 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
paragraphptr = ¶graph->next;
|
paragraphptr = ¶graph->next;
|
||||||
|
|
||||||
paragraph->next = NULL;
|
paragraph->next = NULL;
|
||||||
paragraph->link = NULL;
|
paragraph->link = attributes.link;
|
||||||
|
if (paragraph->link) paragraph->link->wRefCount++;
|
||||||
if (attributes.hBitmap)
|
paragraph->cookie = para_normal_text;
|
||||||
{
|
|
||||||
paragraph->cookie = para_image;
|
|
||||||
paragraph->u.image.hBitmap = attributes.hBitmap;
|
|
||||||
paragraph->u.image.pos = attributes.bmpPos;
|
|
||||||
if (attributes.wVSpace) paragraph->u.image.pos |= 0x8000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
paragraph->cookie = (attributes.bDebug) ? para_debug_text : para_normal_text;
|
|
||||||
paragraph->u.text.wFont = attributes.wFont;
|
paragraph->u.text.wFont = attributes.wFont;
|
||||||
paragraph->u.text.wVSpace = attributes.wVSpace;
|
paragraph->u.text.wVSpace = attributes.wVSpace;
|
||||||
paragraph->u.text.wHSpace = attributes.wHSpace;
|
paragraph->u.text.wHSpace = attributes.wHSpace;
|
||||||
paragraph->u.text.wIndent = attributes.wIndent;
|
paragraph->u.text.wIndent = attributes.wIndent;
|
||||||
paragraph->u.text.lpszText = (char*)paragraph + sizeof(HLPFILE_PARAGRAPH);
|
paragraph->u.text.lpszText = (char*)paragraph + sizeof(HLPFILE_PARAGRAPH);
|
||||||
strcpy(paragraph->u.text.lpszText, text);
|
strcpy(paragraph->u.text.lpszText, text);
|
||||||
}
|
|
||||||
|
|
||||||
if (attributes.link.lpszString)
|
|
||||||
{
|
|
||||||
/* FIXME: should build a string table for the attributes.link.lpszPath
|
|
||||||
* they are reallocated for each link
|
|
||||||
*/
|
|
||||||
paragraph->link = HeapAlloc(GetProcessHeap(), 0,
|
|
||||||
sizeof(HLPFILE_LINK) + strlen(attributes.link.lpszString) + 1);
|
|
||||||
if (!paragraph->link) return FALSE;
|
|
||||||
|
|
||||||
paragraph->link->cookie = attributes.link.cookie;
|
|
||||||
paragraph->link->lpszString = (char*)paragraph->link + sizeof(HLPFILE_LINK);
|
|
||||||
strcpy((char*)paragraph->link->lpszString, attributes.link.lpszString);
|
|
||||||
paragraph->link->lHash = attributes.link.lHash;
|
|
||||||
paragraph->link->bClrChange = attributes.link.bClrChange;
|
|
||||||
paragraph->link->window = attributes.link.window;
|
|
||||||
|
|
||||||
WINE_TRACE("Link[%d] to %s@%08lx:%d\n",
|
|
||||||
paragraph->link->cookie, paragraph->link->lpszString,
|
|
||||||
paragraph->link->lHash, paragraph->link->window);
|
|
||||||
}
|
|
||||||
attributes.hBitmap = 0;
|
|
||||||
attributes.link.lpszString = NULL;
|
|
||||||
attributes.link.bClrChange = FALSE;
|
|
||||||
attributes.link.lHash = 0;
|
|
||||||
attributes.link.window = -1;
|
|
||||||
attributes.wVSpace = 0;
|
attributes.wVSpace = 0;
|
||||||
attributes.wHSpace = 0;
|
attributes.wHSpace = 0;
|
||||||
attributes.wIndent = 0;
|
|
||||||
}
|
}
|
||||||
/* else: null text, keep on storing attributes */
|
/* else: null text, keep on storing attributes */
|
||||||
text += textsize;
|
text += textsize;
|
||||||
|
@ -886,8 +960,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x82:
|
case 0x82:
|
||||||
attributes.wVSpace += 2 - attributes.wVBackSpace;
|
attributes.wVSpace++;
|
||||||
attributes.wVBackSpace = 0;
|
|
||||||
attributes.wIndent = 0;
|
attributes.wIndent = 0;
|
||||||
format += 1;
|
format += 1;
|
||||||
break;
|
break;
|
||||||
|
@ -914,26 +987,38 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
format += 2;
|
format += 2;
|
||||||
size = fetch_long(&format);
|
size = fetch_long(&format);
|
||||||
|
|
||||||
|
paragraph = HeapAlloc(GetProcessHeap(), 0,
|
||||||
|
sizeof(HLPFILE_PARAGRAPH) + textsize);
|
||||||
|
if (!paragraph) return FALSE;
|
||||||
|
*paragraphptr = paragraph;
|
||||||
|
paragraphptr = ¶graph->next;
|
||||||
|
|
||||||
|
paragraph->next = NULL;
|
||||||
|
paragraph->link = attributes.link;
|
||||||
|
if (paragraph->link) paragraph->link->wRefCount++;
|
||||||
|
paragraph->cookie = para_bitmap;
|
||||||
|
paragraph->u.gfx.pos = pos;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0x22:
|
case 0x22:
|
||||||
fetch_ushort(&format); /* hot spot */
|
fetch_ushort(&format); /* hot spot */
|
||||||
/* fall thru */
|
/* fall thru */
|
||||||
case 0x03:
|
case 0x03:
|
||||||
switch (*(short*)format)
|
switch (GET_SHORT(format, 0))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
HLPFILE_LoadPictureByIndex(hlpfile,
|
HLPFILE_LoadGfxByIndex(hlpfile, GET_SHORT(format, 2),
|
||||||
*(short*)(format + 2), pos);
|
paragraph);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
WINE_FIXME("does it work ??? %x<%lu>#%u\n",
|
WINE_FIXME("does it work ??? %x<%lu>#%u\n",
|
||||||
*(short*)format, size, *(short*)(format+2));
|
GET_SHORT(format, 0),
|
||||||
HLPFILE_LoadPictureByAddr(hlpfile, format + 2,
|
size, GET_SHORT(format, 2));
|
||||||
size - 4, pos);
|
HLPFILE_LoadGfxByAddr(hlpfile, format + 2, size - 4,
|
||||||
|
paragraph);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WINE_FIXME("??? %u\n", *(short*)format);
|
WINE_FIXME("??? %u\n", GET_SHORT(format, 0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -944,12 +1029,15 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
WINE_FIXME("Got a type %d picture\n", type);
|
WINE_FIXME("Got a type %d picture\n", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (attributes.wVSpace) paragraph->u.gfx.pos |= 0x8000;
|
||||||
|
|
||||||
format += size;
|
format += size;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x89:
|
case 0x89:
|
||||||
attributes.wVBackSpace++;
|
HLPFILE_FreeLink(attributes.link);
|
||||||
|
attributes.link = NULL;
|
||||||
format += 1;
|
format += 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -968,9 +1056,9 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
case 0xC8:
|
case 0xC8:
|
||||||
case 0xCC:
|
case 0xCC:
|
||||||
WINE_TRACE("macro => %s\n", format + 3);
|
WINE_TRACE("macro => %s\n", format + 3);
|
||||||
attributes.link.bClrChange = !(*format & 4);
|
HLPFILE_FreeLink(attributes.link);
|
||||||
attributes.link.cookie = hlp_link_macro;
|
attributes.link = HLPFILE_AllocLink(hlp_link_macro, format + 3,
|
||||||
attributes.link.lpszString = format + 3;
|
0, !(*format & 4), -1);
|
||||||
format += 3 + GET_USHORT(format, 1);
|
format += 3 + GET_USHORT(format, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -982,13 +1070,13 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
|
|
||||||
case 0xE2:
|
case 0xE2:
|
||||||
case 0xE3:
|
case 0xE3:
|
||||||
attributes.link.bClrChange = TRUE;
|
|
||||||
/* fall thru */
|
|
||||||
case 0xE6:
|
case 0xE6:
|
||||||
case 0xE7:
|
case 0xE7:
|
||||||
attributes.link.cookie = (*format & 1) ? hlp_link_link : hlp_link_popup;
|
HLPFILE_FreeLink(attributes.link);
|
||||||
attributes.link.lpszString = hlpfile->lpszPath;
|
attributes.link = HLPFILE_AllocLink((*format & 1) ? hlp_link_link : hlp_link_popup,
|
||||||
attributes.link.lHash = GET_UINT(format, 1);
|
hlpfile->lpszPath,
|
||||||
|
GET_UINT(format, 1),
|
||||||
|
!(*format & 4), -1);
|
||||||
format += 5;
|
format += 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -999,35 +1087,30 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
|
||||||
{
|
{
|
||||||
char* ptr = format + 8;
|
char* ptr = format + 8;
|
||||||
BYTE type = format[3];
|
BYTE type = format[3];
|
||||||
|
int wnd = -1;
|
||||||
|
char* str;
|
||||||
|
|
||||||
attributes.link.cookie = hlp_link_link;
|
if (type == 1) wnd = *ptr++;
|
||||||
attributes.link.lHash = GET_UINT(format, 4);
|
|
||||||
attributes.link.bClrChange = !(*format & 1);
|
|
||||||
|
|
||||||
if (type == 1)
|
|
||||||
attributes.link.window = *ptr++;
|
|
||||||
if (type == 4 || type == 6)
|
if (type == 4 || type == 6)
|
||||||
{
|
{
|
||||||
attributes.link.lpszString = ptr;
|
str = ptr;
|
||||||
ptr += strlen(ptr) + 1;
|
ptr += strlen(ptr) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
attributes.link.lpszString = hlpfile->lpszPath;
|
str = hlpfile->lpszPath;
|
||||||
if (type == 6)
|
if (type == 6)
|
||||||
{
|
{
|
||||||
int i;
|
for (wnd = hlpfile->numWindows - 1; wnd >= 0; wnd--)
|
||||||
|
|
||||||
for (i = 0; i < hlpfile->numWindows; i++)
|
|
||||||
{
|
{
|
||||||
if (!strcmp(ptr, hlpfile->windows[i].name))
|
if (!strcmp(ptr, hlpfile->windows[wnd].name)) break;
|
||||||
{
|
|
||||||
attributes.link.window = i;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
if (wnd == -1)
|
||||||
if (attributes.link.window == -1)
|
|
||||||
WINE_WARN("Couldn't find window info for %s\n", ptr);
|
WINE_WARN("Couldn't find window info for %s\n", ptr);
|
||||||
}
|
}
|
||||||
|
HLPFILE_FreeLink(attributes.link);
|
||||||
|
attributes.link = HLPFILE_AllocLink((*format & 4) ? hlp_link_link : hlp_link_popup,
|
||||||
|
str, GET_UINT(format, 4),
|
||||||
|
!(*format & 1), wnd);
|
||||||
}
|
}
|
||||||
format += 3 + GET_USHORT(format, 1);
|
format += 3 + GET_USHORT(format, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -1107,7 +1190,7 @@ static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile)
|
||||||
case 0x05: hlpfile->fonts[i].LogFont.lfPitchAndFamily |= FF_DECORATIVE; break;
|
case 0x05: hlpfile->fonts[i].LogFont.lfPitchAndFamily |= FF_DECORATIVE; break;
|
||||||
default: WINE_FIXME("Unknown family %u\n", family);
|
default: WINE_FIXME("Unknown family %u\n", family);
|
||||||
}
|
}
|
||||||
idx = *(unsigned short*)(ref + dscr_offset + i * 11 + 3);
|
idx = GET_USHORT(ref, dscr_offset + i * 11 + 3);
|
||||||
|
|
||||||
if (idx < face_num)
|
if (idx < face_num)
|
||||||
{
|
{
|
||||||
|
@ -1124,7 +1207,7 @@ static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile)
|
||||||
ref[dscr_offset + i * 11 + 6],
|
ref[dscr_offset + i * 11 + 6],
|
||||||
ref[dscr_offset + i * 11 + 7]);
|
ref[dscr_offset + i * 11 + 7]);
|
||||||
#define X(b,s) ((flag & (1 << b)) ? "-"s: "")
|
#define X(b,s) ((flag & (1 << b)) ? "-"s: "")
|
||||||
WINE_TRACE("Font[%d]: flags=%02x%s%s%s%s%s%s pSize=%u family=%u face=%s[%u] color=%08lx\n",
|
WINE_TRACE("Font[%d]: flags=%02x%s%s%s%s%s%s pSize=%u family=%u face=%s[%u] color=%08x\n",
|
||||||
i, flag,
|
i, flag,
|
||||||
X(0, "bold"),
|
X(0, "bold"),
|
||||||
X(1, "italic"),
|
X(1, "italic"),
|
||||||
|
@ -1135,7 +1218,7 @@ static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile)
|
||||||
ref[dscr_offset + i * 11 + 1],
|
ref[dscr_offset + i * 11 + 1],
|
||||||
family,
|
family,
|
||||||
hlpfile->fonts[i].LogFont.lfFaceName, idx,
|
hlpfile->fonts[i].LogFont.lfFaceName, idx,
|
||||||
*(unsigned long*)(ref + dscr_offset + i * 11 + 5) & 0x00FFFFFF);
|
GET_UINT(ref, dscr_offset + i * 11 + 5) & 0x00FFFFFF);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1778,6 +1861,17 @@ static BOOL HLPFILE_GetContext(HLPFILE *hlpfile)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* HLPFILE_DeleteLink
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void HLPFILE_FreeLink(HLPFILE_LINK* link)
|
||||||
|
{
|
||||||
|
if (link && !--link->wRefCount)
|
||||||
|
HeapFree(GetProcessHeap(), 0, link);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* HLPFILE_DeleteParagraph
|
* HLPFILE_DeleteParagraph
|
||||||
|
@ -1789,7 +1883,11 @@ static void HLPFILE_DeleteParagraph(HLPFILE_PARAGRAPH* paragraph)
|
||||||
while (paragraph)
|
while (paragraph)
|
||||||
{
|
{
|
||||||
next = paragraph->next;
|
next = paragraph->next;
|
||||||
if (paragraph->link) HeapFree(GetProcessHeap(), 0, paragraph->link);
|
|
||||||
|
if (paragraph->cookie == para_metafile)
|
||||||
|
DeleteMetaFile(paragraph->u.gfx.u.mf.hMetaFile);
|
||||||
|
|
||||||
|
HLPFILE_FreeLink(paragraph->link);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, paragraph);
|
HeapFree(GetProcessHeap(), 0, paragraph);
|
||||||
paragraph = next;
|
paragraph = next;
|
||||||
|
|
|
@ -36,14 +36,15 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
enum {hlp_link_none, hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
|
enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
|
||||||
LPCSTR lpszString;
|
LPCSTR lpszString; /* name of the file to for the link (NULL if same file) */
|
||||||
LONG lHash;
|
LONG lHash; /* topic index */
|
||||||
BOOL bClrChange;
|
unsigned bClrChange : 1, /* true if the link is green & underlined */
|
||||||
unsigned window;
|
wRefCount; /* number of internal references to this object */
|
||||||
|
unsigned window; /* window number for displaying the link (-1 is current) */
|
||||||
} HLPFILE_LINK;
|
} HLPFILE_LINK;
|
||||||
|
|
||||||
enum para_type {para_normal_text, para_debug_text, para_image};
|
enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
|
||||||
|
|
||||||
typedef struct tagHlpFileParagraph
|
typedef struct tagHlpFileParagraph
|
||||||
{
|
{
|
||||||
|
@ -61,9 +62,20 @@ typedef struct tagHlpFileParagraph
|
||||||
} text;
|
} text;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
HBITMAP hBitmap;
|
|
||||||
unsigned pos; /* 0: center, 1: left, 2: right */
|
unsigned pos; /* 0: center, 1: left, 2: right */
|
||||||
} image;
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
HBITMAP hBitmap;
|
||||||
|
} bmp;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
HMETAFILE hMetaFile;
|
||||||
|
SIZE mfSize;
|
||||||
|
} mf;
|
||||||
|
} u;
|
||||||
|
} gfx; /* for bitmaps and metafiles */
|
||||||
} u;
|
} u;
|
||||||
|
|
||||||
HLPFILE_LINK* link;
|
HLPFILE_LINK* link;
|
||||||
|
@ -142,4 +154,5 @@ HLPFILE_PAGE* HLPFILE_Contents(HLPFILE* hlpfile);
|
||||||
HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
|
HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
|
||||||
HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
|
HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
|
||||||
LONG HLPFILE_Hash(LPCSTR lpszContext);
|
LONG HLPFILE_Hash(LPCSTR lpszContext);
|
||||||
|
void HLPFILE_FreeLink(HLPFILE_LINK* link);
|
||||||
void HLPFILE_FreeHlpFile(HLPFILE*);
|
void HLPFILE_FreeHlpFile(HLPFILE*);
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void WINHELP_InitFonts(HWND hWnd);
|
||||||
static void WINHELP_DeleteLines(WINHELP_WINDOW*);
|
static void WINHELP_DeleteLines(WINHELP_WINDOW*);
|
||||||
static void WINHELP_DeleteWindow(WINHELP_WINDOW*);
|
static void WINHELP_DeleteWindow(WINHELP_WINDOW*);
|
||||||
static void WINHELP_SetupText(HWND hWnd);
|
static void WINHELP_SetupText(HWND hWnd);
|
||||||
static WINHELP_LINE_PART* WINHELP_IsOverLink(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
static WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW*, WPARAM, LPARAM);
|
||||||
|
|
||||||
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 1, 0, 0};
|
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 1, 0, 0};
|
||||||
|
|
||||||
|
@ -852,18 +852,27 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
DeleteObject(hPen);
|
DeleteObject(hPen);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case hlp_line_part_image:
|
case hlp_line_part_bitmap:
|
||||||
{
|
{
|
||||||
HDC hMemDC;
|
HDC hMemDC;
|
||||||
|
|
||||||
hMemDC = CreateCompatibleDC(hDc);
|
hMemDC = CreateCompatibleDC(hDc);
|
||||||
SelectObject(hMemDC, part->u.image.hBitmap);
|
SelectObject(hMemDC, part->u.bitmap.hBitmap);
|
||||||
BitBlt(hDc, part->rect.left, part->rect.top - scroll_pos,
|
BitBlt(hDc, part->rect.left, part->rect.top - scroll_pos,
|
||||||
part->rect.right - part->rect.left, part->rect.bottom - part->rect.top,
|
part->rect.right - part->rect.left, part->rect.bottom - part->rect.top,
|
||||||
hMemDC, 0, 0, SRCCOPY);
|
hMemDC, 0, 0, SRCCOPY);
|
||||||
DeleteDC(hMemDC);
|
DeleteDC(hMemDC);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case hlp_line_part_metafile:
|
||||||
|
{
|
||||||
|
POINT pt;
|
||||||
|
|
||||||
|
SetViewportOrgEx(hDc, part->rect.left, part->rect.top - scroll_pos, &pt);
|
||||||
|
PlayMetaFile(hDc, part->u.metafile.hMetaFile);
|
||||||
|
SetViewportOrgEx(hDc, pt.x, pt.y, NULL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -874,7 +883,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
|
win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
|
||||||
|
|
||||||
if (WINHELP_IsOverLink(hWnd, wParam, lParam))
|
if (WINHELP_IsOverLink(win, wParam, lParam))
|
||||||
SetCursor(win->hHandCur); /* set to hand pointer cursor to indicate a link */
|
SetCursor(win->hHandCur); /* set to hand pointer cursor to indicate a link */
|
||||||
else
|
else
|
||||||
SetCursor(win->hArrowCur); /* set to hand pointer cursor to indicate a link */
|
SetCursor(win->hArrowCur); /* set to hand pointer cursor to indicate a link */
|
||||||
|
@ -887,7 +896,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
hPopupWnd = Globals.hPopupWnd;
|
hPopupWnd = Globals.hPopupWnd;
|
||||||
Globals.hPopupWnd = 0;
|
Globals.hPopupWnd = 0;
|
||||||
|
|
||||||
part = WINHELP_IsOverLink(hWnd, wParam, lParam);
|
part = WINHELP_IsOverLink(win, wParam, lParam);
|
||||||
if (part)
|
if (part)
|
||||||
{
|
{
|
||||||
HLPFILE* hlpfile;
|
HLPFILE* hlpfile;
|
||||||
|
@ -896,35 +905,33 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
mouse.x = LOWORD(lParam);
|
mouse.x = LOWORD(lParam);
|
||||||
mouse.y = HIWORD(lParam);
|
mouse.y = HIWORD(lParam);
|
||||||
|
|
||||||
switch (part->link.cookie)
|
if (part->link) switch (part->link->cookie)
|
||||||
{
|
{
|
||||||
case hlp_link_none:
|
|
||||||
break;
|
|
||||||
case hlp_link_link:
|
case hlp_link_link:
|
||||||
hlpfile = WINHELP_LookupHelpFile(part->link.lpszString);
|
hlpfile = WINHELP_LookupHelpFile(part->link->lpszString);
|
||||||
if (part->link.window == -1)
|
if (part->link->window == -1)
|
||||||
wi = win->info;
|
wi = win->info;
|
||||||
else if (part->link.window < hlpfile->numWindows)
|
else if (part->link->window < hlpfile->numWindows)
|
||||||
wi = &hlpfile->windows[part->link.window];
|
wi = &hlpfile->windows[part->link->window];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WINE_WARN("link to window %d/%d\n", part->link.window, hlpfile->numWindows);
|
WINE_WARN("link to window %d/%d\n", part->link->window, hlpfile->numWindows);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
WINHELP_CreateHelpWindowByHash(hlpfile, part->link.lHash, wi,
|
WINHELP_CreateHelpWindowByHash(hlpfile, part->link->lHash, wi,
|
||||||
SW_NORMAL);
|
SW_NORMAL);
|
||||||
break;
|
break;
|
||||||
case hlp_link_popup:
|
case hlp_link_popup:
|
||||||
hlpfile = WINHELP_LookupHelpFile(part->link.lpszString);
|
hlpfile = WINHELP_LookupHelpFile(part->link->lpszString);
|
||||||
WINHELP_CreateHelpWindowByHash(hlpfile, part->link.lHash,
|
WINHELP_CreateHelpWindowByHash(hlpfile, part->link->lHash,
|
||||||
WINHELP_GetPopupWindowInfo(hlpfile, hWnd, &mouse),
|
WINHELP_GetPopupWindowInfo(hlpfile, hWnd, &mouse),
|
||||||
SW_NORMAL);
|
SW_NORMAL);
|
||||||
break;
|
break;
|
||||||
case hlp_link_macro:
|
case hlp_link_macro:
|
||||||
MACRO_ExecuteMacro(part->link.lpszString);
|
MACRO_ExecuteMacro(part->link->lpszString);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WINE_FIXME("Unknown link cookie %d\n", part->link.cookie);
|
WINE_FIXME("Unknown link cookie %d\n", part->link->cookie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,7 +1068,7 @@ static BOOL WINHELP_AppendText(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp
|
||||||
*line_ascent = ascent;
|
*line_ascent = ascent;
|
||||||
|
|
||||||
line = HeapAlloc(GetProcessHeap(), 0,
|
line = HeapAlloc(GetProcessHeap(), 0,
|
||||||
sizeof(WINHELP_LINE) + textlen + (link ? lstrlen(link->lpszString) + 1 : 0));
|
sizeof(WINHELP_LINE) + textlen);
|
||||||
if (!line) return FALSE;
|
if (!line) return FALSE;
|
||||||
|
|
||||||
line->next = 0;
|
line->next = 0;
|
||||||
|
@ -1094,8 +1101,7 @@ static BOOL WINHELP_AppendText(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp
|
||||||
}
|
}
|
||||||
|
|
||||||
part = HeapAlloc(GetProcessHeap(), 0,
|
part = HeapAlloc(GetProcessHeap(), 0,
|
||||||
sizeof(WINHELP_LINE_PART) + textlen +
|
sizeof(WINHELP_LINE_PART) + textlen);
|
||||||
(link ? lstrlen(link->lpszString) + 1 : 0));
|
|
||||||
if (!part) return FALSE;
|
if (!part) return FALSE;
|
||||||
**partp = part;
|
**partp = part;
|
||||||
ptr = (char*)part + sizeof(WINHELP_LINE_PART);
|
ptr = (char*)part + sizeof(WINHELP_LINE_PART);
|
||||||
|
@ -1122,16 +1128,9 @@ static BOOL WINHELP_AppendText(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp
|
||||||
part->u.text.lpsText,
|
part->u.text.lpsText,
|
||||||
part->u.text.wTextLen,
|
part->u.text.wTextLen,
|
||||||
part->rect.left, part->rect.top, part->rect.right, part->rect.bottom);
|
part->rect.left, part->rect.top, part->rect.right, part->rect.bottom);
|
||||||
if (link)
|
|
||||||
{
|
part->link = link;
|
||||||
strcpy(ptr + textlen, link->lpszString);
|
if (link) link->wRefCount++;
|
||||||
part->link.lpszString = ptr + textlen;
|
|
||||||
part->link.cookie = link->cookie;
|
|
||||||
part->link.lHash = link->lHash;
|
|
||||||
part->link.bClrChange = link->bClrChange;
|
|
||||||
part->link.window = link->window;
|
|
||||||
}
|
|
||||||
else part->link.cookie = hlp_link_none;
|
|
||||||
|
|
||||||
part->next = 0;
|
part->next = 0;
|
||||||
*partp = &part->next;
|
*partp = &part->next;
|
||||||
|
@ -1143,11 +1142,10 @@ static BOOL WINHELP_AppendText(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* WINHELP_AppendBitmap
|
* WINHELP_AppendGfxObject
|
||||||
*/
|
*/
|
||||||
static BOOL WINHELP_AppendBitmap(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp,
|
static WINHELP_LINE_PART* WINHELP_AppendGfxObject(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp,
|
||||||
LPSIZE space,
|
LPSIZE space, LPSIZE gfxSize,
|
||||||
HBITMAP hBmp, LPSIZE bmpSize,
|
|
||||||
HLPFILE_LINK *link, unsigned pos)
|
HLPFILE_LINK *link, unsigned pos)
|
||||||
{
|
{
|
||||||
WINHELP_LINE *line;
|
WINHELP_LINE *line;
|
||||||
|
@ -1156,9 +1154,8 @@ static BOOL WINHELP_AppendBitmap(WINHELP_LINE ***linep, WINHELP_LINE_PART ***par
|
||||||
|
|
||||||
if (!*partp || pos == 1) /* New line */
|
if (!*partp || pos == 1) /* New line */
|
||||||
{
|
{
|
||||||
line = HeapAlloc(GetProcessHeap(), 0,
|
line = HeapAlloc(GetProcessHeap(), 0, sizeof(WINHELP_LINE));
|
||||||
sizeof(WINHELP_LINE) + (link ? lstrlen(link->lpszString) + 1 : 0));
|
if (!line) return NULL;
|
||||||
if (!line) return FALSE;
|
|
||||||
|
|
||||||
line->next = NULL;
|
line->next = NULL;
|
||||||
part = &line->first_part;
|
part = &line->first_part;
|
||||||
|
@ -1178,45 +1175,32 @@ static BOOL WINHELP_AppendBitmap(WINHELP_LINE ***linep, WINHELP_LINE_PART ***par
|
||||||
if (pos == 2) WINE_FIXME("Left alignment not handled\n");
|
if (pos == 2) WINE_FIXME("Left alignment not handled\n");
|
||||||
line = **linep;
|
line = **linep;
|
||||||
|
|
||||||
part = HeapAlloc(GetProcessHeap(), 0,
|
part = HeapAlloc(GetProcessHeap(), 0, sizeof(WINHELP_LINE_PART));
|
||||||
sizeof(WINHELP_LINE_PART) +
|
if (!part) return NULL;
|
||||||
(link ? lstrlen(link->lpszString) + 1 : 0));
|
|
||||||
if (!part) return FALSE;
|
|
||||||
**partp = part;
|
**partp = part;
|
||||||
ptr = (char*)part + sizeof(WINHELP_LINE_PART);
|
ptr = (char*)part + sizeof(WINHELP_LINE_PART);
|
||||||
}
|
}
|
||||||
|
|
||||||
part->cookie = hlp_line_part_image;
|
/* part->cookie should be set by caller (image or metafile) */
|
||||||
part->rect.left = line->rect.right + (*partp ? space->cx : 0);
|
part->rect.left = line->rect.right + (*partp ? space->cx : 0);
|
||||||
part->rect.right = part->rect.left + bmpSize->cx;
|
part->rect.right = part->rect.left + gfxSize->cx;
|
||||||
line->rect.right = part->rect.right;
|
line->rect.right = part->rect.right;
|
||||||
part->rect.top =
|
part->rect.top = (*partp) ? line->rect.top : line->rect.bottom;
|
||||||
((*partp) ? line->rect.top : line->rect.bottom);
|
part->rect.bottom = part->rect.top + gfxSize->cy;
|
||||||
part->rect.bottom = part->rect.top + bmpSize->cy;
|
|
||||||
line->rect.bottom = max(line->rect.bottom, part->rect.bottom);
|
line->rect.bottom = max(line->rect.bottom, part->rect.bottom);
|
||||||
part->u.image.hBitmap = hBmp;
|
|
||||||
|
|
||||||
WINE_TRACE("Appended bitmap '%d' @ (%d,%d-%d,%d)\n",
|
WINE_TRACE("Appended gfx @ (%d,%d-%d,%d)\n",
|
||||||
(unsigned)part->u.image.hBitmap,
|
|
||||||
part->rect.left, part->rect.top, part->rect.right, part->rect.bottom);
|
part->rect.left, part->rect.top, part->rect.right, part->rect.bottom);
|
||||||
|
|
||||||
if (link)
|
part->link = link;
|
||||||
{
|
if (link) link->wRefCount++;
|
||||||
strcpy(ptr, link->lpszString);
|
|
||||||
part->link.lpszString = ptr;
|
|
||||||
part->link.cookie = link->cookie;
|
|
||||||
part->link.lHash = link->lHash;
|
|
||||||
part->link.bClrChange = link->bClrChange;
|
|
||||||
part->link.window = link->window;
|
|
||||||
}
|
|
||||||
else part->link.cookie = hlp_link_none;
|
|
||||||
|
|
||||||
part->next = NULL;
|
part->next = NULL;
|
||||||
*partp = &part->next;
|
*partp = &part->next;
|
||||||
|
|
||||||
space->cx = 0;
|
space->cx = 0;
|
||||||
|
|
||||||
return TRUE;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1286,7 +1270,7 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
|
||||||
hFont = win->fonts[wFont];
|
hFont = win->fonts[wFont];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->link)
|
if (p->link && p->link->bClrChange)
|
||||||
{
|
{
|
||||||
underline = (p->link->cookie == hlp_link_popup) ? 3 : 1;
|
underline = (p->link->cookie == hlp_link_popup) ? 3 : 1;
|
||||||
color = RGB(0, 0x80, 0);
|
color = RGB(0, 0x80, 0);
|
||||||
|
@ -1371,13 +1355,14 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case para_image:
|
case para_bitmap:
|
||||||
|
case para_metafile:
|
||||||
{
|
{
|
||||||
DIBSECTION dibs;
|
SIZE gfxSize;
|
||||||
SIZE bmpSize;
|
|
||||||
INT free_width;
|
INT free_width;
|
||||||
|
WINHELP_LINE_PART* ref_part;
|
||||||
|
|
||||||
if (p->u.image.pos & 0x8000)
|
if (p->u.gfx.pos & 0x8000)
|
||||||
{
|
{
|
||||||
space.cx = rect.left;
|
space.cx = rect.left;
|
||||||
if (*line)
|
if (*line)
|
||||||
|
@ -1385,9 +1370,15 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
|
||||||
part = 0;
|
part = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetObject(p->u.image.hBitmap, sizeof(dibs), &dibs);
|
if (p->cookie == para_bitmap)
|
||||||
bmpSize.cx = dibs.dsBm.bmWidth;
|
{
|
||||||
bmpSize.cy = dibs.dsBm.bmHeight;
|
DIBSECTION dibs;
|
||||||
|
|
||||||
|
GetObject(p->u.gfx.u.bmp.hBitmap, sizeof(dibs), &dibs);
|
||||||
|
gfxSize.cx = dibs.dsBm.bmWidth;
|
||||||
|
gfxSize.cy = dibs.dsBm.bmHeight;
|
||||||
|
}
|
||||||
|
else gfxSize = p->u.gfx.u.mf.mfSize;
|
||||||
|
|
||||||
free_width = rect.right - ((part && *line) ? (*line)->rect.right : rect.left) - space.cx;
|
free_width = rect.right - ((part && *line) ? (*line)->rect.right : rect.left) - space.cx;
|
||||||
if (free_width <= 0)
|
if (free_width <= 0)
|
||||||
|
@ -1396,17 +1387,25 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
|
||||||
space.cx = rect.left;
|
space.cx = rect.left;
|
||||||
space.cx = min(space.cx, rect.right - rect.left - 1);
|
space.cx = min(space.cx, rect.right - rect.left - 1);
|
||||||
}
|
}
|
||||||
if (!WINHELP_AppendBitmap(&line, &part, &space,
|
ref_part = WINHELP_AppendGfxObject(&line, &part, &space, &gfxSize,
|
||||||
p->u.image.hBitmap, &bmpSize,
|
p->link, p->u.gfx.pos);
|
||||||
p->link, p->u.image.pos) ||
|
if (!ref_part || (!newsize && (*line)->rect.bottom > rect.bottom))
|
||||||
(!newsize && (*line)->rect.bottom > rect.bottom))
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (p->cookie == para_bitmap)
|
||||||
|
{
|
||||||
|
ref_part->cookie = hlp_line_part_bitmap;
|
||||||
|
ref_part->u.bitmap.hBitmap = p->u.gfx.u.bmp.hBitmap;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ref_part->cookie = hlp_line_part_metafile;
|
||||||
|
ref_part->u.metafile.hMetaFile = p->u.gfx.u.mf.hMetaFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newsize)
|
if (newsize)
|
||||||
|
@ -1452,6 +1451,7 @@ static void WINHELP_DeleteLines(WINHELP_WINDOW *win)
|
||||||
for (part = &line->first_part; part; part = next_part)
|
for (part = &line->first_part; part; part = next_part)
|
||||||
{
|
{
|
||||||
next_part = part->next;
|
next_part = part->next;
|
||||||
|
HLPFILE_FreeLink(part->link);
|
||||||
HeapFree(GetProcessHeap(), 0, part);
|
HeapFree(GetProcessHeap(), 0, part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1574,13 +1574,12 @@ INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WORD type
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WINHELP_LINE_PART* WINHELP_IsOverLink(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW* win, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
WINHELP_WINDOW* win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
|
|
||||||
POINT mouse;
|
POINT mouse;
|
||||||
WINHELP_LINE *line;
|
WINHELP_LINE *line;
|
||||||
WINHELP_LINE_PART *part;
|
WINHELP_LINE_PART *part;
|
||||||
int scroll_pos = GetScrollPos(hWnd, SB_VERT);
|
int scroll_pos = GetScrollPos(win->hMainWnd, SB_VERT);
|
||||||
|
|
||||||
mouse.x = LOWORD(lParam);
|
mouse.x = LOWORD(lParam);
|
||||||
mouse.y = HIWORD(lParam);
|
mouse.y = HIWORD(lParam);
|
||||||
|
@ -1588,8 +1587,8 @@ WINHELP_LINE_PART* WINHELP_IsOverLink(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
for (part = &line->first_part; part; part = part->next)
|
for (part = &line->first_part; part; part = part->next)
|
||||||
{
|
{
|
||||||
if (part->link.cookie != hlp_link_none &&
|
if (part->link &&
|
||||||
part->link.lpszString &&
|
part->link->lpszString &&
|
||||||
part->rect.left <= mouse.x &&
|
part->rect.left <= mouse.x &&
|
||||||
part->rect.right >= mouse.x &&
|
part->rect.right >= mouse.x &&
|
||||||
part->rect.top <= mouse.y + scroll_pos &&
|
part->rect.top <= mouse.y + scroll_pos &&
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
typedef struct tagHelpLinePart
|
typedef struct tagHelpLinePart
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
enum {hlp_line_part_text, hlp_line_part_image} cookie;
|
enum {hlp_line_part_text, hlp_line_part_bitmap, hlp_line_part_metafile} cookie;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -54,9 +54,13 @@ typedef struct tagHelpLinePart
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
HBITMAP hBitmap;
|
HBITMAP hBitmap;
|
||||||
} image;
|
} bitmap;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
HMETAFILE hMetaFile;
|
||||||
|
} metafile;
|
||||||
} u;
|
} u;
|
||||||
HLPFILE_LINK link;
|
HLPFILE_LINK* link;
|
||||||
|
|
||||||
struct tagHelpLinePart *next;
|
struct tagHelpLinePart *next;
|
||||||
} WINHELP_LINE_PART;
|
} WINHELP_LINE_PART;
|
||||||
|
|
Loading…
Reference in New Issue