winhelp: Remove the internal data used for the old rendering.

This commit is contained in:
Eric Pouech 2008-05-01 21:17:04 +02:00 committed by Alexandre Julliard
parent 303462329c
commit 2ee5cd8d7c
2 changed files with 18 additions and 399 deletions

View File

@ -51,15 +51,6 @@ static inline unsigned GET_UINT(const BYTE* buffer, unsigned i)
static HLPFILE *first_hlpfile = 0; static HLPFILE *first_hlpfile = 0;
static struct
{
UINT wFont;
UINT wIndent;
UINT wHSpace;
UINT wVSpace;
HLPFILE_LINK* link;
} attributes;
static BOOL HLPFILE_DoReadHlpFile(HLPFILE*, LPCSTR); static BOOL HLPFILE_DoReadHlpFile(HLPFILE*, LPCSTR);
static BOOL HLPFILE_ReadFileToBuffer(HLPFILE*, HFILE); static BOOL HLPFILE_ReadFileToBuffer(HLPFILE*, HFILE);
static BOOL HLPFILE_FindSubFile(HLPFILE*, LPCSTR, BYTE**, BYTE**); static BOOL HLPFILE_FindSubFile(HLPFILE*, LPCSTR, BYTE**, BYTE**);
@ -431,7 +422,6 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned ref
page->file = hlpfile; page->file = hlpfile;
page->next = NULL; page->next = NULL;
page->first_paragraph = NULL;
page->first_macro = NULL; page->first_macro = NULL;
page->first_link = NULL; page->first_link = NULL;
page->wNumber = GET_UINT(buf, 0x21); page->wNumber = GET_UINT(buf, 0x21);
@ -445,8 +435,6 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned ref
page->wNumber, page->lpszTitle, page->wNumber, page->lpszTitle,
page->browse_bwd, page->offset, page->browse_fwd); page->browse_bwd, page->offset, page->browse_fwd);
memset(&attributes, 0, sizeof(attributes));
/* now load macros */ /* now load macros */
ptr = page->lpszTitle + strlen(page->lpszTitle) + 1; ptr = page->lpszTitle + strlen(page->lpszTitle) + 1;
while (ptr < page->lpszTitle + titlesize) while (ptr < page->lpszTitle + titlesize)
@ -1000,228 +988,6 @@ static BOOL HLPFILE_RtfAddGfxByIndex(struct RtfData* rd, HLPFILE *hlpfile,
return HLPFILE_RtfAddGfxByAddr(rd, hlpfile, ref, end - ref); return HLPFILE_RtfAddGfxByAddr(rd, hlpfile, ref, end - ref);
} }
/******************************************************************
* HLPFILE_LoadBitmap
*
*
*/
static BOOL HLPFILE_LoadBitmap(BYTE* beg, BYTE type, BYTE pack,
HLPFILE_PARAGRAPH* paragraph)
{
BYTE* ptr;
BYTE* pict_beg;
BITMAPINFO* bi;
unsigned long off, csz;
HDC hdc;
bi = HeapAlloc(GetProcessHeap(), 0, sizeof(*bi));
if (!bi) return FALSE;
ptr = beg + 2; /* for type and pack */
bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
bi->bmiHeader.biXPelsPerMeter = fetch_ulong(&ptr);
bi->bmiHeader.biYPelsPerMeter = fetch_ulong(&ptr);
bi->bmiHeader.biPlanes = fetch_ushort(&ptr);
bi->bmiHeader.biBitCount = fetch_ushort(&ptr);
bi->bmiHeader.biWidth = fetch_ulong(&ptr);
bi->bmiHeader.biHeight = fetch_ulong(&ptr);
bi->bmiHeader.biClrUsed = fetch_ulong(&ptr);
bi->bmiHeader.biClrImportant = fetch_ulong(&ptr);
bi->bmiHeader.biCompression = BI_RGB;
if (bi->bmiHeader.biBitCount > 32) WINE_FIXME("Unknown bit count %u\n", bi->bmiHeader.biBitCount);
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;
WINE_TRACE("planes=%d bc=%d size=(%d,%d)\n",
bi->bmiHeader.biPlanes, bi->bmiHeader.biBitCount,
bi->bmiHeader.biWidth, bi->bmiHeader.biHeight);
csz = fetch_ulong(&ptr);
fetch_ulong(&ptr); /* hotspot size */
off = GET_UINT(ptr, 0); ptr += 4;
/* GET_UINT(ptr, 0); hotspot offset */ ptr += 4;
/* now read palette info */
if (type == 0x06)
{
unsigned nc = bi->bmiHeader.biClrUsed;
unsigned i;
/* not quite right, especially for bitfields type of compression */
if (!nc && bi->bmiHeader.biBitCount <= 8)
nc = 1 << bi->bmiHeader.biBitCount;
bi = HeapReAlloc(GetProcessHeap(), 0, bi, sizeof(*bi) + nc * sizeof(RGBQUAD));
if (!bi) return FALSE;
for (i = 0; i < nc; i++)
{
bi->bmiColors[i].rgbBlue = ptr[0];
bi->bmiColors[i].rgbGreen = ptr[1];
bi->bmiColors[i].rgbRed = ptr[2];
bi->bmiColors[i].rgbReserved = 0;
ptr += 4;
}
}
pict_beg = HLPFILE_DecompressGfx(beg + off, csz, bi->bmiHeader.biSizeImage, pack);
paragraph->u.gfx.u.bmp.hBitmap = CreateDIBitmap(hdc = GetDC(0), &bi->bmiHeader,
CBM_INIT, pict_beg,
bi, DIB_RGB_COLORS);
ReleaseDC(0, hdc);
if (!paragraph->u.gfx.u.bmp.hBitmap)
WINE_ERR("Couldn't create bitmap\n");
HeapFree(GetProcessHeap(), 0, bi);
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;
LPMETAFILEPICT lpmfp;
WINE_TRACE("Loading metafile\n");
ptr = beg + 2; /* for type and pack */
lpmfp = &paragraph->u.gfx.u.mfp;
lpmfp->mm = fetch_ushort(&ptr); /* mapping mode */
lpmfp->xExt = GET_USHORT(ptr, 0);
lpmfp->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_TRACE("sz=%lu csz=%lu (%d,%d) offs=%lu/%lu,%lu\n",
size, csize, lpmfp->xExt, lpmfp->yExt, off, (SIZE_T)(ptr - beg), hsoff);
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
if (!bits) return FALSE;
paragraph->cookie = para_metafile;
lpmfp->hMF = SetMetaFileBitsEx(size, bits);
if (!lpmfp->hMF)
WINE_FIXME("Couldn't load metafile\n");
if (bits != beg + off) HeapFree(GetProcessHeap(), 0, bits);
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 */
if (numpict != 1) WINE_FIXME("Supporting only one bitmap format per logical bitmap (for now). Using first format\n");
break;
}
return TRUE;
}
/******************************************************************
* HLPFILE_LoadGfxByIndex
*
*
*/
static BOOL HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
HLPFILE_PARAGRAPH* paragraph)
{
char tmp[16];
BYTE *ref, *end;
BOOL ret;
WINE_TRACE("Loading picture #%d\n", index);
if (index < hlpfile->numBmps && hlpfile->bmps[index] != NULL)
{
paragraph->u.gfx.u.bmp.hBitmap = hlpfile->bmps[index];
return TRUE;
}
sprintf(tmp, "|bm%u", index);
if (!HLPFILE_FindSubFile(hlpfile, tmp, &ref, &end)) {WINE_WARN("no sub file\n"); return FALSE;}
ref += 9;
ret = HLPFILE_LoadGfxByAddr(hlpfile, ref, end - ref, paragraph);
/* cache bitmap */
if (ret && paragraph->cookie == para_bitmap)
{
if (index >= hlpfile->numBmps)
{
hlpfile->numBmps = index + 1;
if (hlpfile->bmps)
hlpfile->bmps = HeapReAlloc(GetProcessHeap(), 0, hlpfile->bmps,
hlpfile->numBmps * sizeof(hlpfile->bmps[0]));
else
hlpfile->bmps = HeapAlloc(GetProcessHeap(), 0,
hlpfile->numBmps * sizeof(hlpfile->bmps[0]));
}
hlpfile->bmps[index] = paragraph->u.gfx.u.bmp.hBitmap;
}
return ret;
}
/****************************************************************** /******************************************************************
* HLPFILE_AllocLink * HLPFILE_AllocLink
* *
@ -1248,17 +1014,13 @@ static HLPFILE_LINK* HLPFILE_AllocLink(struct RtfData* rd, int cookie,
link->hash = hash; link->hash = hash;
link->bClrChange = clrChange ? 1 : 0; link->bClrChange = clrChange ? 1 : 0;
link->window = wnd; link->window = wnd;
link->wRefCount = 1;
if (rd) {
link->next = rd->first_link; link->next = rd->first_link;
rd->first_link = link; rd->first_link = link;
link->cpMin = rd->char_pos; link->cpMin = rd->char_pos;
link->cpMax = 0; link->cpMax = 0;
rd->force_color = clrChange; rd->force_color = clrChange;
link->wRefCount++;
if (rd->current_link) WINE_FIXME("Pending link\n"); if (rd->current_link) WINE_FIXME("Pending link\n");
rd->current_link = link; rd->current_link = link;
}
WINE_TRACE("Link[%d] to %s@%08x:%d\n", WINE_TRACE("Link[%d] to %s@%08x:%d\n",
link->cookie, link->string, link->hash, link->window); link->cookie, link->string, link->hash, link->window);
@ -1283,7 +1045,6 @@ unsigned HLPFILE_HalfPointsToTwips(unsigned pts)
*/ */
static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE *buf, BYTE* end) static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE *buf, BYTE* end)
{ {
HLPFILE_PARAGRAPH *paragraph, **paragraphptr;
UINT textsize; UINT textsize;
BYTE *format, *format_end; BYTE *format, *format_end;
char *text, *text_base, *text_end; char *text, *text_base, *text_end;
@ -1295,9 +1056,6 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
char tmp[256]; char tmp[256];
BOOL ret = FALSE; BOOL ret = FALSE;
for (paragraphptr = &page->first_paragraph; *paragraphptr;
paragraphptr = &(*paragraphptr)->next) /* Nothing */;
if (buf + 0x19 > end) {WINE_WARN("header too small\n"); return FALSE;}; if (buf + 0x19 > end) {WINE_WARN("header too small\n"); return FALSE;};
blocksize = GET_UINT(buf, 0); blocksize = GET_UINT(buf, 0);
@ -1496,30 +1254,6 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
textsize = strlen(text); textsize = strlen(text);
if (textsize) if (textsize)
{ {
paragraph = HeapAlloc(GetProcessHeap(), 0,
sizeof(HLPFILE_PARAGRAPH) + textsize + 1);
if (!paragraph) return FALSE;
*paragraphptr = paragraph;
paragraphptr = &paragraph->next;
paragraph->next = NULL;
if (!rd)
{
paragraph->link = attributes.link;
if (paragraph->link) paragraph->link->wRefCount++;
}
else paragraph->link = NULL;
paragraph->cookie = para_normal_text;
paragraph->u.text.wFont = attributes.wFont;
paragraph->u.text.wVSpace = attributes.wVSpace;
paragraph->u.text.wHSpace = attributes.wHSpace;
paragraph->u.text.wIndent = attributes.wIndent;
paragraph->u.text.lpszText = (char*)paragraph + sizeof(HLPFILE_PARAGRAPH);
strcpy(paragraph->u.text.lpszText, text);
attributes.wVSpace = 0;
attributes.wHSpace = 0;
if (rd) /* FIXME: TEMP */ {
if (rd->force_color) if (rd->force_color)
{ {
if ((rd->current_link->cookie == hlp_link_popup) ? if ((rd->current_link->cookie == hlp_link_popup) ?
@ -1530,7 +1264,6 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
if (rd->force_color && !HLPFILE_RtfAddControl(rd, "}")) goto done; if (rd->force_color && !HLPFILE_RtfAddControl(rd, "}")) goto done;
rd->char_pos += textsize; rd->char_pos += textsize;
} }
}
/* else: null text, keep on storing attributes */ /* else: null text, keep on storing attributes */
text += textsize + 1; text += textsize + 1;
@ -1557,8 +1290,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
{ {
unsigned font = GET_USHORT(format, 1); unsigned font = GET_USHORT(format, 1);
unsigned fs; unsigned fs;
attributes.wFont = font;
WINE_TRACE("Changing font to %d\n", attributes.wFont); WINE_TRACE("Changing font to %d\n", font);
format += 3; format += 3;
fs = (4 * page->file->fonts[font].LogFont.lfHeight - 3) / 5; fs = (4 * page->file->fonts[font].LogFont.lfHeight - 3) / 5;
/* FIXME: missing at least colors, also bold attribute looses information */ /* FIXME: missing at least colors, also bold attribute looses information */
@ -1575,9 +1308,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case 0x81: case 0x81:
if (!HLPFILE_RtfAddControl(rd, "\\line")) goto done; if (!HLPFILE_RtfAddControl(rd, "\\line")) goto done;
attributes.wVSpace++;
format += 1; format += 1;
if (rd) /* FIXME: TEMP */ rd->char_pos++; rd->char_pos++;
break; break;
case 0x82: case 0x82:
@ -1593,17 +1325,14 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
} }
} }
else if (!HLPFILE_RtfAddControl(rd, "\\par")) goto done; else if (!HLPFILE_RtfAddControl(rd, "\\par")) goto done;
attributes.wVSpace++;
attributes.wIndent = 0;
format += 1; format += 1;
if (rd) /* FIXME: TEMP */ rd->char_pos++; rd->char_pos++;
break; break;
case 0x83: case 0x83:
if (!HLPFILE_RtfAddControl(rd, "\\tab")) goto done; if (!HLPFILE_RtfAddControl(rd, "\\tab")) goto done;
attributes.wIndent++;
format += 1; format += 1;
if (rd) /* FIXME: TEMP */ rd->char_pos++; rd->char_pos++;
break; break;
#if 0 #if 0
@ -1616,27 +1345,13 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case 0x87: case 0x87:
case 0x88: case 0x88:
{ {
BYTE pos = (*format - 0x86);
BYTE type = format[1]; BYTE type = format[1];
long size; long size;
/* FIXME: we don't use 'BYTE pos = (*format - 0x86);' for the image position */
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 = &paragraph->next;
paragraph->next = NULL;
if (!rd){
paragraph->link = attributes.link;
if (paragraph->link) paragraph->link->wRefCount++;
}
else paragraph->link = NULL;
paragraph->cookie = para_bitmap;
paragraph->u.gfx.pos = pos;
switch (type) switch (type)
{ {
case 0x22: case 0x22:
@ -1646,23 +1361,15 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
switch (GET_SHORT(format, 0)) switch (GET_SHORT(format, 0))
{ {
case 0: case 0:
HLPFILE_LoadGfxByIndex(page->file, GET_SHORT(format, 2),
paragraph);
if (rd) { /* FIXME: TEMP */
HLPFILE_RtfAddGfxByIndex(rd, page->file, GET_SHORT(format, 2)); HLPFILE_RtfAddGfxByIndex(rd, page->file, GET_SHORT(format, 2));
rd->char_pos++; rd->char_pos++;
}
break; break;
case 1: case 1:
WINE_FIXME("does it work ??? %x<%lu>#%u\n", WINE_FIXME("does it work ??? %x<%lu>#%u\n",
GET_SHORT(format, 0), GET_SHORT(format, 0),
size, GET_SHORT(format, 2)); size, GET_SHORT(format, 2));
HLPFILE_LoadGfxByAddr(page->file, format + 2, size - 4,
paragraph);
if (rd) { /* FIXME: TEMP */
HLPFILE_RtfAddGfxByAddr(rd, page->file, format + 2, size - 4); HLPFILE_RtfAddGfxByAddr(rd, page->file, format + 2, size - 4);
rd->char_pos++; rd->char_pos++;
}
break; break;
default: default:
WINE_FIXME("??? %u\n", GET_SHORT(format, 0)); WINE_FIXME("??? %u\n", GET_SHORT(format, 0));
@ -1676,24 +1383,17 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
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:
HLPFILE_FreeLink(attributes.link);
attributes.link = NULL;
format += 1; format += 1;
if (rd) {
if (!rd->current_link) if (!rd->current_link)
WINE_FIXME("No existing link\n"); WINE_FIXME("No existing link\n");
else
rd->current_link->cpMax = rd->char_pos; rd->current_link->cpMax = rd->char_pos;
rd->current_link = NULL; rd->current_link = NULL;
rd->force_color = FALSE; rd->force_color = FALSE;
}
break; break;
case 0x8B: case 0x8B:
@ -1718,8 +1418,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case 0xC8: case 0xC8:
case 0xCC: case 0xCC:
WINE_TRACE("macro => %s\n", format + 3); WINE_TRACE("macro => %s\n", format + 3);
HLPFILE_FreeLink(attributes.link); HLPFILE_AllocLink(rd, hlp_link_macro, (const char*)format + 3,
attributes.link = HLPFILE_AllocLink(rd, hlp_link_macro, (const char*)format + 3,
GET_USHORT(format, 1), 0, !(*format & 4), -1); GET_USHORT(format, 1), 0, !(*format & 4), -1);
format += 3 + GET_USHORT(format, 1); format += 3 + GET_USHORT(format, 1);
break; break;
@ -1727,11 +1426,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case 0xE0: case 0xE0:
case 0xE1: case 0xE1:
WINE_WARN("jump topic 1 => %u\n", GET_UINT(format, 1)); WINE_WARN("jump topic 1 => %u\n", GET_UINT(format, 1));
HLPFILE_FreeLink(attributes.link); HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup,
attributes.link = HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup, page->file->lpszPath, -1, GET_UINT(format, 1)-16, 1, -1);
page->file->lpszPath, -1,
GET_UINT(format, 1)-16,
1, -1);
format += 5; format += 5;
@ -1741,9 +1437,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case 0xE3: case 0xE3:
case 0xE6: case 0xE6:
case 0xE7: case 0xE7:
attributes.link = HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup, HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup,
page->file->lpszPath, -1, page->file->lpszPath, -1, GET_UINT(format, 1),
GET_UINT(format, 1),
!(*format & 4), -1); !(*format & 4), -1);
format += 5; format += 5;
break; break;
@ -1780,10 +1475,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
WINE_WARN("Unknown link type %d\n", type); WINE_WARN("Unknown link type %d\n", type);
break; break;
} }
HLPFILE_FreeLink(attributes.link); HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup,
attributes.link = HLPFILE_AllocLink(rd, (*format & 1) ? hlp_link_link : hlp_link_popup, ptr, -1, GET_UINT(format, 4), !(*format & 4), wnd);
ptr, -1, GET_UINT(format, 4),
!(*format & 4), wnd);
} }
format += 3 + GET_USHORT(format, 1); format += 3 + GET_USHORT(format, 1);
break; break;
@ -2861,41 +2554,6 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
return TRUE; return TRUE;
} }
/******************************************************************
* HLPFILE_DeleteLink
*
*
*/
void HLPFILE_FreeLink(HLPFILE_LINK* link)
{
if (link && !--link->wRefCount)
{
HeapFree(GetProcessHeap(), 0, link);
}
}
/***********************************************************************
*
* HLPFILE_DeleteParagraph
*/
static void HLPFILE_DeleteParagraph(HLPFILE_PARAGRAPH* paragraph)
{
HLPFILE_PARAGRAPH* next;
while (paragraph)
{
next = paragraph->next;
if (paragraph->cookie == para_metafile)
DeleteMetaFile(paragraph->u.gfx.u.mfp.hMF);
HLPFILE_FreeLink(paragraph->link);
HeapFree(GetProcessHeap(), 0, paragraph);
paragraph = next;
}
}
/*********************************************************************** /***********************************************************************
* *
* DeleteMacro * DeleteMacro
@ -2923,7 +2581,6 @@ static void HLPFILE_DeletePage(HLPFILE_PAGE* page)
while (page) while (page)
{ {
next = page->next; next = page->next;
HLPFILE_DeleteParagraph(page->first_paragraph);
HLPFILE_DeleteMacro(page->first_macro); HLPFILE_DeleteMacro(page->first_macro);
HeapFree(GetProcessHeap(), 0, page); HeapFree(GetProcessHeap(), 0, page);
page = next; page = next;

View File

@ -40,49 +40,13 @@ typedef struct tagHlpFileLink
enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie; enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
LPCSTR string; /* name of the file to for the link (NULL if same file) */ LPCSTR string; /* name of the file to for the link (NULL if same file) */
LONG hash; /* topic index */ LONG hash; /* topic index */
unsigned bClrChange : 1, /* true if the link is green & underlined */ unsigned bClrChange : 1; /* true if the link is green & underlined */
wRefCount; /* number of internal references to this object */
unsigned window; /* window number for displaying the link (-1 is current) */ unsigned window; /* window number for displaying the link (-1 is current) */
DWORD cpMin; DWORD cpMin;
DWORD cpMax; DWORD cpMax;
struct tagHlpFileLink* next; struct tagHlpFileLink* next;
} HLPFILE_LINK; } HLPFILE_LINK;
enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
typedef struct tagHlpFileParagraph
{
enum para_type cookie;
union
{
struct
{
LPSTR lpszText;
unsigned wFont;
unsigned wIndent;
unsigned wHSpace;
unsigned wVSpace;
} text;
struct
{
unsigned pos; /* 0: center, 1: left, 2: right */
union
{
struct
{
HBITMAP hBitmap;
} bmp;
METAFILEPICT mfp;
} u;
} gfx; /* for bitmaps and metafiles */
} u;
HLPFILE_LINK* link;
struct tagHlpFileParagraph* next;
} HLPFILE_PARAGRAPH;
typedef struct tagHlpFileMacro typedef struct tagHlpFileMacro
{ {
LPCSTR lpszMacro; LPCSTR lpszMacro;
@ -92,7 +56,6 @@ typedef struct tagHlpFileMacro
typedef struct tagHlpFilePage typedef struct tagHlpFilePage
{ {
LPSTR lpszTitle; LPSTR lpszTitle;
HLPFILE_PARAGRAPH* first_paragraph;
HLPFILE_MACRO* first_macro; HLPFILE_MACRO* first_macro;
HLPFILE_LINK* first_link; HLPFILE_LINK* first_link;
@ -199,7 +162,6 @@ HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash, ULONG* relative);
HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap, ULONG* relative); HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap, ULONG* relative);
HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relative); HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relative);
LONG HLPFILE_Hash(LPCSTR lpszContext); LONG HLPFILE_Hash(LPCSTR lpszContext);
void HLPFILE_FreeLink(HLPFILE_LINK* link);
void HLPFILE_FreeHlpFile(HLPFILE*); void HLPFILE_FreeHlpFile(HLPFILE*);
unsigned HLPFILE_HalfPointsToTwips(unsigned pts); unsigned HLPFILE_HalfPointsToTwips(unsigned pts);