ReactOS  0.4.12-dev-75-g00dd17e
winhelp.c File Reference
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commdlg.h"
#include "winhelp.h"
#include "winhelp_res.h"
#include "shellapi.h"
#include "richedit.h"
#include "commctrl.h"
#include "wine/debug.h"
Include dependency graph for winhelp.c:

Go to the source code of this file.

Classes

struct  WINHELP
 
struct  index_data
 

Macros

#define NONAMELESSUNION
 
#define CTL_ID_BUTTON   0x700
 
#define CTL_ID_TEXT   0x701
 
#define FONTS_LEN   (sizeof(logfontlist)/sizeof(*logfontlist))
 

Typedefs

typedef struct WINHELPLPWINHELP
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (winhelp)
 
static void WINHELP_InitFonts (HWND hWnd)
 
static DWORD CALLBACK WINHELP_RtfStreamIn (DWORD_PTR cookie, BYTE *buff, LONG cb, LONG *pcb)
 
static void WINHELP_SetupText (HWND hTextWnd, WINHELP_WINDOW *win, ULONG relative)
 
BOOL WINHELP_GetOpenFileName (LPSTR lpszFile, int len)
 
static INT WINHELP_MessageBoxIDS_s (UINT ids_text, LPCSTR str, UINT ids_title, WORD type)
 
HLPFILEWINHELP_LookupHelpFile (LPCSTR lpszFile)
 
HLPFILE_WINDOWINFOWINHELP_GetWindowInfo (HLPFILE *hlpfile, LPCSTR name)
 
static HLPFILE_WINDOWINFOWINHELP_GetPopupWindowInfo (HLPFILE *hlpfile, WINHELP_WINDOW *parent, LPARAM mouse)
 
static BOOL WINHELP_HasWorkingWindow (void)
 
static LRESULT WINHELP_HandleCommand (HWND hSrcWnd, LPARAM lParam)
 
void WINHELP_LayoutMainWindow (WINHELP_WINDOW *win)
 
static void WINHELP_DeleteButtons (WINHELP_WINDOW *win)
 
void WINHELP_DeleteBackSet (WINHELP_WINDOW *win)
 
static void WINHELP_DeletePageLinks (HLPFILE_PAGE *page)
 
WINHELP_WINDOWWINHELP_GrabWindow (WINHELP_WINDOW *win)
 
BOOL WINHELP_ReleaseWindow (WINHELP_WINDOW *win)
 
static void WINHELP_DeleteWindow (WINHELP_WINDOW *win)
 
static charWINHELP_GetCaption (WINHELP_WNDPAGE *wpage)
 
static void WINHELP_RememberPage (WINHELP_WINDOW *win, WINHELP_WNDPAGE *wpage)
 
static HLPFILE_LINKWINHELP_FindLink (WINHELP_WINDOW *win, LPARAM pos)
 
static LRESULT CALLBACK WINHELP_RicheditWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINHELP_CreateHelpWindow (WINHELP_WNDPAGE *wpage, int nCmdShow, BOOL remember)
 
BOOL WINHELP_OpenHelpWindow (HLPFILE_PAGE *(*lookup)(HLPFILE *, LONG, ULONG *), HLPFILE *hlpfile, LONG val, HLPFILE_WINDOWINFO *wi, int nCmdShow)
 
static BOOL WINHELP_HandleTextMouse (WINHELP_WINDOW *win, UINT msg, LPARAM lParam)
 
static BOOL WINHELP_CheckPopup (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
 
static LRESULT CALLBACK WINHELP_ButtonWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WINHELP_ButtonBoxWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WINHELP_HistoryWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void cb_KWBTree (void *p, void **next, void *cookie)
 
static INT_PTR CALLBACK WINHELP_IndexDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK WINHELP_SearchDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WINHELP_MainWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINHELP_CreateIndexWindow (BOOL is_search)
 
static BOOL WINHELP_RegisterWinClasses (void)
 
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
 

Variables

WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}, NULL}
 

Macro Definition Documentation

◆ CTL_ID_BUTTON

#define CTL_ID_BUTTON   0x700

Definition at line 50 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow(), and WINHELP_LayoutMainWindow().

◆ CTL_ID_TEXT

◆ FONTS_LEN

#define FONTS_LEN   (sizeof(logfontlist)/sizeof(*logfontlist))

Referenced by WINHELP_InitFonts().

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 31 of file winhelp.c.

Typedef Documentation

◆ LPWINHELP

Function Documentation

◆ cb_KWBTree()

static void cb_KWBTree ( void p,
void **  next,
void cookie 
)
static

Definition at line 1203 of file winhelp.c.

Referenced by WINHELP_IndexDlgProc().

1204 {
1205  HWND hListWnd = cookie;
1206  int count;
1207 
1208  WINE_TRACE("Adding %s to search list\n", debugstr_a((char *)p));
1209  SendMessageA(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p);
1210  count = SendMessageW(hListWnd, LB_GETCOUNT, 0, 0);
1211  SendMessageW(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p);
1212  *next = (char*)p + strlen((char*)p) + 7;
1213 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WINE_TRACE
Definition: debug.h:353
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:1999
#define debugstr_a
Definition: kernel32.h:31
#define LB_SETITEMDATA
Definition: winuser.h:2026
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLfloat GLfloat p
Definition: glext.h:8902
#define LB_INSERTSTRING
Definition: winuser.h:2014

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( winhelp  )

◆ WINHELP_ButtonBoxWndProc()

static LRESULT CALLBACK WINHELP_ButtonBoxWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1023 of file winhelp.c.

Referenced by WINHELP_RegisterWinClasses().

1024 {
1025  WINDOWPOS *winpos;
1027  WINHELP_BUTTON *button;
1028  SIZE button_size;
1029  INT x, y;
1030 
1031  if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, NULL)) return 0L;
1032 
1033  switch (msg)
1034  {
1035  case WM_WINDOWPOSCHANGING:
1036  winpos = (WINDOWPOS*) lParam;
1037  win = (WINHELP_WINDOW*) GetWindowLongPtrW(GetParent(hWnd), 0);
1038 
1039  /* Update buttons */
1040  button_size.cx = 0;
1041  button_size.cy = 0;
1042  for (button = win->first_button; button; button = button->next)
1043  {
1044  HDC hDc;
1045  SIZE textsize;
1046  if (!button->hWnd)
1047  {
1048  button->hWnd = CreateWindowA(STRING_BUTTON, button->lpszName,
1050  0, 0, 0, 0,
1051  hWnd, (HMENU) button->wParam,
1052  Globals.hInstance, 0);
1053  if (button->hWnd)
1054  {
1055  if (Globals.button_proc == NULL)
1056  {
1057  NONCLIENTMETRICSW ncm;
1059 
1060  ncm.cbSize = sizeof(NONCLIENTMETRICSW);
1061  SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
1062  sizeof(NONCLIENTMETRICSW), &ncm, 0);
1063  Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont);
1064  }
1066  if (Globals.hButtonFont)
1068  }
1069  }
1070  hDc = GetDC(button->hWnd);
1071  GetTextExtentPointA(hDc, button->lpszName, strlen(button->lpszName), &textsize);
1072  ReleaseDC(button->hWnd, hDc);
1073 
1074  button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX);
1075  button_size.cy = max(button_size.cy, textsize.cy + BUTTON_CY);
1076  }
1077 
1078  x = 0;
1079  y = 0;
1080  for (button = win->first_button; button; button = button->next)
1081  {
1082  SetWindowPos(button->hWnd, HWND_TOP, x, y, button_size.cx, button_size.cy, 0);
1083 
1084  if (x + 2 * button_size.cx <= winpos->cx)
1085  x += button_size.cx;
1086  else
1087  x = 0, y += button_size.cy;
1088  }
1089  winpos->cy = y + (x ? button_size.cy : 0);
1090  break;
1091 
1092  case WM_COMMAND:
1094  break;
1095 
1096  case WM_KEYDOWN:
1097  switch (wParam)
1098  {
1099  case VK_UP:
1100  case VK_DOWN:
1101  case VK_PRIOR:
1102  case VK_NEXT:
1103  case VK_ESCAPE:
1104  return SendMessageA(GetParent(hWnd), msg, wParam, lParam);
1105  }
1106  break;
1107  }
1108 
1109  return DefWindowProcA(hWnd, msg, wParam, lParam);
1110 }
#define HDC
Definition: msvc.h:22
WINHELP_BUTTON * first_button
Definition: winhelp.h:77
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetTextExtentPointA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
HANDLE hInstance
Definition: winhelp.h:133
static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
Definition: winhelp.c:951
#define HWND_TOP
Definition: winuser.h:1193
#define BUTTON_CX
Definition: winhelp.h:32
#define VK_DOWN
Definition: winuser.h:2181
#define WS_CHILD
Definition: pedump.c:617
#define VK_PRIOR
Definition: winuser.h:2174
#define GetWindowLongPtrW
Definition: winuser.h:4698
#define VK_ESCAPE
Definition: winuser.h:2168
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
#define VK_NEXT
Definition: winuser.h:2175
UINT_PTR WPARAM
Definition: windef.h:207
HFONT hButtonFont
Definition: winhelp.h:141
#define BUTTON_CY
Definition: winhelp.h:33
INT INT y
Definition: msvc.h:62
#define VK_UP
Definition: winuser.h:2179
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
const char STRING_BUTTON[]
Definition: string.c:26
LONG cx
Definition: windef.h:324
#define WM_KEYDOWN
Definition: winuser.h:1691
static LRESULT CALLBACK WINHELP_ButtonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:999
#define GetWindowLongPtrA
Definition: winuser.h:4697
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
struct tagHelpButton * next
Definition: winhelp.h:57
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
static const WCHAR L[]
Definition: oid.c:1087
#define SetWindowLongPtrA
Definition: winuser.h:5214
#define WM_COMMAND
Definition: winuser.h:1716
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND hWnd
Definition: winhelp.h:47
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
HWND WINAPI GetParent(_In_ HWND)
static real win[4][36]
INT x
Definition: msvc.h:62
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPCSTR lpszName
Definition: winhelp.h:50
#define WM_SETFONT
Definition: winuser.h:1632
WNDPROC button_proc
Definition: winhelp.h:138
WPARAM wParam
Definition: winhelp.h:53
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WS_VISIBLE
Definition: pedump.c:620
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LONG cy
Definition: windef.h:325
LPARAM lParam
Definition: combotst.c:139

◆ WINHELP_ButtonWndProc()

static LRESULT CALLBACK WINHELP_ButtonWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 999 of file winhelp.c.

Referenced by WINHELP_ButtonBoxWndProc().

1000 {
1001  if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, NULL)) return 0;
1002 
1003  if (msg == WM_KEYDOWN)
1004  {
1005  switch (wParam)
1006  {
1007  case VK_UP:
1008  case VK_DOWN:
1009  case VK_PRIOR:
1010  case VK_NEXT:
1011  case VK_ESCAPE:
1012  return SendMessageA(GetParent(hWnd), msg, wParam, lParam);
1013  }
1014  }
1015 
1017 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
Definition: winhelp.c:951
#define VK_DOWN
Definition: winuser.h:2181
#define VK_PRIOR
Definition: winuser.h:2174
#define VK_ESCAPE
Definition: winuser.h:2168
WPARAM wParam
Definition: combotst.c:138
#define VK_NEXT
Definition: winuser.h:2175
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define VK_UP
Definition: winuser.h:2179
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1691
HWND WINAPI GetParent(_In_ HWND)
WNDPROC button_proc
Definition: winhelp.h:138
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
LPARAM lParam
Definition: combotst.c:139

◆ WINHELP_CheckPopup()

static BOOL WINHELP_CheckPopup ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lret 
)
static

Definition at line 951 of file winhelp.c.

Referenced by WINHELP_ButtonBoxWndProc(), WINHELP_ButtonWndProc(), and WINHELP_MainWndProc().

952 {
953  WINHELP_WINDOW* popup;
954 
955  if (!Globals.active_popup) return FALSE;
956 
957  switch (msg)
958  {
959  case WM_NOTIFY:
960  {
961  MSGFILTER* msgf = (MSGFILTER*)lParam;
962  if (msgf->nmhdr.code == EN_MSGFILTER)
963  {
964  if (!WINHELP_CheckPopup(hWnd, msgf->msg, msgf->wParam, msgf->lParam, NULL))
965  return FALSE;
966  if (lret) *lret = 1;
967  return TRUE;
968  }
969  }
970  break;
971  case WM_ACTIVATE:
975  break;
976  /* fall through */
977  case WM_LBUTTONDOWN:
978  if (msg == WM_LBUTTONDOWN)
980  /* fall through */
981  case WM_MBUTTONDOWN:
982  case WM_RBUTTONDOWN:
983  case WM_NCLBUTTONDOWN:
984  case WM_NCMBUTTONDOWN:
985  case WM_NCRBUTTONDOWN:
986  popup = Globals.active_popup;
988  WINHELP_ReleaseWindow(popup);
989  if (lret) *lret = 1;
990  return TRUE;
991  }
992  return FALSE;
993 }
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
HANDLE HWND
Definition: compat.h:13
static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
Definition: winhelp.c:951
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1677
WPARAM wParam
Definition: richedit.h:642
WINHELP_WINDOW * active_popup
Definition: winhelp.h:136
LPARAM lParam
Definition: richedit.h:643
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3112
BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:524
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
#define EN_MSGFILTER
Definition: richedit.h:191
#define WM_RBUTTONDOWN
Definition: winuser.h:1755
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
UINT msg
Definition: richedit.h:641
#define WM_NCMBUTTONDOWN
Definition: winuser.h:1680
#define WM_ACTIVATE
Definition: winuser.h:1594
HWND hMainWnd
Definition: winhelp.h:80
#define WM_MBUTTONDOWN
Definition: winuser.h:1758
static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW *win, UINT msg, LPARAM lParam)
Definition: winhelp.c:895
#define GW_OWNER
Definition: winuser.h:761
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
#define WA_INACTIVE
Definition: winuser.h:2576
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
NMHDR nmhdr
Definition: richedit.h:640

◆ WINHELP_CreateHelpWindow()

BOOL WINHELP_CreateHelpWindow ( WINHELP_WNDPAGE wpage,
int  nCmdShow,
BOOL  remember 
)

Definition at line 698 of file winhelp.c.

Referenced by MACRO_Back(), MACRO_Next(), MACRO_Prev(), WINHELP_HistoryWndProc(), and WINHELP_OpenHelpWindow().

699 {
701  BOOL bPrimary, bPopup, bReUsed = FALSE;
702  HICON hIcon;
703  HWND hTextWnd = NULL;
704 
705  bPrimary = !lstrcmpiA(wpage->wininfo->name, "main");
706  bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP);
707 
708  if (!bPopup)
709  {
710  for (win = Globals.win_list; win; win = win->next)
711  {
712  if (!lstrcmpiA(win->info->name, wpage->wininfo->name))
713  {
714  if (win->page == wpage->page && win->info == wpage->wininfo)
715  {
716  /* see #22979, some hlp files have a macro (run at page opening), which
717  * jumps to the very same page
718  * Exit gracefully in that case
719  */
720  return TRUE;
721  }
723  bReUsed = TRUE;
725  if (win->info != wpage->wininfo)
726  {
727  POINT pt = {0, 0};
728  SIZE sz = {0, 0};
730 
731  if (wpage->wininfo->origin.x != CW_USEDEFAULT &&
732  wpage->wininfo->origin.y != CW_USEDEFAULT)
733  {
734  pt = wpage->wininfo->origin;
735  flags &= ~SWP_NOSIZE;
736  }
737  if (wpage->wininfo->size.cx != CW_USEDEFAULT &&
738  wpage->wininfo->size.cy != CW_USEDEFAULT)
739  {
740  sz = wpage->wininfo->size;
741  flags &= ~SWP_NOMOVE;
742  }
743  SetWindowPos(win->hMainWnd, HWND_TOP, pt.x, pt.y, sz.cx, sz.cy, flags);
744  }
745 
746  if (wpage->page && win->page && wpage->page->file != win->page->file)
749 
750  win->page = wpage->page;
751  win->info = wpage->wininfo;
752  hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
753  WINHELP_SetupText(hTextWnd, win, wpage->relative);
754 
756  if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
757 
758  break;
759  }
760  }
761  }
762 
763  if (!win)
764  {
765  /* Initialize WINHELP_WINDOW struct */
767  if (!win) return FALSE;
768  win->next = Globals.win_list;
769  Globals.win_list = win;
770 
771  win->hHandCur = LoadCursorW(0, (LPWSTR)IDC_HAND);
772  win->back.index = 0;
773  win->font_scale = 1;
774  WINHELP_GrabWindow(win);
775  }
776  win->page = wpage->page;
777  win->info = wpage->wininfo;
778  WINHELP_GrabWindow(win);
779 
780  if (!bPopup && wpage->page && remember)
781  {
782  WINHELP_RememberPage(win, wpage);
783  }
784 
785  if (bPopup)
787  else
789 
790  /* Initialize default pushbuttons */
791  if (bPrimary && wpage->page)
792  {
794 
795  LoadStringA(Globals.hInstance, STID_CONTENTS, buffer, sizeof(buffer));
796  MACRO_CreateButton("BTN_CONTENTS", buffer, "Contents()");
797  LoadStringA(Globals.hInstance, STID_INDEX, buffer, sizeof(buffer));
798  MACRO_CreateButton("BTN_INDEX", buffer, "Finder()");
799  LoadStringA(Globals.hInstance, STID_BACK, buffer, sizeof(buffer));
800  MACRO_CreateButton("BTN_BACK", buffer, "Back()");
801  if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK");
802  }
803 
804  if (!bReUsed)
805  {
807  WINHELP_GetCaption(wpage),
808  bPrimary ? WS_OVERLAPPEDWINDOW : wpage->wininfo->win_style,
809  wpage->wininfo->origin.x, wpage->wininfo->origin.y,
810  wpage->wininfo->size.cx, wpage->wininfo->size.cy,
811  bPopup ? Globals.active_win->hMainWnd : NULL,
813  Globals.hInstance, win);
814  if (!bPopup)
815  /* Create button box and text Window */
817  0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL);
818 
819  hTextWnd = CreateWindowA(RICHEDIT_CLASS20A, NULL,
821  0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
822  SendMessageW(hTextWnd, EM_SETEVENTMASK, 0,
823  SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS);
826  }
827 
828  hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL;
831  SendMessageW(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon);
832 
833  /* Initialize file specific pushbuttons */
834  if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
835  {
836  HLPFILE_MACRO *macro;
837  for (macro = wpage->page->file->first_macro; macro; macro = macro->next)
838  MACRO_ExecuteMacro(win, macro->lpszMacro);
839 
840  for (macro = wpage->page->first_macro; macro; macro = macro->next)
841  MACRO_ExecuteMacro(win, macro->lpszMacro);
842  }
843  /* See #17681, in some cases, the newly created window is closed by the macros it contains
844  * (braindead), so deal with this case
845  */
846  for (win = Globals.win_list; win; win = win->next)
847  {
848  if (!lstrcmpiA(win->info->name, wpage->wininfo->name)) break;
849  }
850  if (!win || !WINHELP_ReleaseWindow(win)) return TRUE;
851 
852  if (bPopup)
853  {
854  DWORD mask = SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0);
855 
857  WINHELP_SetupText(hTextWnd, win, wpage->relative);
858 
859  /* we need the window to be shown for richedit to compute the size */
860  ShowWindow(win->hMainWnd, nCmdShow);
861  SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask | ENM_REQUESTRESIZE);
862  SendMessageW(hTextWnd, EM_REQUESTRESIZE, 0, 0);
863  SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask);
864  }
865  else
866  {
867  WINHELP_SetupText(hTextWnd, win, wpage->relative);
869  ShowWindow(win->hMainWnd, nCmdShow);
870  }
871 
872  return TRUE;
873 }
LPCSTR lpszMacro
Definition: hlpfile.h:64
static void WINHELP_RememberPage(WINHELP_WINDOW *win, WINHELP_WNDPAGE *wpage)
Definition: winhelp.c:592
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
#define CTL_ID_TEXT
Definition: winhelp.c:51
long y
Definition: polytest.cpp:48
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
long x
Definition: polytest.cpp:48
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define pt(x, y)
Definition: drawing.c:79
#define ENM_MOUSEEVENTS
Definition: richedit.h:476
struct tagHlpFileFile * file
Definition: hlpfile.h:84
char CHAR
Definition: xmlstorage.h:175
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
#define ES_MULTILINE
Definition: pedump.c:667
#define MAIN_MENU
Definition: resources.h:12
HANDLE hInstance
Definition: winhelp.h:133
static void WINHELP_InitFonts(HWND hWnd)
Definition: winhelp.c:58
void WINHELP_DeleteBackSet(WINHELP_WINDOW *win)
Definition: winhelp.c:481
#define HWND_TOP
Definition: winuser.h:1193
GLuint buffer
Definition: glext.h:5915
#define SM_CYSMICON
Definition: winuser.h:1003
#define MAX_STRING_LEN
Definition: precomp.h:36
#define ES_READONLY
Definition: pedump.c:675
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
WINHELP_WINDOW * active_popup
Definition: winhelp.h:136
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define ICON_SMALL
Definition: tnclass.cpp:48
HLPFILE_MACRO * first_macro
Definition: hlpfile.h:71
#define STID_INDEX
Definition: winhelp_res.h:43
GLenum GLint GLuint mask
Definition: glext.h:6028
BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:524
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
struct tagHlpFileMacro * next
Definition: hlpfile.h:65
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
#define CW_USEDEFAULT
Definition: winuser.h:225
WINHELP_WINDOW * win_list
Definition: winhelp.h:137
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
Definition: macro.c:73
WINHELP_WINDOW * WINHELP_GrabWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:513
unsigned index
Definition: winhelp.h:71
#define IDI_WINHELP
Definition: winhelp_res.h:56
#define EM_SETEVENTMASK
Definition: richedit.h:102
const char MAIN_WIN_CLASS_NAME[]
Definition: string.c:23
char name[9]
Definition: hlpfile.h:30
#define STID_CONTENTS
Definition: winhelp_res.h:42
#define IDC_HAND
Definition: winuser.h:693
unsigned int BOOL
Definition: ntddk_ex.h:94
void WINHELP_LayoutMainWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:434
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:717
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
static char * WINHELP_GetCaption(WINHELP_WNDPAGE *wpage)
Definition: winhelp.c:586
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define WS_HSCROLL
Definition: pedump.c:628
GLbitfield flags
Definition: glext.h:7161
#define SM_CXSMICON
Definition: winuser.h:1002
#define CTL_ID_BUTTON
Definition: winhelp.c:50
static LRESULT CALLBACK WINHELP_RicheditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:670
#define SetWindowLongPtrA
Definition: winuser.h:5214
BOOL MACRO_ExecuteMacro(struct tagWinHelp *, LPCSTR)
uint32_t DWORD_PTR
Definition: typedefs.h:63
WNDPROC origRicheditWndProc
Definition: winhelp.h:83
#define EM_REQUESTRESIZE
Definition: richedit.h:98
HLPFILE_PAGE * page
Definition: winhelp.h:62
#define GWLP_WNDPROC
Definition: treelist.c:66
void CALLBACK MACRO_DisableButton(LPCSTR id)
Definition: macro.c:116
#define SWP_NOSIZE
Definition: winuser.h:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
HWND hHistoryWnd
Definition: winhelp.h:81
HCURSOR hHandCur
Definition: winhelp.h:88
static real win[4][36]
HWND hMainWnd
Definition: winhelp.h:80
HICON hIcon
Definition: msconfig.c:44
ULONG relative
Definition: winhelp.h:64
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define RICHEDIT_CLASS20A
Definition: richedit.h:43
HLPFILE_WINDOWINFO * wininfo
Definition: winhelp.h:63
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define STID_BACK
Definition: winhelp_res.h:44
#define ENM_REQUESTRESIZE
Definition: richedit.h:477
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
WINHELP_PAGESET back
Definition: winhelp.h:94
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define SWP_NOMOVE
Definition: winuser.h:1229
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static void WINHELP_DeleteButtons(WINHELP_WINDOW *win)
Definition: winhelp.c:463
HLPFILE_PAGE * page
Definition: winhelp.h:78
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const char BUTTON_BOX_WIN_CLASS_NAME[]
Definition: string.c:24
#define WS_VISIBLE
Definition: pedump.c:620
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LONG cy
Definition: windef.h:325
static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW *win, ULONG relative)
Definition: winhelp.c:104
unsigned font_scale
Definition: winhelp.h:95
struct tagWinHelp * next
Definition: winhelp.h:97

◆ WINHELP_CreateIndexWindow()

BOOL WINHELP_CreateIndexWindow ( BOOL  is_search)

Definition at line 1542 of file winhelp.c.

Referenced by MACRO_Finder(), and MACRO_Search().

1543 {
1544  HPROPSHEETPAGE psPage[3];
1545  PROPSHEETPAGEA psp;
1546  PROPSHEETHEADERA psHead;
1547  struct index_data id;
1548  char buf[256];
1549 
1552  else
1553  return FALSE;
1554 
1555  if (id.hlpfile->kwbtree == NULL)
1556  {
1557  WINE_TRACE("No index provided\n");
1558  return FALSE;
1559  }
1560 
1562 
1563  id.jump = FALSE;
1564  memset(&psp, 0, sizeof(psp));
1565  psp.dwSize = sizeof(psp);
1566  psp.dwFlags = 0;
1567  psp.hInstance = Globals.hInstance;
1568 
1570  psp.lParam = (LPARAM)&id;
1572  psPage[0] = CreatePropertySheetPageA(&psp);
1573 
1575  psp.lParam = (LPARAM)&id;
1577  psPage[1] = CreatePropertySheetPageA(&psp);
1578 
1579  memset(&psHead, 0, sizeof(psHead));
1580  psHead.dwSize = sizeof(psHead);
1581 
1582  LoadStringA(Globals.hInstance, STID_PSH_INDEX, buf, sizeof(buf));
1584 
1585  psHead.pszCaption = buf;
1586  psHead.nPages = 2;
1587  psHead.u2.nStartPage = is_search ? 1 : 0;
1589  psHead.u3.phpage = psPage;
1590  psHead.dwFlags = PSH_NOAPPLYNOW;
1591 
1592  PropertySheetA(&psHead);
1593  if (id.jump)
1594  {
1595  WINE_TRACE("got %d as an offset\n", id.offset);
1598  }
1599  return TRUE;
1600 }
#define SW_NORMAL
Definition: winuser.h:763
#define TRUE
Definition: types.h:120
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
DWORD dwSize
Definition: prsht.h:177
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
struct tagHlpFileFile * file
Definition: hlpfile.h:84
#define IDD_SEARCH
Definition: winhelp_res.h:54
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
LPCSTR pszCaption
Definition: prsht.h:248
GLintptr offset
Definition: glext.h:5920
HANDLE hInstance
Definition: winhelp.h:133
char caption[51]
Definition: hlpfile.h:31
#define WINE_TRACE
Definition: debug.h:353
LPCSTR pszTemplate
Definition: prsht.h:181
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
UINT nStartPage
Definition: prsht.h:251
static INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1293
HLPFILE_PAGE * HLPFILE_PageByOffset(HLPFILE *hlpfile, LONG offset, ULONG *relative)
Definition: hlpfile.c:369
HWND hwndParent
Definition: prsht.h:242
#define STID_PSH_INDEX
Definition: winhelp_res.h:50
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HINSTANCE hInstance
Definition: prsht.h:179
smooth NULL
Definition: ftsmooth.c:416
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE *(*lookup)(HLPFILE *, LONG, ULONG *), HLPFILE *hlpfile, LONG val, HLPFILE_WINDOWINFO *wi, int nCmdShow)
Definition: winhelp.c:879
HPROPSHEETPAGE * phpage
Definition: prsht.h:256
INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
Definition: propsheet.c:2855
DWORD dwSize
Definition: prsht.h:240
LPARAM lParam
Definition: prsht.h:190
DWORD dwFlags
Definition: prsht.h:241
BOOL jump
Definition: winhelp.c:1218
DWORD dwFlags
Definition: prsht.h:178
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(LPCPROPSHEETPAGEA lpPropSheetPage)
Definition: propsheet.c:2982
HWND hMainWnd
Definition: winhelp.h:80
#define IDD_INDEX
Definition: winhelp_res.h:52
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
BYTE * kwbtree
Definition: hlpfile.h:111
static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1226
HLPFILE * hlpfile
Definition: winhelp.c:1217
GLenum GLuint id
Definition: glext.h:5579
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
HLPFILE_PAGE * page
Definition: winhelp.h:78
#define memset(x, y, z)
Definition: compat.h:39
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
DLGPROC pfnDlgProc
Definition: prsht.h:189
#define LPARAM
Definition: msvc.h:38

◆ WINHELP_DeleteBackSet()

void WINHELP_DeleteBackSet ( WINHELP_WINDOW win)

Definition at line 481 of file winhelp.c.

Referenced by MACRO_BackFlush(), WINHELP_CreateHelpWindow(), and WINHELP_DeleteWindow().

482 {
483  unsigned int i;
484 
485  for (i = 0; i < win->back.index; i++)
486  {
488  win->back.set[i].page = NULL;
489  }
490  win->back.index = 0;
491 }
WINHELP_WNDPAGE set[40]
Definition: winhelp.h:70
struct tagHlpFileFile * file
Definition: hlpfile.h:84
void HLPFILE_FreeHlpFile(HLPFILE *hlpfile)
Definition: hlpfile.c:2297
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
unsigned index
Definition: winhelp.h:71
HLPFILE_PAGE * page
Definition: winhelp.h:62
WINHELP_PAGESET back
Definition: winhelp.h:94

◆ WINHELP_DeleteButtons()

static void WINHELP_DeleteButtons ( WINHELP_WINDOW win)
static

Definition at line 463 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow(), and WINHELP_DeleteWindow().

464 {
465  WINHELP_BUTTON* b;
466  WINHELP_BUTTON* bp;
467 
468  for (b = win->first_button; b; b = bp)
469  {
470  DestroyWindow(b->hWnd);
471  bp = b->next;
472  HeapFree(GetProcessHeap(), 0, b);
473  }
474  win->first_button = NULL;
475 }
WINHELP_BUTTON * first_button
Definition: winhelp.h:77
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
#define GetProcessHeap()
Definition: compat.h:395
struct tagHelpButton * next
Definition: winhelp.h:57
HWND hWnd
Definition: winhelp.h:47
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ WINHELP_DeletePageLinks()

static void WINHELP_DeletePageLinks ( HLPFILE_PAGE page)
static

Definition at line 497 of file winhelp.c.

Referenced by WINHELP_DeleteWindow().

498 {
499  HLPFILE_LINK* curr;
501 
502  for (curr = page->first_link; curr; curr = next)
503  {
504  next = curr->next;
505  HeapFree(GetProcessHeap(), 0, curr);
506  }
507 }
HLPFILE_LINK * first_link
Definition: hlpfile.h:73
#define GetProcessHeap()
Definition: compat.h:395
static unsigned __int64 next
Definition: rand_nt.c:6
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ WINHELP_DeleteWindow()

static void WINHELP_DeleteWindow ( WINHELP_WINDOW win)
static

Definition at line 540 of file winhelp.c.

Referenced by WINHELP_MainWndProc().

541 {
542  WINHELP_WINDOW** w;
543  BOOL bExit;
544  HWND hTextWnd;
545 
546  for (w = &Globals.win_list; *w; w = &(*w)->next)
547  {
548  if (*w == win)
549  {
550  *w = win->next;
551  break;
552  }
553  }
554  bExit = (Globals.wVersion >= 4 && !lstrcmpiA(win->info->name, "main"));
555 
556  if (Globals.active_win == win)
557  {
559  if (Globals.win_list)
561  }
562 
563  if (win == Globals.active_popup)
565 
566  hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
568 
570 
571  if (win->page) WINHELP_DeletePageLinks(win->page);
572  if (win->hHistoryWnd) DestroyWindow(win->hHistoryWnd);
573 
574  DeleteObject(win->hBrush);
575 
577 
578  if (win->page) HLPFILE_FreeHlpFile(win->page->file);
579  HeapFree(GetProcessHeap(), 0, win);
580 
581  if (bExit) MACRO_Exit();
582  if (!Globals.win_list)
583  PostQuitMessage(0);
584 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define CTL_ID_TEXT
Definition: winhelp.c:51
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
static void WINHELP_DeletePageLinks(HLPFILE_PAGE *page)
Definition: winhelp.c:497
struct tagHlpFileFile * file
Definition: hlpfile.h:84
void HLPFILE_FreeHlpFile(HLPFILE *hlpfile)
Definition: hlpfile.c:2297
void WINHELP_DeleteBackSet(WINHELP_WINDOW *win)
Definition: winhelp.c:481
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
WINHELP_WINDOW * active_popup
Definition: winhelp.h:136
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND WINAPI SetActiveWindow(_In_ HWND)
WINHELP_WINDOW * win_list
Definition: winhelp.h:137
smooth NULL
Definition: ftsmooth.c:416
char name[9]
Definition: hlpfile.h:30
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SetWindowLongPtrA
Definition: winuser.h:5214
WNDPROC origRicheditWndProc
Definition: winhelp.h:83
#define GWLP_WNDPROC
Definition: treelist.c:66
HWND hHistoryWnd
Definition: winhelp.h:81
HWND hMainWnd
Definition: winhelp.h:80
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HBRUSH hBrush
Definition: winhelp.h:90
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
BOOL bExit
Definition: cmd.c:152
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
void CALLBACK MACRO_Exit(void)
Definition: macro.c:392
static void WINHELP_DeleteButtons(WINHELP_WINDOW *win)
Definition: winhelp.c:463
HLPFILE_PAGE * page
Definition: winhelp.h:78
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
#define HeapFree(x, y, z)
Definition: compat.h:394
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
struct tagWinHelp * next
Definition: winhelp.h:97

◆ WINHELP_FindLink()

static HLPFILE_LINK* WINHELP_FindLink ( WINHELP_WINDOW win,
LPARAM  pos 
)
static

Definition at line 630 of file winhelp.c.

Referenced by WINHELP_HandleTextMouse(), and WINHELP_RicheditWndProc().

631 {
633  POINTL mouse_ptl, char_ptl, char_next_ptl;
634  DWORD cp;
635 
636  if (!win->page) return NULL;
637 
638  mouse_ptl.x = (short)LOWORD(pos);
639  mouse_ptl.y = (short)HIWORD(pos);
641  0, (LPARAM)&mouse_ptl);
642 
643  for (link = win->page->first_link; link; link = link->next)
644  {
645  if (link->cpMin <= cp && cp <= link->cpMax)
646  {
647  /* check whether we're at end of line */
649  (LPARAM)&char_ptl, cp);
651  (LPARAM)&char_next_ptl, cp + 1);
652  if (link->bHotSpot)
653  {
654  HLPFILE_HOTSPOTLINK* hslink = (HLPFILE_HOTSPOTLINK*)link;
655  if ((mouse_ptl.x < char_ptl.x + hslink->x) ||
656  (mouse_ptl.x >= char_ptl.x + hslink->x + hslink->width) ||
657  (mouse_ptl.y < char_ptl.y + hslink->y) ||
658  (mouse_ptl.y >= char_ptl.y + hslink->y + hslink->height))
659  continue;
660  break;
661  }
662  if (char_next_ptl.y != char_ptl.y || mouse_ptl.x >= char_next_ptl.x)
663  link = NULL;
664  break;
665  }
666  }
667  return link;
668 }
#define CTL_ID_TEXT
Definition: winhelp.c:51
LONG y
Definition: windef.h:320
HLPFILE_LINK * first_link
Definition: hlpfile.h:73
#define EM_CHARFROMPOS
Definition: richedit.h:78
#define EM_POSFROMCHAR
Definition: richedit.h:77
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:91
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:319
HWND hMainWnd
Definition: winhelp.h:80
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
POINT cp
Definition: magnifier.c:60
#define HIWORD(l)
Definition: typedefs.h:246
const WCHAR * link
Definition: db.cpp:926
HLPFILE_PAGE * page
Definition: winhelp.h:78
#define LOWORD(l)
Definition: pedump.c:82

◆ WINHELP_GetCaption()

static char* WINHELP_GetCaption ( WINHELP_WNDPAGE wpage)
static

Definition at line 586 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow().

587 {
588  if (wpage->wininfo->caption[0]) return wpage->wininfo->caption;
589  return wpage->page->file->lpszTitle;
590 }
struct tagHlpFileFile * file
Definition: hlpfile.h:84
char caption[51]
Definition: hlpfile.h:31
HLPFILE_PAGE * page
Definition: winhelp.h:62
HLPFILE_WINDOWINFO * wininfo
Definition: winhelp.h:63

◆ WINHELP_GetOpenFileName()

BOOL WINHELP_GetOpenFileName ( LPSTR  lpszFile,
int  len 
)

Definition at line 146 of file winhelp.c.

Referenced by MACRO_FileOpen(), and WINHELP_LookupHelpFile().

147 {
148  OPENFILENAMEA openfilename;
149  CHAR szDir[MAX_PATH];
150  CHAR szzFilter[2 * MAX_STRING_LEN + 100];
151  LPSTR p = szzFilter;
152 
153  WINE_TRACE("()\n");
154 
156  p += strlen(p) + 1;
157  strcpy(p, "*.hlp");
158  p += strlen(p) + 1;
160  p += strlen(p) + 1;
161  strcpy(p, "*.*");
162  p += strlen(p) + 1;
163  *p = '\0';
164 
165  GetCurrentDirectoryA(sizeof(szDir), szDir);
166 
167  lpszFile[0]='\0';
168 
169  openfilename.lStructSize = sizeof(openfilename);
170  openfilename.hwndOwner = (Globals.active_win ? Globals.active_win->hMainWnd : 0);
171  openfilename.hInstance = Globals.hInstance;
172  openfilename.lpstrFilter = szzFilter;
173  openfilename.lpstrCustomFilter = 0;
174  openfilename.nMaxCustFilter = 0;
175  openfilename.nFilterIndex = 1;
176  openfilename.lpstrFile = lpszFile;
177  openfilename.nMaxFile = len;
178  openfilename.lpstrFileTitle = 0;
179  openfilename.nMaxFileTitle = 0;
180  openfilename.lpstrInitialDir = szDir;
181  openfilename.lpstrTitle = 0;
183  openfilename.nFileOffset = 0;
184  openfilename.nFileExtension = 0;
185  openfilename.lpstrDefExt = 0;
186  openfilename.lCustData = 0;
187  openfilename.lpfnHook = 0;
188  openfilename.lpTemplateName = 0;
189 
190  return GetOpenFileNameA(&openfilename);
191 }
WORD nFileExtension
Definition: commdlg.h:344
LPSTR lpstrFileTitle
Definition: commdlg.h:338
LPARAM lCustData
Definition: commdlg.h:346
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HWND hwndOwner
Definition: commdlg.h:330
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
char CHAR
Definition: xmlstorage.h:175
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
HANDLE hInstance
Definition: winhelp.h:133
#define WINE_TRACE
Definition: debug.h:353
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define MAX_STRING_LEN
Definition: precomp.h:36
LPCSTR lpTemplateName
Definition: commdlg.h:348
char * LPSTR
Definition: xmlstorage.h:182
DWORD nMaxFile
Definition: commdlg.h:337
#define STID_ALL_FILES
Definition: winhelp_res.h:45
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
HINSTANCE hInstance
Definition: commdlg.h:331
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
DWORD nMaxCustFilter
Definition: commdlg.h:334
#define OFN_READONLY
Definition: commdlg.h:118
GLenum GLsizei len
Definition: glext.h:6722
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define STID_HELP_FILES_HLP
Definition: winhelp_res.h:46
HWND hMainWnd
Definition: winhelp.h:80
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4186
LPCSTR lpstrFilter
Definition: commdlg.h:332
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
LPCSTR lpstrTitle
Definition: commdlg.h:341
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
DWORD nFilterIndex
Definition: commdlg.h:335
GLfloat GLfloat p
Definition: glext.h:8902
#define OFN_ENABLESIZING
Definition: commdlg.h:101
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
DWORD nMaxFileTitle
Definition: commdlg.h:339
WORD nFileOffset
Definition: commdlg.h:343
DWORD Flags
Definition: commdlg.h:342

◆ WINHELP_GetPopupWindowInfo()

static HLPFILE_WINDOWINFO* WINHELP_GetPopupWindowInfo ( HLPFILE hlpfile,
WINHELP_WINDOW parent,
LPARAM  mouse 
)
static

Definition at line 299 of file winhelp.c.

Referenced by WINHELP_HandleTextMouse().

301 {
302  static HLPFILE_WINDOWINFO wi;
303 
304  RECT parent_rect;
305 
306  wi.type[0] = wi.name[0] = wi.caption[0] = '\0';
307 
308  /* Calculate horizontal size and position of a popup window */
309  GetWindowRect(parent->hMainWnd, &parent_rect);
310  wi.size.cx = (parent_rect.right - parent_rect.left) / 2;
311  wi.size.cy = 10; /* need a non null value, so that borders are taken into account while computing */
312 
313  wi.origin.x = (short)LOWORD(mouse);
314  wi.origin.y = (short)HIWORD(mouse);
315  ClientToScreen(parent->hMainWnd, &wi.origin);
316  wi.origin.x -= wi.size.cx / 2;
318  wi.origin.x = max(wi.origin.x, 0);
319 
320  wi.style = SW_SHOW;
322  if (parent->page->file->has_popup_color)
323  wi.sr_color = parent->page->file->popup_color;
324  else
325  wi.sr_color = parent->info->sr_color;
326  wi.nsr_color = 0xFFFFFF;
327 
328  return &wi;
329 }
#define max(a, b)
Definition: svc.c:63
long y
Definition: polytest.cpp:48
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
long x
Definition: polytest.cpp:48
struct tagHlpFileFile * file
Definition: hlpfile.h:84
char caption[51]
Definition: hlpfile.h:31
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:91
#define SM_CXSCREEN
Definition: winuser.h:949
LONG cx
Definition: windef.h:324
#define SW_SHOW
Definition: winuser.h:769
char name[9]
Definition: hlpfile.h:30
COLORREF sr_color
Definition: hlpfile.h:36
COLORREF nsr_color
Definition: hlpfile.h:37
int WINAPI GetSystemMetrics(_In_ int)
#define WS_BORDER
Definition: pedump.c:625
HWND hMainWnd
Definition: winhelp.h:80
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
#define HIWORD(l)
Definition: typedefs.h:246
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HLPFILE_PAGE * page
Definition: winhelp.h:78
LONG cy
Definition: windef.h:325
#define LOWORD(l)
Definition: pedump.c:82
char type[10]
Definition: hlpfile.h:29

◆ WINHELP_GetWindowInfo()

HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo ( HLPFILE hlpfile,
LPCSTR  name 
)

Definition at line 254 of file winhelp.c.

Referenced by MACRO_JumpContents(), MACRO_JumpContext(), MACRO_JumpHash(), and WinMain().

255 {
256  static HLPFILE_WINDOWINFO mwi;
257  unsigned int i;
258 
259  if (!name || !name[0])
261 
262  if (hlpfile)
263  for (i = 0; i < hlpfile->numWindows; i++)
264  if (!lstrcmpiA(hlpfile->windows[i].name, name))
265  return &hlpfile->windows[i];
266 
267  if (strcmp(name, "main") != 0)
268  {
269  WINE_FIXME("Couldn't find window info for %s\n", debugstr_a(name));
270  assert(0);
271  return NULL;
272  }
273  if (!mwi.name[0])
274  {
275  strcpy(mwi.type, "primary");
276  strcpy(mwi.name, "main");
277  if (hlpfile && hlpfile->lpszTitle[0])
278  {
279  char tmp[128];
280  LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
281  snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s",
282  hlpfile->lpszTitle, tmp, hlpfile->lpszPath);
283  }
284  else
286  mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT;
287  mwi.style = SW_SHOW;
289  mwi.sr_color = mwi.nsr_color = 0xFFFFFF;
290  }
291  return &mwi;
292 }
long y
Definition: polytest.cpp:48
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
long x
Definition: polytest.cpp:48
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
HANDLE hInstance
Definition: winhelp.h:133
char caption[51]
Definition: hlpfile.h:31
#define snprintf
Definition: wintirpc.h:48
#define assert(x)
Definition: debug.h:53
unsigned numWindows
Definition: hlpfile.h:146
GLenum GLclampf GLint i
Definition: glfuncs.h:14
LPSTR lpszPath
Definition: hlpfile.h:104
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:324
#define SW_SHOW
Definition: winuser.h:769
char name[9]
Definition: hlpfile.h:30
COLORREF sr_color
Definition: hlpfile.h:36
COLORREF nsr_color
Definition: hlpfile.h:37
#define debugstr_a
Definition: kernel32.h:31
LPSTR lpszTitle
Definition: hlpfile.h:105
HLPFILE_WINDOWINFO * windows
Definition: hlpfile.h:147
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
Definition: name.c:36
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
LONG cy
Definition: windef.h:325
#define STID_WINE_HELP
Definition: winhelp_res.h:36
char type[10]
Definition: hlpfile.h:29
#define WINE_FIXME
Definition: debug.h:365

◆ WINHELP_GrabWindow()

WINHELP_WINDOW* WINHELP_GrabWindow ( WINHELP_WINDOW win)

Definition at line 513 of file winhelp.c.

Referenced by MACRO_ExecuteMacro(), and WINHELP_CreateHelpWindow().

514 {
515  WINE_TRACE("Grab %p#%d++\n", win, win->ref_count);
516  win->ref_count++;
517  return win;
518 }
#define WINE_TRACE
Definition: debug.h:353
unsigned ref_count
Definition: winhelp.h:76
static real win[4][36]

◆ WINHELP_HandleCommand()

static LRESULT WINHELP_HandleCommand ( HWND  hSrcWnd,
LPARAM  lParam 
)
static

Definition at line 353 of file winhelp.c.

Referenced by WINHELP_MainWndProc().

354 {
356  WINHELP* wh;
357 
358  if (cds->dwData != 0xA1DE505)
359  {
360  WINE_FIXME("Wrong magic number (%08lx)\n", cds->dwData);
361  return 0;
362  }
363 
364  wh = cds->lpData;
365 
366  if (wh)
367  {
368  char* ptr = (wh->ofsFilename) ? (LPSTR)wh + wh->ofsFilename : NULL;
369 
370  WINE_TRACE("Got[%u]: cmd=%u data=%08x fn=%s\n",
371  wh->size, wh->command, wh->data, debugstr_a(ptr));
372  switch (wh->command)
373  {
374  case HELP_CONTEXT:
375  if (ptr)
376  {
377  MACRO_JumpContext(ptr, "main", wh->data);
378  }
380  break;
381  case HELP_QUIT:
382  MACRO_Exit();
383  break;
384  case HELP_CONTENTS:
385  if (ptr)
386  {
387  MACRO_JumpContents(ptr, "main");
388  }
390  break;
391  case HELP_HELPONHELP:
392  MACRO_HelpOn();
394  break;
395  /* case HELP_SETINDEX: */
396  case HELP_SETCONTENTS:
397  if (ptr)
398  {
399  MACRO_SetContents(ptr, wh->data);
400  }
401  break;
402  case HELP_CONTEXTPOPUP:
403  if (ptr)
404  {
405  MACRO_PopupContext(ptr, wh->data);
406  }
407  break;
408  /* case HELP_FORCEFILE:*/
409  /* case HELP_CONTEXTMENU: */
410  case HELP_FINDER:
411  /* in fact, should be the topic dialog box */
412  WINE_FIXME("HELP_FINDER: stub\n");
413  if (ptr)
414  {
415  MACRO_JumpHash(ptr, "main", 0);
416  }
417  break;
418  /* case HELP_WM_HELP: */
419  /* case HELP_SETPOPUP_POS: */
420  /* case HELP_KEY: */
421  /* case HELP_COMMAND: */
422  /* case HELP_PARTIALKEY: */
423  /* case HELP_MULTIKEY: */
424  /* case HELP_SETWINPOS: */
425  default:
426  WINE_FIXME("Unhandled command (%x) for remote winhelp control\n", wh->command);
427  break;
428  }
429  }
430  /* Always return success for now */
431  return 1;
432 }
#define HELP_CONTENTS
Definition: winuser.h:2359
#define HELP_CONTEXTPOPUP
Definition: winuser.h:2361
LONG data
Definition: winhelp.c:335
WORD size
Definition: winhelp.c:333
#define HELP_QUIT
Definition: winuser.h:2368
#define HELP_HELPONHELP
Definition: winuser.h:2363
#define WINE_TRACE
Definition: debug.h:353
char * LPSTR
Definition: xmlstorage.h:182
#define HELP_FINDER
Definition: winuser.h:2373
ULONG_PTR dwData
Definition: winuser.h:2954
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
WORD ofsFilename
Definition: winhelp.c:337
#define HELP_CONTEXT
Definition: winuser.h:2360
#define debugstr_a
Definition: kernel32.h:31
void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
Definition: macro.c:585
void CALLBACK MACRO_SetContents(LPCSTR str, LONG u)
Definition: macro.c:833
#define HELP_SETCONTENTS
Definition: winuser.h:2369
void CALLBACK MACRO_HelpOn(void)
Definition: macro.c:474
void CALLBACK MACRO_PopupContext(LPCSTR str, LONG u)
Definition: macro.c:680
static BOOL WINHELP_HasWorkingWindow(void)
Definition: winhelp.c:341
void CALLBACK MACRO_Exit(void)
Definition: macro.c:392
WORD command
Definition: winhelp.c:334
void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
Definition: macro.c:573
LPARAM lParam
Definition: combotst.c:139
void CALLBACK MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
Definition: macro.c:140
#define WINE_FIXME
Definition: debug.h:365

◆ WINHELP_HandleTextMouse()

static BOOL WINHELP_HandleTextMouse ( WINHELP_WINDOW win,
UINT  msg,
LPARAM  lParam 
)
static

Definition at line 895 of file winhelp.c.

Referenced by WINHELP_CheckPopup(), and WINHELP_MainWndProc().

896 {
897  HLPFILE* hlpfile;
899  BOOL ret = FALSE;
900 
901  switch (msg)
902  {
903  case WM_LBUTTONDOWN:
904  if ((link = WINHELP_FindLink(win, lParam)))
905  {
906  HLPFILE_WINDOWINFO* wi;
907 
908  switch (link->cookie)
909  {
910  case hlp_link_link:
911  if ((hlpfile = WINHELP_LookupHelpFile(link->string)))
912  {
913  if (link->window == -1)
914  {
915  wi = win->info;
916  if (wi->win_style & WS_POPUP) wi = Globals.active_win->info;
917  }
918  else if (link->window < hlpfile->numWindows)
919  wi = &hlpfile->windows[link->window];
920  else
921  {
922  WINE_WARN("link to window %d/%d\n", link->window, hlpfile->numWindows);
923  break;
924  }
926  }
927  break;
928  case hlp_link_popup:
929  if ((hlpfile = WINHELP_LookupHelpFile(link->string)))
931  WINHELP_GetPopupWindowInfo(hlpfile, win, lParam),
932  SW_NORMAL);
933  break;
934  case hlp_link_macro:
935  MACRO_ExecuteMacro(win, link->string);
936  break;
937  default:
938  WINE_FIXME("Unknown link cookie %d\n", link->cookie);
939  }
940  ret = TRUE;
941  }
942  break;
943  }
944  return ret;
945 }
#define SW_NORMAL
Definition: winuser.h:763
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
unsigned numWindows
Definition: hlpfile.h:146
static HLPFILE_LINK * WINHELP_FindLink(WINHELP_WINDOW *win, LPARAM pos)
Definition: winhelp.c:630
static HLPFILE_WINDOWINFO * WINHELP_GetPopupWindowInfo(HLPFILE *hlpfile, WINHELP_WINDOW *parent, LPARAM mouse)
Definition: winhelp.c:299
UINT msg
Definition: msvc.h:92
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE *(*lookup)(HLPFILE *, LONG, ULONG *), HLPFILE *hlpfile, LONG val, HLPFILE_WINDOWINFO *wi, int nCmdShow)
Definition: winhelp.c:879
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
BOOL MACRO_ExecuteMacro(struct tagWinHelp *, LPCSTR)
HLPFILE_WINDOWINFO * windows
Definition: hlpfile.h:147
HLPFILE * WINHELP_LookupHelpFile(LPCSTR lpszFile)
Definition: winhelp.c:212
#define WINE_WARN
Definition: debug.h:359
#define WS_POPUP
Definition: pedump.c:616
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
HLPFILE * hlpfile
Definition: winhelp.c:1217
HLPFILE_PAGE * HLPFILE_PageByHash(HLPFILE *hlpfile, LONG lHash, ULONG *relative)
Definition: hlpfile.c:437
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
const WCHAR * link
Definition: db.cpp:926
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
LPARAM lParam
Definition: combotst.c:139
#define WINE_FIXME
Definition: debug.h:365

◆ WINHELP_HasWorkingWindow()

static BOOL WINHELP_HasWorkingWindow ( void  )
static

Definition at line 341 of file winhelp.c.

Referenced by WINHELP_HandleCommand().

342 {
343  if (!Globals.active_win) return FALSE;
346 }
#define TRUE
Definition: types.h:120
struct tagHlpFileFile * file
Definition: hlpfile.h:84
WINHELP_WINDOW * win_list
Definition: winhelp.h:137
smooth NULL
Definition: ftsmooth.c:416
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
HLPFILE_PAGE * page
Definition: winhelp.h:78
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
struct tagWinHelp * next
Definition: winhelp.h:97

◆ WINHELP_HistoryWndProc()

static LRESULT CALLBACK WINHELP_HistoryWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1117 of file winhelp.c.

Referenced by WINHELP_RegisterWinClasses().

1118 {
1120  PAINTSTRUCT ps;
1121  HDC hDc;
1122  TEXTMETRICW tm;
1123  unsigned int i;
1124  RECT r;
1125 
1126  switch (msg)
1127  {
1128  case WM_NCCREATE:
1129  win = (WINHELP_WINDOW*)((LPCREATESTRUCTA)lParam)->lpCreateParams;
1130  SetWindowLongPtrW(hWnd, 0, (ULONG_PTR)win);
1131  win->hHistoryWnd = hWnd;
1132  break;
1133  case WM_CREATE:
1134  hDc = GetDC(hWnd);
1135  GetTextMetricsW(hDc, &tm);
1136  GetWindowRect(hWnd, &r);
1137 
1138  r.right = r.left + 30 * tm.tmAveCharWidth;
1139  r.bottom = r.top + (sizeof(Globals.history.set) / sizeof(Globals.history.set[0])) * tm.tmHeight;
1141  if (r.left < 0) {r.right -= r.left; r.left = 0;}
1142  if (r.top < 0) {r.bottom -= r.top; r.top = 0;}
1143 
1144  MoveWindow(hWnd, r.left, r.top, r.right, r.bottom, TRUE);
1145  ReleaseDC(hWnd, hDc);
1146  break;
1147  case WM_LBUTTONDOWN:
1148  hDc = GetDC(hWnd);
1149  GetTextMetricsW(hDc, &tm);
1150  i = HIWORD(lParam) / tm.tmHeight;
1151  if (i < Globals.history.index)
1153  ReleaseDC(hWnd, hDc);
1154  break;
1155  case WM_PAINT:
1156  hDc = BeginPaint(hWnd, &ps);
1157  GetTextMetricsW(hDc, &tm);
1158 
1159  for (i = 0; i < Globals.history.index; i++)
1160  {
1162  {
1163  TextOutA(hDc, 0, i * tm.tmHeight,
1166  }
1167  else
1168  {
1169  char buffer[1024];
1170  const char* ptr1;
1171  const char* ptr2;
1172  unsigned len;
1173 
1174  ptr1 = strrchr(Globals.history.set[i].page->file->lpszPath, '\\');
1175  if (!ptr1) ptr1 = Globals.history.set[i].page->file->lpszPath;
1176  else ptr1++;
1177  ptr2 = strrchr(ptr1, '.');
1178  len = ptr2 ? ptr2 - ptr1 : strlen(ptr1);
1179  if (len > sizeof(buffer)) len = sizeof(buffer);
1180  memcpy(buffer, ptr1, len);
1181  if (len < sizeof(buffer)) buffer[len++] = ':';
1182  lstrcpynA(&buffer[len], Globals.history.set[i].page->lpszTitle, sizeof(buffer) - len);
1183  TextOutA(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer));
1184  }
1185  }
1186  EndPaint(hWnd, &ps);
1187  break;
1188  case WM_DESTROY:
1189  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1190  if (hWnd == win->hHistoryWnd)
1191  win->hHistoryWnd = 0;
1192  break;
1193  }
1194  return DefWindowProcA(hWnd, msg, wParam, lParam);
1195 }
#define HDC
Definition: msvc.h:22
WINHELP_WNDPAGE set[40]
Definition: winhelp.h:70
#define TRUE
Definition: types.h:120
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
WINHELP_PAGESET history
Definition: winhelp.h:140
HDC WINAPI GetDC(_In_opt_ HWND)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
struct tagHlpFileFile * file
Definition: hlpfile.h:84
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG tmAveCharWidth
Definition: wingdi.h:2365
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:297
GLuint buffer
Definition: glext.h:5915
#define GetWindowLongPtrW
Definition: winuser.h:4698
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
LONG left
Definition: windef.h:296
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:298
#define WM_NCCREATE
Definition: winuser.h:1665
WPARAM wParam
Definition: combotst.c:138
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE *wpage, int nCmdShow, BOOL remember)
Definition: winhelp.c:698
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
GLenum GLclampf GLint i
Definition: glfuncs.h:14
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
UINT msg
Definition: msvc.h:92
unsigned index
Definition: winhelp.h:71
#define SW_SHOW
Definition: winuser.h:769
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_PAINT
Definition: winuser.h:1602
LPSTR lpszTitle
Definition: hlpfile.h:70
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
Definition: time.h:76
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
HLPFILE_PAGE * page
Definition: winhelp.h:62
#define GWL_STYLE
Definition: winuser.h:846
HWND hHistoryWnd
Definition: winhelp.h:81
static real win[4][36]
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
#define lstrcpynA
Definition: compat.h:408
BOOL WINAPI TextOutA(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCSTR lpString, _In_ int c)
#define WM_CREATE
Definition: winuser.h:1590
#define HIWORD(l)
Definition: typedefs.h:246
LONG bottom
Definition: windef.h:299
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SetWindowLongPtrW
Definition: winuser.h:5215
LONG tmHeight
Definition: wingdi.h:2360
HLPFILE_PAGE * page
Definition: winhelp.h:78
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
LPARAM lParam
Definition: combotst.c:139

◆ WINHELP_IndexDlgProc()

static INT_PTR CALLBACK WINHELP_IndexDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1226 of file winhelp.c.

Referenced by WINHELP_CreateIndexWindow().

1227 {
1228  static struct index_data* id;
1229  int sel;
1230 
1231  switch (msg)
1232  {
1233  case WM_INITDIALOG:
1234  id = (struct index_data*)((PROPSHEETPAGEA*)lParam)->lParam;
1236  GetDlgItem(hWnd, IDC_INDEXLIST));
1237  id->jump = FALSE;
1238  id->offset = 1;
1239  return TRUE;
1240  case WM_COMMAND:
1241  switch (HIWORD(wParam))
1242  {
1243  case LBN_DBLCLK:
1244  if (LOWORD(wParam) == IDC_INDEXLIST)
1246  break;
1247  }
1248  break;
1249  case WM_NOTIFY:
1250  switch (((NMHDR*)lParam)->code)
1251  {
1252  case PSN_APPLY:
1253  sel = SendDlgItemMessageW(hWnd, IDC_INDEXLIST, LB_GETCURSEL, 0, 0);
1254  if (sel != LB_ERR)
1255  {
1256  BYTE *p;
1257  int count;
1258 
1259  p = (BYTE*)SendDlgItemMessageW(hWnd, IDC_INDEXLIST, LB_GETITEMDATA, sel, 0);
1260  count = *(short*)((char *)p + strlen((char *)p) + 1);
1261  if (count > 1)
1262  {
1263  MessageBoxA(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP);
1265  return TRUE;
1266  }
1267  id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3);
1268  id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9);
1269  if (id->offset == 0xFFFFFFFF)
1270  {
1271  MessageBoxA(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP);
1273  return TRUE;
1274  }
1275  id->jump = TRUE;
1277  }
1278  return TRUE;
1279  default:
1280  return FALSE;
1281  }
1282  break;
1283  default:
1284  break;
1285  }
1286  return FALSE;
1287 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define LB_GETITEMDATA
Definition: winuser.h:2002
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define IDC_INDEXLIST
Definition: winhelp_res.h:53
#define MB_ICONSTOP
Definition: winuser.h:797
#define PSN_APPLY
Definition: prsht.h:117
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
static void cb_KWBTree(void *p, void **next, void *cookie)
Definition: winhelp.c:1203
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
#define LB_ERR
Definition: winuser.h:2386
UINT msg
Definition: msvc.h:92
void HLPFILE_BPTreeEnum(BYTE *buf, HLPFILE_BPTreeCallback cb, void *cookie)
Definition: hlpfile.c:125
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BYTE * kwdata
Definition: hlpfile.h:112
#define LBN_DBLCLK
Definition: winuser.h:2032
#define PSBTN_OK
Definition: prsht.h:149
#define PSNRET_NOERROR
Definition: prsht.h:129
ULONG offset
Definition: winhelp.c:1219
#define WM_COMMAND
Definition: winuser.h:1716
unsigned char BYTE
Definition: ntddk_ex.h:96
HWND WINAPI GetParent(_In_ HWND)
#define PSNRET_INVALID
Definition: prsht.h:130
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2000
#define MB_OK
Definition: winuser.h:784
BYTE * kwbtree
Definition: hlpfile.h:111
HLPFILE * hlpfile
Definition: winhelp.c:1217
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define PSM_PRESSBUTTON
Definition: prsht.h:100
GLfloat GLfloat p
Definition: glext.h:8902
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

◆ WINHELP_InitFonts()

static void WINHELP_InitFonts ( HWND  hWnd)
static

Definition at line 58 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow().

59 {
61  LOGFONTW logfontlist[] = {
62  {-10, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
63  {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
64  {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
65  {-12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
66  {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
67  {-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
68  { -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}};
69 #define FONTS_LEN (sizeof(logfontlist)/sizeof(*logfontlist))
70 
71  static HFONT fonts[FONTS_LEN];
72  static BOOL init = FALSE;
73 
74  win->fonts_len = FONTS_LEN;
75  win->fonts = fonts;
76 
77  if (!init)
78  {
79  UINT i;
80 
81  for (i = 0; i < FONTS_LEN; i++)
82  {
83  fonts[i] = CreateFontIndirectW(&logfontlist[i]);
84  }
85 
86  init = TRUE;
87  }
88 }
#define TRUE
Definition: types.h:120
#define GetWindowLongPtrW
Definition: winuser.h:4698
#define DEFAULT_CHARSET
Definition: wingdi.h:382
static int init
Definition: wintirpc.c:33
GLenum GLclampf GLint i
Definition: glfuncs.h:14
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
UINT fonts_len
Definition: winhelp.h:86
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned int UINT
Definition: ndis.h:50
HFONT * fonts
Definition: winhelp.h:85
static real win[4][36]
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define FONTS_LEN

◆ WINHELP_LayoutMainWindow()

void WINHELP_LayoutMainWindow ( WINHELP_WINDOW win)

Definition at line 434 of file winhelp.c.

Referenced by MACRO_ChangeButtonBinding(), MACRO_CreateButton(), WINHELP_CreateHelpWindow(), and WINHELP_MainWndProc().

435 {
436  RECT rect, button_box_rect;
437  INT text_top = 0;
438  HWND hButtonBoxWnd = GetDlgItem(win->hMainWnd, CTL_ID_BUTTON);
439  HWND hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
440 
441  GetClientRect(win->hMainWnd, &rect);
442 
443  /* Update button box and text Window */
444  SetWindowPos(hButtonBoxWnd, HWND_TOP,
445  rect.left, rect.top,
446  rect.right - rect.left,
447  rect.bottom - rect.top, 0);
448 
449  if (GetWindowRect(hButtonBoxWnd, &button_box_rect))
450  text_top = rect.top + button_box_rect.bottom - button_box_rect.top;
451 
452  SetWindowPos(hTextWnd, HWND_TOP,
453  rect.left, text_top,
454  rect.right - rect.left,
455  rect.bottom - text_top, 0);
456 
457 }
#define CTL_ID_TEXT
Definition: winhelp.c:51
LONG top
Definition: windef.h:297
#define HWND_TOP
Definition: winuser.h:1193
LONG left
Definition: windef.h:296
LONG right
Definition: windef.h:298
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CTL_ID_BUTTON
Definition: winhelp.c:50
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND hMainWnd
Definition: winhelp.h:80
LONG bottom
Definition: windef.h:299
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

◆ WINHELP_LookupHelpFile()

HLPFILE* WINHELP_LookupHelpFile ( LPCSTR  lpszFile)

Definition at line 212 of file winhelp.c.

Referenced by MACRO_JumpContents(), MACRO_JumpContext(), MACRO_JumpHash(), WINHELP_HandleTextMouse(), and WinMain().

213 {
214  HLPFILE* hlpfile;
215  char szFullName[MAX_PATH];
216  char szAddPath[MAX_PATH];
217  char *p;
218 
219  /*
220  * NOTE: This is needed by popup windows only.
221  * In other cases it's not needed but does not hurt though.
222  */
224  {
225  strcpy(szAddPath, Globals.active_win->page->file->lpszPath);
226  p = strrchr(szAddPath, '\\');
227  if (p) *p = 0;
228  }
229 
230  /*
231  * FIXME: Should we swap conditions?
232  */
233  if (!SearchPathA(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) &&
234  !SearchPathA(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL))
235  {
238  return NULL;
239  if (!WINHELP_GetOpenFileName(szFullName, MAX_PATH))
240  return NULL;
241  }
242  hlpfile = HLPFILE_ReadHlpFile(szFullName);
243  if (!hlpfile)
246  return hlpfile;
247 }
static INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WORD type)
Definition: winhelp.c:197
#define IDYES
Definition: winuser.h:829
struct tagHlpFileFile * file
Definition: hlpfile.h:84
#define STID_HLPFILE_ERROR_s
Definition: winhelp_res.h:41
#define MB_ICONSTOP
Definition: winuser.h:797
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define STID_WHERROR
Definition: winhelp_res.h:37
#define MB_YESNO
Definition: winuser.h:811
DWORD WINAPI SearchPathA(IN LPCSTR lpPath OPTIONAL, IN LPCSTR lpFileName, IN LPCSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart OPTIONAL)
Definition: path.c:1122
HLPFILE * HLPFILE_ReadHlpFile(LPCSTR lpszPath)
Definition: hlpfile.c:2759
smooth NULL
Definition: ftsmooth.c:416
#define MB_ICONQUESTION
Definition: winuser.h:783
#define MAX_PATH
Definition: compat.h:26
#define STID_FILE_NOT_FOUND_s
Definition: winhelp_res.h:48
BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len)
Definition: winhelp.c:146
#define MB_OK
Definition: winuser.h:784
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
HLPFILE * hlpfile
Definition: winhelp.c:1217
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HLPFILE_PAGE * page
Definition: winhelp.h:78
GLfloat GLfloat p
Definition: glext.h:8902
WINHELP_GLOBALS Globals
Definition: winhelp.c:48

◆ WINHELP_MainWndProc()

static LRESULT CALLBACK WINHELP_MainWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1319 of file winhelp.c.

Referenced by WINHELP_RegisterWinClasses().

1320 {
1322  WINHELP_BUTTON *button;
1323  HWND hTextWnd;
1324  LRESULT ret;
1325 
1326  if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, &ret)) return ret;
1327 
1328  switch (msg)
1329  {
1330  case WM_NCCREATE:
1331  win = (WINHELP_WINDOW*) ((LPCREATESTRUCTA) lParam)->lpCreateParams;
1332  SetWindowLongPtrW(hWnd, 0, (ULONG_PTR) win);
1333  if (!win->page && Globals.isBook)
1335  win->hMainWnd = hWnd;
1336  break;
1337 
1338  case WM_WINDOWPOSCHANGED:
1340  break;
1341 
1342  case WM_COMMAND:
1343  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1344  switch (LOWORD(wParam))
1345  {
1346  /* Menu FILE */
1347  case MNID_FILE_OPEN: MACRO_FileOpen(); break;
1348  case MNID_FILE_PRINT: MACRO_Print(); break;
1349  case MNID_FILE_SETUP: MACRO_PrinterSetup(); break;
1350  case MNID_FILE_EXIT: MACRO_Exit(); break;
1351 
1352  /* Menu EDIT */
1353  case MNID_EDIT_COPYDLG:
1354  SendDlgItemMessageW(hWnd, CTL_ID_TEXT, WM_COPY, 0, 0);
1355  break;
1356  case MNID_EDIT_ANNOTATE:MACRO_Annotate(); break;
1357 
1358  /* Menu Bookmark */
1359  case MNID_BKMK_DEFINE: MACRO_BookmarkDefine(); break;
1360 
1361  /* Menu Help */
1362  case MNID_HELP_HELPON: MACRO_HelpOn(); break;
1363  case MNID_HELP_HELPTOP: MACRO_HelpOnTop(); break;
1364  case MNID_HELP_ABOUT: MACRO_About(); break;
1365 
1366  /* Context help */
1367  case MNID_CTXT_ANNOTATE:MACRO_Annotate(); break;
1368  case MNID_CTXT_COPY: MACRO_CopyDialog(); break;
1369  case MNID_CTXT_PRINT: MACRO_Print(); break;
1370  case MNID_OPTS_HISTORY: MACRO_History(); break;
1371  case MNID_OPTS_FONTS_SMALL:
1372  case MNID_CTXT_FONTS_SMALL:
1373  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1374  if (win->font_scale != 0)
1375  {
1376  win->font_scale = 0;
1377  WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1378  }
1379  break;
1382  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1383  if (win->font_scale != 1)
1384  {
1385  win->font_scale = 1;
1386  WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1387  }
1388  break;
1389  case MNID_OPTS_FONTS_LARGE:
1390  case MNID_CTXT_FONTS_LARGE:
1391  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1392  if (win->font_scale != 2)
1393  {
1394  win->font_scale = 2;
1395  WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1396  }
1397  break;
1398 
1399  default:
1400  /* Buttons */
1401  for (button = win->first_button; button; button = button->next)
1402  if (wParam == button->wParam) break;
1403  if (button)
1404  MACRO_ExecuteMacro(win, button->lpszMacro);
1405  else if (!HIWORD(wParam))
1408  break;
1409  }
1410  break;
1411 /* EPP case WM_DESTROY: */
1412 /* EPP if (Globals.hPopupWnd) DestroyWindow(Globals.hPopupWnd); */
1413 /* EPP break; */
1414  case WM_COPYDATA:
1416 
1417  case WM_CHAR:
1418  if (wParam == 3)
1419  {
1420  SendDlgItemMessageW(hWnd, CTL_ID_TEXT, WM_COPY, 0, 0);
1421  return 0;
1422  }
1423  break;
1424 
1425  case WM_KEYDOWN:
1426  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1427  hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
1428 
1429  switch (wParam)
1430  {
1431  case VK_UP:
1432  SendMessageW(hTextWnd, EM_SCROLL, SB_LINEUP, 0);
1433  return 0;
1434  case VK_DOWN:
1435  SendMessageW(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
1436  return 0;
1437  case VK_PRIOR:
1438  SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
1439  return 0;
1440  case VK_NEXT:
1441  SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
1442  return 0;
1443  case VK_ESCAPE:
1444  MACRO_Exit();
1445  return 0;
1446  }
1447  break;
1448 
1449  case WM_NOTIFY:
1450  if (wParam == CTL_ID_TEXT)
1451  {
1452  RECT rc;
1453 
1454  switch (((NMHDR*)lParam)->code)
1455  {
1456  case EN_MSGFILTER:
1457  {
1458  const MSGFILTER* msgf = (const MSGFILTER*)lParam;
1459  switch (msgf->msg)
1460  {
1461  case WM_KEYUP:
1462  if (msgf->wParam == VK_ESCAPE)
1464  break;
1465  case WM_RBUTTONDOWN:
1466  {
1467  HMENU hMenu;
1468  POINT pt;
1469 
1470  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1472  switch (win->font_scale)
1473  {
1474  case 0:
1477  break;
1478  default:
1479  WINE_FIXME("Unsupported %d\n", win->font_scale);
1480  /* fall through */
1481  case 1:
1484  break;
1485  case 2:
1488  break;
1489  }
1490  pt.x = (int)(short)LOWORD(msgf->lParam);
1491  pt.y = (int)(short)HIWORD(msgf->lParam);
1492  ClientToScreen(msgf->nmhdr.hwndFrom, &pt);
1494  pt.x, pt.y, 0, hWnd, NULL);
1495  DestroyMenu(hMenu);
1496  }
1497  break;
1498  default:
1500  msgf->msg, msgf->lParam);
1501  }
1502  }
1503  break;
1504 
1505  case EN_REQUESTRESIZE:
1506  rc = ((REQRESIZE*)lParam)->rc;
1507  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1509  FALSE);
1510  SetWindowPos(win->hMainWnd, HWND_TOP, 0, 0,
1511  rc.right - rc.left, rc.bottom - rc.top,
1514  break;
1515  }
1516  }
1517  break;
1518 
1519  case WM_INITMENUPOPUP:
1520  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1522  (win->font_scale == 0) ? MF_CHECKED : MF_UNCHECKED);
1524  (win->font_scale == 1) ? MF_CHECKED : MF_UNCHECKED);
1526  (win->font_scale == 2) ? MF_CHECKED : MF_UNCHECKED);
1527  break;
1528  case WM_DESTROY:
1529  win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
1530  WINHELP_DeleteWindow(win);
1531  break;
1532  }
1533  return DefWindowProcA(hWnd, msg, wParam, lParam);
1534 }
void CALLBACK MACRO_HelpOnTop(void)
Definition: macro.c:489
WINHELP_BUTTON * first_button
Definition: winhelp.h:77
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_PAGEUP
Definition: winuser.h:568
#define MNID_EDIT_COPYDLG
Definition: winhelp_res.h:11
#define CTL_ID_TEXT
Definition: winhelp.c:51
#define MF_BYCOMMAND
Definition: winuser.h:202
long y
Definition: polytest.cpp:48
#define WM_CHAR
Definition: winuser.h:1693
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define MNID_FILE_OPEN
Definition: winhelp_res.h:6
#define MNID_OPTS_FONTS_SMALL
Definition: winhelp_res.h:17
#define MNID_FILE_PRINT
Definition: winhelp_res.h:7
long x
Definition: polytest.cpp:48
#define MNID_HELP_HELPON
Definition: winhelp_res.h:21
#define pt(x, y)
Definition: drawing.c:79
#define TPM_LEFTALIGN
Definition: winuser.h:2331
#define WM_INITMENUPOPUP
Definition: winuser.h:1722
HWND hWnd
Definition: settings.c:17
HANDLE hInstance
Definition: winhelp.h:133
LONG top
Definition: windef.h:297
#define MNID_CTXT_PRINT
Definition: winhelp_res.h:27
static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
Definition: winhelp.c:951
#define HWND_TOP
Definition: winuser.h:1193
#define VK_DOWN
Definition: winuser.h:2181
#define VK_PRIOR
Definition: winuser.h:2174
#define GetWindowLongPtrW
Definition: winuser.h:4698
LONG left
Definition: windef.h:296
#define SWP_NOZORDER
Definition: winuser.h:1232
WPARAM wParam
Definition: richedit.h:642
#define VK_ESCAPE
Definition: winuser.h:2168
#define STID_WHERROR
Definition: winhelp_res.h:37
LONG right
Definition: windef.h:298
#define WM_NCCREATE
Definition: winuser.h:1665
LPARAM lParam
Definition: richedit.h:643
WPARAM wParam
Definition: combotst.c:138
static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
Definition: winhelp.c:353
#define VK_NEXT
Definition: winuser.h:2175
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:524
#define VK_UP
Definition: winuser.h:2179
#define WM_COPY
Definition: winuser.h:1823
#define TPM_TOPALIGN
Definition: winuser.h:2337
#define MNID_FILE_SETUP
Definition: winhelp_res.h:8
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
#define MNID_CTXT_FONTS_NORMAL
Definition: winhelp_res.h:29
#define WM_KEYDOWN
Definition: winuser.h:1691
#define MNID_EDIT_ANNOTATE
Definition: winhelp_res.h:12
void CALLBACK MACRO_About(void)
Definition: macro.c:152
#define EN_MSGFILTER
Definition: richedit.h:191
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_RBUTTONDOWN
Definition: winuser.h:1755
#define MF_CHECKED
Definition: winuser.h:132
#define WM_COPYDATA
Definition: winuser.h:1646
void WINHELP_LayoutMainWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:434
struct tagHelpButton * next
Definition: winhelp.h:57
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EM_SCROLL
Definition: winuser.h:1968
void CALLBACK MACRO_Annotate(void)
Definition: macro.c:171
#define WM_KEYUP
Definition: winuser.h:1692
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MNID_CTXT_COPY
Definition: winhelp_res.h:26
#define MNID_CTXT_ANNOTATE
Definition: winhelp_res.h:25
#define MNID_OPTS_HISTORY
Definition: winhelp_res.h:16
#define MNID_OPTS_FONTS_NORMAL
Definition: winhelp_res.h:18
#define MNID_OPTS_FONTS_LARGE
Definition: winhelp_res.h:19
int ret
BOOL MACRO_ExecuteMacro(struct tagWinHelp *, LPCSTR)
void CALLBACK MACRO_Print(void)
Definition: macro.c:715
LPCSTR lpszMacro
Definition: winhelp.h:51
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwndFrom
Definition: winuser.h:3110
UINT msg
Definition: richedit.h:641
#define MF_UNCHECKED
Definition: winuser.h:204
#define STID_NOT_IMPLEMENTED
Definition: winhelp_res.h:40
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MNID_BKMK_DEFINE
Definition: winhelp_res.h:14
void CALLBACK MACRO_FileOpen(void)
Definition: macro.c:421
#define GWL_STYLE
Definition: winuser.h:846
#define MNID_FILE_EXIT
Definition: winhelp_res.h:9
void CALLBACK MACRO_PrinterSetup(void)
Definition: macro.c:746
static real win[4][36]
#define MNID_HELP_HELPTOP
Definition: winhelp_res.h:22
HWND hMainWnd
Definition: winhelp.h:80
void CALLBACK MACRO_BookmarkDefine(void)
Definition: macro.c:200
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MNID_CTXT_FONTS_LARGE
Definition: winhelp_res.h:30
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_LINEUP
Definition: winuser.h:564
static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW *win, UINT msg, LPARAM lParam)
Definition: winhelp.c:895
#define MB_OK
Definition: winuser.h:784
void CALLBACK MACRO_CopyDialog(void)
Definition: macro.c:336
void CALLBACK MACRO_HelpOn(void)
Definition: macro.c:474
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define HIWORD(l)
Definition: typedefs.h:246
#define CONTEXT_MENU
Definition: winhelp_res.h:33
#define MNID_CTXT_FONTS_SMALL
Definition: winhelp_res.h:28
LONG bottom
Definition: windef.h:299
WPARAM wParam
Definition: winhelp.h:53
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5215
void CALLBACK MACRO_Exit(void)
Definition: macro.c:392
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define EN_REQUESTRESIZE
Definition: richedit.h:192
HLPFILE_PAGE * page
Definition: winhelp.h:78
LONG_PTR LRESULT
Definition: windef.h:209
void CALLBACK MACRO_History(void)
Definition: macro.c:516
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW *win, ULONG relative)
Definition: winhelp.c:104
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define LOWORD(l)
Definition: pedump.c:82
#define MNID_HELP_ABOUT
Definition: winhelp_res.h:23
unsigned font_scale
Definition: winhelp.h:95
#define WM_NOTIFY
Definition: richedit.h:61
static void WINHELP_DeleteWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:540
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29
#define WINE_FIXME
Definition: debug.h:365
NMHDR nmhdr
Definition: richedit.h:640

