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
15f6786b
Commit
15f6786b
authored
May 01, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
May 02, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhelp: Added support for font scaling when using RichEdit.
parent
c3b022ce
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
7 deletions
+149
-7
En.rc
programs/winhelp/En.rc
+23
-0
Fr.rc
programs/winhelp/Fr.rc
+23
-0
hlpfile.c
programs/winhelp/hlpfile.c
+9
-2
hlpfile.h
programs/winhelp/hlpfile.h
+2
-1
winhelp.c
programs/winhelp/winhelp.c
+78
-3
winhelp.h
programs/winhelp/winhelp.h
+1
-0
winhelp_res.h
programs/winhelp/winhelp_res.h
+13
-1
No files found.
programs/winhelp/En.rc
View file @
15f6786b
...
...
@@ -79,3 +79,26 @@ STID_HELP_FILES_HLP, "Help files (*.hlp)"
STID_FILE_NOT_FOUND_s "Cannot find '%s'. Do you want to find this file yourself?"
STID_NO_RICHEDIT "Cannot find a richedit implementation... Aborting"
}
CONTEXT_MENU MENU LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
BEGIN
POPUP ""
BEGIN
MENUITEM "Annotation...", MNID_CTXT_ANNOTATE
MENUITEM "Copy", MNID_CTXT_COPY
MENUITEM "Print...", MNID_CTXT_PRINT
POPUP "Fonts"
BEGIN
MENUITEM "Small", MNID_CTXT_FONTS_SMALL
MENUITEM "Normal", MNID_CTXT_FONTS_NORMAL
MENUITEM "Large", MNID_CTXT_FONTS_LARGE
END
POPUP "Help always visible"
BEGIN
MENUITEM "Default", MNID_CTXT_HELP_DEFAULT
MENUITEM "Visible", MNID_CTXT_HELP_VISIBLE
MENUITEM "Non visible", MNID_CTXT_HELP_NONVISIBLE
END
MENUITEM "Use system colors", MNID_CTXT_SYSTEM_COLORS
END
END
programs/winhelp/Fr.rc
View file @
15f6786b
...
...
@@ -82,3 +82,26 @@ STID_HELP_FILES_HLP, "Fichiers d'aide (*.hlp)"
STID_FILE_NOT_FOUND_s "Impossible de trouver %s. Souhaitez-vous rechercher ce fichier vous-mme?"
STID_NO_RICHEDIT "La bibliothque RichEdit n'a pu tre localise... Abandon"
}
CONTEXT_MENU MENU
BEGIN
POPUP ""
BEGIN
MENUITEM "Annotation...", MNID_CTXT_ANNOTATE
MENUITEM "Copier", MNID_CTXT_COPY
MENUITEM "Imprimer la rubrique...", MNID_CTXT_PRINT
POPUP "Polices"
BEGIN
MENUITEM "Petite", MNID_CTXT_FONTS_SMALL
MENUITEM "Normale", MNID_CTXT_FONTS_NORMAL
MENUITEM "Grande", MNID_CTXT_FONTS_LARGE
END
POPUP "Aide toujours visible"
BEGIN
MENUITEM "Par dfaut", MNID_CTXT_HELP_DEFAULT
MENUITEM "Visible", MNID_CTXT_HELP_VISIBLE
MENUITEM "Non visible", MNID_CTXT_HELP_NONVISIBLE
END
MENUITEM "Utiliser les couleurs systme", MNID_CTXT_SYSTEM_COLORS
END
END
programs/winhelp/hlpfile.c
View file @
15f6786b
...
...
@@ -1289,7 +1289,13 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE
WINE_TRACE
(
"Changing font to %d
\n
"
,
font
);
format
+=
3
;
fs
=
(
4
*
page
->
file
->
fonts
[
font
].
LogFont
.
lfHeight
-
3
)
/
5
;
switch
(
rd
->
font_scale
)
{
case
0
:
fs
=
(
4
*
page
->
file
->
fonts
[
font
].
LogFont
.
lfHeight
-
13
)
/
5
;
break
;
default:
case
1
:
fs
=
(
4
*
page
->
file
->
fonts
[
font
].
LogFont
.
lfHeight
-
3
)
/
5
;
break
;
case
2
:
fs
=
(
4
*
page
->
file
->
fonts
[
font
].
LogFont
.
lfHeight
+
17
)
/
5
;
break
;
}
/* FIXME: missing at least colors, also bold attribute looses information */
sprintf
(
tmp
,
"
\\
f%d
\\
cf%d
\\
fs%d%s%s%s%s"
,
...
...
@@ -1499,7 +1505,7 @@ done:
* HLPFILE_BrowsePage
*
*/
BOOL
HLPFILE_BrowsePage
(
HLPFILE_PAGE
*
page
,
struct
RtfData
*
rd
)
BOOL
HLPFILE_BrowsePage
(
HLPFILE_PAGE
*
page
,
struct
RtfData
*
rd
,
unsigned
font_scale
)
{
HLPFILE
*
hlpfile
=
page
->
file
;
BYTE
*
buf
,
*
end
;
...
...
@@ -1513,6 +1519,7 @@ BOOL HLPFILE_BrowsePage(HLPFILE_PAGE* page, struct RtfData* rd)
rd
->
char_pos
=
0
;
rd
->
first_link
=
rd
->
current_link
=
NULL
;
rd
->
force_color
=
FALSE
;
rd
->
font_scale
=
font_scale
;
switch
(
hlpfile
->
charset
)
{
...
...
programs/winhelp/hlpfile.h
View file @
15f6786b
...
...
@@ -180,9 +180,10 @@ struct RtfData {
unsigned
allocated
;
/* overall allocated size */
unsigned
char_pos
;
/* current char position (in richedit) */
char
*
where
;
/* pointer to feed back richedit */
unsigned
font_scale
;
/* how to scale fonts */
HLPFILE_LINK
*
first_link
;
HLPFILE_LINK
*
current_link
;
BOOL
force_color
;
};
BOOL
HLPFILE_BrowsePage
(
HLPFILE_PAGE
*
,
struct
RtfData
*
rd
);
BOOL
HLPFILE_BrowsePage
(
HLPFILE_PAGE
*
,
struct
RtfData
*
rd
,
unsigned
font_scale
);
programs/winhelp/winhelp.c
View file @
15f6786b
...
...
@@ -591,6 +591,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
win
->
lpszName
=
name
;
win
->
hHandCur
=
LoadCursorW
(
0
,
(
LPWSTR
)
IDC_HAND
);
win
->
back
.
index
=
0
;
win
->
font_scale
=
1
;
}
win
->
page
=
wpage
->
page
;
win
->
info
=
wpage
->
wininfo
;
...
...
@@ -665,6 +666,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
DWORD
mask
=
SendMessage
(
hTextWnd
,
EM_GETEVENTMASK
,
0
,
0
);
RECT
rect
;
win
->
font_scale
=
Globals
.
active_win
->
font_scale
;
WINHELP_SetupText
(
hTextWnd
,
win
,
wpage
->
relative
);
/* we need the window to be shown for richedit to compute the size */
...
...
@@ -862,6 +864,40 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case
MNID_HELP_ABOUT
:
MACRO_About
();
break
;
case
MNID_HELP_WINE
:
ShellAbout
(
hWnd
,
"WINE"
,
"Help"
,
0
);
break
;
/* Context help */
case
MNID_CTXT_ANNOTATE
:
MACRO_Annotate
();
break
;
case
MNID_CTXT_COPY
:
MACRO_CopyDialog
();
break
;
case
MNID_CTXT_PRINT
:
MACRO_Print
();
break
;
case
MNID_CTXT_FONTS_SMALL
:
win
=
(
WINHELP_WINDOW
*
)
GetWindowLongPtr
(
hWnd
,
0
);
if
(
win
->
font_scale
!=
0
)
{
win
->
font_scale
=
0
;
WINHELP_SetupText
(
GetDlgItem
(
hWnd
,
CTL_ID_TEXT
),
win
,
0
/* FIXME */
);
}
break
;
case
MNID_CTXT_FONTS_NORMAL
:
win
=
(
WINHELP_WINDOW
*
)
GetWindowLong
(
hWnd
,
0
);
if
(
win
->
font_scale
!=
1
)
{
win
->
font_scale
=
1
;
WINHELP_SetupText
(
GetDlgItem
(
hWnd
,
CTL_ID_TEXT
),
win
,
0
/* FIXME */
);
}
break
;
case
MNID_CTXT_FONTS_LARGE
:
win
=
(
WINHELP_WINDOW
*
)
GetWindowLong
(
hWnd
,
0
);
if
(
win
->
font_scale
!=
2
)
{
win
->
font_scale
=
2
;
WINHELP_SetupText
(
GetDlgItem
(
hWnd
,
CTL_ID_TEXT
),
win
,
0
/* FIXME */
);
}
break
;
case
MNID_CTXT_HELP_DEFAULT
:
case
MNID_CTXT_HELP_VISIBLE
:
case
MNID_CTXT_HELP_NONVISIBLE
:
case
MNID_CTXT_SYSTEM_COLORS
:
/* FIXME: NIY */
default:
/* Buttons */
for
(
button
=
win
->
first_button
;
button
;
button
=
button
->
next
)
...
...
@@ -934,8 +970,47 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case
EN_MSGFILTER
:
{
const
MSGFILTER
*
msgf
=
(
const
MSGFILTER
*
)
lParam
;
return
WINHELP_HandleTextMouse
((
WINHELP_WINDOW
*
)
GetWindowLong
(
hWnd
,
0
),
msgf
->
msg
,
msgf
->
lParam
);
switch
(
msgf
->
msg
)
{
case
WM_KEYUP
:
if
(
msgf
->
wParam
==
VK_ESCAPE
)
DestroyWindow
(
hWnd
);
break
;
case
WM_RBUTTONDOWN
:
{
HMENU
hMenu
;
POINT
pt
;
win
=
(
WINHELP_WINDOW
*
)
GetWindowLong
(
hWnd
,
0
);
hMenu
=
LoadMenu
(
Globals
.
hInstance
,
(
LPSTR
)
CONTEXT_MENU
);
switch
(
win
->
font_scale
)
{
case
0
:
CheckMenuItem
(
hMenu
,
MNID_CTXT_FONTS_SMALL
,
MF_BYCOMMAND
|
MF_CHECKED
);
break
;
default:
WINE_FIXME
(
"Unsupported %d
\n
"
,
win
->
font_scale
);
case
1
:
CheckMenuItem
(
hMenu
,
MNID_CTXT_FONTS_NORMAL
,
MF_BYCOMMAND
|
MF_CHECKED
);
break
;
case
2
:
CheckMenuItem
(
hMenu
,
MNID_CTXT_FONTS_LARGE
,
MF_BYCOMMAND
|
MF_CHECKED
);
break
;
}
pt
.
x
=
(
int
)(
short
)
LOWORD
(
msgf
->
lParam
);
pt
.
y
=
(
int
)(
short
)
HIWORD
(
msgf
->
lParam
);
ClientToScreen
(
hWnd
,
&
pt
);
TrackPopupMenu
(
GetSubMenu
(
hMenu
,
0
),
TPM_LEFTALIGN
|
TPM_TOPALIGN
,
pt
.
x
,
pt
.
y
,
0
,
hWnd
,
NULL
);
DestroyMenu
(
hMenu
);
}
break
;
default:
return
WINHELP_HandleTextMouse
((
WINHELP_WINDOW
*
)
GetWindowLongPtr
(
hWnd
,
0
),
msgf
->
msg
,
msgf
->
lParam
);
}
}
break
;
...
...
@@ -994,7 +1069,7 @@ static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative
struct
RtfData
rd
;
EDITSTREAM
es
;
if
(
HLPFILE_BrowsePage
(
win
->
page
,
&
rd
))
if
(
HLPFILE_BrowsePage
(
win
->
page
,
&
rd
,
win
->
font_scale
))
{
rd
.
where
=
rd
.
data
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
rd
;
...
...
programs/winhelp/winhelp.h
View file @
15f6786b
...
...
@@ -91,6 +91,7 @@ typedef struct tagWinHelp
HLPFILE_LINK
*
current_link
;
WINHELP_PAGESET
back
;
unsigned
font_scale
;
/* 0 = small, 1 = normal, 2 = large */
struct
tagWinHelp
*
next
;
}
WINHELP_WINDOW
;
...
...
programs/winhelp/winhelp_res.h
View file @
15f6786b
...
...
@@ -13,7 +13,19 @@
#define MNID_HELP_ABOUT 0x141
#define MNID_HELP_WINE 0x142
#define MAIN_MENU 0x10F
#define MNID_CTXT_ANNOTATE 0x200
#define MNID_CTXT_COPY 0x201
#define MNID_CTXT_PRINT 0x202
#define MNID_CTXT_FONTS_SMALL 0x210
#define MNID_CTXT_FONTS_NORMAL 0x211
#define MNID_CTXT_FONTS_LARGE 0x212
#define MNID_CTXT_HELP_DEFAULT 0x220
#define MNID_CTXT_HELP_VISIBLE 0x221
#define MNID_CTXT_HELP_NONVISIBLE 0x222
#define MNID_CTXT_SYSTEM_COLORS 0x230
#define MAIN_MENU 0xF000
#define CONTEXT_MENU 0xF001
#define STID_WINE_HELP 0x120
#define STID_WHERROR 0x121
...
...
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