Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
24c13b9f
Commit
24c13b9f
authored
Feb 28, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 28, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl.ocx: Merge WBInfo to HHInfo.
parent
5a01e102
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
70 deletions
+51
-70
help.c
dlls/hhctrl.ocx/help.c
+13
-29
hhctrl.h
dlls/hhctrl.ocx/hhctrl.h
+16
-12
webbrowser.c
dlls/hhctrl.ocx/webbrowser.c
+22
-29
No files found.
dlls/hhctrl.ocx/help.c
View file @
24c13b9f
...
...
@@ -43,16 +43,6 @@ static void Help_OnSize(HWND hWnd);
static
const
WCHAR
szEmpty
[]
=
{
0
};
typedef
struct
tagHHInfo
{
HH_WINTYPEW
WinType
;
CHMInfo
*
pCHMInfo
;
WBInfo
*
pWBInfo
;
HWND
hwndTabCtrl
;
HWND
hwndSizeBar
;
HFONT
hFont
;
}
HHInfo
;
/* Loads a string from the resource file */
static
LPWSTR
HH_LoadString
(
DWORD
dwID
)
{
...
...
@@ -68,7 +58,7 @@ static LPWSTR HH_LoadString(DWORD dwID)
return
string
;
}
static
BOOL
NavigateToChm
(
WBInfo
*
pWBI
nfo
,
LPCWSTR
file
,
LPCWSTR
index
)
static
BOOL
NavigateToChm
(
HHInfo
*
i
nfo
,
LPCWSTR
file
,
LPCWSTR
index
)
{
WCHAR
buf
[
INTERNET_MAX_URL_LENGTH
];
WCHAR
full_path
[
MAX_PATH
];
...
...
@@ -77,7 +67,7 @@ static BOOL NavigateToChm(WBInfo *pWBInfo, LPCWSTR file, LPCWSTR index)
static
const
WCHAR
url_format
[]
=
{
'm'
,
'k'
,
':'
,
'@'
,
'M'
,
'S'
,
'I'
,
'T'
,
'S'
,
't'
,
'o'
,
'r'
,
'e'
,
':'
,
'%'
,
's'
,
':'
,
':'
,
'/'
,
'%'
,
's'
,
0
};
if
(
!
pWBInfo
->
pWebBrowser2
)
if
(
!
info
->
web_browser
)
return
FALSE
;
if
(
!
GetFullPathNameW
(
file
,
sizeof
(
full_path
),
full_path
,
NULL
))
{
...
...
@@ -90,7 +80,7 @@ static BOOL NavigateToChm(WBInfo *pWBInfo, LPCWSTR file, LPCWSTR index)
V_VT
(
&
url
)
=
VT_BSTR
;
V_BSTR
(
&
url
)
=
SysAllocString
(
buf
);
IWebBrowser2_Navigate2
(
pWBInfo
->
pWebBrowser2
,
&
url
,
0
,
0
,
0
,
0
);
IWebBrowser2_Navigate2
(
info
->
web_browser
,
&
url
,
0
,
0
,
0
,
0
);
VariantClear
(
&
url
);
return
TRUE
;
...
...
@@ -316,24 +306,24 @@ static void HH_RegisterChildWndClass(HHInfo *pHHInfo)
static
void
TB_OnClick
(
HWND
hWnd
,
DWORD
dwID
)
{
HHInfo
*
pHHI
nfo
=
(
HHInfo
*
)
GetWindowLongPtrW
(
hWnd
,
GWLP_USERDATA
);
HHInfo
*
i
nfo
=
(
HHInfo
*
)
GetWindowLongPtrW
(
hWnd
,
GWLP_USERDATA
);
switch
(
dwID
)
{
case
IDTB_STOP
:
WB_DoPageAction
(
pHHInfo
->
pWBI
nfo
,
WB_STOP
);
DoPageAction
(
i
nfo
,
WB_STOP
);
break
;
case
IDTB_REFRESH
:
WB_DoPageAction
(
pHHInfo
->
pWBI
nfo
,
WB_REFRESH
);
DoPageAction
(
i
nfo
,
WB_REFRESH
);
break
;
case
IDTB_BACK
:
WB_DoPageAction
(
pHHInfo
->
pWBI
nfo
,
WB_GOBACK
);
DoPageAction
(
i
nfo
,
WB_GOBACK
);
break
;
case
IDTB_HOME
:
NavigateToChm
(
pHHInfo
->
pWBInfo
,
pHHInfo
->
pCHMInfo
->
szFile
,
pHHI
nfo
->
WinType
.
pszHome
);
NavigateToChm
(
info
,
info
->
pCHMInfo
->
szFile
,
i
nfo
->
WinType
.
pszHome
);
break
;
case
IDTB_FORWARD
:
WB_DoPageAction
(
pHHInfo
->
pWBI
nfo
,
WB_GOFORWARD
);
DoPageAction
(
i
nfo
,
WB_GOFORWARD
);
break
;
case
IDTB_EXPAND
:
case
IDTB_CONTRACT
:
...
...
@@ -580,7 +570,7 @@ static BOOL HH_AddHTMLPane(HHInfo *pHHInfo)
if
(
!
hWnd
)
return
FALSE
;
if
(
!
WB_EmbedBrowser
(
pHHInfo
->
pWB
Info
,
hWnd
))
if
(
!
InitWebBrowser
(
pHH
Info
,
hWnd
))
return
FALSE
;
/* store the pointer to the HH info struct */
...
...
@@ -623,7 +613,7 @@ static void Help_OnSize(HWND hWnd)
/* Resize browser window taking the frame size into account */
dwSize
=
GetSystemMetrics
(
SM_CXFRAME
);
WB_ResizeBrowser
(
pHHInfo
->
pWB
Info
,
rc
.
right
-
dwSize
,
rc
.
bottom
-
dwSize
);
ResizeWebBrowser
(
pHH
Info
,
rc
.
right
-
dwSize
,
rc
.
bottom
-
dwSize
);
}
static
LRESULT
CALLBACK
Help_WndProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
...
...
@@ -795,11 +785,7 @@ static void HH_Close(HHInfo *info)
if
(
info
->
pCHMInfo
)
CloseCHM
(
info
->
pCHMInfo
);
if
(
info
->
pWBInfo
)
{
WB_UnEmbedBrowser
(
info
->
pWBInfo
);
hhctrl_free
(
info
->
pWBInfo
);
}
ReleaseWebBrowser
(
info
);
}
static
HHInfo
*
HH_OpenHH
(
LPWSTR
filename
)
...
...
@@ -812,8 +798,6 @@ static HHInfo *HH_OpenHH(LPWSTR filename)
return
NULL
;
}
pHHInfo
->
pWBInfo
=
hhctrl_alloc
(
sizeof
(
WBInfo
));
if
(
!
CHM_LoadWinTypeFromCHM
(
pHHInfo
->
pCHMInfo
,
&
pHHInfo
->
WinType
))
{
HH_Close
(
pHHInfo
);
return
NULL
;
...
...
@@ -838,7 +822,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
return
-
1
;
}
NavigateToChm
(
pHHInfo
->
pWBInfo
,
pHHInfo
->
pCHMInfo
->
szFile
,
pHHInfo
->
WinType
.
pszFile
);
NavigateToChm
(
pHHInfo
,
pHHInfo
->
pCHMInfo
->
szFile
,
pHHInfo
->
WinType
.
pszFile
);
while
(
GetMessageW
(
&
msg
,
0
,
0
,
0
))
{
...
...
dlls/hhctrl.ocx/hhctrl.h
View file @
24c13b9f
...
...
@@ -57,18 +57,22 @@ typedef struct CHMInfo
}
CHMInfo
;
typedef
struct
WBInfo
{
IOleClientSite
*
pOleClientSite
;
IWebBrowser2
*
pWebBrowser2
;
IOleObject
*
pBrowserObject
;
HWND
hwndParent
;
}
WBInfo
;
BOOL
WB_EmbedBrowser
(
WBInfo
*
pWBInfo
,
HWND
hwndParent
);
void
WB_UnEmbedBrowser
(
WBInfo
*
pWBInfo
);
void
WB_ResizeBrowser
(
WBInfo
*
pWBInfo
,
DWORD
dwWidth
,
DWORD
dwHeight
);
void
WB_DoPageAction
(
WBInfo
*
pWBInfo
,
DWORD
dwAction
);
typedef
struct
{
IOleClientSite
*
client_site
;
IWebBrowser2
*
web_browser
;
IOleObject
*
wb_object
;
HH_WINTYPEW
WinType
;
CHMInfo
*
pCHMInfo
;
HWND
hwndTabCtrl
;
HWND
hwndSizeBar
;
HFONT
hFont
;
}
HHInfo
;
BOOL
InitWebBrowser
(
HHInfo
*
,
HWND
);
void
ReleaseWebBrowser
(
HHInfo
*
);
void
ResizeWebBrowser
(
HHInfo
*
,
DWORD
,
DWORD
);
void
DoPageAction
(
HHInfo
*
,
DWORD
);
CHMInfo
*
OpenCHM
(
LPCWSTR
szFile
);
BOOL
CHM_LoadWinTypeFromCHM
(
CHMInfo
*
pCHMInfo
,
HH_WINTYPEW
*
pHHWinType
);
...
...
dlls/hhctrl.ocx/webbrowser.c
View file @
24c13b9f
...
...
@@ -567,7 +567,7 @@ static const IStorageVtbl MyIStorageTable =
static
IStorage
MyIStorage
=
{
&
MyIStorageTable
};
BOOL
WB_EmbedBrowser
(
WBInfo
*
pWBI
nfo
,
HWND
hwndParent
)
BOOL
InitWebBrowser
(
HHInfo
*
i
nfo
,
HWND
hwndParent
)
{
IOleClientSiteImpl
*
iOleClientSiteImpl
;
IOleInPlaceObject
*
inplace
;
...
...
@@ -576,9 +576,6 @@ BOOL WB_EmbedBrowser(WBInfo *pWBInfo, HWND hwndParent)
HRESULT
hr
;
RECT
rc
;
/* clear out struct to keep from accessing invalid ptrs */
ZeroMemory
(
pWBInfo
,
sizeof
(
WBInfo
));
iOleClientSiteImpl
=
hhctrl_alloc_zero
(
sizeof
(
IOleClientSiteImpl
));
if
(
!
iOleClientSiteImpl
)
return
FALSE
;
...
...
@@ -594,8 +591,8 @@ BOOL WB_EmbedBrowser(WBInfo *pWBInfo, HWND hwndParent)
(
IOleClientSite
*
)
iOleClientSiteImpl
,
&
MyIStorage
,
(
void
**
)
&
browserObject
);
pWBInfo
->
pOleClientS
ite
=
(
IOleClientSite
*
)
iOleClientSiteImpl
;
pWBInfo
->
pBrowserO
bject
=
browserObject
;
info
->
client_s
ite
=
(
IOleClientSite
*
)
iOleClientSiteImpl
;
info
->
wb_o
bject
=
browserObject
;
if
(
FAILED
(
hr
))
goto
error
;
...
...
@@ -622,55 +619,51 @@ BOOL WB_EmbedBrowser(WBInfo *pWBInfo, HWND hwndParent)
(
void
**
)
&
webBrowser2
);
if
(
SUCCEEDED
(
hr
))
{
pWBInfo
->
pWebBrowser2
=
webBrowser2
;
pWBInfo
->
hwndParent
=
hwndParent
;
info
->
web_browser
=
webBrowser2
;
return
TRUE
;
}
error:
WB_UnEmbedBrowser
(
pWBI
nfo
);
ReleaseWebBrowser
(
i
nfo
);
hhctrl_free
(
iOleClientSiteImpl
);
return
FALSE
;
}
void
WB_UnEmbedBrowser
(
WBInfo
*
pWBI
nfo
)
void
ReleaseWebBrowser
(
HHInfo
*
i
nfo
)
{
if
(
pWBInfo
->
pBrowserO
bject
)
if
(
info
->
wb_o
bject
)
{
IOleObject_Close
(
pWBInfo
->
pBrowserO
bject
,
OLECLOSE_NOSAVE
);
IOleObject_Release
(
pWBInfo
->
pBrowserO
bject
);
pWBInfo
->
pBrowserO
bject
=
NULL
;
IOleObject_Close
(
info
->
wb_o
bject
,
OLECLOSE_NOSAVE
);
IOleObject_Release
(
info
->
wb_o
bject
);
info
->
wb_o
bject
=
NULL
;
}
if
(
pWBInfo
->
pWebBrowser2
)
if
(
info
->
web_browser
)
{
IWebBrowser2_Release
(
pWBInfo
->
pWebBrowser2
);
pWBInfo
->
pWebBrowser2
=
NULL
;
IWebBrowser2_Release
(
info
->
web_browser
);
info
->
web_browser
=
NULL
;
}
if
(
pWBInfo
->
pOleClientS
ite
)
if
(
info
->
client_s
ite
)
{
IOleClientSite_Release
(
pWBInfo
->
pOleClientS
ite
);
pWBInfo
->
pOleClientS
ite
=
NULL
;
IOleClientSite_Release
(
info
->
client_s
ite
);
info
->
client_s
ite
=
NULL
;
}
}
void
WB_ResizeBrowser
(
WBInfo
*
pWBI
nfo
,
DWORD
dwWidth
,
DWORD
dwHeight
)
void
ResizeWebBrowser
(
HHInfo
*
i
nfo
,
DWORD
dwWidth
,
DWORD
dwHeight
)
{
IWebBrowser2
*
pWebBrowser2
=
pWBInfo
->
pWebBrowser2
;
if
(
!
pWebBrowser2
)
if
(
!
info
->
web_browser
)
return
;
IWebBrowser2_put_Width
(
pWebBrowser2
,
dwWidth
);
IWebBrowser2_put_Height
(
pWebBrowser2
,
dwHeight
);
IWebBrowser2_put_Width
(
info
->
web_browser
,
dwWidth
);
IWebBrowser2_put_Height
(
info
->
web_browser
,
dwHeight
);
}
void
WB_DoPageAction
(
WBInfo
*
pWBI
nfo
,
DWORD
dwAction
)
void
DoPageAction
(
HHInfo
*
i
nfo
,
DWORD
dwAction
)
{
IWebBrowser2
*
pWebBrowser2
=
pWBInfo
->
pWebBrowser2
;
IWebBrowser2
*
pWebBrowser2
=
info
->
web_browser
;
if
(
!
pWebBrowser2
)
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment