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
603e1a15
Commit
603e1a15
authored
Apr 23, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
Apr 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhelp: Implement the first round of support for links in RichEdit.
parent
1e5199af
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
36 deletions
+209
-36
hlpfile.c
programs/winhelp/hlpfile.c
+57
-20
hlpfile.h
programs/winhelp/hlpfile.h
+10
-3
winhelp.c
programs/winhelp/winhelp.c
+141
-13
winhelp.h
programs/winhelp/winhelp.h
+1
-0
No files found.
programs/winhelp/hlpfile.c
View file @
603e1a15
...
@@ -433,6 +433,7 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned ref
...
@@ -433,6 +433,7 @@ static BOOL HLPFILE_AddPage(HLPFILE *hlpfile, BYTE *buf, BYTE *end, unsigned ref
page
->
next
=
NULL
;
page
->
next
=
NULL
;
page
->
first_paragraph
=
NULL
;
page
->
first_paragraph
=
NULL
;
page
->
first_macro
=
NULL
;
page
->
first_macro
=
NULL
;
page
->
first_link
=
NULL
;
page
->
wNumber
=
GET_UINT
(
buf
,
0x21
);
page
->
wNumber
=
GET_UINT
(
buf
,
0x21
);
page
->
offset
=
offset
;
page
->
offset
=
offset
;
page
->
reference
=
ref
;
page
->
reference
=
ref
;
...
@@ -904,8 +905,9 @@ static BOOL HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
...
@@ -904,8 +905,9 @@ static BOOL HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
*
*
*
*
*/
*/
static
HLPFILE_LINK
*
HLPFILE_AllocLink
(
int
cookie
,
const
char
*
str
,
LONG
hash
,
static
HLPFILE_LINK
*
HLPFILE_AllocLink
(
struct
RtfData
*
rd
,
int
cookie
,
BOOL
clrChange
,
unsigned
wnd
)
const
char
*
str
,
unsigned
len
,
LONG
hash
,
unsigned
clrChange
,
unsigned
wnd
)
{
{
HLPFILE_LINK
*
link
;
HLPFILE_LINK
*
link
;
char
*
link_str
;
char
*
link_str
;
...
@@ -913,20 +915,31 @@ static HLPFILE_LINK* HLPFILE_AllocLink(int cookie, const char* str, LONG h
...
@@ -913,20 +915,31 @@ static HLPFILE_LINK* HLPFILE_AllocLink(int cookie, const char* str, LONG h
/* FIXME: should build a string table for the attributes.link.lpszPath
/* FIXME: should build a string table for the attributes.link.lpszPath
* they are reallocated for each link
* they are reallocated for each link
*/
*/
link
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
HLPFILE_LINK
)
+
strlen
(
str
)
+
1
);
if
(
len
==
-
1
)
len
=
strlen
(
str
);
link
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
HLPFILE_LINK
)
+
len
+
1
);
if
(
!
link
)
return
NULL
;
if
(
!
link
)
return
NULL
;
link
->
cookie
=
cookie
;
link
->
cookie
=
cookie
;
link
->
lpszString
=
link_str
=
(
char
*
)
link
+
sizeof
(
HLPFILE_LINK
);
link
->
string
=
link_str
=
(
char
*
)(
link
+
1
);
strcpy
(
link_str
,
str
);
memcpy
(
link_str
,
str
,
len
);
link
->
lHash
=
hash
;
link_str
[
len
]
=
'\0'
;
link
->
hash
=
hash
;
link
->
bClrChange
=
clrChange
?
1
:
0
;
link
->
bClrChange
=
clrChange
?
1
:
0
;
link
->
window
=
wnd
;
link
->
window
=
wnd
;
link
->
wRefCount
=
1
;
link
->
wRefCount
=
1
;
if
(
rd
)
{
link
->
next
=
rd
->
first_link
;
rd
->
first_link
=
link
;
link
->
cpMin
=
rd
->
char_pos
;
link
->
cpMax
=
0
;
rd
->
force_color
=
clrChange
;
link
->
wRefCount
++
;
if
(
rd
->
current_link
)
WINE_FIXME
(
"Pending link
\n
"
);
rd
->
current_link
=
link
;
}
WINE_TRACE
(
"Link[%d] to %s@%08x:%d
\n
"
,
WINE_TRACE
(
"Link[%d] to %s@%08x:%d
\n
"
,
link
->
cookie
,
link
->
lpszString
,
link
->
cookie
,
link
->
string
,
link
->
hash
,
link
->
window
);
link
->
lHash
,
link
->
window
);
return
link
;
return
link
;
}
}
...
@@ -1047,8 +1060,12 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1047,8 +1060,12 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
paragraphptr
=
&
paragraph
->
next
;
paragraphptr
=
&
paragraph
->
next
;
paragraph
->
next
=
NULL
;
paragraph
->
next
=
NULL
;
if
(
!
rd
)
{
paragraph
->
link
=
attributes
.
link
;
paragraph
->
link
=
attributes
.
link
;
if
(
paragraph
->
link
)
paragraph
->
link
->
wRefCount
++
;
if
(
paragraph
->
link
)
paragraph
->
link
->
wRefCount
++
;
}
else
paragraph
->
link
=
NULL
;
paragraph
->
cookie
=
para_normal_text
;
paragraph
->
cookie
=
para_normal_text
;
paragraph
->
u
.
text
.
wFont
=
attributes
.
wFont
;
paragraph
->
u
.
text
.
wFont
=
attributes
.
wFont
;
paragraph
->
u
.
text
.
wVSpace
=
attributes
.
wVSpace
;
paragraph
->
u
.
text
.
wVSpace
=
attributes
.
wVSpace
;
...
@@ -1060,7 +1077,12 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1060,7 +1077,12 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
attributes
.
wVSpace
=
0
;
attributes
.
wVSpace
=
0
;
attributes
.
wHSpace
=
0
;
attributes
.
wHSpace
=
0
;
if
(
rd
)
/* FIXME: TEMP */
{
if
(
rd
)
/* FIXME: TEMP */
{
if
(
rd
->
force_color
&&
!
HLPFILE_RtfAddControl
(
rd
,
"{
\\
ul
\\
cf1 "
))
goto
done
;
if
(
rd
->
force_color
)
{
if
((
rd
->
current_link
->
cookie
==
hlp_link_popup
)
?
!
HLPFILE_RtfAddControl
(
rd
,
"{
\\
uld
\\
cf1"
)
:
!
HLPFILE_RtfAddControl
(
rd
,
"{
\\
ul
\\
cf1"
))
goto
done
;
}
if
(
!
HLPFILE_RtfAddText
(
rd
,
text
))
goto
done
;
if
(
!
HLPFILE_RtfAddText
(
rd
,
text
))
goto
done
;
if
(
rd
->
force_color
&&
!
HLPFILE_RtfAddControl
(
rd
,
"}"
))
goto
done
;
if
(
rd
->
force_color
&&
!
HLPFILE_RtfAddControl
(
rd
,
"}"
))
goto
done
;
rd
->
char_pos
+=
textsize
;
rd
->
char_pos
+=
textsize
;
...
@@ -1152,8 +1174,11 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1152,8 +1174,11 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
paragraphptr
=
&
paragraph
->
next
;
paragraphptr
=
&
paragraph
->
next
;
paragraph
->
next
=
NULL
;
paragraph
->
next
=
NULL
;
if
(
!
rd
){
paragraph
->
link
=
attributes
.
link
;
paragraph
->
link
=
attributes
.
link
;
if
(
paragraph
->
link
)
paragraph
->
link
->
wRefCount
++
;
if
(
paragraph
->
link
)
paragraph
->
link
->
wRefCount
++
;
}
else
paragraph
->
link
=
NULL
;
paragraph
->
cookie
=
para_bitmap
;
paragraph
->
cookie
=
para_bitmap
;
paragraph
->
u
.
gfx
.
pos
=
pos
;
paragraph
->
u
.
gfx
.
pos
=
pos
;
switch
(
type
)
switch
(
type
)
...
@@ -1197,6 +1222,14 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1197,6 +1222,14 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
HLPFILE_FreeLink
(
attributes
.
link
);
HLPFILE_FreeLink
(
attributes
.
link
);
attributes
.
link
=
NULL
;
attributes
.
link
=
NULL
;
format
+=
1
;
format
+=
1
;
if
(
rd
)
{
if
(
!
rd
->
current_link
)
WINE_FIXME
(
"No existing link
\n
"
);
else
rd
->
current_link
->
cpMax
=
rd
->
char_pos
;
rd
->
current_link
=
NULL
;
rd
->
force_color
=
FALSE
;
}
break
;
break
;
case
0x8B
:
case
0x8B
:
...
@@ -1222,8 +1255,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1222,8 +1255,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case
0xCC
:
case
0xCC
:
WINE_TRACE
(
"macro => %s
\n
"
,
format
+
3
);
WINE_TRACE
(
"macro => %s
\n
"
,
format
+
3
);
HLPFILE_FreeLink
(
attributes
.
link
);
HLPFILE_FreeLink
(
attributes
.
link
);
attributes
.
link
=
HLPFILE_AllocLink
(
hlp_link_macro
,
(
const
char
*
)
format
+
3
,
attributes
.
link
=
HLPFILE_AllocLink
(
rd
,
hlp_link_macro
,
(
const
char
*
)
format
+
3
,
0
,
!
(
*
format
&
4
),
-
1
);
GET_USHORT
(
format
,
1
),
0
,
!
(
*
format
&
4
),
-
1
);
format
+=
3
+
GET_USHORT
(
format
,
1
);
format
+=
3
+
GET_USHORT
(
format
,
1
);
break
;
break
;
...
@@ -1231,8 +1264,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1231,8 +1264,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case
0xE1
:
case
0xE1
:
WINE_WARN
(
"jump topic 1 => %u
\n
"
,
GET_UINT
(
format
,
1
));
WINE_WARN
(
"jump topic 1 => %u
\n
"
,
GET_UINT
(
format
,
1
));
HLPFILE_FreeLink
(
attributes
.
link
);
HLPFILE_FreeLink
(
attributes
.
link
);
attributes
.
link
=
HLPFILE_AllocLink
((
*
format
&
1
)
?
hlp_link_link
:
hlp_link_popup
,
attributes
.
link
=
HLPFILE_AllocLink
(
rd
,
(
*
format
&
1
)
?
hlp_link_link
:
hlp_link_popup
,
page
->
file
->
lpszPath
,
page
->
file
->
lpszPath
,
-
1
,
GET_UINT
(
format
,
1
)
-
16
,
GET_UINT
(
format
,
1
)
-
16
,
1
,
-
1
);
1
,
-
1
);
...
@@ -1244,10 +1277,9 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1244,10 +1277,9 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
case
0xE3
:
case
0xE3
:
case
0xE6
:
case
0xE6
:
case
0xE7
:
case
0xE7
:
HLPFILE_FreeLink
(
attributes
.
link
);
attributes
.
link
=
HLPFILE_AllocLink
(
rd
,
(
*
format
&
1
)
?
hlp_link_link
:
hlp_link_popup
,
attributes
.
link
=
HLPFILE_AllocLink
((
*
format
&
1
)
?
hlp_link_link
:
hlp_link_popup
,
page
->
file
->
lpszPath
,
-
1
,
page
->
file
->
lpszPath
,
GET_UINT
(
format
,
1
),
GET_UINT
(
format
,
1
),
!
(
*
format
&
4
),
-
1
);
!
(
*
format
&
4
),
-
1
);
format
+=
5
;
format
+=
5
;
break
;
break
;
...
@@ -1285,8 +1317,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
...
@@ -1285,8 +1317,8 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
break
;
break
;
}
}
HLPFILE_FreeLink
(
attributes
.
link
);
HLPFILE_FreeLink
(
attributes
.
link
);
attributes
.
link
=
HLPFILE_AllocLink
((
*
format
&
1
)
?
hlp_link_link
:
hlp_link_popup
,
attributes
.
link
=
HLPFILE_AllocLink
(
rd
,
(
*
format
&
1
)
?
hlp_link_link
:
hlp_link_popup
,
ptr
,
GET_UINT
(
format
,
4
),
ptr
,
-
1
,
GET_UINT
(
format
,
4
),
!
(
*
format
&
4
),
wnd
);
!
(
*
format
&
4
),
wnd
);
}
}
format
+=
3
+
GET_USHORT
(
format
,
1
);
format
+=
3
+
GET_USHORT
(
format
,
1
);
...
@@ -1321,6 +1353,7 @@ BOOL HLPFILE_BrowsePage(HLPFILE_PAGE* page, struct RtfData* rd)
...
@@ -1321,6 +1353,7 @@ BOOL HLPFILE_BrowsePage(HLPFILE_PAGE* page, struct RtfData* rd)
rd
->
in_text
=
TRUE
;
rd
->
in_text
=
TRUE
;
rd
->
data
=
rd
->
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
rd
->
allocated
=
32768
);
rd
->
data
=
rd
->
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
rd
->
allocated
=
32768
);
rd
->
char_pos
=
0
;
rd
->
char_pos
=
0
;
rd
->
first_link
=
rd
->
current_link
=
NULL
;
rd
->
force_color
=
FALSE
;
rd
->
force_color
=
FALSE
;
}
}
...
@@ -1451,6 +1484,8 @@ BOOL HLPFILE_BrowsePage(HLPFILE_PAGE* page, struct RtfData* rd)
...
@@ -1451,6 +1484,8 @@ BOOL HLPFILE_BrowsePage(HLPFILE_PAGE* page, struct RtfData* rd)
ref
=
GET_UINT
(
buf
,
0xc
);
ref
=
GET_UINT
(
buf
,
0xc
);
}
while
(
ref
!=
0xffffffff
);
}
while
(
ref
!=
0xffffffff
);
done:
done:
if
(
rd
)
page
->
first_link
=
rd
->
first_link
;
return
HLPFILE_RtfAddControl
(
rd
,
"}"
);
return
HLPFILE_RtfAddControl
(
rd
,
"}"
);
}
}
...
@@ -2364,7 +2399,9 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
...
@@ -2364,7 +2399,9 @@ static BOOL HLPFILE_GetMap(HLPFILE *hlpfile)
void
HLPFILE_FreeLink
(
HLPFILE_LINK
*
link
)
void
HLPFILE_FreeLink
(
HLPFILE_LINK
*
link
)
{
{
if
(
link
&&
!--
link
->
wRefCount
)
if
(
link
&&
!--
link
->
wRefCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
link
);
HeapFree
(
GetProcessHeap
(),
0
,
link
);
}
}
}
/***********************************************************************
/***********************************************************************
...
...
programs/winhelp/hlpfile.h
View file @
603e1a15
...
@@ -35,14 +35,17 @@ typedef struct
...
@@ -35,14 +35,17 @@ typedef struct
COLORREF
nsr_color
;
/* color for non scrollable region */
COLORREF
nsr_color
;
/* color for non scrollable region */
}
HLPFILE_WINDOWINFO
;
}
HLPFILE_WINDOWINFO
;
typedef
struct
typedef
struct
tagHlpFileLink
{
{
enum
{
hlp_link_link
,
hlp_link_popup
,
hlp_link_macro
}
cookie
;
enum
{
hlp_link_link
,
hlp_link_popup
,
hlp_link_macro
}
cookie
;
LPCSTR
lpszString
;
/* name of the file to for the link (NULL if same file) */
LPCSTR
string
;
/* name of the file to for the link (NULL if same file) */
LONG
lHash
;
/* topic index */
LONG
hash
;
/* topic index */
unsigned
bClrChange
:
1
,
/* true if the link is green & underlined */
unsigned
bClrChange
:
1
,
/* true if the link is green & underlined */
wRefCount
;
/* number of internal references to this object */
wRefCount
;
/* number of internal references to this object */
unsigned
window
;
/* window number for displaying the link (-1 is current) */
unsigned
window
;
/* window number for displaying the link (-1 is current) */
DWORD
cpMin
;
DWORD
cpMax
;
struct
tagHlpFileLink
*
next
;
}
HLPFILE_LINK
;
}
HLPFILE_LINK
;
enum
para_type
{
para_normal_text
,
para_debug_text
,
para_bitmap
,
para_metafile
};
enum
para_type
{
para_normal_text
,
para_debug_text
,
para_bitmap
,
para_metafile
};
...
@@ -92,6 +95,8 @@ typedef struct tagHlpFilePage
...
@@ -92,6 +95,8 @@ typedef struct tagHlpFilePage
HLPFILE_PARAGRAPH
*
first_paragraph
;
HLPFILE_PARAGRAPH
*
first_paragraph
;
HLPFILE_MACRO
*
first_macro
;
HLPFILE_MACRO
*
first_macro
;
HLPFILE_LINK
*
first_link
;
unsigned
wNumber
;
unsigned
wNumber
;
unsigned
offset
;
unsigned
offset
;
DWORD
reference
;
DWORD
reference
;
...
@@ -207,6 +212,8 @@ struct RtfData {
...
@@ -207,6 +212,8 @@ struct RtfData {
unsigned
allocated
;
/* overall allocated size */
unsigned
allocated
;
/* overall allocated size */
unsigned
char_pos
;
/* current char position (in richedit) */
unsigned
char_pos
;
/* current char position (in richedit) */
char
*
where
;
/* pointer to feed back richedit */
char
*
where
;
/* pointer to feed back richedit */
HLPFILE_LINK
*
first_link
;
HLPFILE_LINK
*
current_link
;
BOOL
force_color
;
BOOL
force_color
;
};
};
...
...
programs/winhelp/winhelp.c
View file @
603e1a15
This diff is collapsed.
Click to expand it.
programs/winhelp/winhelp.h
View file @
603e1a15
...
@@ -126,6 +126,7 @@ typedef struct tagWinHelp
...
@@ -126,6 +126,7 @@ typedef struct tagWinHelp
HBRUSH
hBrush
;
HBRUSH
hBrush
;
HLPFILE_WINDOWINFO
*
info
;
HLPFILE_WINDOWINFO
*
info
;
HLPFILE_LINK
*
current_link
;
WINHELP_PAGESET
back
;
WINHELP_PAGESET
back
;
...
...
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