◆ WINHELP_MessageBoxIDS_s()

static INT WINHELP_MessageBoxIDS_s ( UINT  ids_text,
LPCSTR  str,
UINT  ids_title,
WORD  type 
)
static

Definition at line 197 of file winhelp.c.

Referenced by WINHELP_LookupHelpFile().

198 {
200  CHAR newtext[MAX_STRING_LEN + MAX_PATH];
201 
202  LoadStringA(Globals.hInstance, ids_text, text, sizeof(text));
203  wsprintfA(newtext, text, str);
204 
205  return MessageBoxA(0, newtext, MAKEINTRESOURCEA(ids_title), type);
206 }
const WCHAR * text
Definition: package.c:1827
char CHAR
Definition: xmlstorage.h:175
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
HANDLE hInstance
Definition: winhelp.h:133
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define MAX_STRING_LEN
Definition: precomp.h:36
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
const WCHAR * str
#define MAX_PATH
Definition: compat.h:26
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
WINHELP_GLOBALS Globals
Definition: winhelp.c:48

◆ WINHELP_OpenHelpWindow()

BOOL WINHELP_OpenHelpWindow ( HLPFILE_PAGE *(*)(HLPFILE *, LONG, ULONG *)  lookup,
HLPFILE hlpfile,
LONG  val,
HLPFILE_WINDOWINFO wi,
int  nCmdShow 
)

Definition at line 879 of file winhelp.c.

Referenced by MACRO_JumpContents(), MACRO_JumpContext(), MACRO_JumpHash(), WINHELP_CreateIndexWindow(), WINHELP_HandleTextMouse(), and WinMain().

882 {
883  WINHELP_WNDPAGE wpage;
884 
885  wpage.page = lookup(hlpfile, val, &wpage.relative);
886  if (wpage.page) wpage.page->file->wRefCount++;
887  wpage.wininfo = wi;
888  return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
889 }
#define TRUE
Definition: types.h:120
struct tagHlpFileFile * file
Definition: hlpfile.h:84
static ULONG lookup[16]
Definition: vga.c:46
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE *wpage, int nCmdShow, BOOL remember)
Definition: winhelp.c:698
GLuint GLfloat * val
Definition: glext.h:7180
HLPFILE_PAGE * page
Definition: winhelp.h:62
ULONG relative
Definition: winhelp.h:64
HLPFILE_WINDOWINFO * wininfo
Definition: winhelp.h:63

◆ WINHELP_RegisterWinClasses()

static BOOL WINHELP_RegisterWinClasses ( void  )
static

Definition at line 1606 of file winhelp.c.

Referenced by WinMain().

1607 {
1608  WNDCLASSEXA class_main, class_button_box, class_history;
1609 
1610  class_main.cbSize = sizeof(class_main);
1611  class_main.style = CS_HREDRAW | CS_VREDRAW;
1612  class_main.lpfnWndProc = WINHELP_MainWndProc;
1613  class_main.cbClsExtra = 0;
1614  class_main.cbWndExtra = sizeof(WINHELP_WINDOW *);
1615  class_main.hInstance = Globals.hInstance;
1617  class_main.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
1618  class_main.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
1619  class_main.lpszMenuName = 0;
1620  class_main.lpszClassName = MAIN_WIN_CLASS_NAME;
1623  LR_SHARED);
1624 
1625  class_button_box = class_main;
1626  class_button_box.lpfnWndProc = WINHELP_ButtonBoxWndProc;
1627  class_button_box.cbWndExtra = 0;
1628  class_button_box.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
1629  class_button_box.lpszClassName = BUTTON_BOX_WIN_CLASS_NAME;
1630 
1631  class_history = class_main;
1632  class_history.lpfnWndProc = WINHELP_HistoryWndProc;
1633  class_history.lpszClassName = HISTORY_WIN_CLASS_NAME;
1634 
1635  return (RegisterClassExA(&class_main) &&
1636  RegisterClassExA(&class_button_box) &&
1637  RegisterClassExA(&class_history));
1638 }
UINT style
Definition: winuser.h:3155
LPCSTR lpszMenuName
Definition: winuser.h:3163
#define LR_SHARED
Definition: winuser.h:1090
#define IMAGE_ICON
Definition: winuser.h:212
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
LPCSTR lpszClassName
Definition: winuser.h:3164
HANDLE hInstance
Definition: winhelp.h:133
#define CS_HREDRAW
Definition: winuser.h:648
#define SM_CYSMICON
Definition: winuser.h:1003
HICON hIconSm
Definition: winuser.h:3165
#define COLOR_WINDOW
Definition: winuser.h:908
HINSTANCE hInstance
Definition: winuser.h:3159
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1117
UINT cbSize
Definition: winuser.h:3154
#define IDI_WINHELP
Definition: winhelp_res.h:56
HBRUSH hbrBackground
Definition: winuser.h:3162
const char MAIN_WIN_CLASS_NAME[]
Definition: string.c:23
#define CS_VREDRAW
Definition: winuser.h:653
int WINAPI GetSystemMetrics(_In_ int)
int cbWndExtra
Definition: winuser.h:3158
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
const char HISTORY_WIN_CLASS_NAME[]
Definition: string.c:25
#define SM_CXSMICON
Definition: winuser.h:1002
HICON hIcon
Definition: winuser.h:3160
static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1319
#define COLOR_BTNFACE
Definition: winuser.h:918
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
int cbClsExtra
Definition: winuser.h:3157
#define IDC_ARROW
Definition: winuser.h:682
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const char BUTTON_BOX_WIN_CLASS_NAME[]
Definition: string.c:24
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1023

◆ WINHELP_ReleaseWindow()

BOOL WINHELP_ReleaseWindow ( WINHELP_WINDOW win)

Definition at line 524 of file winhelp.c.

Referenced by MACRO_CloseSecondarys(), MACRO_CloseWindow(), MACRO_ExecuteMacro(), MACRO_Exit(), WINHELP_CheckPopup(), WINHELP_CreateHelpWindow(), and WINHELP_MainWndProc().

525 {
526  WINE_TRACE("Release %p#%d--\n", win, win->ref_count);
527 
528  if (!--win->ref_count)
529  {
530  DestroyWindow(win->hMainWnd);
531  return FALSE;
532  }
533  return TRUE;
534 }
#define TRUE
Definition: types.h:120
#define WINE_TRACE
Definition: debug.h:353
BOOL WINAPI DestroyWindow(_In_ HWND)
unsigned ref_count
Definition: winhelp.h:76
HWND hMainWnd
Definition: winhelp.h:80

◆ WINHELP_RememberPage()

static void WINHELP_RememberPage ( WINHELP_WINDOW win,
WINHELP_WNDPAGE wpage 
)
static

Definition at line 592 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow().

593 {
594  unsigned num;
595 
596  if (!Globals.history.index || Globals.history.set[0].page != wpage->page)
597  {
598  num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]);
599  /* we're full, remove latest entry */
600  if (Globals.history.index == num)
601  {
604  }
606  Globals.history.index * sizeof(Globals.history.set[0]));
607  Globals.history.set[0] = *wpage;
609  wpage->page->file->wRefCount++;
610  }
611  if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
612 
613  num = sizeof(win->back.set) / sizeof(win->back.set[0]);
614  if (win->back.index == num)
615  {
616  /* we're full, remove latest entry */
618  memmove(&win->back.set[0], &win->back.set[1],
619  (num - 1) * sizeof(win->back.set[0]));
620  win->back.index--;
621  }
622  win->back.set[win->back.index++] = *wpage;
623  wpage->page->file->wRefCount++;
624 }
WINHELP_WNDPAGE set[40]
Definition: winhelp.h:70
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
WINHELP_PAGESET history
Definition: winhelp.h:140
struct tagHlpFileFile * file
Definition: hlpfile.h:84
void HLPFILE_FreeHlpFile(HLPFILE *hlpfile)
Definition: hlpfile.c:2297
smooth NULL
Definition: ftsmooth.c:416
unsigned index
Definition: winhelp.h:71
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
GLuint GLuint num
Definition: glext.h:9618
HLPFILE_PAGE * page
Definition: winhelp.h:62
HWND hHistoryWnd
Definition: winhelp.h:81
WINHELP_PAGESET back
Definition: winhelp.h:94
WINHELP_GLOBALS Globals
Definition: winhelp.c:48

◆ WINHELP_RicheditWndProc()

