Commit 7d75cfed authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added support for window information from the .hlp file.

Added support for window numbers in link.
parent 5d0b9871
......@@ -227,6 +227,9 @@ HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath)
hlpfile->numFonts = 0;
hlpfile->fonts = NULL;
hlpfile->numWindows = 0;
hlpfile->windows = NULL;
strcpy(hlpfile->lpszPath, lpszPath);
first_hlpfile = hlpfile;
......@@ -800,21 +803,20 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
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\n",
paragraph->link->cookie, paragraph->link->lpszString, paragraph->link->lHash);
WINE_TRACE("Link[%d] to %s@%08lx:%d\n",
paragraph->link->cookie, paragraph->link->lpszString,
paragraph->link->lHash, paragraph->link->window);
}
#if 0
memset(&attributes, 0, sizeof(attributes));
#else
attributes.hBitmap = 0;
attributes.link.lpszString = NULL;
attributes.link.bClrChange = FALSE;
attributes.link.lHash = 0;
attributes.link.window = -1;
attributes.wVSpace = 0;
attributes.wHSpace = 0;
attributes.wIndent = 0;
#endif
}
/* else: null text, keep on storing attributes */
text += textsize;
......@@ -969,7 +971,7 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
attributes.link.bClrChange = !(*format & 1);
if (type == 1)
{WINE_FIXME("Unsupported wnd number %d for link\n", *ptr); ptr++;}
attributes.link.window = *ptr++;
if (type == 4 || type == 6)
{
attributes.link.lpszString = ptr;
......@@ -978,7 +980,20 @@ static BOOL HLPFILE_AddParagraph(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigne
else
attributes.link.lpszString = hlpfile->lpszPath;
if (type == 6)
WINE_FIXME("Unsupported wnd name '%s' for link\n", ptr);
{
int i;
for (i = 0; i < hlpfile->numWindows; i++)
{
if (!strcmp(ptr, hlpfile->windows[i].name))
{
attributes.link.window = i;
break;
}
}
if (attributes.link.window == -1)
WINE_WARN("Couldn't find window info for %s\n", ptr);
}
}
format += 3 + GET_USHORT(format, 1);
break;
......@@ -1257,10 +1272,35 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
case 6:
if (GET_USHORT(ptr, 2) != 90) {WINE_WARN("system6\n");break;}
WINE_FIXME("System-Window: flags=%4x type=%s name=%s caption=%s (%d,%d)x(%d,%d)\n",
GET_USHORT(ptr, 4), ptr + 6, ptr + 16, ptr + 25,
GET_SHORT(ptr, 76), GET_USHORT(ptr, 78),
GET_SHORT(ptr, 80), GET_USHORT(ptr, 82));
hlpfile->windows = HeapReAlloc(GetProcessHeap(), 0, hlpfile->windows,
sizeof(HLPFILE_WINDOWINFO) * ++hlpfile->numWindows);
if (hlpfile->windows)
{
unsigned flags = GET_USHORT(ptr, 4);
HLPFILE_WINDOWINFO* wi = &hlpfile->windows[hlpfile->numWindows - 1];
if (flags & 0x0001) strcpy(wi->type, ptr + 6); else wi->type[0] = '\0';
if (flags & 0x0002) strcpy(wi->name, ptr + 16); else wi->name[0] = '\0';
if (flags & 0x0004) strcpy(wi->caption, ptr + 25); else strncpy(wi->caption, hlpfile->lpszTitle, sizeof(wi->caption));
wi->origin.x = (flags & 0x0008) ? GET_USHORT(ptr, 76) : CW_USEDEFAULT;
wi->origin.y = (flags & 0x0010) ? GET_USHORT(ptr, 78) : CW_USEDEFAULT;
wi->size.cx = (flags & 0x0020) ? GET_USHORT(ptr, 80) : CW_USEDEFAULT;
wi->size.cy = (flags & 0x0040) ? GET_USHORT(ptr, 82) : CW_USEDEFAULT;
wi->style = (flags & 0x0080) ? GET_USHORT(ptr, 84) : SW_SHOW;
wi->sr_color = (flags & 0x0100) ? GET_UINT(ptr, 86) : 0xFFFFFF;
wi->nsr_color = (flags & 0x0200) ? GET_UINT(ptr, 90) : 0xFFFFFF;
WINE_FIXME("System-Window: flags=%c%c%c%c%c%c%c%c type=%s name=%s caption=%s (%ld,%ld)x(%ld,%ld)\n",
flags & 0x0001 ? 'T' : 't',
flags & 0x0002 ? 'N' : 'n',
flags & 0x0004 ? 'C' : 'c',
flags & 0x0008 ? 'X' : 'x',
flags & 0x0010 ? 'Y' : 'y',
flags & 0x0020 ? 'W' : 'w',
flags & 0x0040 ? 'H' : 'h',
flags & 0x0080 ? 'S' : 's',
wi->type, wi->name, wi->caption, wi->origin.x, wi->origin.y,
wi->size.cx, wi->size.cy);
}
break;
default:
WINE_WARN("Unsupported SystemRecord[%d]\n", GET_USHORT(ptr, 0));
......@@ -1790,6 +1830,7 @@ void HLPFILE_FreeHlpFile(HLPFILE* hlpfile)
HLPFILE_DeletePage(hlpfile->first_page);
HLPFILE_DeleteMacro(hlpfile->first_macro);
if (hlpfile->numWindows) HeapFree(GetProcessHeap(), 0, hlpfile->windows);
if (hlpfile->Context) HeapFree(GetProcessHeap(), 0, hlpfile->Context);
if (hlpfile->lpszTitle) HeapFree(GetProcessHeap(), 0, hlpfile->lpszTitle);
if (hlpfile->lpszCopyright) HeapFree(GetProcessHeap(), 0, hlpfile->lpszCopyright);
......
......@@ -21,12 +21,26 @@
struct tagHelpFile;
typedef struct
{
char type[10];
char name[9];
char caption[51];
POINT origin;
SIZE size;
int style;
DWORD win_style;
COLORREF sr_color; /* color for scrollable region */
COLORREF nsr_color; /* color for non scrollable region */
} HLPFILE_WINDOWINFO;
typedef struct
{
enum {hlp_link_none, hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
LPCSTR lpszString;
LONG lHash;
BOOL bClrChange;
LPCSTR lpszString;
LONG lHash;
BOOL bClrChange;
unsigned window;
} HLPFILE_LINK;
enum para_type {para_normal_text, para_debug_text, para_image};
......@@ -113,6 +127,9 @@ typedef struct tagHlpFileFile
unsigned numFonts;
HLPFILE_FONT* fonts;
unsigned numWindows;
HLPFILE_WINDOWINFO* windows;
} HLPFILE;
HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath);
......
......@@ -535,7 +535,12 @@ void MACRO_FileOpen(void)
openfilename.lpTemplateName = 0;
if (GetOpenFileName(&openfilename))
WINHELP_CreateHelpWindowByHash(szPath, 0, "main", FALSE, 0, NULL, SW_SHOWNORMAL);
{
HLPFILE* hlpfile = WINHELP_LookupHelpFile(szPath);
WINHELP_CreateHelpWindowByHash(hlpfile, 0,
WINHELP_GetWindowInfo(hlpfile, "main"), SW_SHOWNORMAL);
}
}
void MACRO_Find(void)
......@@ -643,8 +648,13 @@ BOOL MACRO_IsNotMark(LPCSTR str)
void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
{
HLPFILE* hlpfile;
WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath, lpszWindow);
WINHELP_CreateHelpWindowByHash(lpszPath, 0, lpszWindow, FALSE, 0, NULL, SW_NORMAL);
hlpfile = WINHELP_LookupHelpFile(lpszPath);
WINHELP_CreateHelpWindowByHash(hlpfile, 0,
WINHELP_GetWindowInfo(hlpfile, lpszWindow),
SW_NORMAL);
}
void MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
......@@ -654,8 +664,13 @@ void MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
{
HLPFILE* hlpfile;
WINE_TRACE("(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, lHash);
WINHELP_CreateHelpWindowByHash(lpszPath, lHash, lpszWindow, FALSE, 0, NULL, SW_NORMAL);
hlpfile = WINHELP_LookupHelpFile(lpszPath);
WINHELP_CreateHelpWindowByHash(hlpfile, lHash,
WINHELP_GetWindowInfo(hlpfile, lpszWindow),
SW_NORMAL);
}
void MACRO_JumpHelpOn(void)
......@@ -699,9 +714,14 @@ void MACRO_MPrintID(LPCSTR str)
void MACRO_Next(void)
{
HLPFILE_PAGE* page;
WINE_TRACE("()\n");
if (Globals.active_win->page->next)
WINHELP_CreateHelpWindowByPage(Globals.active_win->page->next, "main", FALSE, 0, NULL, SW_NORMAL);
if ((page = Globals.active_win->page->next) != NULL)
{
page->file->wRefCount++;
WINHELP_CreateHelpWindow(page, Globals.active_win->info, SW_NORMAL);
}
}
void MACRO_NoShow(void)
......@@ -731,9 +751,14 @@ void MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR st
void MACRO_Prev(void)
{
HLPFILE_PAGE* page;
WINE_TRACE("()\n");
if (Globals.active_win->page->prev)
WINHELP_CreateHelpWindowByPage(Globals.active_win->page->prev, "main", FALSE, 0, NULL, SW_NORMAL);
if ((page = Globals.active_win->page->prev) != NULL)
{
page->file->wRefCount++;
WINHELP_CreateHelpWindow(page, Globals.active_win->info, SW_NORMAL);
}
}
void MACRO_Print(void)
......
......@@ -85,7 +85,7 @@ typedef struct tagHelpButton
typedef struct tagWinHelp
{
LPCSTR lpszName;
LPCSTR lpszName;
WINHELP_BUTTON* first_button;
HLPFILE_PAGE* page;
......@@ -102,6 +102,8 @@ typedef struct tagWinHelp
HCURSOR hArrowCur;
HCURSOR hHandCur;
HLPFILE_WINDOWINFO* info;
struct tagWinHelp* next;
} WINHELP_WINDOW;
......@@ -118,10 +120,12 @@ typedef struct
extern WINHELP_GLOBALS Globals;
BOOL WINHELP_CreateHelpWindowByHash(LPCSTR, LONG, LPCSTR, BOOL, HWND, LPPOINT, INT);
BOOL WINHELP_CreateHelpWindowByPage(HLPFILE_PAGE*, LPCSTR, BOOL, HWND, LPPOINT, INT);
BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE*, HLPFILE_WINDOWINFO*, int);
INT WINHELP_MessageBoxIDS(UINT, UINT, WORD);
INT WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
extern char MAIN_WIN_CLASS_NAME[];
extern char BUTTON_BOX_WIN_CLASS_NAME[];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment