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
a4480365
Commit
a4480365
authored
Apr 22, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
Apr 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhelp: Added ability to locate information within a page (and to store it inside WNDPAGE).
parent
61cc5106
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
33 deletions
+37
-33
hlpfile.c
programs/winhelp/hlpfile.c
+18
-17
hlpfile.h
programs/winhelp/hlpfile.h
+4
-4
macro.c
programs/winhelp/macro.c
+5
-4
winhelp.c
programs/winhelp/winhelp.c
+9
-8
winhelp.h
programs/winhelp/winhelp.h
+1
-0
No files found.
programs/winhelp/hlpfile.c
View file @
a4480365
...
...
@@ -96,21 +96,12 @@ static HLPFILE_PAGE *HLPFILE_PageByNumber(HLPFILE* hlpfile, UINT wNum)
return
page
;
}
/* FIXME:
* this finds the page containing the offset. The offset can either
* refer to the top of the page (offset == page->offset), or
* to some paragraph inside the page...
* As of today, we only return the page... we should also return
* a paragraph, and then, while opening a new page, compute the
* y-offset of the paragraph to be shown and scroll the window
* accordingly
*/
/******************************************************************
* HLPFILE_PageByOffset
*
*
*/
HLPFILE_PAGE
*
HLPFILE_PageByOffset
(
HLPFILE
*
hlpfile
,
LONG
offset
)
HLPFILE_PAGE
*
HLPFILE_PageByOffset
(
HLPFILE
*
hlpfile
,
LONG
offset
,
ULONG
*
relative
)
{
HLPFILE_PAGE
*
page
;
HLPFILE_PAGE
*
found
;
...
...
@@ -125,8 +116,11 @@ HLPFILE_PAGE *HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset)
for
(
found
=
NULL
,
page
=
hlpfile
->
first_page
;
page
;
page
=
page
->
next
)
{
if
(
page
->
offset
<=
offset
&&
(
!
found
||
found
->
offset
<
page
->
offset
))
{
*
relative
=
offset
-
page
->
offset
;
found
=
page
;
}
}
if
(
!
found
)
WINE_ERR
(
"Page of offset %u not found in file %s
\n
"
,
offset
,
hlpfile
->
lpszPath
);
...
...
@@ -156,7 +150,7 @@ static int comp_PageByHash(void *p, const void *key,
*
* HLPFILE_HlpFilePageByHash
*/
HLPFILE_PAGE
*
HLPFILE_PageByHash
(
HLPFILE
*
hlpfile
,
LONG
lHash
)
HLPFILE_PAGE
*
HLPFILE_PageByHash
(
HLPFILE
*
hlpfile
,
LONG
lHash
,
ULONG
*
relative
)
{
BYTE
*
ptr
;
...
...
@@ -166,7 +160,10 @@ HLPFILE_PAGE *HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash)
/* For win 3.0 files hash values are really page numbers */
if
(
hlpfile
->
version
<=
16
)
{
*
relative
=
0
;
return
HLPFILE_PageByNumber
(
hlpfile
,
lHash
);
}
ptr
=
HLPFILE_BPTreeSearch
(
hlpfile
->
Context
,
LongToPtr
(
lHash
),
comp_PageByHash
);
if
(
!
ptr
)
...
...
@@ -175,14 +172,14 @@ HLPFILE_PAGE *HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash)
return
NULL
;
}
return
HLPFILE_PageByOffset
(
hlpfile
,
GET_UINT
(
ptr
,
4
));
return
HLPFILE_PageByOffset
(
hlpfile
,
GET_UINT
(
ptr
,
4
)
,
relative
);
}
/***********************************************************************
*
* HLPFILE_PageByMap
*/
HLPFILE_PAGE
*
HLPFILE_PageByMap
(
HLPFILE
*
hlpfile
,
LONG
lMap
)
HLPFILE_PAGE
*
HLPFILE_PageByMap
(
HLPFILE
*
hlpfile
,
LONG
lMap
,
ULONG
*
relative
)
{
unsigned
int
i
;
...
...
@@ -193,7 +190,7 @@ HLPFILE_PAGE *HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap)
for
(
i
=
0
;
i
<
hlpfile
->
wMapLen
;
i
++
)
{
if
(
hlpfile
->
Map
[
i
].
lMap
==
lMap
)
return
HLPFILE_PageByOffset
(
hlpfile
,
hlpfile
->
Map
[
i
].
offset
);
return
HLPFILE_PageByOffset
(
hlpfile
,
hlpfile
->
Map
[
i
].
offset
,
relative
);
}
WINE_ERR
(
"Page of Map %x not found in file %s
\n
"
,
lMap
,
hlpfile
->
lpszPath
);
...
...
@@ -204,14 +201,18 @@ HLPFILE_PAGE *HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap)
*
* HLPFILE_Contents
*/
HLPFILE_PAGE
*
HLPFILE_Contents
(
HLPFILE
*
hlpfile
)
HLPFILE_PAGE
*
HLPFILE_Contents
(
HLPFILE
*
hlpfile
,
ULONG
*
relative
)
{
HLPFILE_PAGE
*
page
=
NULL
;
if
(
!
hlpfile
)
return
NULL
;
page
=
HLPFILE_PageByOffset
(
hlpfile
,
hlpfile
->
contents_start
);
if
(
!
page
)
page
=
hlpfile
->
first_page
;
page
=
HLPFILE_PageByOffset
(
hlpfile
,
hlpfile
->
contents_start
,
relative
);
if
(
!
page
)
{
page
=
hlpfile
->
first_page
;
*
relative
=
0
;
}
return
page
;
}
...
...
programs/winhelp/hlpfile.h
View file @
a4480365
...
...
@@ -188,10 +188,10 @@ typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
typedef
void
(
*
HLPFILE_BPTreeCallback
)(
void
*
p
,
void
**
next
,
void
*
cookie
);
HLPFILE
*
HLPFILE_ReadHlpFile
(
LPCSTR
lpszPath
);
HLPFILE_PAGE
*
HLPFILE_Contents
(
HLPFILE
*
hlpfile
);
HLPFILE_PAGE
*
HLPFILE_PageByHash
(
HLPFILE
*
hlpfile
,
LONG
lHash
);
HLPFILE_PAGE
*
HLPFILE_PageByMap
(
HLPFILE
*
hlpfile
,
LONG
lMap
);
HLPFILE_PAGE
*
HLPFILE_PageByOffset
(
HLPFILE
*
hlpfile
,
LONG
offset
);
HLPFILE_PAGE
*
HLPFILE_Contents
(
HLPFILE
*
hlpfile
,
ULONG
*
relative
);
HLPFILE_PAGE
*
HLPFILE_PageByHash
(
HLPFILE
*
hlpfile
,
LONG
lHash
,
ULONG
*
relative
);
HLPFILE_PAGE
*
HLPFILE_PageByMap
(
HLPFILE
*
hlpfile
,
LONG
lMap
,
ULONG
*
relative
);
HLPFILE_PAGE
*
HLPFILE_PageByOffset
(
HLPFILE
*
hlpfile
,
LONG
offset
,
ULONG
*
relative
);
LONG
HLPFILE_Hash
(
LPCSTR
lpszContext
);
void
HLPFILE_FreeLink
(
HLPFILE_LINK
*
link
);
void
HLPFILE_FreeHlpFile
(
HLPFILE
*
);
...
...
programs/winhelp/macro.c
View file @
a4480365
...
...
@@ -246,15 +246,16 @@ void CALLBACK MACRO_BookmarkMore(void)
void
CALLBACK
MACRO_BrowseButtons
(
void
)
{
HLPFILE_PAGE
*
page
=
Globals
.
active_win
->
page
;
ULONG
relative
;
WINE_TRACE
(
"()
\n
"
);
MACRO_CreateButton
(
"BTN_PREV"
,
"&<<"
,
"Prev()"
);
MACRO_CreateButton
(
"BTN_NEXT"
,
"&>>"
,
"Next()"
);
if
(
!
HLPFILE_PageByOffset
(
page
->
file
,
page
->
browse_bwd
))
if
(
!
HLPFILE_PageByOffset
(
page
->
file
,
page
->
browse_bwd
,
&
relative
))
MACRO_DisableButton
(
"BTN_PREV"
);
if
(
!
HLPFILE_PageByOffset
(
page
->
file
,
page
->
browse_fwd
))
if
(
!
HLPFILE_PageByOffset
(
page
->
file
,
page
->
browse_fwd
,
&
relative
))
MACRO_DisableButton
(
"BTN_NEXT"
);
}
...
...
@@ -718,7 +719,7 @@ void CALLBACK MACRO_Next(void)
WINE_TRACE
(
"()
\n
"
);
wp
.
page
=
Globals
.
active_win
->
page
;
wp
.
page
=
HLPFILE_PageByOffset
(
wp
.
page
->
file
,
wp
.
page
->
browse_fwd
);
wp
.
page
=
HLPFILE_PageByOffset
(
wp
.
page
->
file
,
wp
.
page
->
browse_fwd
,
&
wp
.
relative
);
if
(
wp
.
page
)
{
wp
.
page
->
file
->
wRefCount
++
;
...
...
@@ -758,7 +759,7 @@ void CALLBACK MACRO_Prev(void)
WINE_TRACE
(
"()
\n
"
);
wp
.
page
=
Globals
.
active_win
->
page
;
wp
.
page
=
HLPFILE_PageByOffset
(
wp
.
page
->
file
,
wp
.
page
->
browse_bwd
);
wp
.
page
=
HLPFILE_PageByOffset
(
wp
.
page
->
file
,
wp
.
page
->
browse_bwd
,
&
wp
.
relative
);
if
(
wp
.
page
)
{
wp
.
page
->
file
->
wRefCount
++
;
...
...
programs/winhelp/winhelp.c
View file @
a4480365
...
...
@@ -53,7 +53,7 @@ static void WINHELP_InitFonts(HWND hWnd);
static
void
WINHELP_DeleteLines
(
WINHELP_WINDOW
*
);
static
void
WINHELP_DeleteWindow
(
WINHELP_WINDOW
*
);
static
void
WINHELP_DeleteButtons
(
WINHELP_WINDOW
*
);
static
void
WINHELP_SetupText
(
HWND
hWnd
);
static
void
WINHELP_SetupText
(
HWND
hWnd
,
ULONG
relative
);
static
WINHELP_LINE_PART
*
WINHELP_IsOverLink
(
WINHELP_WINDOW
*
,
WPARAM
,
LPARAM
);
WINHELP_GLOBALS
Globals
=
{
3
,
NULL
,
NULL
,
TRUE
,
NULL
,
NULL
,
NULL
,
NULL
,
{{{
NULL
,
NULL
}},
0
}};
...
...
@@ -560,7 +560,8 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
win
->
page
=
wpage
->
page
;
win
->
info
=
wpage
->
wininfo
;
WINHELP_SetupText
(
GetDlgItem
(
win
->
hMainWnd
,
CTL_ID_TEXT
));
WINHELP_SetupText
(
GetDlgItem
(
win
->
hMainWnd
,
CTL_ID_TEXT
),
wpage
->
relative
);
InvalidateRect
(
win
->
hMainWnd
,
NULL
,
TRUE
);
if
(
win
->
hHistoryWnd
)
InvalidateRect
(
win
->
hHistoryWnd
,
NULL
,
TRUE
);
break
;
...
...
@@ -669,8 +670,8 @@ BOOL WINHELP_CreateHelpWindowByHash(HLPFILE* hlpfile, LONG lHash,
wpage
.
page
=
NULL
;
if
(
hlpfile
)
wpage
.
page
=
lHash
?
HLPFILE_PageByHash
(
hlpfile
,
lHash
)
:
HLPFILE_Contents
(
hlpfile
);
wpage
.
page
=
lHash
?
HLPFILE_PageByHash
(
hlpfile
,
lHash
,
&
wpage
.
relative
)
:
HLPFILE_Contents
(
hlpfile
,
&
wpage
.
relative
);
if
(
wpage
.
page
)
wpage
.
page
->
file
->
wRefCount
++
;
wpage
.
wininfo
=
wi
;
return
WINHELP_CreateHelpWindow
(
&
wpage
,
nCmdShow
,
TRUE
);
...
...
@@ -685,7 +686,7 @@ BOOL WINHELP_CreateHelpWindowByMap(HLPFILE* hlpfile, LONG lMap,
{
WINHELP_WNDPAGE
wpage
;
wpage
.
page
=
HLPFILE_PageByMap
(
hlpfile
,
lMap
);
wpage
.
page
=
HLPFILE_PageByMap
(
hlpfile
,
lMap
,
&
wpage
.
relative
);
if
(
wpage
.
page
)
wpage
.
page
->
file
->
wRefCount
++
;
wpage
.
wininfo
=
wi
;
return
WINHELP_CreateHelpWindow
(
&
wpage
,
nCmdShow
,
TRUE
);
...
...
@@ -700,7 +701,7 @@ BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE* hlpfile, LONG lOffset,
{
WINHELP_WNDPAGE
wpage
;
wpage
.
page
=
HLPFILE_PageByOffset
(
hlpfile
,
lOffset
);
wpage
.
page
=
HLPFILE_PageByOffset
(
hlpfile
,
lOffset
,
&
wpage
.
relative
);
if
(
wpage
.
page
)
wpage
.
page
->
file
->
wRefCount
++
;
wpage
.
wininfo
=
wi
;
return
WINHELP_CreateHelpWindow
(
&
wpage
,
nCmdShow
,
TRUE
);
...
...
@@ -1022,7 +1023,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case
WM_WINDOWPOSCHANGED
:
winpos
=
(
WINDOWPOS
*
)
lParam
;
if
(
!
(
winpos
->
flags
&
SWP_NOSIZE
))
WINHELP_SetupText
(
hWnd
);
if
(
!
(
winpos
->
flags
&
SWP_NOSIZE
))
WINHELP_SetupText
(
hWnd
,
0
);
break
;
case
WM_MOUSEWHEEL
:
...
...
@@ -1359,7 +1360,7 @@ static LRESULT CALLBACK WINHELP_ShadowWndProc(HWND hWnd, UINT msg, WPARAM wParam
*
* SetupText
*/
static
void
WINHELP_SetupText
(
HWND
hWnd
)
static
void
WINHELP_SetupText
(
HWND
hWnd
,
ULONG
relative
)
{
HDC
hDc
=
GetDC
(
hWnd
);
RECT
rect
;
...
...
programs/winhelp/winhelp.h
View file @
a4480365
...
...
@@ -95,6 +95,7 @@ typedef struct
{
HLPFILE_PAGE
*
page
;
HLPFILE_WINDOWINFO
*
wininfo
;
ULONG
relative
;
}
WINHELP_WNDPAGE
;
typedef
struct
tagPageSet
...
...
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