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
0587a472
Commit
0587a472
authored
May 21, 2002
by
Eric Pouech
Committed by
Alexandre Julliard
May 21, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow ANSI charset in font enumeration.
Added ability not to close the wineconsole on console object destruction.
parent
9259cfa8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
40 deletions
+56
-40
dialog.c
programs/wineconsole/dialog.c
+6
-19
registry.c
programs/wineconsole/registry.c
+9
-0
user.c
programs/wineconsole/user.c
+40
-21
winecon_private.h
programs/wineconsole/winecon_private.h
+1
-0
No files found.
programs/wineconsole/dialog.c
View file @
0587a472
...
...
@@ -409,25 +409,23 @@ static int CALLBACK font_enum(const LOGFONT* lf, const TEXTMETRIC* tm,
DWORD
FontType
,
LPARAM
lParam
)
{
struct
dialog_info
*
di
=
(
struct
dialog_info
*
)
lParam
;
HDC
hdc
;
WCUSER_DumpLogFont
(
"
font
"
,
lf
,
FontType
);
if
(
WCUSER_ValidateFont
(
di
->
data
,
lf
)
&&
(
hdc
=
GetDC
(
di
->
hDlg
))
)
WCUSER_DumpLogFont
(
"
DlgFamily:
"
,
lf
,
FontType
);
if
(
WCUSER_ValidateFont
(
di
->
data
,
lf
))
{
if
(
FontType
&
RASTER_FONTTYPE
)
{
di
->
nFont
=
0
;
EnumFontFamilies
(
hdc
,
lf
->
lfFaceName
,
font_enum_size2
,
(
LPARAM
)
di
);
EnumFontFamilies
(
PRIVATE
(
di
->
data
)
->
hMemDC
,
lf
->
lfFaceName
,
font_enum_size2
,
(
LPARAM
)
di
);
}
else
di
->
nFont
=
1
;
if
(
di
->
nFont
)
{
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_ADDSTRING
,
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_ADDSTRING
,
0
,
(
LPARAM
)
lf
->
lfFaceName
);
}
ReleaseDC
(
di
->
hDlg
,
hdc
);
}
return
1
;
...
...
@@ -552,24 +550,19 @@ static BOOL select_font(struct dialog_info* di)
*/
static
BOOL
fill_list_size
(
struct
dialog_info
*
di
,
BOOL
doInit
)
{
HDC
hdc
;
int
idx
;
WCHAR
lfFaceName
[
LF_FACESIZE
];
idx
=
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_GETCURSEL
,
0L
,
0L
);
if
(
idx
<
0
)
return
FALSE
;
hdc
=
GetDC
(
di
->
hDlg
);
if
(
!
hdc
)
return
FALSE
;
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_GETTEXT
,
idx
,
(
LPARAM
)
lfFaceName
);
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_SIZE
,
LB_RESETCONTENT
,
0L
,
0L
);
if
(
di
->
font
)
HeapFree
(
GetProcessHeap
(),
0
,
di
->
font
);
di
->
nFont
=
0
;
di
->
font
=
NULL
;
EnumFontFamilies
(
hdc
,
lfFaceName
,
font_enum_size
,
(
LPARAM
)
di
);
ReleaseDC
(
di
->
hDlg
,
hdc
);
EnumFontFamilies
(
PRIVATE
(
di
->
data
)
->
hMemDC
,
lfFaceName
,
font_enum_size
,
(
LPARAM
)
di
);
if
(
doInit
)
{
...
...
@@ -601,14 +594,8 @@ static BOOL fill_list_size(struct dialog_info* di, BOOL doInit)
*/
static
BOOL
fill_list_font
(
struct
dialog_info
*
di
)
{
HDC
hdc
;
hdc
=
GetDC
(
di
->
hDlg
);
if
(
!
hdc
)
return
FALSE
;
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_RESETCONTENT
,
0L
,
0L
);
EnumFontFamilies
(
hdc
,
NULL
,
font_enum
,
(
LPARAM
)
di
);
ReleaseDC
(
di
->
hDlg
,
hdc
);
EnumFontFamilies
(
PRIVATE
(
di
->
data
)
->
hMemDC
,
NULL
,
font_enum
,
(
LPARAM
)
di
);
if
(
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_SELECTSTRING
,
(
WPARAM
)
-
1
,
(
LPARAM
)
di
->
config
->
face_name
)
==
LB_ERR
)
SendDlgItemMessage
(
di
->
hDlg
,
IDC_FNT_LIST_FONT
,
LB_SETCURSEL
,
0L
,
0L
);
...
...
programs/wineconsole/registry.c
View file @
0587a472
...
...
@@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wineconsole);
static
const
WCHAR
wszConsole
[]
=
{
'C'
,
'o'
,
'n'
,
's'
,
'o'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
wszCursorSize
[]
=
{
'C'
,
'u'
,
'r'
,
's'
,
'o'
,
'r'
,
'S'
,
'i'
,
'z'
,
'e'
,
0
};
static
const
WCHAR
wszCursorVisible
[]
=
{
'C'
,
'u'
,
'r'
,
's'
,
'o'
,
'r'
,
'V'
,
'i'
,
's'
,
'i'
,
'b'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
wszExitOnDie
[]
=
{
'E'
,
'x'
,
'i'
,
't'
,
'O'
,
'n'
,
'D'
,
'i'
,
'e'
,
0
};
static
const
WCHAR
wszFaceName
[]
=
{
'F'
,
'a'
,
'c'
,
'e'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
wszFontSize
[]
=
{
'F'
,
'o'
,
'n'
,
't'
,
'S'
,
'i'
,
'z'
,
'e'
,
0
};
static
const
WCHAR
wszFontWeight
[]
=
{
'F'
,
'o'
,
'n'
,
't'
,
'W'
,
'e'
,
'i'
,
'g'
,
'h'
,
't'
,
0
};
...
...
@@ -64,6 +65,11 @@ BOOL WINECON_RegLoad(struct config_data* cfg)
val
=
1
;
cfg
->
cursor_visible
=
val
;
count
=
sizeof
(
val
);
if
(
!
hConKey
||
RegQueryValueEx
(
hConKey
,
wszExitOnDie
,
0
,
&
type
,
(
char
*
)
&
val
,
&
count
))
val
=
1
;
cfg
->
exit_on_die
=
val
;
count
=
sizeof
(
cfg
->
face_name
);
if
(
!
hConKey
||
RegQueryValueEx
(
hConKey
,
wszFaceName
,
0
,
&
type
,
(
char
*
)
&
cfg
->
face_name
,
&
count
))
cfg
->
face_name
[
0
]
=
0
;
...
...
@@ -139,6 +145,9 @@ BOOL WINECON_RegSave(const struct config_data* cfg)
val
=
cfg
->
cursor_visible
;
RegSetValueEx
(
hConKey
,
wszCursorVisible
,
0
,
REG_DWORD
,
(
char
*
)
&
val
,
sizeof
(
val
));
val
=
cfg
->
exit_on_die
;
RegSetValueEx
(
hConKey
,
wszExitOnDie
,
0
,
REG_DWORD
,
(
char
*
)
&
val
,
sizeof
(
val
));
RegSetValueEx
(
hConKey
,
wszFaceName
,
0
,
REG_SZ
,
(
char
*
)
&
cfg
->
face_name
,
sizeof
(
cfg
->
face_name
));
val
=
MAKELONG
(
cfg
->
cell_width
,
cfg
->
cell_height
);
...
...
programs/wineconsole/user.c
View file @
0587a472
...
...
@@ -64,7 +64,7 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_
for
(
i
=
0
;
i
<
data
->
curcfg
.
sb_width
;
i
++
)
{
attr
=
cell
[
i
].
Attributes
;
SetBkColor
(
PRIVATE
(
data
)
->
hMemDC
,
WCUSER_ColorMap
[(
attr
>>
4
)
&
0x0F
]);
SetBkColor
(
PRIVATE
(
data
)
->
hMemDC
,
WCUSER_ColorMap
[(
attr
>>
4
)
&
0x0F
]);
SetTextColor
(
PRIVATE
(
data
)
->
hMemDC
,
WCUSER_ColorMap
[
attr
&
0x0F
]);
for
(
k
=
i
;
k
<
data
->
curcfg
.
sb_width
&&
cell
[
k
].
Attributes
==
attr
;
k
++
)
{
...
...
@@ -90,7 +90,8 @@ static void WCUSER_NewBitmap(struct inner_data* data, BOOL fill)
HDC
hDC
;
HBITMAP
hnew
,
hold
;
if
(
!
data
->
curcfg
.
sb_width
||
!
data
->
curcfg
.
sb_height
||
!
(
hDC
=
GetDC
(
PRIVATE
(
data
)
->
hWnd
)))
if
(
!
data
->
curcfg
.
sb_width
||
!
data
->
curcfg
.
sb_height
||
!
PRIVATE
(
data
)
->
hFont
||
!
(
hDC
=
GetDC
(
PRIVATE
(
data
)
->
hWnd
)))
return
;
hnew
=
CreateCompatibleBitmap
(
hDC
,
data
->
curcfg
.
sb_width
*
data
->
curcfg
.
cell_width
,
...
...
@@ -328,7 +329,7 @@ BOOL WCUSER_ValidateFontMetric(const struct inner_data* data, const TEXTMETRIC*
ret
=
(
tm
->
tmMaxCharWidth
*
data
->
curcfg
.
win_width
<
GetSystemMetrics
(
SM_CXSCREEN
)
&&
tm
->
tmHeight
*
data
->
curcfg
.
win_height
<
GetSystemMetrics
(
SM_CYSCREEN
));
return
ret
&&
!
tm
->
tmItalic
&&
!
tm
->
tmUnderlined
&&
!
tm
->
tmStruckOut
&&
(
tm
->
tmCharSet
==
DEFAULT_CHARSET
/*|| tm->tmCharSet == ANSI_CHARSET*/
);
(
tm
->
tmCharSet
==
DEFAULT_CHARSET
||
tm
->
tmCharSet
==
ANSI_CHARSET
);
}
/******************************************************************
...
...
@@ -355,19 +356,31 @@ static int CALLBACK get_first_font_enum_2(const LOGFONT* lf, const TEXTMETRIC* t
struct
font_chooser
*
fc
=
(
struct
font_chooser
*
)
lParam
;
WCUSER_DumpTextMetric
(
tm
,
FontType
);
if
(
WCUSER_ValidateFontMetric
(
fc
->
data
,
tm
,
FontType
)
&&
WCUSER_SetFont
(
fc
->
data
,
lf
))
if
(
WCUSER_ValidateFontMetric
(
fc
->
data
,
tm
,
FontType
))
{
fc
->
done
=
1
;
/* since we've modified the current config with new font information,
* set it as the new default.
* Force also its writing back to the registry so that we can get it
* the next time
LOGFONT
mlf
=
*
lf
;
/* Use the default sizes for the font (this is needed, especially for
* TrueType fonts, so that we get a decent size, not the max size)
*/
fc
->
data
->
defcfg
=
fc
->
data
->
curcfg
;
WINECON_RegSave
(
&
fc
->
data
->
defcfg
);
return
0
;
mlf
.
lfWidth
=
fc
->
data
->
curcfg
.
cell_width
;
mlf
.
lfHeight
=
fc
->
data
->
curcfg
.
cell_height
;
if
(
WCUSER_SetFont
(
fc
->
data
,
&
mlf
))
{
WCUSER_DumpLogFont
(
"InitChoosing: "
,
&
mlf
,
FontType
);
fc
->
done
=
1
;
/* since we've modified the current config with new font information,
* set this information as the new default.
*/
fc
->
data
->
defcfg
.
cell_width
=
fc
->
data
->
curcfg
.
cell_width
;
fc
->
data
->
defcfg
.
cell_height
=
fc
->
data
->
curcfg
.
cell_height
;
lstrcpyW
(
fc
->
data
->
defcfg
.
face_name
,
fc
->
data
->
curcfg
.
face_name
);
/* Force also its writing back to the registry so that we can get it
* the next time.
*/
WINECON_RegSave
(
&
fc
->
data
->
defcfg
);
return
0
;
}
}
return
1
;
}
...
...
@@ -377,8 +390,7 @@ static int CALLBACK get_first_font_enum(const LOGFONT* lf, const TEXTMETRIC* tm,
{
struct
font_chooser
*
fc
=
(
struct
font_chooser
*
)
lParam
;
WCUSER_DumpLogFont
(
"init"
,
lf
,
FontType
);
WCUSER_DumpLogFont
(
"InitFamily: "
,
lf
,
FontType
);
if
(
WCUSER_ValidateFont
(
fc
->
data
,
lf
))
{
EnumFontFamilies
(
PRIVATE
(
fc
->
data
)
->
hMemDC
,
lf
->
lfFaceName
,
...
...
@@ -431,7 +443,8 @@ HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf)
{
if
(
buf
[
j
]
!=
w
)
{
WINE_WARN
(
"Non uniform cell width: [%d]=%d [%d]=%d
\n
"
,
WINE_WARN
(
"Non uniform cell width: [%d]=%d [%d]=%d
\n
"
"This may be caused by old freetype libraries, >= 2.0.8 is recommended
\n
"
,
i
+
j
,
buf
[
j
],
tm
.
tmFirstChar
,
w
);
goto
err
;
}
...
...
@@ -515,6 +528,7 @@ static BOOL WCUSER_InitFont(struct inner_data* data)
{
struct
font_chooser
fc
;
WINE_TRACE_
(
wc_font
)(
"=> %s
\n
"
,
wine_dbgstr_wn
(
data
->
curcfg
.
face_name
,
-
1
));
if
(
data
->
curcfg
.
face_name
[
0
]
!=
'\0'
&&
data
->
curcfg
.
cell_height
!=
0
&&
data
->
curcfg
.
font_weight
!=
0
)
...
...
@@ -525,7 +539,11 @@ static BOOL WCUSER_InitFont(struct inner_data* data)
data
->
curcfg
.
cell_height
,
data
->
curcfg
.
font_weight
);
if
(
PRIVATE
(
data
)
->
hFont
!=
0
)
WINE_FIXME
(
"Oh strange
\n
"
);
if
(
WCUSER_SetFont
(
data
,
&
lf
))
return
TRUE
;
if
(
WCUSER_SetFont
(
data
,
&
lf
))
{
WCUSER_DumpLogFont
(
"InitReuses: "
,
&
lf
,
0
);
return
TRUE
;
}
}
/* try to find an acceptable font */
...
...
@@ -533,6 +551,7 @@ static BOOL WCUSER_InitFont(struct inner_data* data)
fc
.
data
=
data
;
fc
.
done
=
0
;
EnumFontFamilies
(
PRIVATE
(
data
)
->
hMemDC
,
NULL
,
get_first_font_enum
,
(
LPARAM
)
&
fc
);
if
(
!
fc
.
done
)
WINE_WARN
(
"Couldn't find a decent font, aborting
\n
"
);
return
fc
.
done
;
}
...
...
@@ -1308,10 +1327,10 @@ static LRESULT CALLBACK WCUSER_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
void
WCUSER_DeleteBackend
(
struct
inner_data
*
data
)
{
if
(
!
PRIVATE
(
data
))
return
;
if
(
PRIVATE
(
data
)
->
hMemDC
)
DeleteDC
(
PRIVATE
(
data
)
->
hMemDC
);
if
(
PRIVATE
(
data
)
->
hWnd
)
DestroyWindow
(
PRIVATE
(
data
)
->
hWnd
);
if
(
PRIVATE
(
data
)
->
hFont
)
DeleteObject
(
PRIVATE
(
data
)
->
hFont
);
if
(
PRIVATE
(
data
)
->
cursor_bitmap
)
DeleteObject
(
PRIVATE
(
data
)
->
cursor_bitmap
);
if
(
PRIVATE
(
data
)
->
hMemDC
)
DeleteDC
(
PRIVATE
(
data
)
->
hMemDC
);
if
(
PRIVATE
(
data
)
->
hBitmap
)
DeleteObject
(
PRIVATE
(
data
)
->
hBitmap
);
HeapFree
(
GetProcessHeap
(),
0
,
PRIVATE
(
data
));
}
...
...
@@ -1330,8 +1349,8 @@ static int WCUSER_MainLoop(struct inner_data* data)
switch
(
MsgWaitForMultipleObjects
(
1
,
&
data
->
hSynchro
,
FALSE
,
INFINITE
,
QS_ALLINPUT
))
{
case
WAIT_OBJECT_0
:
if
(
!
WINECON_GrabChanges
(
data
))
PostQuitMessage
(
0
);
if
(
!
WINECON_GrabChanges
(
data
)
&&
data
->
curcfg
.
exit_on_die
)
PostQuitMessage
(
0
);
break
;
case
WAIT_OBJECT_0
+
1
:
switch
(
GetMessage
(
&
msg
,
0
,
0
,
0
))
...
...
programs/wineconsole/winecon_private.h
View file @
0587a472
...
...
@@ -40,6 +40,7 @@ struct config_data {
unsigned
win_width
;
/* size (in cells) of visible part of window (width & height) */
unsigned
win_height
;
COORD
win_pos
;
/* position (in cells) of visible part of screen buffer in window */
BOOL
exit_on_die
;
/* whether the wineconsole should quit if server destroys the console */
};
struct
inner_data
{
...
...
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