Commit 75792878 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Bring winhelp back to life, with mainly support for Win95 help files.

parent 21ec1d2a
/*
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
* Copyright 1996 Ulrich Schmid
* 2002 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -22,74 +23,89 @@ struct tagHelpFile;
typedef struct
{
LPCSTR lpszPath;
LONG lHash;
BOOL bPopup;
HGLOBAL hSelf;
LPCSTR lpszPath;
LONG lHash;
BOOL bPopup;
} HLPFILE_LINK;
enum para_type {para_normal_text, para_debug_text, para_image};
typedef struct tagHlpFileParagraph
{
LPSTR lpszText;
UINT bDebug;
UINT wFont;
UINT wIndent;
UINT wHSpace;
UINT wVSpace;
HLPFILE_LINK *link;
struct tagHlpFileParagraph *next;
HGLOBAL hSelf;
enum para_type cookie;
union
{
struct
{
LPSTR lpszText;
unsigned wFont;
unsigned wIndent;
unsigned wHSpace;
unsigned wVSpace;
} text;
struct
{
HBITMAP hBitmap;
unsigned pos; /* 0: center, 1: left, 2: right */
} image;
} u;
HLPFILE_LINK* link;
struct tagHlpFileParagraph* next;
} HLPFILE_PARAGRAPH;
typedef struct tagHlpFilePage
{
LPSTR lpszTitle;
HLPFILE_PARAGRAPH *first_paragraph;
UINT wNumber;
struct tagHlpFilePage *next;
struct tagHlpFileFile *file;
HGLOBAL hSelf;
LPSTR lpszTitle;
HLPFILE_PARAGRAPH* first_paragraph;
unsigned wNumber;
unsigned offset;
struct tagHlpFilePage* next;
struct tagHlpFilePage* prev;
struct tagHlpFileFile* file;
} HLPFILE_PAGE;
typedef struct
{
LONG lHash;
UINT wPage;
LONG lHash;
unsigned long offset;
} HLPFILE_CONTEXT;
typedef struct tagHlpFileMacro
{
LPCSTR lpszMacro;
HGLOBAL hSelf;
struct tagHlpFileMacro *next;
LPCSTR lpszMacro;
struct tagHlpFileMacro* next;
} HLPFILE_MACRO;
typedef struct tagHlpFileFile
typedef struct
{
LPSTR lpszPath;
LPSTR lpszTitle;
HLPFILE_PAGE *first_page;
HLPFILE_MACRO *first_macro;
UINT wContextLen;
HLPFILE_CONTEXT *Context;
struct tagHlpFileFile *prev;
struct tagHlpFileFile *next;
LOGFONT LogFont;
HFONT hFont;
COLORREF color;
} HLPFILE_FONT;
UINT wRefCount;
HGLOBAL hTitle;
HGLOBAL hContext;
HGLOBAL hSelf;
typedef struct tagHlpFileFile
{
LPSTR lpszPath;
LPSTR lpszTitle;
HLPFILE_PAGE* first_page;
HLPFILE_MACRO* first_macro;
unsigned wContextLen;
HLPFILE_CONTEXT* Context;
struct tagHlpFileFile* prev;
struct tagHlpFileFile* next;
unsigned wRefCount;
unsigned short version;
unsigned short flags;
unsigned hasPhrases; /* Phrases or PhrIndex/PhrImage */
unsigned numFonts;
HLPFILE_FONT* fonts;
} HLPFILE;
HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath);
......@@ -98,7 +114,3 @@ HLPFILE_PAGE *HLPFILE_PageByHash(LPCSTR lpszPath, LONG wNum);
LONG HLPFILE_Hash(LPCSTR lpszContext);
VOID HLPFILE_FreeHlpFilePage(HLPFILE_PAGE*);
VOID HLPFILE_FreeHlpFile(HLPFILE*);
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
......@@ -97,83 +97,83 @@ macrosep: ';' |
':' ;
macro: /* Empty */ |
IF_THEN '(' bool_macro ',' {if (! $3) skip++;}
macrostring ')' {if (! $3) skip--;} |
IF_THEN_ELSE '(' bool_macro ',' {if (! $3) skip++;}
macrostring ',' {if (! $3) skip--; else skip++;}
macrostring ')' {if ( $3) skip--;} |
IF_THEN '(' bool_macro ',' {if (!$3) skip++;}
macrostring ')' {if (!$3) skip--;} |
IF_THEN_ELSE '(' bool_macro ',' {if (!$3) skip++;}
macrostring ',' {if (!$3) skip--; else skip++;}
macrostring ')' {if ( $3) skip--;} |
VOID_FUNCTION_VOID
'(' ')'
{if (! skip) (*$1)();} |
{if (!skip) (*$1)();} |
VOID_FUNCTION_STRING
'(' tSTRING ')'
{if (! skip) (*$1)($3);} |
{if (!skip) (*$1)($3);} |
VOID_FUNCTION_2STRING
'(' tSTRING ',' tSTRING ')'
{if (! skip) (*$1)($3, $5);} |
{if (!skip) (*$1)($3, $5);} |
VOID_FUNCTION_2STRING_UINT
'(' tSTRING ',' tSTRING ',' INTEGER ')'
{if (! skip) (*$1)($3, $5, $7);} |
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_2STRING_UINT_STRING
'(' tSTRING ',' tSTRING ',' INTEGER ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7, $9);} |
{if (!skip) (*$1)($3, $5, $7, $9);} |
VOID_FUNCTION_2STRING_2UINT_2STRING
'(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7, $9, $11, $13);} |
{if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
'(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7, $9, $11);} |
{if (!skip) (*$1)($3, $5, $7, $9, $11);} |
VOID_FUNCTION_3STRING
'(' tSTRING ',' tSTRING ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7);} |
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_3STRING_2UINT
'(' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ')'
{if (! skip) (*$1)($3, $5, $7, $9, $11);} |
{if (!skip) (*$1)($3, $5, $7, $9, $11);} |
VOID_FUNCTION_4STRING
'(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7, $9);} |
{if (!skip) (*$1)($3, $5, $7, $9);} |
VOID_FUNCTION_4STRING_UINT
'(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER')'
{if (! skip) (*$1)($3, $5, $7, $9, $11);} |
{if (!skip) (*$1)($3, $5, $7, $9, $11);} |
VOID_FUNCTION_4STRING_2UINT
'(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER')'
{if (! skip) (*$1)($3, $5, $7, $9, $11, $13);} |
{if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
VOID_FUNCTION_STRING_UINT
'(' tSTRING ',' INTEGER ')'
{if (! skip) (*$1)($3, $5);} |
{if (!skip) (*$1)($3, $5);} |
VOID_FUNCTION_STRING_UINT_STRING
'(' tSTRING ',' INTEGER ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7);} |
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_STRING_UINT_2STRING
'(' tSTRING ',' INTEGER ',' tSTRING ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7, $9);} |
{if (!skip) (*$1)($3, $5, $7, $9);} |
VOID_FUNCTION_STRING_WPARAM_LPARAM
'(' tSTRING ',' INTEGER ',' INTEGER ')'
{if (! skip) (*$1)($3, $5, $7);} |
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_UINT
'(' INTEGER ')'
{if (! skip) (*$1)($3);} |
{if (!skip) (*$1)($3);} |
VOID_FUNCTION_2UINT
'(' INTEGER ',' INTEGER ')'
{if (! skip) (*$1)($3, $5);} |
{if (!skip) (*$1)($3, $5);} |
VOID_FUNCTION_2UINT_STRING
'(' INTEGER ',' INTEGER ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7);} |
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_3UINT
'(' INTEGER ',' INTEGER ',' INTEGER ')'
{if (! skip) (*$1)($3, $5, $7);} |
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_2INT_3UINT_STRING
'(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' tSTRING ')'
{if (! skip) (*$1)($3, $5, $7, $9, $11, $13);} |
{if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
VOID_FUNCTION_FILE_WIN
'(' file_win ')'
{if (! skip) (*$1)(filename, windowname);} |
{if (!skip) (*$1)(filename, windowname);} |
VOID_FUNCTION_FILE_WIN_STRING
'(' file_win ',' tSTRING ')'
{if (! skip) (*$1)(filename, windowname, $5);} |
{if (!skip) (*$1)(filename, windowname, $5);} |
VOID_FUNCTION_FILE_WIN_UINT
'(' file_win ',' INTEGER ')'
{if (! skip) (*$1)(filename, windowname, $5);} ;
{if (!skip) (*$1)(filename, windowname, $5);} ;
file_win: tSTRING
{
......
/*
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
* 2002 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
......@@ -19,16 +20,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define MAX_LANGUAGE_NUMBER 255
#define MAX_PATHNAME_LEN 1024
#define MAX_STRING_LEN 255
#define MAX_LANGUAGE_NUMBER 255
#define MAX_PATHNAME_LEN 1024
#define MAX_STRING_LEN 255
#define INTERNAL_BORDER_WIDTH 5
#define POPUP_YDISTANCE 20
#define SHADOW_DX 20
#define SHADOW_DY 20
#define BUTTON_CX 6
#define BUTTON_CY 6
#define INTERNAL_BORDER_WIDTH 5
#define POPUP_YDISTANCE 20
#define SHADOW_DX 10
#define SHADOW_DY 10
#define BUTTON_CX 6
#define BUTTON_CY 6
#ifndef RC_INVOKED
......@@ -38,82 +39,92 @@
typedef struct tagHelpLinePart
{
RECT rect;
LPCSTR lpsText;
UINT wTextLen;
HFONT hFont;
COLORREF color;
struct
{
LPCSTR lpszPath;
LONG lHash;
BOOL bPopup;
} link;
HGLOBAL hSelf;
struct tagHelpLinePart *next;
RECT rect;
enum {hlp_line_part_text, hlp_line_part_image} cookie;
union
{
struct
{
LPCSTR lpsText;
HFONT hFont;
COLORREF color;
WORD wTextLen;
WORD wUnderline; /* 0 None, 1 simple, 2 double, 3 dotted */
} text;
struct
{
HBITMAP hBitmap;
} image;
} u;
struct
{
LPCSTR lpszPath;
LONG lHash;
BOOL bPopup;
} link;
struct tagHelpLinePart *next;
} WINHELP_LINE_PART;
typedef struct tagHelpLine
{
RECT rect;
WINHELP_LINE_PART first_part;
struct tagHelpLine *next;
RECT rect;
WINHELP_LINE_PART first_part;
struct tagHelpLine* next;
} WINHELP_LINE;
typedef struct tagHelpButton
{
HWND hWnd;
HWND hWnd;
LPCSTR lpszID;
LPCSTR lpszName;
LPCSTR lpszMacro;
LPCSTR lpszID;
LPCSTR lpszName;
LPCSTR lpszMacro;
WPARAM wParam;
WPARAM wParam;
RECT rect;
RECT rect;
HGLOBAL hSelf;
struct tagHelpButton *next;
struct tagHelpButton*next;
} WINHELP_BUTTON;
typedef struct tagWinHelp
{
LPCSTR lpszName;
LPCSTR lpszName;
WINHELP_BUTTON *first_button;
HLPFILE_PAGE *page;
WINHELP_LINE *first_line;
WINHELP_BUTTON* first_button;
HLPFILE_PAGE* page;
WINHELP_LINE* first_line;
HWND hMainWnd;
HWND hButtonBoxWnd;
HWND hTextWnd;
HWND hShadowWnd;
HWND hMainWnd;
HWND hButtonBoxWnd;
HWND hTextWnd;
HWND hShadowWnd;
HFONT (*fonts)[2];
UINT fonts_len;
HFONT* fonts;
UINT fonts_len;
HCURSOR hArrowCur;
HCURSOR hHandCur;
HCURSOR hArrowCur;
HCURSOR hHandCur;
HGLOBAL hSelf;
struct tagWinHelp *next;
struct tagWinHelp* next;
} WINHELP_WINDOW;
typedef struct
{
UINT wVersion;
HANDLE hInstance;
HWND hPopupWnd;
UINT wStringTableOffset;
WINHELP_WINDOW *active_win;
WINHELP_WINDOW *win_list;
UINT wVersion;
HANDLE hInstance;
HWND hPopupWnd;
UINT wStringTableOffset;
WINHELP_WINDOW* active_win;
WINHELP_WINDOW* win_list;
} WINHELP_GLOBALS;
extern WINHELP_GLOBALS Globals;
VOID WINHELP_CreateHelpWindow(LPCSTR, LONG, LPCSTR, BOOL, HWND, LPPOINT, INT);
BOOL WINHELP_CreateHelpWindowByHash(LPCSTR, LONG, LPCSTR, BOOL, HWND, LPPOINT, INT);
BOOL WINHELP_CreateHelpWindowByPage(HLPFILE_PAGE*, LPCSTR, BOOL, HWND, LPPOINT, INT);
INT WINHELP_MessageBoxIDS(UINT, UINT, WORD);
INT WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
......@@ -128,7 +139,3 @@ extern CHAR STRING_DIALOG_TEST[];
/* Buttons */
#define WH_FIRST_BUTTON 500
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */
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