Eric Pouech : winhelp: Added support for richedit tabs in paragraph format.
Alexandre Julliard
julliard at winehq.org
Fri Apr 25 08:10:44 CDT 2008
Module: wine
Branch: master
Commit: 523a5b3f3141a0f746256ff059df8eab3efe3d1b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=523a5b3f3141a0f746256ff059df8eab3efe3d1b
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Thu Apr 24 22:05:59 2008 +0200
winhelp: Added support for richedit tabs in paragraph format.
---
programs/winhelp/hlpfile.c | 35 ++++++++++++++++++++++++++++++-----
programs/winhelp/hlpfile.h | 6 ++++++
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 78a9643..3e85dc3 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -943,6 +943,18 @@ static HLPFILE_LINK* HLPFILE_AllocLink(struct RtfData* rd, int cookie,
return link;
}
+unsigned HLPFILE_HalfPointsToTwips(unsigned pts)
+{
+ static unsigned logPxY;
+ if (!logPxY)
+ {
+ HDC hdc = GetDC(NULL);
+ logPxY = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+ }
+ return MulDiv(pts, 72 * 10, logPxY);
+}
+
/***********************************************************************
*
* HLPFILE_BrowseParagraph
@@ -1034,13 +1046,26 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
if (bits & 0x0100) format += 3;
if (bits & 0x0200)
{
- int ntab = fetch_short(&format);
- unsigned short ts;
+ int i, ntab = fetch_short(&format);
+ unsigned tab, ts;
+ const char* kind;
- while (ntab-- > 0)
+ for (i = 0; i < ntab; i++)
{
- ts = fetch_ushort(&format);
- if (ts & 0x4000) fetch_ushort(&format);
+ tab = fetch_ushort(&format);
+ ts = (tab & 0x4000) ? fetch_ushort(&format) : 0 /* left */;
+ switch (ts)
+ {
+ default: WINE_FIXME("Unknown tab style %x\n", ts);
+ /* fall through */
+ case 0: kind = ""; break;
+ case 1: kind = "\\tqr"; break;
+ case 2: kind = "\\tqc"; break;
+ }
+ /* FIXME: do kind */
+ sprintf(tmp, "%s\\tx%d",
+ kind, HLPFILE_HalfPointsToTwips(tab & 0x3FFF));
+ if (!HLPFILE_RtfAddControl(rd, tmp)) goto done;
}
}
/* 0x0400, 0x0800 and 0x1000 don't need space */
diff --git a/programs/winhelp/hlpfile.h b/programs/winhelp/hlpfile.h
index 63ddc0c..7b67259 100644
--- a/programs/winhelp/hlpfile.h
+++ b/programs/winhelp/hlpfile.h
@@ -201,6 +201,12 @@ HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relativ
LONG HLPFILE_Hash(LPCSTR lpszContext);
void HLPFILE_FreeLink(HLPFILE_LINK* link);
void HLPFILE_FreeHlpFile(HLPFILE*);
+unsigned HLPFILE_HalfPointsToTwips(unsigned pts);
+
+static inline unsigned HLPFILE_PointsToTwips(unsigned pts)
+{
+ return HLPFILE_HalfPointsToTwips(2 * pts);
+}
void* HLPFILE_BPTreeSearch(BYTE*, const void*, HLPFILE_BPTreeCompare);
void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);
More information about the wine-cvs
mailing list