Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
6d40dbe3
Commit
6d40dbe3
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 the notion of WINHELP_WNDPAGE and use it to move the history to…
winhelp: Added the notion of WINHELP_WNDPAGE and use it to move the history to the global variables.
parent
7a608ea6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
96 deletions
+109
-96
macro.c
programs/winhelp/macro.c
+20
-19
winhelp.c
programs/winhelp/winhelp.c
+73
-71
winhelp.h
programs/winhelp/winhelp.h
+16
-6
No files found.
programs/winhelp/macro.c
View file @
6d40dbe3
...
@@ -220,9 +220,8 @@ void CALLBACK MACRO_Back(void)
...
@@ -220,9 +220,8 @@ void CALLBACK MACRO_Back(void)
WINE_TRACE
(
"()
\n
"
);
WINE_TRACE
(
"()
\n
"
);
if
(
win
&&
win
->
backIndex
>=
2
)
if
(
win
&&
win
->
back
.
index
>=
2
)
WINHELP_CreateHelpWindow
(
win
->
back
[
--
win
->
backIndex
-
1
],
WINHELP_CreateHelpWindow
(
&
win
->
back
.
set
[
--
win
->
back
.
index
-
1
],
SW_SHOW
);
win
->
info
,
SW_SHOW
);
}
}
void
CALLBACK
MACRO_BackFlush
(
void
)
void
CALLBACK
MACRO_BackFlush
(
void
)
...
@@ -235,12 +234,12 @@ void CALLBACK MACRO_BackFlush(void)
...
@@ -235,12 +234,12 @@ void CALLBACK MACRO_BackFlush(void)
{
{
unsigned
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
win
->
back
I
ndex
;
i
++
)
for
(
i
=
0
;
i
<
win
->
back
.
i
ndex
;
i
++
)
{
{
HLPFILE_FreeHlpFile
(
win
->
back
[
i
]
->
file
);
HLPFILE_FreeHlpFile
(
win
->
back
.
set
[
i
].
page
->
file
);
win
->
back
[
i
]
=
NULL
;
win
->
back
.
set
[
i
].
page
=
NULL
;
}
}
win
->
back
I
ndex
=
0
;
win
->
back
.
i
ndex
=
0
;
}
}
}
}
...
@@ -701,15 +700,16 @@ void CALLBACK MACRO_MPrintID(LPCSTR str)
...
@@ -701,15 +700,16 @@ void CALLBACK MACRO_MPrintID(LPCSTR str)
void
CALLBACK
MACRO_Next
(
void
)
void
CALLBACK
MACRO_Next
(
void
)
{
{
HLPFILE_PAGE
*
page
;
WINHELP_WNDPAGE
wp
;
WINE_TRACE
(
"()
\n
"
);
WINE_TRACE
(
"()
\n
"
);
page
=
Globals
.
active_win
->
page
;
wp
.
page
=
Globals
.
active_win
->
page
;
page
=
HLPFILE_PageByOffset
(
page
->
file
,
page
->
browse_fwd
);
wp
.
page
=
HLPFILE_PageByOffset
(
wp
.
page
->
file
,
wp
.
page
->
browse_fwd
);
if
(
page
)
if
(
wp
.
page
)
{
{
page
->
file
->
wRefCount
++
;
wp
.
page
->
file
->
wRefCount
++
;
WINHELP_CreateHelpWindow
(
page
,
Globals
.
active_win
->
info
,
SW_NORMAL
);
wp
.
wininfo
=
Globals
.
active_win
->
info
;
WINHELP_CreateHelpWindow
(
&
wp
,
SW_NORMAL
);
}
}
}
}
...
@@ -740,15 +740,16 @@ void CALLBACK MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3,
...
@@ -740,15 +740,16 @@ void CALLBACK MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3,
void
CALLBACK
MACRO_Prev
(
void
)
void
CALLBACK
MACRO_Prev
(
void
)
{
{
HLPFILE_PAGE
*
page
;
WINHELP_WNDPAGE
wp
;
WINE_TRACE
(
"()
\n
"
);
WINE_TRACE
(
"()
\n
"
);
page
=
Globals
.
active_win
->
page
;
wp
.
page
=
Globals
.
active_win
->
page
;
page
=
HLPFILE_PageByOffset
(
page
->
file
,
page
->
browse_bwd
);
wp
.
page
=
HLPFILE_PageByOffset
(
wp
.
page
->
file
,
wp
.
page
->
browse_bwd
);
if
(
page
)
if
(
wp
.
page
)
{
{
page
->
file
->
wRefCount
++
;
wp
.
page
->
file
->
wRefCount
++
;
WINHELP_CreateHelpWindow
(
page
,
Globals
.
active_win
->
info
,
SW_NORMAL
);
wp
.
wininfo
=
Globals
.
active_win
->
info
;
WINHELP_CreateHelpWindow
(
&
wp
,
SW_NORMAL
);
}
}
}
}
...
...
programs/winhelp/winhelp.c
View file @
6d40dbe3
...
@@ -56,7 +56,7 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW*);
...
@@ -56,7 +56,7 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW*);
static
void
WINHELP_SetupText
(
HWND
hWnd
);
static
void
WINHELP_SetupText
(
HWND
hWnd
);
static
WINHELP_LINE_PART
*
WINHELP_IsOverLink
(
WINHELP_WINDOW
*
,
WPARAM
,
LPARAM
);
static
WINHELP_LINE_PART
*
WINHELP_IsOverLink
(
WINHELP_WINDOW
*
,
WPARAM
,
LPARAM
);
WINHELP_GLOBALS
Globals
=
{
3
,
NULL
,
NULL
,
TRUE
,
NULL
,
NULL
,
NULL
,
NULL
};
WINHELP_GLOBALS
Globals
=
{
3
,
NULL
,
NULL
,
TRUE
,
NULL
,
NULL
,
NULL
,
NULL
,
{{{
NULL
,
NULL
}},
0
}
};
#define CTL_ID_BUTTON 0x700
#define CTL_ID_BUTTON 0x700
#define CTL_ID_TEXT 0x701
#define CTL_ID_TEXT 0x701
...
@@ -484,35 +484,38 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
...
@@ -484,35 +484,38 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
unsigned
i
,
num
;
unsigned
i
,
num
;
/* FIXME: when using back, we shouldn't update the history... */
/* FIXME: when using back, we shouldn't update the history... */
for
(
i
=
0
;
i
<
win
->
histI
ndex
;
i
++
)
for
(
i
=
0
;
i
<
Globals
.
history
.
i
ndex
;
i
++
)
if
(
win
->
history
[
i
]
==
page
)
break
;
if
(
Globals
.
history
.
set
[
i
].
page
==
page
)
break
;
/* if the new page is already in the history, do nothing */
/* if the new page is already in the history, do nothing */
if
(
i
==
win
->
histI
ndex
)
if
(
i
==
Globals
.
history
.
i
ndex
)
{
{
num
=
sizeof
(
win
->
history
)
/
sizeof
(
win
->
history
[
0
]);
num
=
sizeof
(
Globals
.
history
.
set
)
/
sizeof
(
Globals
.
history
.
set
[
0
]);
if
(
win
->
histI
ndex
==
num
)
if
(
Globals
.
history
.
i
ndex
==
num
)
{
{
/* we're full, remove latest entry */
/* we're full, remove latest entry */
HLPFILE_FreeHlpFile
(
win
->
history
[
0
]
->
file
);
HLPFILE_FreeHlpFile
(
Globals
.
history
.
set
[
0
].
page
->
file
);
memmove
(
&
win
->
history
[
0
],
&
win
->
history
[
1
],
memmove
(
&
Globals
.
history
.
set
[
0
],
&
Globals
.
history
.
set
[
1
],
(
num
-
1
)
*
sizeof
(
win
->
history
[
0
]));
(
num
-
1
)
*
sizeof
(
Globals
.
history
.
set
[
0
]));
win
->
histI
ndex
--
;
Globals
.
history
.
i
ndex
--
;
}
}
win
->
history
[
win
->
histIndex
++
]
=
page
;
Globals
.
history
.
set
[
Globals
.
history
.
index
].
page
=
page
;
Globals
.
history
.
set
[
Globals
.
history
.
index
++
].
wininfo
=
win
->
info
;
page
->
file
->
wRefCount
++
;
page
->
file
->
wRefCount
++
;
if
(
win
->
hHistoryWnd
)
InvalidateRect
(
win
->
hHistoryWnd
,
NULL
,
TRUE
);
if
(
win
->
hHistoryWnd
)
InvalidateRect
(
win
->
hHistoryWnd
,
NULL
,
TRUE
);
}
}
num
=
sizeof
(
win
->
back
)
/
sizeof
(
win
->
back
[
0
]);
num
=
sizeof
(
win
->
back
.
set
)
/
sizeof
(
win
->
back
.
set
[
0
]);
if
(
win
->
back
I
ndex
==
num
)
if
(
win
->
back
.
i
ndex
==
num
)
{
{
/* we're full, remove latest entry */
/* we're full, remove latest entry */
HLPFILE_FreeHlpFile
(
win
->
back
[
0
]
->
file
);
HLPFILE_FreeHlpFile
(
win
->
back
.
set
[
0
].
page
->
file
);
memmove
(
&
win
->
back
[
0
],
&
win
->
back
[
1
],
(
num
-
1
)
*
sizeof
(
win
->
back
[
0
]));
memmove
(
&
win
->
back
.
set
[
0
],
&
win
->
back
.
set
[
1
],
win
->
backIndex
--
;
(
num
-
1
)
*
sizeof
(
win
->
back
.
set
[
0
]));
win
->
back
.
index
--
;
}
}
win
->
back
[
win
->
backIndex
++
]
=
page
;
win
->
back
.
set
[
win
->
back
.
index
].
page
=
page
;
win
->
back
.
set
[
win
->
back
.
index
++
].
wininfo
=
win
->
info
;
page
->
file
->
wRefCount
++
;
page
->
file
->
wRefCount
++
;
}
}
...
@@ -520,39 +523,38 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
...
@@ -520,39 +523,38 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
*
*
* WINHELP_CreateHelpWindow
* WINHELP_CreateHelpWindow
*/
*/
BOOL
WINHELP_CreateHelpWindow
(
HLPFILE_PAGE
*
page
,
HLPFILE_WINDOWINFO
*
wi
,
BOOL
WINHELP_CreateHelpWindow
(
WINHELP_WNDPAGE
*
wpage
,
int
nCmdShow
)
int
nCmdShow
)
{
{
WINHELP_WINDOW
*
win
=
NULL
;
WINHELP_WINDOW
*
win
=
NULL
;
BOOL
bPrimary
,
bPopup
,
bReUsed
=
FALSE
;
BOOL
bPrimary
,
bPopup
,
bReUsed
=
FALSE
;
LPSTR
name
;
LPSTR
name
;
bPrimary
=
!
lstrcmpi
(
w
i
->
name
,
"main"
);
bPrimary
=
!
lstrcmpi
(
w
page
->
wininfo
->
name
,
"main"
);
bPopup
=
!
bPrimary
&&
(
w
i
->
win_style
&
WS_POPUP
);
bPopup
=
!
bPrimary
&&
(
w
page
->
wininfo
->
win_style
&
WS_POPUP
);
if
(
page
&&
!
page
->
first_paragraph
)
HLPFILE_BrowsePage
(
page
);
if
(
wpage
->
page
&&
!
wpage
->
page
->
first_paragraph
)
HLPFILE_BrowsePage
(
wpage
->
page
);
if
(
!
bPopup
)
if
(
!
bPopup
)
{
{
for
(
win
=
Globals
.
win_list
;
win
;
win
=
win
->
next
)
for
(
win
=
Globals
.
win_list
;
win
;
win
=
win
->
next
)
{
{
if
(
!
lstrcmpi
(
win
->
lpszName
,
w
i
->
name
))
if
(
!
lstrcmpi
(
win
->
lpszName
,
w
page
->
wininfo
->
name
))
{
{
WINHELP_DeleteButtons
(
win
);
WINHELP_DeleteButtons
(
win
);
bReUsed
=
TRUE
;
bReUsed
=
TRUE
;
SetWindowText
(
win
->
hMainWnd
,
w
i
->
caption
);
SetWindowText
(
win
->
hMainWnd
,
w
page
->
wininfo
->
caption
);
if
(
w
i
->
origin
.
x
!=
CW_USEDEFAULT
&&
if
(
w
page
->
wininfo
->
origin
.
x
!=
CW_USEDEFAULT
&&
w
i
->
origin
.
y
!=
CW_USEDEFAULT
)
w
page
->
wininfo
->
origin
.
y
!=
CW_USEDEFAULT
)
SetWindowPos
(
win
->
hMainWnd
,
HWND_TOP
,
SetWindowPos
(
win
->
hMainWnd
,
HWND_TOP
,
w
i
->
origin
.
x
,
wi
->
origin
.
y
,
0
,
0
,
SWP_NOSIZE
);
w
page
->
wininfo
->
origin
.
x
,
wpage
->
wininfo
->
origin
.
y
,
0
,
0
,
SWP_NOSIZE
);
if
(
w
i
->
size
.
cx
!=
CW_USEDEFAULT
&&
if
(
w
page
->
wininfo
->
size
.
cx
!=
CW_USEDEFAULT
&&
w
i
->
size
.
cy
!=
CW_USEDEFAULT
)
w
page
->
wininfo
->
size
.
cy
!=
CW_USEDEFAULT
)
SetWindowPos
(
win
->
hMainWnd
,
HWND_TOP
,
SetWindowPos
(
win
->
hMainWnd
,
HWND_TOP
,
0
,
0
,
w
i
->
size
.
cx
,
wi
->
size
.
cy
,
SWP_NOMOVE
);
0
,
0
,
w
page
->
wininfo
->
size
.
cx
,
wpage
->
wininfo
->
size
.
cy
,
SWP_NOMOVE
);
WINHELP_InitFonts
(
win
->
hMainWnd
);
WINHELP_InitFonts
(
win
->
hMainWnd
);
win
->
page
=
page
;
win
->
page
=
wpage
->
page
;
win
->
info
=
w
i
;
win
->
info
=
w
page
->
wininfo
;
WINHELP_SetupText
(
GetDlgItem
(
win
->
hMainWnd
,
CTL_ID_TEXT
));
WINHELP_SetupText
(
GetDlgItem
(
win
->
hMainWnd
,
CTL_ID_TEXT
));
InvalidateRect
(
win
->
hMainWnd
,
NULL
,
TRUE
);
InvalidateRect
(
win
->
hMainWnd
,
NULL
,
TRUE
);
if
(
win
->
hHistoryWnd
)
InvalidateRect
(
win
->
hHistoryWnd
,
NULL
,
TRUE
);
if
(
win
->
hHistoryWnd
)
InvalidateRect
(
win
->
hHistoryWnd
,
NULL
,
TRUE
);
...
@@ -565,33 +567,33 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
...
@@ -565,33 +567,33 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
{
{
/* Initialize WINHELP_WINDOW struct */
/* Initialize WINHELP_WINDOW struct */
win
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
win
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WINHELP_WINDOW
)
+
strlen
(
w
i
->
name
)
+
1
);
sizeof
(
WINHELP_WINDOW
)
+
strlen
(
w
page
->
wininfo
->
name
)
+
1
);
if
(
!
win
)
return
FALSE
;
if
(
!
win
)
return
FALSE
;
win
->
next
=
Globals
.
win_list
;
win
->
next
=
Globals
.
win_list
;
Globals
.
win_list
=
win
;
Globals
.
win_list
=
win
;
name
=
(
char
*
)
win
+
sizeof
(
WINHELP_WINDOW
);
name
=
(
char
*
)
win
+
sizeof
(
WINHELP_WINDOW
);
lstrcpy
(
name
,
w
i
->
name
);
lstrcpy
(
name
,
w
page
->
wininfo
->
name
);
win
->
lpszName
=
name
;
win
->
lpszName
=
name
;
win
->
hHandCur
=
LoadCursorW
(
0
,
(
LPWSTR
)
IDC_HAND
);
win
->
hHandCur
=
LoadCursorW
(
0
,
(
LPWSTR
)
IDC_HAND
);
win
->
histIndex
=
win
->
backI
ndex
=
0
;
win
->
back
.
i
ndex
=
0
;
}
}
win
->
page
=
page
;
win
->
page
=
wpage
->
page
;
win
->
info
=
w
i
;
win
->
info
=
w
page
->
wininfo
;
win
->
hArrowCur
=
LoadCursorA
(
0
,
(
LPSTR
)
IDC_ARROW
);
win
->
hArrowCur
=
LoadCursorA
(
0
,
(
LPSTR
)
IDC_ARROW
);
win
->
hHandCur
=
LoadCursorA
(
0
,
(
LPSTR
)
IDC_HAND
);
win
->
hHandCur
=
LoadCursorA
(
0
,
(
LPSTR
)
IDC_HAND
);
if
(
!
bPopup
&&
page
)
if
(
!
bPopup
&&
wpage
->
page
)
{
{
WINHELP_AddHistory
(
win
,
page
);
WINHELP_AddHistory
(
win
,
wpage
->
page
);
}
}
if
(
!
bPopup
)
if
(
!
bPopup
)
Globals
.
active_win
=
win
;
Globals
.
active_win
=
win
;
/* Initialize default pushbuttons */
/* Initialize default pushbuttons */
if
(
bPrimary
&&
page
)
if
(
bPrimary
&&
wpage
->
page
)
{
{
CHAR
buffer
[
MAX_STRING_LEN
];
CHAR
buffer
[
MAX_STRING_LEN
];
...
@@ -608,22 +610,23 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
...
@@ -608,22 +610,23 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
}
}
/* Initialize file specific pushbuttons */
/* Initialize file specific pushbuttons */
if
(
!
(
w
i
->
win_style
&
WS_POPUP
)
&&
page
)
if
(
!
(
w
page
->
wininfo
->
win_style
&
WS_POPUP
)
&&
wpage
->
page
)
{
{
HLPFILE_MACRO
*
macro
;
HLPFILE_MACRO
*
macro
;
for
(
macro
=
page
->
file
->
first_macro
;
macro
;
macro
=
macro
->
next
)
for
(
macro
=
wpage
->
page
->
file
->
first_macro
;
macro
;
macro
=
macro
->
next
)
MACRO_ExecuteMacro
(
macro
->
lpszMacro
);
MACRO_ExecuteMacro
(
macro
->
lpszMacro
);
for
(
macro
=
page
->
first_macro
;
macro
;
macro
=
macro
->
next
)
for
(
macro
=
wpage
->
page
->
first_macro
;
macro
;
macro
=
macro
->
next
)
MACRO_ExecuteMacro
(
macro
->
lpszMacro
);
MACRO_ExecuteMacro
(
macro
->
lpszMacro
);
}
}
if
(
!
bReUsed
)
if
(
!
bReUsed
)
{
{
win
->
hMainWnd
=
CreateWindowEx
((
bPopup
)
?
WS_EX_TOOLWINDOW
:
0
,
MAIN_WIN_CLASS_NAME
,
win
->
hMainWnd
=
CreateWindowEx
((
bPopup
)
?
WS_EX_TOOLWINDOW
:
0
,
MAIN_WIN_CLASS_NAME
,
wi
->
caption
,
wpage
->
wininfo
->
caption
,
bPrimary
?
WS_OVERLAPPEDWINDOW
:
wi
->
win_style
,
bPrimary
?
WS_OVERLAPPEDWINDOW
:
wpage
->
wininfo
->
win_style
,
wi
->
origin
.
x
,
wi
->
origin
.
y
,
wi
->
size
.
cx
,
wi
->
size
.
cy
,
wpage
->
wininfo
->
origin
.
x
,
wpage
->
wininfo
->
origin
.
y
,
wpage
->
wininfo
->
size
.
cx
,
wpage
->
wininfo
->
size
.
cy
,
bPopup
?
Globals
.
active_win
->
hMainWnd
:
NULL
,
bPopup
?
Globals
.
active_win
->
hMainWnd
:
NULL
,
bPrimary
?
LoadMenu
(
Globals
.
hInstance
,
MAKEINTRESOURCE
(
MAIN_MENU
))
:
0
,
bPrimary
?
LoadMenu
(
Globals
.
hInstance
,
MAKEINTRESOURCE
(
MAIN_MENU
))
:
0
,
Globals
.
hInstance
,
win
);
Globals
.
hInstance
,
win
);
...
@@ -652,13 +655,15 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
...
@@ -652,13 +655,15 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
BOOL
WINHELP_CreateHelpWindowByHash
(
HLPFILE
*
hlpfile
,
LONG
lHash
,
BOOL
WINHELP_CreateHelpWindowByHash
(
HLPFILE
*
hlpfile
,
LONG
lHash
,
HLPFILE_WINDOWINFO
*
wi
,
int
nCmdShow
)
HLPFILE_WINDOWINFO
*
wi
,
int
nCmdShow
)
{
{
HLPFILE_PAGE
*
page
=
NULL
;
WINHELP_WNDPAGE
wpage
;
wpage
.
page
=
NULL
;
if
(
hlpfile
)
if
(
hlpfile
)
page
=
lHash
?
HLPFILE_PageByHash
(
hlpfile
,
lHash
)
:
wpage
.
page
=
lHash
?
HLPFILE_PageByHash
(
hlpfile
,
lHash
)
:
HLPFILE_Contents
(
hlpfile
);
HLPFILE_Contents
(
hlpfile
);
if
(
page
)
page
->
file
->
wRefCount
++
;
if
(
wpage
.
page
)
wpage
.
page
->
file
->
wRefCount
++
;
return
WINHELP_CreateHelpWindow
(
page
,
wi
,
nCmdShow
);
wpage
.
wininfo
=
wi
;
return
WINHELP_CreateHelpWindow
(
&
wpage
,
nCmdShow
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -668,11 +673,12 @@ BOOL WINHELP_CreateHelpWindowByHash(HLPFILE* hlpfile, LONG lHash,
...
@@ -668,11 +673,12 @@ BOOL WINHELP_CreateHelpWindowByHash(HLPFILE* hlpfile, LONG lHash,
BOOL
WINHELP_CreateHelpWindowByMap
(
HLPFILE
*
hlpfile
,
LONG
lMap
,
BOOL
WINHELP_CreateHelpWindowByMap
(
HLPFILE
*
hlpfile
,
LONG
lMap
,
HLPFILE_WINDOWINFO
*
wi
,
int
nCmdShow
)
HLPFILE_WINDOWINFO
*
wi
,
int
nCmdShow
)
{
{
HLPFILE_PAGE
*
page
=
NULL
;
WINHELP_WNDPAGE
wpage
;
page
=
HLPFILE_PageByMap
(
hlpfile
,
lMap
);
wpage
.
page
=
HLPFILE_PageByMap
(
hlpfile
,
lMap
);
if
(
page
)
page
->
file
->
wRefCount
++
;
if
(
wpage
.
page
)
wpage
.
page
->
file
->
wRefCount
++
;
return
WINHELP_CreateHelpWindow
(
page
,
wi
,
nCmdShow
);
wpage
.
wininfo
=
wi
;
return
WINHELP_CreateHelpWindow
(
&
wpage
,
nCmdShow
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -682,11 +688,12 @@ BOOL WINHELP_CreateHelpWindowByMap(HLPFILE* hlpfile, LONG lMap,
...
@@ -682,11 +688,12 @@ BOOL WINHELP_CreateHelpWindowByMap(HLPFILE* hlpfile, LONG lMap,
BOOL
WINHELP_CreateHelpWindowByOffset
(
HLPFILE
*
hlpfile
,
LONG
lOffset
,
BOOL
WINHELP_CreateHelpWindowByOffset
(
HLPFILE
*
hlpfile
,
LONG
lOffset
,
HLPFILE_WINDOWINFO
*
wi
,
int
nCmdShow
)
HLPFILE_WINDOWINFO
*
wi
,
int
nCmdShow
)
{
{
HLPFILE_PAGE
*
page
=
NULL
;
WINHELP_WNDPAGE
wpage
;
page
=
HLPFILE_PageByOffset
(
hlpfile
,
lOffset
);
wpage
.
page
=
HLPFILE_PageByOffset
(
hlpfile
,
lOffset
);
if
(
page
)
page
->
file
->
wRefCount
++
;
if
(
wpage
.
page
)
wpage
.
page
->
file
->
wRefCount
++
;
return
WINHELP_CreateHelpWindow
(
page
,
wi
,
nCmdShow
);
wpage
.
wininfo
=
wi
;
return
WINHELP_CreateHelpWindow
(
&
wpage
,
nCmdShow
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -1266,7 +1273,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
...
@@ -1266,7 +1273,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
GetWindowRect
(
hWnd
,
&
r
);
GetWindowRect
(
hWnd
,
&
r
);
r
.
right
=
r
.
left
+
30
*
tm
.
tmAveCharWidth
;
r
.
right
=
r
.
left
+
30
*
tm
.
tmAveCharWidth
;
r
.
bottom
=
r
.
top
+
(
sizeof
(
win
->
history
)
/
sizeof
(
win
->
history
[
0
]))
*
tm
.
tmHeight
;
r
.
bottom
=
r
.
top
+
(
sizeof
(
Globals
.
history
.
set
)
/
sizeof
(
Globals
.
history
.
set
[
0
]))
*
tm
.
tmHeight
;
AdjustWindowRect
(
&
r
,
GetWindowLong
(
hWnd
,
GWL_STYLE
),
FALSE
);
AdjustWindowRect
(
&
r
,
GetWindowLong
(
hWnd
,
GWL_STYLE
),
FALSE
);
if
(
r
.
left
<
0
)
{
r
.
right
-=
r
.
left
;
r
.
left
=
0
;}
if
(
r
.
left
<
0
)
{
r
.
right
-=
r
.
left
;
r
.
left
=
0
;}
if
(
r
.
top
<
0
)
{
r
.
bottom
-=
r
.
top
;
r
.
top
=
0
;}
if
(
r
.
top
<
0
)
{
r
.
bottom
-=
r
.
top
;
r
.
top
=
0
;}
...
@@ -1279,8 +1286,8 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
...
@@ -1279,8 +1286,8 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
hDc
=
GetDC
(
hWnd
);
hDc
=
GetDC
(
hWnd
);
GetTextMetrics
(
hDc
,
&
tm
);
GetTextMetrics
(
hDc
,
&
tm
);
i
=
HIWORD
(
lParam
)
/
tm
.
tmHeight
;
i
=
HIWORD
(
lParam
)
/
tm
.
tmHeight
;
if
(
i
<
win
->
histI
ndex
)
if
(
i
<
Globals
.
history
.
i
ndex
)
WINHELP_CreateHelpWindow
(
win
->
history
[
i
],
win
->
info
,
SW_SHOW
);
WINHELP_CreateHelpWindow
(
&
Globals
.
history
.
set
[
i
]
,
SW_SHOW
);
ReleaseDC
(
hWnd
,
hDc
);
ReleaseDC
(
hWnd
,
hDc
);
break
;
break
;
case
WM_PAINT
:
case
WM_PAINT
:
...
@@ -1288,10 +1295,10 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
...
@@ -1288,10 +1295,10 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
win
=
(
WINHELP_WINDOW
*
)
GetWindowLongPtr
(
hWnd
,
0
);
win
=
(
WINHELP_WINDOW
*
)
GetWindowLongPtr
(
hWnd
,
0
);
GetTextMetrics
(
hDc
,
&
tm
);
GetTextMetrics
(
hDc
,
&
tm
);
for
(
i
=
0
;
i
<
win
->
histI
ndex
;
i
++
)
for
(
i
=
0
;
i
<
Globals
.
history
.
i
ndex
;
i
++
)
{
{
TextOut
(
hDc
,
0
,
i
*
tm
.
tmHeight
,
win
->
history
[
i
]
->
lpszTitle
,
TextOut
(
hDc
,
0
,
i
*
tm
.
tmHeight
,
Globals
.
history
.
set
[
i
].
page
->
lpszTitle
,
strlen
(
win
->
history
[
i
]
->
lpszTitle
));
strlen
(
Globals
.
history
.
set
[
i
].
page
->
lpszTitle
));
}
}
EndPaint
(
hWnd
,
&
ps
);
EndPaint
(
hWnd
,
&
ps
);
break
;
break
;
...
@@ -1818,13 +1825,8 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
...
@@ -1818,13 +1825,8 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
DeleteObject
(
win
->
hBrush
);
DeleteObject
(
win
->
hBrush
);
for
(
i
=
0
;
i
<
win
->
histIndex
;
i
++
)
for
(
i
=
0
;
i
<
win
->
back
.
index
;
i
++
)
{
HLPFILE_FreeHlpFile
(
win
->
back
.
set
[
i
].
page
->
file
);
HLPFILE_FreeHlpFile
(
win
->
history
[
i
]
->
file
);
}
for
(
i
=
0
;
i
<
win
->
backIndex
;
i
++
)
HLPFILE_FreeHlpFile
(
win
->
back
[
i
]
->
file
);
if
(
win
->
page
)
HLPFILE_FreeHlpFile
(
win
->
page
->
file
);
if
(
win
->
page
)
HLPFILE_FreeHlpFile
(
win
->
page
->
file
);
WINHELP_DeleteLines
(
win
);
WINHELP_DeleteLines
(
win
);
...
...
programs/winhelp/winhelp.h
View file @
6d40dbe3
...
@@ -91,6 +91,19 @@ typedef struct tagHelpButton
...
@@ -91,6 +91,19 @@ typedef struct tagHelpButton
struct
tagHelpButton
*
next
;
struct
tagHelpButton
*
next
;
}
WINHELP_BUTTON
;
}
WINHELP_BUTTON
;
typedef
struct
{
HLPFILE_PAGE
*
page
;
HLPFILE_WINDOWINFO
*
wininfo
;
}
WINHELP_WNDPAGE
;
typedef
struct
tagPageSet
{
/* FIXME: for now it's a fixed size */
WINHELP_WNDPAGE
set
[
40
];
unsigned
index
;
}
WINHELP_PAGESET
;
typedef
struct
tagWinHelp
typedef
struct
tagWinHelp
{
{
LPCSTR
lpszName
;
LPCSTR
lpszName
;
...
@@ -113,11 +126,7 @@ typedef struct tagWinHelp
...
@@ -113,11 +126,7 @@ typedef struct tagWinHelp
HLPFILE_WINDOWINFO
*
info
;
HLPFILE_WINDOWINFO
*
info
;
/* FIXME: for now it's a fixed size */
WINHELP_PAGESET
back
;
HLPFILE_PAGE
*
history
[
40
];
unsigned
histIndex
;
HLPFILE_PAGE
*
back
[
40
];
unsigned
backIndex
;
struct
tagWinHelp
*
next
;
struct
tagWinHelp
*
next
;
}
WINHELP_WINDOW
;
}
WINHELP_WINDOW
;
...
@@ -162,6 +171,7 @@ typedef struct
...
@@ -162,6 +171,7 @@ typedef struct
WINHELP_WINDOW
*
win_list
;
WINHELP_WINDOW
*
win_list
;
WNDPROC
button_proc
;
WNDPROC
button_proc
;
WINHELP_DLL
*
dlls
;
WINHELP_DLL
*
dlls
;
WINHELP_PAGESET
history
;
}
WINHELP_GLOBALS
;
}
WINHELP_GLOBALS
;
extern
WINHELP_GLOBALS
Globals
;
extern
WINHELP_GLOBALS
Globals
;
...
@@ -170,7 +180,7 @@ extern FARPROC Callbacks[];
...
@@ -170,7 +180,7 @@ extern FARPROC Callbacks[];
BOOL
WINHELP_CreateHelpWindowByHash
(
HLPFILE
*
,
LONG
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindowByHash
(
HLPFILE
*
,
LONG
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindowByMap
(
HLPFILE
*
,
LONG
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindowByMap
(
HLPFILE
*
,
LONG
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindowByOffset
(
HLPFILE
*
,
LONG
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindowByOffset
(
HLPFILE
*
,
LONG
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindow
(
HLPFILE_PAGE
*
,
HLPFILE_WINDOWINFO
*
,
int
);
BOOL
WINHELP_CreateHelpWindow
(
WINHELP_WNDPAGE
*
,
int
);
BOOL
WINHELP_GetOpenFileName
(
LPSTR
,
int
);
BOOL
WINHELP_GetOpenFileName
(
LPSTR
,
int
);
BOOL
WINHELP_CreateIndexWindow
(
void
);
BOOL
WINHELP_CreateIndexWindow
(
void
);
INT
WINHELP_MessageBoxIDS
(
UINT
,
UINT
,
WORD
);
INT
WINHELP_MessageBoxIDS
(
UINT
,
UINT
,
WORD
);
...
...
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