В сообщении от Thursday 20 December 2007 15:28:32 вы написали:
> "Ivan Sinitsin" <[EMAIL PROTECTED]> wrote:
> > + if( RegQueryValueExW( hKey, reg_logfont, NULL, &type,
> > + (LPBYTE) &logfont, &size ) !=
> > ERROR_SUCCESS ) { + hFont=GetStockObject(DEFAULT_GUI_FONT);
> > + GetObject(hFont,sizeof(logfont),&logfont);
> > + }
>
> There is no need to introduce the hFont variable.
>
> > + GetObject(Globals.hfont, sizeof(logfont), &logfont);
>
> To make the code more readable this call should be moved where logfont
> is actually used.
>
> > + RegSetValueExW( hKey, reg_logfont, 0, REG_DWORD,
> > + (LPBYTE) &logfont, sizeof(LOGFONT) );
>
> The type should be set to REG_BINARY.
I have corrected the mistakes.
Do I understand you right?
----------------------
Sinitsin Ivan
Index: programs/winefile/winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.81
diff -u -p -u -r1.81 winefile.c
--- programs/winefile/winefile.c 26 Jul 2007 11:38:42 -0000 1.81
+++ programs/winefile/winefile.c 20 Dec 2007 12:53:23 -0000
@@ -66,6 +66,7 @@ static const WCHAR reg_start_x[] = { 's'
static const WCHAR reg_start_y[] = { 's','t','a','r','t','Y','\0'};
static const WCHAR reg_width[] = { 'w','i','d','t','h','\0'};
static const WCHAR reg_height[] = { 'h','e','i','g','h','t','\0'};
+static const WCHAR reg_logfont[] = { 'l','o','g','f','o','n','t','\0'};
enum ENTRY_TYPE {
ET_WINDOWS,
@@ -1645,6 +1646,7 @@ static windowOptions load_registry_setti
DWORD type;
HKEY hKey;
windowOptions opts;
+ LOGFONT logfont;
RegOpenKeyExW( HKEY_CURRENT_USER, registry_key,
0, KEY_QUERY_VALUE, &hKey );
@@ -1666,9 +1668,14 @@ static windowOptions load_registry_setti
if( RegQueryValueExW( hKey, reg_height, NULL, &type,
(LPBYTE) &opts.height, &size ) != ERROR_SUCCESS )
opts.height = CW_USEDEFAULT;
+ size=sizeof(logfont);
+ if( RegQueryValueExW( hKey, reg_logfont, NULL, &type,
+ (LPBYTE) &logfont, &size ) != ERROR_SUCCESS )
+ GetObject(GetStockObject(DEFAULT_GUI_FONT),sizeof(logfont),&logfont);
RegCloseKey( hKey );
+ Globals.hfont = CreateFontIndirect(&logfont);
return opts;
}
@@ -1677,6 +1684,7 @@ static void save_registry_settings(void)
WINDOWINFO wi;
HKEY hKey;
INT width, height;
+ LOGFONT logfont;
wi.cbSize = sizeof( WINDOWINFO );
GetWindowInfo(Globals.hMainWnd, &wi);
@@ -1704,6 +1712,9 @@ static void save_registry_settings(void)
(LPBYTE) &width, sizeof(DWORD) );
RegSetValueExW( hKey, reg_height, 0, REG_DWORD,
(LPBYTE) &height, sizeof(DWORD) );
+ GetObject(Globals.hfont, sizeof(logfont), &logfont);
+ RegSetValueExW( hKey, reg_logfont, 0, REG_BINARY,
+ (LPBYTE) &logfont, sizeof(LOGFONT) );
/* TODO: Save more settings here (List vs. Detailed View, etc.) */
RegCloseKey( hKey );