static LRESULT CALLBACK WINHELP_RicheditWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 670 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow().

672 {
674  DWORD messagePos;
675  POINT pt;
676  switch(msg)
677  {
678  case WM_SETCURSOR:
679  messagePos = GetMessagePos();
680  pt.x = (short)LOWORD(messagePos);
681  pt.y = (short)HIWORD(messagePos);
682  ScreenToClient(hWnd, &pt);
683  if (win->page && WINHELP_FindLink(win, MAKELPARAM(pt.x, pt.y)))
684  {
685  SetCursor(win->hHandCur);
686  return 0;
687  }
688  /* fall through */
689  default:
690  return CallWindowProcA(win->origRicheditWndProc, hWnd, msg, wParam, lParam);
691  }
692 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define pt(x, y)
Definition: drawing.c:79
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1326
#define GetWindowLongPtrW
Definition: winuser.h:4698
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:91
static HLPFILE_LINK * WINHELP_FindLink(WINHELP_WINDOW *win, LPARAM pos)
Definition: winhelp.c:630
#define WM_SETCURSOR
Definition: winuser.h:1618
UINT msg
Definition: msvc.h:92
unsigned long DWORD
Definition: ntddk_ex.h:95
WNDPROC origRicheditWndProc
Definition: winhelp.h:83
HWND WINAPI GetParent(_In_ HWND)
HCURSOR hHandCur
Definition: winhelp.h:88
static real win[4][36]
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define HIWORD(l)
Definition: typedefs.h:246
HLPFILE_PAGE * page
Definition: winhelp.h:78
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ WINHELP_RtfStreamIn()

static DWORD CALLBACK WINHELP_RtfStreamIn ( DWORD_PTR  cookie,
BYTE buff,
LONG  cb,
LONG pcb 
)
static

Definition at line 90 of file winhelp.c.

Referenced by WINHELP_SetupText().

92 {
93  struct RtfData* rd = (struct RtfData*)cookie;
94 
95  if (rd->where >= rd->ptr) return 1;
96  if (rd->where + cb > rd->ptr)
97  cb = rd->ptr - rd->where;
98  memcpy(buff, rd->where, cb);
99  rd->where += cb;
100  *pcb = cb;
101  return 0;
102 }
int rd
Definition: scanf.h:134
char * where
Definition: hlpfile.h:196
static DWORD cb
Definition: integrity.c:41
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char * ptr
Definition: hlpfile.h:193
static unsigned char buff[32768]
Definition: fatten.c:17

◆ WINHELP_SearchDlgProc()

static INT_PTR CALLBACK WINHELP_SearchDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1293 of file winhelp.c.

Referenced by WINHELP_CreateIndexWindow().

1294 {
1295  switch (msg)
1296  {
1297  case WM_INITDIALOG:
1298  return TRUE;
1299  case WM_NOTIFY:
1300  switch (((NMHDR*)lParam)->code)
1301  {
1302  case PSN_APPLY:
1304  return TRUE;
1305  default:
1306  return FALSE;
1307  }
1308  break;
1309  default:
1310  break;
1311  }
1312  return FALSE;
1313 }
#define TRUE
Definition: types.h:120
#define PSN_APPLY
Definition: prsht.h:117
#define DWLP_MSGRESULT
Definition: winuser.h:864
UINT msg
Definition: msvc.h:92
#define PSNRET_NOERROR
Definition: prsht.h:129
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

◆ WINHELP_SetupText()

static void WINHELP_SetupText ( HWND  hTextWnd,
WINHELP_WINDOW win,
ULONG  relative 
)
static

Definition at line 104 of file winhelp.c.

Referenced by WINHELP_CreateHelpWindow(), and WINHELP_MainWndProc().

105 {
106  static const WCHAR emptyW[1];
107  /* At first clear area - needed by EM_POSFROMCHAR/EM_SETSCROLLPOS */
108  SendMessageW(hTextWnd, WM_SETTEXT, 0, (LPARAM)emptyW);
109  SendMessageW(hTextWnd, WM_SETREDRAW, FALSE, 0);
110  SendMessageW(hTextWnd, EM_SETBKGNDCOLOR, 0, (LPARAM)win->info->sr_color);
111  /* set word-wrap to window size (undocumented) */
112  SendMessageW(hTextWnd, EM_SETTARGETDEVICE, 0, 0);
113  if (win->page)
114  {
115  struct RtfData rd;
116  EDITSTREAM es;
117  unsigned cp = 0;
118  POINTL ptl;
119  POINT pt;
120 
121 
122  if (HLPFILE_BrowsePage(win->page, &rd, win->font_scale, relative))
123  {
124  rd.where = rd.data;
125  es.dwCookie = (DWORD_PTR)&rd;
126  es.dwError = 0;
127  es.pfnCallback = WINHELP_RtfStreamIn;
128 
129  SendMessageW(hTextWnd, EM_STREAMIN, SF_RTF, (LPARAM)&es);
130  cp = rd.char_pos_rel;
131  }
132  /* FIXME: else leaking potentially the rd.first_link chain */
133  HeapFree(GetProcessHeap(), 0, rd.data);
134  SendMessageW(hTextWnd, EM_POSFROMCHAR, (WPARAM)&ptl, cp ? cp - 1 : 0);
135  pt.x = 0; pt.y = ptl.y;
136  SendMessageW(hTextWnd, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
137  }
138  SendMessageW(hTextWnd, WM_SETREDRAW, TRUE, 0);
140 }
int rd
Definition: scanf.h:134
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
#define DWORD_PTR
Definition: treelist.c:76
long x
Definition: polytest.cpp:48
#define SF_RTF
Definition: richedit.h:721
#define pt(x, y)
Definition: drawing.c:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SETREDRAW
Definition: winuser.h:1598
#define RDW_FRAME
Definition: winuser.h:1198
LONG y
Definition: windef.h:320
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_POSFROMCHAR
Definition: richedit.h:77
unsigned relative
Definition: hlpfile.h:201
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
static DWORD CALLBACK WINHELP_RtfStreamIn(DWORD_PTR cookie, BYTE *buff, LONG cb, LONG *pcb)
Definition: winhelp.c:90
#define WM_SETTEXT
Definition: winuser.h:1599
#define EM_STREAMIN
Definition: richedit.h:106
#define EM_SETTARGETDEVICE
Definition: richedit.h:105
#define GetProcessHeap()
Definition: compat.h:395
COLORREF sr_color
Definition: hlpfile.h:36
BOOL HLPFILE_BrowsePage(HLPFILE_PAGE *page, struct RtfData *rd, unsigned font_scale, unsigned relative)
Definition: hlpfile.c:1703
#define EM_SETSCROLLPOS
Definition: richedit.h:166
static const WCHAR emptyW[]
Definition: navigate.c:36
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
POINT cp
Definition: magnifier.c:60
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
HLPFILE_PAGE * page
Definition: winhelp.h:78
#define es
Definition: i386-dis.c:431
#define HeapFree(x, y, z)
Definition: compat.h:394
unsigned font_scale
Definition: winhelp.h:95
#define RDW_INVALIDATE
Definition: winuser.h:1200

◆ WinMain()

int PASCAL WinMain ( HINSTANCE  hInstance,
HINSTANCE  prev,
LPSTR  cmdline,
int  show 
)

Definition at line 1644 of file winhelp.c.

1645 {
1646  MSG msg;
1647  LONG lHash = 0;
1648  HLPFILE* hlpfile;
1649  static CHAR default_wndname[] = "main";
1650  LPSTR wndname = default_wndname;
1651  WINHELP_DLL* dll;
1652  HACCEL hAccel;
1653 
1655 
1656  if (LoadLibraryA("riched20.dll") == NULL)
1659 
1660  /* Get options */
1661  while (*cmdline && (*cmdline == ' ' || *cmdline == '-'))
1662  {
1663  CHAR option;
1664  LPCSTR topic_id;
1665  if (*cmdline++ == ' ') continue;
1666 
1667  option = *cmdline;
1668  if (option) cmdline++;
1669  while (*cmdline == ' ') cmdline++;
1670  switch (option)
1671  {
1672  case 'i':
1673  case 'I':
1674  topic_id = cmdline;
1675  while (*cmdline && *cmdline != ' ') cmdline++;
1676  if (*cmdline) *cmdline++ = '\0';
1677  lHash = HLPFILE_Hash(topic_id);
1678  break;
1679 
1680  case '3':
1681  case '4':
1682  Globals.wVersion = option - '0';
1683  break;
1684 
1685  case 'x':
1686  show = SW_HIDE;
1687  Globals.isBook = FALSE;
1688  break;
1689 
1690  default:
1691  WINE_FIXME("Unsupported cmd line: %s\n", debugstr_a(cmdline));
1692  break;
1693  }
1694  }
1695 
1696  /* Create primary window */
1698  {
1699  WINE_FIXME("Couldn't register classes\n");
1700  return 0;
1701  }
1702 
1703  if (*cmdline)
1704  {
1705  char* ptr;
1706  if ((*cmdline == '"') && (ptr = strchr(cmdline+1, '"')))
1707  {
1708  cmdline++;
1709  *ptr = '\0';
1710  }
1711  if ((ptr = strchr(cmdline, '>')))
1712  {
1713  *ptr = '\0';
1714  wndname = ptr + 1;
1715  }
1716  hlpfile = WINHELP_LookupHelpFile(cmdline);
1717  if (!hlpfile) return 0;
1718  }
1719  else hlpfile = NULL;
1721  WINHELP_GetWindowInfo(hlpfile, wndname), show);
1722 
1723  /* Message loop */
1724  hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(MAIN_ACCEL));
1725  while ((Globals.win_list || Globals.active_popup) && GetMessageW(&msg, 0, 0, 0))
1726  {
1728  if (!TranslateAcceleratorW(hWnd, hAccel, &msg))
1729  {
1730  TranslateMessage(&msg);
1731  DispatchMessageW(&msg);
1732  }
1733  }
1734  for (dll = Globals.dlls; dll; dll = dll->next)
1735  {
1736  if (dll->class & DC_INITTERM) dll->handler(DW_TERM, 0, 0);
1737  }
1738  return 0;
1739 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define STID_NO_RICHEDIT
Definition: winhelp_res.h:49
#define SW_HIDE
Definition: winuser.h:762
char CHAR
Definition: xmlstorage.h:175
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static BOOL WINHELP_RegisterWinClasses(void)
Definition: winhelp.c:1606
HWND hWnd
Definition: settings.c:17
HANDLE hInstance
Definition: winhelp.h:133
TCHAR * cmdline
Definition: stretchblt.cpp:32
WINHELP_DLL * dlls
Definition: winhelp.h:139
#define DC_INITTERM
Definition: winhelp.h:102
char * LPSTR
Definition: xmlstorage.h:182
DWORD class
Definition: winhelp.h:126
WINHELP_WINDOW * active_popup
Definition: winhelp.h:136
#define STID_WHERROR
Definition: winhelp_res.h:37
static HMODULE dll
Definition: str.c:188
HINSTANCE hInstance
Definition: charmap.c:20
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
HACCEL hAccel
Definition: main.c:47
long LONG
Definition: pedump.c:60
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static PVOID ptr
Definition: dispmode.c:27
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
WINHELP_WINDOW * win_list
Definition: winhelp.h:137
smooth NULL
Definition: ftsmooth.c:416
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE *(*lookup)(HLPFILE *, LONG, ULONG *), HLPFILE *hlpfile, LONG val, HLPFILE_WINDOWINFO *wi, int nCmdShow)
Definition: winhelp.c:879
#define MAIN_ACCEL
Definition: winhelp_res.h:34
const char * LPCSTR
Definition: xmlstorage.h:183
GLuint GLenum option
Definition: glext.h:11211
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define debugstr_a
Definition: kernel32.h:31
#define DW_TERM
Definition: winhelp.h:112
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
HLPFILE * WINHELP_LookupHelpFile(LPCSTR lpszFile)
Definition: winhelp.c:212
HWND hMainWnd
Definition: winhelp.h:80
WINHELP_LDLLHandler handler
Definition: winhelp.h:125
#define MB_OK
Definition: winuser.h:784
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
LONG HLPFILE_Hash(LPCSTR lpszContext)
Definition: hlpfile.c:547
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define msg(x)
Definition: auth_time.c:54
HLPFILE_PAGE * HLPFILE_PageByHash(HLPFILE *hlpfile, LONG lHash, ULONG *relative)
Definition: hlpfile.c:437
HLPFILE_WINDOWINFO * WINHELP_GetWindowInfo(HLPFILE *hlpfile, LPCSTR name)
Definition: winhelp.c:254
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
struct tagDll * next
Definition: winhelp.h:127
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
#define WINE_FIXME
Definition: debug.h:365

Variable Documentation

◆ Globals

WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}, NULL}

Definition at line 48 of file winhelp.c.