Commit 97bcef99 authored by Erich Hoover's avatar Erich Hoover Committed by Alexandre Julliard

hhctrl.ocx: Implement HH_CLOSE_ALL.

parent 5a45e347
...@@ -138,7 +138,8 @@ static BOOL ReadChmSystem(CHMInfo *chm) ...@@ -138,7 +138,8 @@ static BOOL ReadChmSystem(CHMInfo *chm)
chm->codePage = CP_ACP; chm->codePage = CP_ACP;
break; break;
case 0x5: case 0x5:
TRACE("Default window is %s\n", debugstr_an(buf, entry.len)); TRACE("Window name is %s\n", debugstr_an(buf, entry.len));
chm->defWindow = strdupnAtoW(buf, entry.len);
break; break;
case 0x6: case 0x6:
TRACE("Compiled file is %s\n", debugstr_an(buf, entry.len)); TRACE("Compiled file is %s\n", debugstr_an(buf, entry.len));
...@@ -268,7 +269,7 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) ...@@ -268,7 +269,7 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
memset((void*)&(info->WinType), 0, sizeof(info->WinType)); memset((void*)&(info->WinType), 0, sizeof(info->WinType));
info->WinType.cbStruct=sizeof(info->WinType); info->WinType.cbStruct=sizeof(info->WinType);
info->WinType.fUniCodeStrings=TRUE; info->WinType.fUniCodeStrings=TRUE;
info->WinType.pszType=strdupW(defaultwinW); info->WinType.pszType = strdupW(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
info->WinType.pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : null); info->WinType.pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : null);
info->WinType.pszIndex = strdupW(null); info->WinType.pszIndex = strdupW(null);
info->WinType.fsValidMembers=0; info->WinType.fsValidMembers=0;
...@@ -530,6 +531,7 @@ CHMInfo *CloseCHM(CHMInfo *chm) ...@@ -530,6 +531,7 @@ CHMInfo *CloseCHM(CHMInfo *chm)
} }
heap_free(chm->strings); heap_free(chm->strings);
heap_free(chm->defWindow);
heap_free(chm->defTitle); heap_free(chm->defTitle);
heap_free(chm->defTopic); heap_free(chm->defTopic);
heap_free(chm->defToc); heap_free(chm->defToc);
......
...@@ -48,6 +48,8 @@ static void ExpandContract(HHInfo *pHHInfo); ...@@ -48,6 +48,8 @@ static void ExpandContract(HHInfo *pHHInfo);
#define TAB_MARGIN 8 #define TAB_MARGIN 8
#define EDIT_HEIGHT 20 #define EDIT_HEIGHT 20
struct list window_list = LIST_INIT(window_list);
static const WCHAR szEmpty[] = {0}; static const WCHAR szEmpty[] = {0};
struct html_encoded_symbol { struct html_encoded_symbol {
...@@ -1740,6 +1742,8 @@ void ReleaseHelpViewer(HHInfo *info) ...@@ -1740,6 +1742,8 @@ void ReleaseHelpViewer(HHInfo *info)
if (!info) if (!info)
return; return;
list_remove(&info->entry);
/* Free allocated strings */ /* Free allocated strings */
heap_free(info->pszType); heap_free(info->pszType);
heap_free(info->pszCaption); heap_free(info->pszCaption);
...@@ -1798,6 +1802,7 @@ HHInfo *CreateHelpViewer(LPCWSTR filename) ...@@ -1798,6 +1802,7 @@ HHInfo *CreateHelpViewer(LPCWSTR filename)
return NULL; return NULL;
} }
list_add_tail(&window_list, &info->entry);
return info; return info;
} }
......
...@@ -41,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp); ...@@ -41,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
HINSTANCE hhctrl_hinstance; HINSTANCE hhctrl_hinstance;
BOOL hh_process = FALSE; BOOL hh_process = FALSE;
extern struct list window_list;
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
{ {
TRACE("(%p,%d,%p)\n", hInstance, fdwReason, lpvReserved); TRACE("(%p,%d,%p)\n", hInstance, fdwReason, lpvReserved);
...@@ -98,7 +100,7 @@ static const char *command_to_string(UINT command) ...@@ -98,7 +100,7 @@ static const char *command_to_string(UINT command)
#undef X #undef X
} }
static BOOL resolve_filename(const WCHAR *filename, WCHAR *fullname, DWORD buflen, const WCHAR **index, const WCHAR **window) static BOOL resolve_filename(const WCHAR *filename, WCHAR *fullname, DWORD buflen, WCHAR **index, WCHAR **window)
{ {
const WCHAR *extra; const WCHAR *extra;
WCHAR chm_file[MAX_PATH]; WCHAR chm_file[MAX_PATH];
...@@ -164,14 +166,15 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -164,14 +166,15 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
HHInfo *info; HHInfo *info;
BOOL res; BOOL res;
NMHDR nmhdr; NMHDR nmhdr;
WCHAR *window = NULL;
const WCHAR *index = NULL; const WCHAR *index = NULL;
WCHAR *default_index = NULL;
int tab_index = TAB_CONTENTS; int tab_index = TAB_CONTENTS;
const WCHAR *default_index = NULL;
if (!filename) if (!filename)
return NULL; return NULL;
if (!resolve_filename(filename, fullname, MAX_PATH, &default_index, NULL)) if (!resolve_filename(filename, fullname, MAX_PATH, &default_index, &window))
{ {
WARN("can't find %s\n", debugstr_w(filename)); WARN("can't find %s\n", debugstr_w(filename));
return 0; return 0;
...@@ -180,10 +183,18 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -180,10 +183,18 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
info = CreateHelpViewer(fullname); info = CreateHelpViewer(fullname);
if(!info) if(!info)
{
heap_free(default_index);
heap_free(window);
return NULL; return NULL;
}
if(!index) if(!index)
index = info->WinType.pszFile; index = info->WinType.pszFile;
if(!info->pszType)
info->WinType.pszType = info->pszType = window;
else
heap_free(window);
/* called to load a specified topic */ /* called to load a specified topic */
switch(command) switch(command)
...@@ -196,9 +207,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -196,9 +207,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
} }
res = NavigateToChm(info, info->pCHMInfo->szFile, index); res = NavigateToChm(info, info->pCHMInfo->szFile, index);
heap_free(default_index);
if (default_index)
heap_free((WCHAR*)default_index);
if(!res) if(!res)
{ {
...@@ -269,6 +278,16 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat ...@@ -269,6 +278,16 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
} }
return 0; return 0;
} }
case HH_CLOSE_ALL: {
HHInfo *info, *next;
LIST_FOR_EACH_ENTRY_SAFE(info, next, &window_list, HHInfo, entry)
{
TRACE("Destroying window %s.\n", debugstr_w(info->WinType.pszType));
ReleaseHelpViewer(info);
}
return 0;
}
default: default:
FIXME("HH case %s not handled.\n", command_to_string( command )); FIXME("HH case %s not handled.\n", command_to_string( command ));
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "wine/itss.h" #include "wine/itss.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/list.h"
#define WB_GOBACK 0 #define WB_GOBACK 0
#define WB_GOFORWARD 1 #define WB_GOFORWARD 1
...@@ -103,6 +104,7 @@ typedef struct CHMInfo ...@@ -103,6 +104,7 @@ typedef struct CHMInfo
DWORD strings_size; DWORD strings_size;
WCHAR *compiledFile; WCHAR *compiledFile;
WCHAR *defWindow;
WCHAR *defTopic; WCHAR *defTopic;
WCHAR *defTitle; WCHAR *defTitle;
WCHAR *defToc; WCHAR *defToc;
...@@ -157,6 +159,7 @@ typedef struct { ...@@ -157,6 +159,7 @@ typedef struct {
LPWSTR pszUrlJump2; LPWSTR pszUrlJump2;
LPWSTR pszCustomTabs; LPWSTR pszCustomTabs;
struct list entry;
CHMInfo *pCHMInfo; CHMInfo *pCHMInfo;
ContentItem *content; ContentItem *content;
IndexItem *index; IndexItem *index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment