mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
- SVN maintenance.
svn path=/trunk/; revision=38880
This commit is contained in:
parent
d068ad2d69
commit
ea435d7876
11 changed files with 8214 additions and 8214 deletions
|
@ -1,180 +1,180 @@
|
|||
/*
|
||||
* Help Viewer - DLL callback into WineHelp
|
||||
*
|
||||
* Copyright 2004 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windows.h"
|
||||
#include "winhelp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
|
||||
|
||||
static WORD CALLBACK WHD_GetFSError(void)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
|
||||
{
|
||||
unsigned mode = 0;
|
||||
|
||||
WINE_FIXME("(%s %x)\n", wine_dbgstr_a(name), flags);
|
||||
switch (flags)
|
||||
{
|
||||
case 0: mode = GENERIC_READ | GENERIC_WRITE; break;
|
||||
case 2: mode = GENERIC_READ; break;
|
||||
default: WINE_FIXME("Undocumented flags %x\n", flags);
|
||||
}
|
||||
return CreateFile(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
}
|
||||
|
||||
static WORD CALLBACK WHD_Close(HANDLE fs)
|
||||
{
|
||||
WINE_FIXME("(%p)\n", fs);
|
||||
CloseHandle(fs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HANDLE CALLBACK WHD_OpenBag(HANDLE fs, LPSTR name, BYTE flags)
|
||||
{
|
||||
WINE_FIXME("(%p %s %x)\n", fs, name, flags);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static HANDLE CALLBACK WHD_CloseBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_ReadBag(HANDLE bag, BYTE* ptr, LONG len)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_TellBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_SeekBag(HANDLE bag, LONG offset, WORD whence)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK WHD_IsEofBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_SizeBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK WHD_Access(HANDLE fs, LPSTR name, BYTE flags)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static WORD CALLBACK WHD_LLInfoFromBag(HANDLE bag, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WORD CALLBACK WHD_LLInfoFromFile(HANDLE fs, LPSTR name, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CALLBACK WHD_Error(int err)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
}
|
||||
|
||||
static void CALLBACK WHD_ErrorString(LPSTR err)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
}
|
||||
|
||||
static ULONG_PTR CALLBACK WHD_GetInfo(WORD what, HWND hnd)
|
||||
{
|
||||
ULONG_PTR ret = 0;
|
||||
|
||||
WINE_TRACE("(%x %p)\n", what, hnd);
|
||||
switch (what)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: /* instance */ ret = (ULONG_PTR)Globals.hInstance; break;
|
||||
case 3: /* current window */ ret = (ULONG_PTR)Globals.active_win->hMainWnd; break;
|
||||
case 2: /* main window */
|
||||
case 4: /* handle to opened file */
|
||||
case 5: /* foreground color */
|
||||
case 6: /* background color */
|
||||
case 7: /* topic number */
|
||||
case 8: /* current opened file name */
|
||||
WINE_FIXME("NIY %u\n", what);
|
||||
break;
|
||||
default:
|
||||
WINE_FIXME("Undocumented %u\n", what);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_API(LPSTR x, WORD xx, DWORD xxx)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
FARPROC Callbacks[] =
|
||||
{
|
||||
(FARPROC)WHD_GetFSError,
|
||||
(FARPROC)WHD_Open,
|
||||
(FARPROC)WHD_Close,
|
||||
(FARPROC)WHD_OpenBag,
|
||||
(FARPROC)WHD_CloseBag,
|
||||
(FARPROC)WHD_ReadBag,
|
||||
(FARPROC)WHD_TellBag,
|
||||
(FARPROC)WHD_SeekBag,
|
||||
(FARPROC)WHD_IsEofBag,
|
||||
(FARPROC)WHD_SizeBag,
|
||||
(FARPROC)WHD_Access,
|
||||
(FARPROC)WHD_LLInfoFromBag,
|
||||
(FARPROC)WHD_LLInfoFromFile,
|
||||
(FARPROC)WHD_Error,
|
||||
(FARPROC)WHD_ErrorString,
|
||||
(FARPROC)WHD_GetInfo,
|
||||
(FARPROC)WHD_API
|
||||
};
|
||||
/*
|
||||
* Help Viewer - DLL callback into WineHelp
|
||||
*
|
||||
* Copyright 2004 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windows.h"
|
||||
#include "winhelp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
|
||||
|
||||
static WORD CALLBACK WHD_GetFSError(void)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
|
||||
{
|
||||
unsigned mode = 0;
|
||||
|
||||
WINE_FIXME("(%s %x)\n", wine_dbgstr_a(name), flags);
|
||||
switch (flags)
|
||||
{
|
||||
case 0: mode = GENERIC_READ | GENERIC_WRITE; break;
|
||||
case 2: mode = GENERIC_READ; break;
|
||||
default: WINE_FIXME("Undocumented flags %x\n", flags);
|
||||
}
|
||||
return CreateFile(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
}
|
||||
|
||||
static WORD CALLBACK WHD_Close(HANDLE fs)
|
||||
{
|
||||
WINE_FIXME("(%p)\n", fs);
|
||||
CloseHandle(fs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HANDLE CALLBACK WHD_OpenBag(HANDLE fs, LPSTR name, BYTE flags)
|
||||
{
|
||||
WINE_FIXME("(%p %s %x)\n", fs, name, flags);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static HANDLE CALLBACK WHD_CloseBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_ReadBag(HANDLE bag, BYTE* ptr, LONG len)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_TellBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_SeekBag(HANDLE bag, LONG offset, WORD whence)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK WHD_IsEofBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_SizeBag(HANDLE bag)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK WHD_Access(HANDLE fs, LPSTR name, BYTE flags)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static WORD CALLBACK WHD_LLInfoFromBag(HANDLE bag, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WORD CALLBACK WHD_LLInfoFromFile(HANDLE fs, LPSTR name, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CALLBACK WHD_Error(int err)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
}
|
||||
|
||||
static void CALLBACK WHD_ErrorString(LPSTR err)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
}
|
||||
|
||||
static ULONG_PTR CALLBACK WHD_GetInfo(WORD what, HWND hnd)
|
||||
{
|
||||
ULONG_PTR ret = 0;
|
||||
|
||||
WINE_TRACE("(%x %p)\n", what, hnd);
|
||||
switch (what)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: /* instance */ ret = (ULONG_PTR)Globals.hInstance; break;
|
||||
case 3: /* current window */ ret = (ULONG_PTR)Globals.active_win->hMainWnd; break;
|
||||
case 2: /* main window */
|
||||
case 4: /* handle to opened file */
|
||||
case 5: /* foreground color */
|
||||
case 6: /* background color */
|
||||
case 7: /* topic number */
|
||||
case 8: /* current opened file name */
|
||||
WINE_FIXME("NIY %u\n", what);
|
||||
break;
|
||||
default:
|
||||
WINE_FIXME("Undocumented %u\n", what);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static LONG CALLBACK WHD_API(LPSTR x, WORD xx, DWORD xxx)
|
||||
{
|
||||
WINE_FIXME("()\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
FARPROC Callbacks[] =
|
||||
{
|
||||
(FARPROC)WHD_GetFSError,
|
||||
(FARPROC)WHD_Open,
|
||||
(FARPROC)WHD_Close,
|
||||
(FARPROC)WHD_OpenBag,
|
||||
(FARPROC)WHD_CloseBag,
|
||||
(FARPROC)WHD_ReadBag,
|
||||
(FARPROC)WHD_TellBag,
|
||||
(FARPROC)WHD_SeekBag,
|
||||
(FARPROC)WHD_IsEofBag,
|
||||
(FARPROC)WHD_SizeBag,
|
||||
(FARPROC)WHD_Access,
|
||||
(FARPROC)WHD_LLInfoFromBag,
|
||||
(FARPROC)WHD_LLInfoFromFile,
|
||||
(FARPROC)WHD_Error,
|
||||
(FARPROC)WHD_ErrorString,
|
||||
(FARPROC)WHD_GetInfo,
|
||||
(FARPROC)WHD_API
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,191 +1,191 @@
|
|||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
* 2002, 2008 Eric Pouech
|
||||
* 2007 Kirill K. Smirnov
|
||||
*
|
||||
* 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
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 tagHlpFileLink
|
||||
{
|
||||
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) */
|
||||
LONG hash; /* topic index */
|
||||
unsigned bClrChange : 1; /* true if the link is green & underlined */
|
||||
unsigned window; /* window number for displaying the link (-1 is current) */
|
||||
DWORD cpMin;
|
||||
DWORD cpMax;
|
||||
struct tagHlpFileLink* next;
|
||||
} HLPFILE_LINK;
|
||||
|
||||
typedef struct tagHlpFileMacro
|
||||
{
|
||||
LPCSTR lpszMacro;
|
||||
struct tagHlpFileMacro* next;
|
||||
} HLPFILE_MACRO;
|
||||
|
||||
typedef struct tagHlpFilePage
|
||||
{
|
||||
LPSTR lpszTitle;
|
||||
HLPFILE_MACRO* first_macro;
|
||||
|
||||
HLPFILE_LINK* first_link;
|
||||
|
||||
unsigned wNumber;
|
||||
unsigned offset;
|
||||
DWORD reference;
|
||||
struct tagHlpFilePage* next;
|
||||
struct tagHlpFilePage* prev;
|
||||
|
||||
DWORD browse_bwd;
|
||||
DWORD browse_fwd;
|
||||
|
||||
struct tagHlpFileFile* file;
|
||||
} HLPFILE_PAGE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LONG lMap;
|
||||
unsigned long offset;
|
||||
} HLPFILE_MAP;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LOGFONT LogFont;
|
||||
HFONT hFont;
|
||||
COLORREF color;
|
||||
} HLPFILE_FONT;
|
||||
|
||||
typedef struct tagHlpFileFile
|
||||
{
|
||||
BYTE* file_buffer;
|
||||
UINT file_buffer_size;
|
||||
LPSTR lpszPath;
|
||||
LPSTR lpszTitle;
|
||||
LPSTR lpszCopyright;
|
||||
HLPFILE_PAGE* first_page;
|
||||
HLPFILE_PAGE* last_page;
|
||||
HLPFILE_MACRO* first_macro;
|
||||
BYTE* Context;
|
||||
BYTE* kwbtree;
|
||||
BYTE* kwdata;
|
||||
unsigned wMapLen;
|
||||
HLPFILE_MAP* Map;
|
||||
unsigned wTOMapLen;
|
||||
unsigned* TOMap;
|
||||
unsigned long contents_start;
|
||||
|
||||
struct tagHlpFileFile* prev;
|
||||
struct tagHlpFileFile* next;
|
||||
|
||||
unsigned wRefCount;
|
||||
|
||||
unsigned short version;
|
||||
unsigned short flags;
|
||||
unsigned short charset;
|
||||
unsigned short tbsize; /* topic block size */
|
||||
unsigned short dsize; /* decompress size */
|
||||
unsigned short compressed;
|
||||
unsigned hasPhrases; /* file has |Phrases */
|
||||
unsigned hasPhrases40; /* file has |PhrIndex/|PhrImage */
|
||||
UINT num_phrases;
|
||||
unsigned* phrases_offsets;
|
||||
char* phrases_buffer;
|
||||
|
||||
BYTE** topic_map;
|
||||
BYTE* topic_end;
|
||||
UINT topic_maplen;
|
||||
|
||||
unsigned numBmps;
|
||||
HBITMAP* bmps;
|
||||
|
||||
unsigned numFonts;
|
||||
HLPFILE_FONT* fonts;
|
||||
|
||||
unsigned numWindows;
|
||||
HLPFILE_WINDOWINFO* windows;
|
||||
HICON hIcon;
|
||||
|
||||
BOOL has_popup_color;
|
||||
COLORREF popup_color;
|
||||
|
||||
LPSTR help_on_file;
|
||||
} HLPFILE;
|
||||
|
||||
/*
|
||||
* Compare function type for HLPFILE_BPTreeSearch function.
|
||||
*
|
||||
* PARAMS
|
||||
* p [I] pointer to testing block (key + data)
|
||||
* key [I] pointer to key value to look for
|
||||
* leaf [I] whether this function called for index of leaf page
|
||||
* next [O] pointer to pointer to next block
|
||||
*/
|
||||
typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
|
||||
int leaf, void **next);
|
||||
|
||||
/*
|
||||
* Callback function type for HLPFILE_BPTreeEnum function.
|
||||
*
|
||||
* PARAMS
|
||||
* p [I] pointer to data block
|
||||
* next [O] pointer to pointer to next block
|
||||
* cookie [IO] cookie data
|
||||
*/
|
||||
typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
|
||||
|
||||
HLPFILE* HLPFILE_ReadHlpFile(LPCSTR lpszPath);
|
||||
HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash, ULONG* relative);
|
||||
HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap, ULONG* relative);
|
||||
HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relative);
|
||||
LONG HLPFILE_Hash(LPCSTR lpszContext);
|
||||
void HLPFILE_FreeHlpFile(HLPFILE*);
|
||||
|
||||
void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);
|
||||
|
||||
struct RtfData {
|
||||
BOOL in_text;
|
||||
char* data; /* RTF stream start */
|
||||
char* ptr; /* current position in stream */
|
||||
unsigned allocated; /* overall allocated size */
|
||||
unsigned char_pos; /* current char position (in richedit) */
|
||||
char* where; /* pointer to feed back richedit */
|
||||
unsigned font_scale; /* how to scale fonts */
|
||||
HLPFILE_LINK*first_link;
|
||||
HLPFILE_LINK*current_link;
|
||||
BOOL force_color;
|
||||
unsigned relative; /* offset within page to lookup for */
|
||||
unsigned char_pos_rel; /* char_pos correspondinf to relative */
|
||||
};
|
||||
|
||||
BOOL HLPFILE_BrowsePage(HLPFILE_PAGE*, struct RtfData* rd,
|
||||
unsigned font_scale, unsigned relative);
|
||||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
* 2002, 2008 Eric Pouech
|
||||
* 2007 Kirill K. Smirnov
|
||||
*
|
||||
* 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
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 tagHlpFileLink
|
||||
{
|
||||
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) */
|
||||
LONG hash; /* topic index */
|
||||
unsigned bClrChange : 1; /* true if the link is green & underlined */
|
||||
unsigned window; /* window number for displaying the link (-1 is current) */
|
||||
DWORD cpMin;
|
||||
DWORD cpMax;
|
||||
struct tagHlpFileLink* next;
|
||||
} HLPFILE_LINK;
|
||||
|
||||
typedef struct tagHlpFileMacro
|
||||
{
|
||||
LPCSTR lpszMacro;
|
||||
struct tagHlpFileMacro* next;
|
||||
} HLPFILE_MACRO;
|
||||
|
||||
typedef struct tagHlpFilePage
|
||||
{
|
||||
LPSTR lpszTitle;
|
||||
HLPFILE_MACRO* first_macro;
|
||||
|
||||
HLPFILE_LINK* first_link;
|
||||
|
||||
unsigned wNumber;
|
||||
unsigned offset;
|
||||
DWORD reference;
|
||||
struct tagHlpFilePage* next;
|
||||
struct tagHlpFilePage* prev;
|
||||
|
||||
DWORD browse_bwd;
|
||||
DWORD browse_fwd;
|
||||
|
||||
struct tagHlpFileFile* file;
|
||||
} HLPFILE_PAGE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LONG lMap;
|
||||
unsigned long offset;
|
||||
} HLPFILE_MAP;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LOGFONT LogFont;
|
||||
HFONT hFont;
|
||||
COLORREF color;
|
||||
} HLPFILE_FONT;
|
||||
|
||||
typedef struct tagHlpFileFile
|
||||
{
|
||||
BYTE* file_buffer;
|
||||
UINT file_buffer_size;
|
||||
LPSTR lpszPath;
|
||||
LPSTR lpszTitle;
|
||||
LPSTR lpszCopyright;
|
||||
HLPFILE_PAGE* first_page;
|
||||
HLPFILE_PAGE* last_page;
|
||||
HLPFILE_MACRO* first_macro;
|
||||
BYTE* Context;
|
||||
BYTE* kwbtree;
|
||||
BYTE* kwdata;
|
||||
unsigned wMapLen;
|
||||
HLPFILE_MAP* Map;
|
||||
unsigned wTOMapLen;
|
||||
unsigned* TOMap;
|
||||
unsigned long contents_start;
|
||||
|
||||
struct tagHlpFileFile* prev;
|
||||
struct tagHlpFileFile* next;
|
||||
|
||||
unsigned wRefCount;
|
||||
|
||||
unsigned short version;
|
||||
unsigned short flags;
|
||||
unsigned short charset;
|
||||
unsigned short tbsize; /* topic block size */
|
||||
unsigned short dsize; /* decompress size */
|
||||
unsigned short compressed;
|
||||
unsigned hasPhrases; /* file has |Phrases */
|
||||
unsigned hasPhrases40; /* file has |PhrIndex/|PhrImage */
|
||||
UINT num_phrases;
|
||||
unsigned* phrases_offsets;
|
||||
char* phrases_buffer;
|
||||
|
||||
BYTE** topic_map;
|
||||
BYTE* topic_end;
|
||||
UINT topic_maplen;
|
||||
|
||||
unsigned numBmps;
|
||||
HBITMAP* bmps;
|
||||
|
||||
unsigned numFonts;
|
||||
HLPFILE_FONT* fonts;
|
||||
|
||||
unsigned numWindows;
|
||||
HLPFILE_WINDOWINFO* windows;
|
||||
HICON hIcon;
|
||||
|
||||
BOOL has_popup_color;
|
||||
COLORREF popup_color;
|
||||
|
||||
LPSTR help_on_file;
|
||||
} HLPFILE;
|
||||
|
||||
/*
|
||||
* Compare function type for HLPFILE_BPTreeSearch function.
|
||||
*
|
||||
* PARAMS
|
||||
* p [I] pointer to testing block (key + data)
|
||||
* key [I] pointer to key value to look for
|
||||
* leaf [I] whether this function called for index of leaf page
|
||||
* next [O] pointer to pointer to next block
|
||||
*/
|
||||
typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
|
||||
int leaf, void **next);
|
||||
|
||||
/*
|
||||
* Callback function type for HLPFILE_BPTreeEnum function.
|
||||
*
|
||||
* PARAMS
|
||||
* p [I] pointer to data block
|
||||
* next [O] pointer to pointer to next block
|
||||
* cookie [IO] cookie data
|
||||
*/
|
||||
typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
|
||||
|
||||
HLPFILE* HLPFILE_ReadHlpFile(LPCSTR lpszPath);
|
||||
HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash, ULONG* relative);
|
||||
HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap, ULONG* relative);
|
||||
HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset, ULONG* relative);
|
||||
LONG HLPFILE_Hash(LPCSTR lpszContext);
|
||||
void HLPFILE_FreeHlpFile(HLPFILE*);
|
||||
|
||||
void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);
|
||||
|
||||
struct RtfData {
|
||||
BOOL in_text;
|
||||
char* data; /* RTF stream start */
|
||||
char* ptr; /* current position in stream */
|
||||
unsigned allocated; /* overall allocated size */
|
||||
unsigned char_pos; /* current char position (in richedit) */
|
||||
char* where; /* pointer to feed back richedit */
|
||||
unsigned font_scale; /* how to scale fonts */
|
||||
HLPFILE_LINK*first_link;
|
||||
HLPFILE_LINK*current_link;
|
||||
BOOL force_color;
|
||||
unsigned relative; /* offset within page to lookup for */
|
||||
unsigned char_pos_rel; /* char_pos correspondinf to relative */
|
||||
};
|
||||
|
||||
BOOL HLPFILE_BrowsePage(HLPFILE_PAGE*, struct RtfData* rd,
|
||||
unsigned font_scale, unsigned relative);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,62 +1,62 @@
|
|||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
* Copyright 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
struct lexret {
|
||||
LPCSTR proto;
|
||||
BOOL bool;
|
||||
LONG integer;
|
||||
LPCSTR string;
|
||||
FARPROC function;
|
||||
};
|
||||
|
||||
extern struct lexret yylval;
|
||||
|
||||
BOOL MACRO_ExecuteMacro(LPCSTR);
|
||||
int MACRO_Lookup(const char* name, struct lexret* lr);
|
||||
|
||||
enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
|
||||
void CALLBACK MACRO_About(void);
|
||||
void CALLBACK MACRO_Annotate(void);
|
||||
void CALLBACK MACRO_BookmarkDefine(void);
|
||||
void CALLBACK MACRO_CopyDialog(void);
|
||||
void CALLBACK MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
|
||||
void CALLBACK MACRO_DisableButton(LPCSTR);
|
||||
void CALLBACK MACRO_Exit(void);
|
||||
void CALLBACK MACRO_FileOpen(void);
|
||||
void CALLBACK MACRO_HelpOn(void);
|
||||
void CALLBACK MACRO_HelpOnTop(void);
|
||||
void CALLBACK MACRO_History(void);
|
||||
void CALLBACK MACRO_JumpContents(LPCSTR, LPCSTR);
|
||||
void CALLBACK MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
|
||||
void CALLBACK MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
|
||||
void CALLBACK MACRO_PopupContext(LPCSTR, LONG);
|
||||
void CALLBACK MACRO_Print(void);
|
||||
void CALLBACK MACRO_PrinterSetup(void);
|
||||
void CALLBACK MACRO_SetContents(LPCSTR, LONG);
|
||||
|
||||
/* Local Variables: */
|
||||
/* c-file-style: "GNU" */
|
||||
/* End: */
|
||||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
* Copyright 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
struct lexret {
|
||||
LPCSTR proto;
|
||||
BOOL bool;
|
||||
LONG integer;
|
||||
LPCSTR string;
|
||||
FARPROC function;
|
||||
};
|
||||
|
||||
extern struct lexret yylval;
|
||||
|
||||
BOOL MACRO_ExecuteMacro(LPCSTR);
|
||||
int MACRO_Lookup(const char* name, struct lexret* lr);
|
||||
|
||||
enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
|
||||
void CALLBACK MACRO_About(void);
|
||||
void CALLBACK MACRO_Annotate(void);
|
||||
void CALLBACK MACRO_BookmarkDefine(void);
|
||||
void CALLBACK MACRO_CopyDialog(void);
|
||||
void CALLBACK MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
|
||||
void CALLBACK MACRO_DisableButton(LPCSTR);
|
||||
void CALLBACK MACRO_Exit(void);
|
||||
void CALLBACK MACRO_FileOpen(void);
|
||||
void CALLBACK MACRO_HelpOn(void);
|
||||
void CALLBACK MACRO_HelpOnTop(void);
|
||||
void CALLBACK MACRO_History(void);
|
||||
void CALLBACK MACRO_JumpContents(LPCSTR, LPCSTR);
|
||||
void CALLBACK MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
|
||||
void CALLBACK MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
|
||||
void CALLBACK MACRO_PopupContext(LPCSTR, LONG);
|
||||
void CALLBACK MACRO_Print(void);
|
||||
void CALLBACK MACRO_PrinterSetup(void);
|
||||
void CALLBACK MACRO_SetContents(LPCSTR, LONG);
|
||||
|
||||
/* Local Variables: */
|
||||
/* c-file-style: "GNU" */
|
||||
/* End: */
|
||||
|
|
|
@ -1,316 +1,316 @@
|
|||
%{ /* -*-C-*- */
|
||||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
* Copyright 2002,2008 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
%}
|
||||
%option noinput nounput interactive 8bit
|
||||
%x quote
|
||||
%{
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HAVE_UNISTD_H
|
||||
#define YY_NO_UNISTD_H
|
||||
#endif
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
|
||||
|
||||
struct lex_data {
|
||||
LPCSTR macroptr;
|
||||
LPSTR strptr;
|
||||
int quote_stack[32];
|
||||
unsigned quote_stk_idx;
|
||||
LPSTR cache_string[32];
|
||||
int cache_used;
|
||||
};
|
||||
static struct lex_data* lex_data = NULL;
|
||||
|
||||
struct lexret yylval;
|
||||
|
||||
#define YY_INPUT(buf,result,max_size)\
|
||||
if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++;
|
||||
|
||||
%}
|
||||
%%
|
||||
|
||||
[-+]?[0-9]+ yylval.integer = strtol(yytext, NULL, 10); return INTEGER;
|
||||
[-+]?0[xX][0-9a-f]+ yylval.integer = strtol(yytext, NULL, 16); return INTEGER;
|
||||
|
||||
[a-zA-Z][_0-9a-zA-Z]* return MACRO_Lookup(yytext, &yylval);
|
||||
|
||||
\` |
|
||||
\" |
|
||||
\' |
|
||||
<quote>\` |
|
||||
<quote>\" |
|
||||
<quote>\' {
|
||||
if (lex_data->quote_stk_idx == 0 ||
|
||||
(yytext[0] == '\"' && lex_data->quote_stack[lex_data->quote_stk_idx - 1] != '\"') ||
|
||||
(yytext[0] == '`'))
|
||||
{
|
||||
/* opening a new one */
|
||||
if (lex_data->quote_stk_idx == 0)
|
||||
{
|
||||
assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0]));
|
||||
lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1);
|
||||
yylval.string = lex_data->strptr;
|
||||
lex_data->cache_used++;
|
||||
BEGIN(quote);
|
||||
}
|
||||
else *lex_data->strptr++ = yytext[0];
|
||||
lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0];
|
||||
assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yytext[0] == '`') assert(0);
|
||||
/* close the current quote */
|
||||
if (--lex_data->quote_stk_idx == 0)
|
||||
{
|
||||
BEGIN INITIAL;
|
||||
*lex_data->strptr++ = '\0';
|
||||
return STRING;
|
||||
}
|
||||
else *lex_data->strptr++ = yytext[0];
|
||||
}
|
||||
}
|
||||
|
||||
<quote>. *lex_data->strptr++ = yytext[0];
|
||||
<quote>\\. *lex_data->strptr++ = yytext[1];
|
||||
<quote><<EOF>> return 0;
|
||||
|
||||
" "
|
||||
. return yytext[0];
|
||||
%%
|
||||
|
||||
#if 0
|
||||
/* all code for testing macros */
|
||||
#include "winhelp.h"
|
||||
static CHAR szTestMacro[256];
|
||||
|
||||
static LRESULT CALLBACK MACRO_TestDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (msg == WM_COMMAND && wParam == IDOK)
|
||||
{
|
||||
GetDlgItemText(hDlg, 99, szTestMacro, sizeof(szTestMacro));
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void macro_test(void)
|
||||
{
|
||||
WNDPROC lpfnDlg = MakeProcInstance(MACRO_TestDialogProc, Globals.hInstance);
|
||||
DialogBox(Globals.hInstance, STRING_DIALOG_TEST, Globals.active_win->hMainWnd, (DLGPROC)lpfnDlg);
|
||||
FreeProcInstance(lpfnDlg);
|
||||
macro = szTestMacro;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* small helper function for debug messages */
|
||||
static const char* ts(int t)
|
||||
{
|
||||
static char c[2] = {0,0};
|
||||
|
||||
switch (t)
|
||||
{
|
||||
case EMPTY: return "EMPTY";
|
||||
case VOID_FUNCTION: return "VOID_FUNCTION";
|
||||
case BOOL_FUNCTION: return "BOOL_FUNCTION";
|
||||
case INTEGER: return "INTEGER";
|
||||
case STRING: return "STRING";
|
||||
case IDENTIFIER: return "IDENTIFIER";
|
||||
default: c[0] = (char)t; return c;
|
||||
}
|
||||
}
|
||||
|
||||
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret);
|
||||
|
||||
/******************************************************************
|
||||
* MACRO_CheckArgs
|
||||
*
|
||||
* checks number of arguments against prototype, and stores arguments on
|
||||
* stack pa for later call
|
||||
* returns -1 on error, otherwise the number of pushed parameters
|
||||
*/
|
||||
static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
|
||||
{
|
||||
int t;
|
||||
unsigned int len = 0, idx = 0;
|
||||
|
||||
WINE_TRACE("Checking %s\n", args);
|
||||
|
||||
if (yylex() != '(') {WINE_WARN("missing (\n");return -1;}
|
||||
|
||||
if (*args)
|
||||
{
|
||||
len = strlen(args);
|
||||
for (;;)
|
||||
{
|
||||
t = yylex();
|
||||
WINE_TRACE("Got %s <=> %c\n", ts(t), *args);
|
||||
|
||||
switch (*args)
|
||||
{
|
||||
case 'S':
|
||||
if (t != STRING)
|
||||
{WINE_WARN("missing S\n");return -1;}
|
||||
pa[idx] = (void*)yylval.string;
|
||||
break;
|
||||
case 'U':
|
||||
case 'I':
|
||||
if (t != INTEGER)
|
||||
{WINE_WARN("missing U\n");return -1;}
|
||||
pa[idx] = LongToPtr(yylval.integer);
|
||||
break;
|
||||
case 'B':
|
||||
if (t != BOOL_FUNCTION)
|
||||
{WINE_WARN("missing B\n");return -1;}
|
||||
if (MACRO_CallBoolFunc(yylval.function, yylval.proto, &pa[idx]) == 0)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
WINE_WARN("unexpected %s while args is %c\n", ts(t), *args);
|
||||
return -1;
|
||||
}
|
||||
idx++;
|
||||
if (*++args == '\0') break;
|
||||
t = yylex();
|
||||
if (t == ')') goto CheckArgs_end;
|
||||
if (t != ',') {WINE_WARN("missing ,\n");return -1;}
|
||||
if (idx >= max) {WINE_FIXME("stack overflow (%d)\n", max);return -1;}
|
||||
}
|
||||
}
|
||||
if (yylex() != ')') {WINE_WARN("missing )\n");return -1;}
|
||||
|
||||
CheckArgs_end:
|
||||
while (len > idx) pa[--len] = NULL;
|
||||
return idx;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MACRO_CallBoolFunc
|
||||
*
|
||||
* Invokes boolean function fn, which arguments are defined by args
|
||||
* stores bool result into ret
|
||||
*/
|
||||
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
|
||||
{
|
||||
void* pa[2];
|
||||
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
|
||||
|
||||
if (idx < 0) return 0;
|
||||
if (!fn) return 1;
|
||||
|
||||
WINE_TRACE("calling with %u pmts\n", idx);
|
||||
|
||||
switch (strlen(args))
|
||||
{
|
||||
case 0: *ret = (void*)(fn)(); break;
|
||||
case 1: *ret = (void*)(fn)(pa[0]); break;
|
||||
default: WINE_FIXME("NIY\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MACRO_CallVoidFunc
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
|
||||
{
|
||||
void* pa[6];
|
||||
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
|
||||
|
||||
if (idx < 0) return 0;
|
||||
if (!fn) return 1;
|
||||
|
||||
WINE_TRACE("calling %p with %u pmts\n", fn, idx);
|
||||
|
||||
switch (strlen(args))
|
||||
{
|
||||
case 0: (fn)(); break;
|
||||
case 1: (fn)(pa[0]); break;
|
||||
case 2: (fn)(pa[0],pa[1]); break;
|
||||
case 3: (fn)(pa[0],pa[1],pa[2]); break;
|
||||
case 4: (fn)(pa[0],pa[1],pa[2],pa[3]); break;
|
||||
case 5: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4]); break;
|
||||
case 6: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]); break;
|
||||
default: WINE_FIXME("NIY\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
BOOL MACRO_ExecuteMacro(LPCSTR macro)
|
||||
{
|
||||
struct lex_data curr_lex_data, *prev_lex_data;
|
||||
BOOL ret = TRUE;
|
||||
int t;
|
||||
|
||||
WINE_TRACE("%s\n", wine_dbgstr_a(macro));
|
||||
|
||||
prev_lex_data = lex_data;
|
||||
lex_data = &curr_lex_data;
|
||||
|
||||
memset(lex_data, 0, sizeof(*lex_data));
|
||||
lex_data->macroptr = macro;
|
||||
|
||||
while ((t = yylex()) != EMPTY)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case VOID_FUNCTION:
|
||||
WINE_TRACE("got type void func(%s)\n", yylval.proto);
|
||||
MACRO_CallVoidFunc(yylval.function, yylval.proto);
|
||||
break;
|
||||
case BOOL_FUNCTION:
|
||||
WINE_WARN("got type bool func(%s)\n", yylval.proto);
|
||||
break;
|
||||
default:
|
||||
WINE_WARN("got unexpected type %s\n", ts(t));
|
||||
return 0;
|
||||
}
|
||||
switch (t = yylex())
|
||||
{
|
||||
case EMPTY: goto done;
|
||||
case ';': break;
|
||||
default: ret = FALSE; goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
for (t = 0; t < lex_data->cache_used; t++)
|
||||
HeapFree(GetProcessHeap(), 0, lex_data->cache_string[t]);
|
||||
lex_data = prev_lex_data;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef yywrap
|
||||
int yywrap(void) { return 1; }
|
||||
#endif
|
||||
%{ /* -*-C-*- */
|
||||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
* Copyright 2002,2008 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
%}
|
||||
%option noinput nounput interactive 8bit
|
||||
%x quote
|
||||
%{
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HAVE_UNISTD_H
|
||||
#define YY_NO_UNISTD_H
|
||||
#endif
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
|
||||
|
||||
struct lex_data {
|
||||
LPCSTR macroptr;
|
||||
LPSTR strptr;
|
||||
int quote_stack[32];
|
||||
unsigned quote_stk_idx;
|
||||
LPSTR cache_string[32];
|
||||
int cache_used;
|
||||
};
|
||||
static struct lex_data* lex_data = NULL;
|
||||
|
||||
struct lexret yylval;
|
||||
|
||||
#define YY_INPUT(buf,result,max_size)\
|
||||
if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++;
|
||||
|
||||
%}
|
||||
%%
|
||||
|
||||
[-+]?[0-9]+ yylval.integer = strtol(yytext, NULL, 10); return INTEGER;
|
||||
[-+]?0[xX][0-9a-f]+ yylval.integer = strtol(yytext, NULL, 16); return INTEGER;
|
||||
|
||||
[a-zA-Z][_0-9a-zA-Z]* return MACRO_Lookup(yytext, &yylval);
|
||||
|
||||
\` |
|
||||
\" |
|
||||
\' |
|
||||
<quote>\` |
|
||||
<quote>\" |
|
||||
<quote>\' {
|
||||
if (lex_data->quote_stk_idx == 0 ||
|
||||
(yytext[0] == '\"' && lex_data->quote_stack[lex_data->quote_stk_idx - 1] != '\"') ||
|
||||
(yytext[0] == '`'))
|
||||
{
|
||||
/* opening a new one */
|
||||
if (lex_data->quote_stk_idx == 0)
|
||||
{
|
||||
assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0]));
|
||||
lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1);
|
||||
yylval.string = lex_data->strptr;
|
||||
lex_data->cache_used++;
|
||||
BEGIN(quote);
|
||||
}
|
||||
else *lex_data->strptr++ = yytext[0];
|
||||
lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0];
|
||||
assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yytext[0] == '`') assert(0);
|
||||
/* close the current quote */
|
||||
if (--lex_data->quote_stk_idx == 0)
|
||||
{
|
||||
BEGIN INITIAL;
|
||||
*lex_data->strptr++ = '\0';
|
||||
return STRING;
|
||||
}
|
||||
else *lex_data->strptr++ = yytext[0];
|
||||
}
|
||||
}
|
||||
|
||||
<quote>. *lex_data->strptr++ = yytext[0];
|
||||
<quote>\\. *lex_data->strptr++ = yytext[1];
|
||||
<quote><<EOF>> return 0;
|
||||
|
||||
" "
|
||||
. return yytext[0];
|
||||
%%
|
||||
|
||||
#if 0
|
||||
/* all code for testing macros */
|
||||
#include "winhelp.h"
|
||||
static CHAR szTestMacro[256];
|
||||
|
||||
static LRESULT CALLBACK MACRO_TestDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (msg == WM_COMMAND && wParam == IDOK)
|
||||
{
|
||||
GetDlgItemText(hDlg, 99, szTestMacro, sizeof(szTestMacro));
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void macro_test(void)
|
||||
{
|
||||
WNDPROC lpfnDlg = MakeProcInstance(MACRO_TestDialogProc, Globals.hInstance);
|
||||
DialogBox(Globals.hInstance, STRING_DIALOG_TEST, Globals.active_win->hMainWnd, (DLGPROC)lpfnDlg);
|
||||
FreeProcInstance(lpfnDlg);
|
||||
macro = szTestMacro;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* small helper function for debug messages */
|
||||
static const char* ts(int t)
|
||||
{
|
||||
static char c[2] = {0,0};
|
||||
|
||||
switch (t)
|
||||
{
|
||||
case EMPTY: return "EMPTY";
|
||||
case VOID_FUNCTION: return "VOID_FUNCTION";
|
||||
case BOOL_FUNCTION: return "BOOL_FUNCTION";
|
||||
case INTEGER: return "INTEGER";
|
||||
case STRING: return "STRING";
|
||||
case IDENTIFIER: return "IDENTIFIER";
|
||||
default: c[0] = (char)t; return c;
|
||||
}
|
||||
}
|
||||
|
||||
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret);
|
||||
|
||||
/******************************************************************
|
||||
* MACRO_CheckArgs
|
||||
*
|
||||
* checks number of arguments against prototype, and stores arguments on
|
||||
* stack pa for later call
|
||||
* returns -1 on error, otherwise the number of pushed parameters
|
||||
*/
|
||||
static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
|
||||
{
|
||||
int t;
|
||||
unsigned int len = 0, idx = 0;
|
||||
|
||||
WINE_TRACE("Checking %s\n", args);
|
||||
|
||||
if (yylex() != '(') {WINE_WARN("missing (\n");return -1;}
|
||||
|
||||
if (*args)
|
||||
{
|
||||
len = strlen(args);
|
||||
for (;;)
|
||||
{
|
||||
t = yylex();
|
||||
WINE_TRACE("Got %s <=> %c\n", ts(t), *args);
|
||||
|
||||
switch (*args)
|
||||
{
|
||||
case 'S':
|
||||
if (t != STRING)
|
||||
{WINE_WARN("missing S\n");return -1;}
|
||||
pa[idx] = (void*)yylval.string;
|
||||
break;
|
||||
case 'U':
|
||||
case 'I':
|
||||
if (t != INTEGER)
|
||||
{WINE_WARN("missing U\n");return -1;}
|
||||
pa[idx] = LongToPtr(yylval.integer);
|
||||
break;
|
||||
case 'B':
|
||||
if (t != BOOL_FUNCTION)
|
||||
{WINE_WARN("missing B\n");return -1;}
|
||||
if (MACRO_CallBoolFunc(yylval.function, yylval.proto, &pa[idx]) == 0)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
WINE_WARN("unexpected %s while args is %c\n", ts(t), *args);
|
||||
return -1;
|
||||
}
|
||||
idx++;
|
||||
if (*++args == '\0') break;
|
||||
t = yylex();
|
||||
if (t == ')') goto CheckArgs_end;
|
||||
if (t != ',') {WINE_WARN("missing ,\n");return -1;}
|
||||
if (idx >= max) {WINE_FIXME("stack overflow (%d)\n", max);return -1;}
|
||||
}
|
||||
}
|
||||
if (yylex() != ')') {WINE_WARN("missing )\n");return -1;}
|
||||
|
||||
CheckArgs_end:
|
||||
while (len > idx) pa[--len] = NULL;
|
||||
return idx;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MACRO_CallBoolFunc
|
||||
*
|
||||
* Invokes boolean function fn, which arguments are defined by args
|
||||
* stores bool result into ret
|
||||
*/
|
||||
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
|
||||
{
|
||||
void* pa[2];
|
||||
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
|
||||
|
||||
if (idx < 0) return 0;
|
||||
if (!fn) return 1;
|
||||
|
||||
WINE_TRACE("calling with %u pmts\n", idx);
|
||||
|
||||
switch (strlen(args))
|
||||
{
|
||||
case 0: *ret = (void*)(fn)(); break;
|
||||
case 1: *ret = (void*)(fn)(pa[0]); break;
|
||||
default: WINE_FIXME("NIY\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* MACRO_CallVoidFunc
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
|
||||
{
|
||||
void* pa[6];
|
||||
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
|
||||
|
||||
if (idx < 0) return 0;
|
||||
if (!fn) return 1;
|
||||
|
||||
WINE_TRACE("calling %p with %u pmts\n", fn, idx);
|
||||
|
||||
switch (strlen(args))
|
||||
{
|
||||
case 0: (fn)(); break;
|
||||
case 1: (fn)(pa[0]); break;
|
||||
case 2: (fn)(pa[0],pa[1]); break;
|
||||
case 3: (fn)(pa[0],pa[1],pa[2]); break;
|
||||
case 4: (fn)(pa[0],pa[1],pa[2],pa[3]); break;
|
||||
case 5: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4]); break;
|
||||
case 6: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]); break;
|
||||
default: WINE_FIXME("NIY\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
BOOL MACRO_ExecuteMacro(LPCSTR macro)
|
||||
{
|
||||
struct lex_data curr_lex_data, *prev_lex_data;
|
||||
BOOL ret = TRUE;
|
||||
int t;
|
||||
|
||||
WINE_TRACE("%s\n", wine_dbgstr_a(macro));
|
||||
|
||||
prev_lex_data = lex_data;
|
||||
lex_data = &curr_lex_data;
|
||||
|
||||
memset(lex_data, 0, sizeof(*lex_data));
|
||||
lex_data->macroptr = macro;
|
||||
|
||||
while ((t = yylex()) != EMPTY)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case VOID_FUNCTION:
|
||||
WINE_TRACE("got type void func(%s)\n", yylval.proto);
|
||||
MACRO_CallVoidFunc(yylval.function, yylval.proto);
|
||||
break;
|
||||
case BOOL_FUNCTION:
|
||||
WINE_WARN("got type bool func(%s)\n", yylval.proto);
|
||||
break;
|
||||
default:
|
||||
WINE_WARN("got unexpected type %s\n", ts(t));
|
||||
return 0;
|
||||
}
|
||||
switch (t = yylex())
|
||||
{
|
||||
case EMPTY: goto done;
|
||||
case ';': break;
|
||||
default: ret = FALSE; goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
for (t = 0; t < lex_data->cache_used; t++)
|
||||
HeapFree(GetProcessHeap(), 0, lex_data->cache_string[t]);
|
||||
lex_data = prev_lex_data;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef yywrap
|
||||
int yywrap(void) { return 1; }
|
||||
#endif
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
*
|
||||
* 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* Class names */
|
||||
|
||||
const char MAIN_WIN_CLASS_NAME[] = "MS_WINHELP";
|
||||
const char BUTTON_BOX_WIN_CLASS_NAME[] = "WHButtonBox";
|
||||
const char SHADOW_WIN_CLASS_NAME[] = "WHShadow";
|
||||
const char HISTORY_WIN_CLASS_NAME[] = "WHHistory";
|
||||
const char STRING_BUTTON[] = "BUTTON";
|
||||
|
||||
/* Resource names */
|
||||
const char STRING_DIALOG_TEST[] = "DIALOG_TEST";
|
||||
|
||||
/* Local Variables: */
|
||||
/* c-file-style: "GNU" */
|
||||
/* End: */
|
||||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* Copyright 1996 Ulrich Schmid
|
||||
*
|
||||
* 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/* Class names */
|
||||
|
||||
const char MAIN_WIN_CLASS_NAME[] = "MS_WINHELP";
|
||||
const char BUTTON_BOX_WIN_CLASS_NAME[] = "WHButtonBox";
|
||||
const char SHADOW_WIN_CLASS_NAME[] = "WHShadow";
|
||||
const char HISTORY_WIN_CLASS_NAME[] = "WHHistory";
|
||||
const char STRING_BUTTON[] = "BUTTON";
|
||||
|
||||
/* Resource names */
|
||||
const char STRING_DIALOG_TEST[] = "DIALOG_TEST";
|
||||
|
||||
/* Local Variables: */
|
||||
/* c-file-style: "GNU" */
|
||||
/* End: */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,167 +1,167 @@
|
|||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define MAX_LANGUAGE_NUMBER 255
|
||||
#define MAX_STRING_LEN 255
|
||||
|
||||
#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
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "hlpfile.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "macro.h"
|
||||
#include "winhelp_res.h"
|
||||
|
||||
typedef struct tagHelpButton
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
LPCSTR lpszID;
|
||||
LPCSTR lpszName;
|
||||
LPCSTR lpszMacro;
|
||||
|
||||
WPARAM wParam;
|
||||
|
||||
RECT rect;
|
||||
|
||||
struct tagHelpButton*next;
|
||||
} WINHELP_BUTTON;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HLPFILE_PAGE* page;
|
||||
HLPFILE_WINDOWINFO* wininfo;
|
||||
ULONG relative;
|
||||
} WINHELP_WNDPAGE;
|
||||
|
||||
typedef struct tagPageSet
|
||||
{
|
||||
/* FIXME: for now it's a fixed size */
|
||||
WINHELP_WNDPAGE set[40];
|
||||
unsigned index;
|
||||
} WINHELP_PAGESET;
|
||||
|
||||
typedef struct tagWinHelp
|
||||
{
|
||||
LPCSTR lpszName;
|
||||
|
||||
WINHELP_BUTTON* first_button;
|
||||
HLPFILE_PAGE* page;
|
||||
|
||||
HWND hMainWnd;
|
||||
HWND hShadowWnd;
|
||||
HWND hHistoryWnd;
|
||||
|
||||
HFONT* fonts;
|
||||
UINT fonts_len;
|
||||
|
||||
HCURSOR hHandCur;
|
||||
|
||||
HBRUSH hBrush;
|
||||
|
||||
HLPFILE_WINDOWINFO* info;
|
||||
HLPFILE_LINK* current_link;
|
||||
|
||||
WINHELP_PAGESET back;
|
||||
unsigned font_scale; /* 0 = small, 1 = normal, 2 = large */
|
||||
|
||||
struct tagWinHelp* next;
|
||||
} WINHELP_WINDOW;
|
||||
|
||||
#define DC_NOMSG 0x00000000
|
||||
#define DC_MINMAX 0x00000001
|
||||
#define DC_INITTERM 0x00000002
|
||||
#define DC_JUMP 0x00000004
|
||||
#define DC_ACTIVATE 0x00000008
|
||||
#define DC_CALLBACKS 0x00000010
|
||||
|
||||
#define DW_NOTUSED 0
|
||||
#define DW_WHATMSG 1
|
||||
#define DW_MINMAX 2
|
||||
#define DW_SIZE 3
|
||||
#define DW_INIT 4
|
||||
#define DW_TERM 5
|
||||
#define DW_STARTJUMP 6
|
||||
#define DW_ENDJUMP 7
|
||||
#define DW_CHGFILE 8
|
||||
#define DW_ACTIVATE 9
|
||||
#define DW_CALLBACKS 10
|
||||
|
||||
typedef long (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG, LONG);
|
||||
|
||||
typedef struct tagDll
|
||||
{
|
||||
HANDLE hLib;
|
||||
const char* name;
|
||||
WINHELP_LDLLHandler handler;
|
||||
DWORD class;
|
||||
struct tagDll* next;
|
||||
} WINHELP_DLL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT wVersion;
|
||||
HANDLE hInstance;
|
||||
BOOL isBook;
|
||||
WINHELP_WINDOW* active_win;
|
||||
WINHELP_WINDOW* active_popup;
|
||||
WINHELP_WINDOW* win_list;
|
||||
WNDPROC button_proc;
|
||||
WINHELP_DLL* dlls;
|
||||
WINHELP_PAGESET history;
|
||||
HFONT hButtonFont;
|
||||
} WINHELP_GLOBALS;
|
||||
|
||||
extern WINHELP_GLOBALS Globals;
|
||||
extern FARPROC Callbacks[];
|
||||
|
||||
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL);
|
||||
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE* (*)(HLPFILE*, LONG, ULONG*),
|
||||
HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
|
||||
BOOL WINHELP_GetOpenFileName(LPSTR, int);
|
||||
BOOL WINHELP_CreateIndexWindow(BOOL);
|
||||
void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
|
||||
HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
|
||||
HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
|
||||
void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
|
||||
|
||||
extern const char MAIN_WIN_CLASS_NAME[];
|
||||
extern const char BUTTON_BOX_WIN_CLASS_NAME[];
|
||||
extern const char TEXT_WIN_CLASS_NAME[];
|
||||
extern const char SHADOW_WIN_CLASS_NAME[];
|
||||
extern const char HISTORY_WIN_CLASS_NAME[];
|
||||
extern const char STRING_BUTTON[];
|
||||
extern const char STRING_MENU_Xx[];
|
||||
extern const char STRING_DIALOG_TEST[];
|
||||
#endif
|
||||
|
||||
/* Buttons */
|
||||
#define WH_FIRST_BUTTON 500
|
||||
/*
|
||||
* Help Viewer
|
||||
*
|
||||
* 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
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define MAX_LANGUAGE_NUMBER 255
|
||||
#define MAX_STRING_LEN 255
|
||||
|
||||
#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
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "hlpfile.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "macro.h"
|
||||
#include "winhelp_res.h"
|
||||
|
||||
typedef struct tagHelpButton
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
LPCSTR lpszID;
|
||||
LPCSTR lpszName;
|
||||
LPCSTR lpszMacro;
|
||||
|
||||
WPARAM wParam;
|
||||
|
||||
RECT rect;
|
||||
|
||||
struct tagHelpButton*next;
|
||||
} WINHELP_BUTTON;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HLPFILE_PAGE* page;
|
||||
HLPFILE_WINDOWINFO* wininfo;
|
||||
ULONG relative;
|
||||
} WINHELP_WNDPAGE;
|
||||
|
||||
typedef struct tagPageSet
|
||||
{
|
||||
/* FIXME: for now it's a fixed size */
|
||||
WINHELP_WNDPAGE set[40];
|
||||
unsigned index;
|
||||
} WINHELP_PAGESET;
|
||||
|
||||
typedef struct tagWinHelp
|
||||
{
|
||||
LPCSTR lpszName;
|
||||
|
||||
WINHELP_BUTTON* first_button;
|
||||
HLPFILE_PAGE* page;
|
||||
|
||||
HWND hMainWnd;
|
||||
HWND hShadowWnd;
|
||||
HWND hHistoryWnd;
|
||||
|
||||
HFONT* fonts;
|
||||
UINT fonts_len;
|
||||
|
||||
HCURSOR hHandCur;
|
||||
|
||||
HBRUSH hBrush;
|
||||
|
||||
HLPFILE_WINDOWINFO* info;
|
||||
HLPFILE_LINK* current_link;
|
||||
|
||||
WINHELP_PAGESET back;
|
||||
unsigned font_scale; /* 0 = small, 1 = normal, 2 = large */
|
||||
|
||||
struct tagWinHelp* next;
|
||||
} WINHELP_WINDOW;
|
||||
|
||||
#define DC_NOMSG 0x00000000
|
||||
#define DC_MINMAX 0x00000001
|
||||
#define DC_INITTERM 0x00000002
|
||||
#define DC_JUMP 0x00000004
|
||||
#define DC_ACTIVATE 0x00000008
|
||||
#define DC_CALLBACKS 0x00000010
|
||||
|
||||
#define DW_NOTUSED 0
|
||||
#define DW_WHATMSG 1
|
||||
#define DW_MINMAX 2
|
||||
#define DW_SIZE 3
|
||||
#define DW_INIT 4
|
||||
#define DW_TERM 5
|
||||
#define DW_STARTJUMP 6
|
||||
#define DW_ENDJUMP 7
|
||||
#define DW_CHGFILE 8
|
||||
#define DW_ACTIVATE 9
|
||||
#define DW_CALLBACKS 10
|
||||
|
||||
typedef long (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG, LONG);
|
||||
|
||||
typedef struct tagDll
|
||||
{
|
||||
HANDLE hLib;
|
||||
const char* name;
|
||||
WINHELP_LDLLHandler handler;
|
||||
DWORD class;
|
||||
struct tagDll* next;
|
||||
} WINHELP_DLL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT wVersion;
|
||||
HANDLE hInstance;
|
||||
BOOL isBook;
|
||||
WINHELP_WINDOW* active_win;
|
||||
WINHELP_WINDOW* active_popup;
|
||||
WINHELP_WINDOW* win_list;
|
||||
WNDPROC button_proc;
|
||||
WINHELP_DLL* dlls;
|
||||
WINHELP_PAGESET history;
|
||||
HFONT hButtonFont;
|
||||
} WINHELP_GLOBALS;
|
||||
|
||||
extern WINHELP_GLOBALS Globals;
|
||||
extern FARPROC Callbacks[];
|
||||
|
||||
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL);
|
||||
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE* (*)(HLPFILE*, LONG, ULONG*),
|
||||
HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
|
||||
BOOL WINHELP_GetOpenFileName(LPSTR, int);
|
||||
BOOL WINHELP_CreateIndexWindow(BOOL);
|
||||
void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
|
||||
HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
|
||||
HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
|
||||
void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
|
||||
|
||||
extern const char MAIN_WIN_CLASS_NAME[];
|
||||
extern const char BUTTON_BOX_WIN_CLASS_NAME[];
|
||||
extern const char TEXT_WIN_CLASS_NAME[];
|
||||
extern const char SHADOW_WIN_CLASS_NAME[];
|
||||
extern const char HISTORY_WIN_CLASS_NAME[];
|
||||
extern const char STRING_BUTTON[];
|
||||
extern const char STRING_MENU_Xx[];
|
||||
extern const char STRING_DIALOG_TEST[];
|
||||
#endif
|
||||
|
||||
/* Buttons */
|
||||
#define WH_FIRST_BUTTON 500
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
#define MNID_FILE_OPEN 0x101
|
||||
#define MNID_FILE_PRINT 0x104
|
||||
#define MNID_FILE_SETUP 0x106
|
||||
#define MNID_FILE_EXIT 0x108
|
||||
|
||||
#define MNID_EDIT_COPYDLG 0x111
|
||||
#define MNID_EDIT_ANNOTATE 0x112
|
||||
|
||||
#define MNID_BKMK_DEFINE 0x121
|
||||
|
||||
#define MNID_OPTS_HELP_DEFAULT 0x131
|
||||
#define MNID_OPTS_HELP_VISIBLE 0x132
|
||||
#define MNID_OPTS_HELP_NONVISIBLE 0x133
|
||||
#define MNID_OPTS_HISTORY 0x134
|
||||
#define MNID_OPTS_FONTS_SMALL 0x135
|
||||
#define MNID_OPTS_FONTS_NORMAL 0x136
|
||||
#define MNID_OPTS_FONTS_LARGE 0x137
|
||||
#define MNID_OPTS_SYSTEM_COLORS 0x138
|
||||
|
||||
#define MNID_HELP_HELPON 0x141
|
||||
#define MNID_HELP_HELPTOP 0x142
|
||||
#define MNID_HELP_ABOUT 0x143
|
||||
#define MNID_HELP_WINE 0x144
|
||||
|
||||
#define MNID_CTXT_ANNOTATE 0x200
|
||||
#define MNID_CTXT_COPY 0x201
|
||||
#define MNID_CTXT_PRINT 0x202
|
||||
#define MNID_CTXT_FONTS_SMALL 0x210
|
||||
#define MNID_CTXT_FONTS_NORMAL 0x211
|
||||
#define MNID_CTXT_FONTS_LARGE 0x212
|
||||
#define MNID_CTXT_HELP_DEFAULT 0x220
|
||||
#define MNID_CTXT_HELP_VISIBLE 0x221
|
||||
#define MNID_CTXT_HELP_NONVISIBLE 0x222
|
||||
#define MNID_CTXT_SYSTEM_COLORS 0x230
|
||||
|
||||
#define MAIN_MENU 0xF000
|
||||
#define CONTEXT_MENU 0xF001
|
||||
|
||||
#define STID_WINE_HELP 0x120
|
||||
#define STID_WHERROR 0x121
|
||||
#define STID_WARNING 0x122
|
||||
#define STID_INFO 0x123
|
||||
#define STID_NOT_IMPLEMENTED 0x124
|
||||
#define STID_HLPFILE_ERROR_s 0x125
|
||||
#define STID_CONTENTS 0x126
|
||||
#define STID_INDEX 0x127
|
||||
#define STID_BACK 0x128
|
||||
#define STID_ALL_FILES 0x12B
|
||||
#define STID_HELP_FILES_HLP 0x12C
|
||||
#define STID_DIALOG_TEST 0x12D
|
||||
#define STID_FILE_NOT_FOUND_s 0x12E
|
||||
#define STID_NO_RICHEDIT 0x12F
|
||||
#define STID_PSH_INDEX 0x130
|
||||
|
||||
#define IDD_INDEX 0x150
|
||||
#define IDC_INDEXLIST 0x151
|
||||
#define IDD_SEARCH 0x152
|
||||
|
||||
#define IDI_WINHELP 0xF00
|
||||
#define MNID_FILE_OPEN 0x101
|
||||
#define MNID_FILE_PRINT 0x104
|
||||
#define MNID_FILE_SETUP 0x106
|
||||
#define MNID_FILE_EXIT 0x108
|
||||
|
||||
#define MNID_EDIT_COPYDLG 0x111
|
||||
#define MNID_EDIT_ANNOTATE 0x112
|
||||
|
||||
#define MNID_BKMK_DEFINE 0x121
|
||||
|
||||
#define MNID_OPTS_HELP_DEFAULT 0x131
|
||||
#define MNID_OPTS_HELP_VISIBLE 0x132
|
||||
#define MNID_OPTS_HELP_NONVISIBLE 0x133
|
||||
#define MNID_OPTS_HISTORY 0x134
|
||||
#define MNID_OPTS_FONTS_SMALL 0x135
|
||||
#define MNID_OPTS_FONTS_NORMAL 0x136
|
||||
#define MNID_OPTS_FONTS_LARGE 0x137
|
||||
#define MNID_OPTS_SYSTEM_COLORS 0x138
|
||||
|
||||
#define MNID_HELP_HELPON 0x141
|
||||
#define MNID_HELP_HELPTOP 0x142
|
||||
#define MNID_HELP_ABOUT 0x143
|
||||
#define MNID_HELP_WINE 0x144
|
||||
|
||||
#define MNID_CTXT_ANNOTATE 0x200
|
||||
#define MNID_CTXT_COPY 0x201
|
||||
#define MNID_CTXT_PRINT 0x202
|
||||
#define MNID_CTXT_FONTS_SMALL 0x210
|
||||
#define MNID_CTXT_FONTS_NORMAL 0x211
|
||||
#define MNID_CTXT_FONTS_LARGE 0x212
|
||||
#define MNID_CTXT_HELP_DEFAULT 0x220
|
||||
#define MNID_CTXT_HELP_VISIBLE 0x221
|
||||
#define MNID_CTXT_HELP_NONVISIBLE 0x222
|
||||
#define MNID_CTXT_SYSTEM_COLORS 0x230
|
||||
|
||||
#define MAIN_MENU 0xF000
|
||||
#define CONTEXT_MENU 0xF001
|
||||
|
||||
#define STID_WINE_HELP 0x120
|
||||
#define STID_WHERROR 0x121
|
||||
#define STID_WARNING 0x122
|
||||
#define STID_INFO 0x123
|
||||
#define STID_NOT_IMPLEMENTED 0x124
|
||||
#define STID_HLPFILE_ERROR_s 0x125
|
||||
#define STID_CONTENTS 0x126
|
||||
#define STID_INDEX 0x127
|
||||
#define STID_BACK 0x128
|
||||
#define STID_ALL_FILES 0x12B
|
||||
#define STID_HELP_FILES_HLP 0x12C
|
||||
#define STID_DIALOG_TEST 0x12D
|
||||
#define STID_FILE_NOT_FOUND_s 0x12E
|
||||
#define STID_NO_RICHEDIT 0x12F
|
||||
#define STID_PSH_INDEX 0x130
|
||||
|
||||
#define IDD_INDEX 0x150
|
||||
#define IDC_INDEXLIST 0x151
|
||||
#define IDD_SEARCH 0x152
|
||||
|
||||
#define IDI_WINHELP 0xF00
|
||||
|
|
Loading…
Reference in a new issue