From: Dirk B. <db...@us...> - 2005-01-23 16:34:28
|
Update of /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fConsole In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28311/extsrc/w32fConsole Modified Files: Console.def Console.rc Term.cpp Log Message: dbu: New word SetConsoleFont ( hFont -- ) to set the font for the console window added Index: Console.rc =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fConsole/Console.rc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Console.rc 23 Jan 2005 09:02:34 -0000 1.3 --- Console.rc 23 Jan 2005 16:34:19 -0000 1.4 *************** *** 55,60 **** VS_VERSION_INFO VERSIONINFO ! FILEVERSION 6,11,0,17 ! PRODUCTVERSION 6,11,0,17 FILEFLAGSMASK 0x3fL #ifdef _DEBUG --- 55,60 ---- VS_VERSION_INFO VERSIONINFO ! FILEVERSION 6,11,0,18 ! PRODUCTVERSION 6,11,0,18 FILEFLAGSMASK 0x3fL #ifdef _DEBUG *************** *** 74,78 **** VALUE "CompanyName", "Win32Forth developer team\0" VALUE "FileDescription", "Win32Forth console\0" ! VALUE "FileVersion", "6, 11, 0, 17\0" VALUE "InternalName", "CONSOLE\0" VALUE "LegalCopyright", "\0" --- 74,78 ---- VALUE "CompanyName", "Win32Forth developer team\0" VALUE "FileDescription", "Win32Forth console\0" ! VALUE "FileVersion", "6, 11, 0, 18\0" VALUE "InternalName", "CONSOLE\0" VALUE "LegalCopyright", "\0" *************** *** 81,85 **** VALUE "PrivateBuild", "\0" VALUE "ProductName", "Win32Forth\0" ! VALUE "ProductVersion", "6, 11, 0, 17\0" VALUE "SpecialBuild", "\0" END --- 81,85 ---- VALUE "PrivateBuild", "\0" VALUE "ProductName", "Win32Forth\0" ! VALUE "ProductVersion", "6, 11, 0, 18\0" VALUE "SpecialBuild", "\0" END Index: Console.def =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fConsole/Console.def,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Console.def 22 Dec 2004 20:25:25 -0000 1.1 --- Console.def 23 Jan 2005 16:34:19 -0000 1.2 *************** *** 32,33 **** --- 32,34 ---- c_getbg c_sizestate + c_setfont Index: Term.cpp =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fConsole/Term.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Term.cpp 23 Jan 2005 09:02:34 -0000 1.3 --- Term.cpp 23 Jan 2005 16:34:19 -0000 1.4 *************** *** 110,113 **** --- 110,146 ---- } + //************************************************************************************************* + // RegReadKey + //************************************************************************************************* + char *RegReadKey( const char *pszValue, char *pszString, unsigned nStringLen ) + { + *pszString = 0; + + HKEY theKey = RegGetKey(); + if( theKey ) + { + DWORD slen = nStringLen; + DWORD ktype; + RegQueryValueEx( theKey, pszValue, NULL, &ktype, (unsigned char *)pszString, &slen ); + RegCloseKey( theKey ); + } + + return pszString; + } + + //************************************************************************************************* + // RegReadKey + //************************************************************************************************* + int RegReadKey( const char *pszValue, int *pInt ) + { + *pInt = 0; + + char szInt[64] = ""; + if( *RegReadKey( pszValue, szInt, sizeof(szInt) ) != 0 ) + *pInt = atoi( szInt ); + + return *pInt; + } + //################################################################################################# //################################################################################################# *************** *** 811,814 **** --- 844,870 ---- //************************************************************************************************* + // Set the Font for the console window + //************************************************************************************************* + int APIENTRY c_setfont( int iFont ) + { + HFONT hFont = (HFONT)iFont; + if( hFont == NULL ) + hFont = (HFONT)GetStockObject( ANSI_FIXED_FONT ); + + + HDC hdc = GetDC( hWndConsole ); + if( hdc ) + { + DeleteObject( SelectObject( hdc, hFont ) ); + SIZE Size; + GetTextExtentPoint32( hdc, "a", 1 , &Size ); + ReleaseDC( hWndConsole, hdc ); + + c_setcharwh( Size.cy, Size.cx ); + } + return 0; + } + + //************************************************************************************************* // Main Window Procedure //************************************************************************************************* *************** *** 835,839 **** if( hWndConsole != NULL ) ! { c_setfgbg( -1, -1 ); SetScrollRange( hWndConsole, SB_VERT, 0, maxrows, FALSE ); --- 891,896 ---- if( hWndConsole != NULL ) ! { ! c_setfont( 0 ); c_setfgbg( -1, -1 ); SetScrollRange( hWndConsole, SB_VERT, 0, maxrows, FALSE ); *************** *** 947,951 **** { PAINTSTRUCT ps ; - SIZE Size; switch( message ) --- 1004,1007 ---- *************** *** 956,968 **** case WM_CREATE: { - hdc = GetDC (hwnd); - - SelectObject( hdc, GetStockObject(ANSI_FIXED_FONT) ); - GetTextExtentPoint32( hdc, "a", 1 , &Size ); - charW = Size.cx; - charH = Size.cy; - - ReleaseDC( hwnd, hdc ); - return 0; } --- 1012,1015 ---- *************** *** 1165,1174 **** // get console window pos from registry ! BYTE s[512]; ! DWORD slen = sizeof(s); ! DWORD ktype; ! HKEY theKey = RegGetKey(); ! RegQueryValueEx( theKey, "Console", NULL, &ktype, s, &slen ); ! RegCloseKey (theKey); RECT pos; memset( &pos, 0, sizeof(pos) ); // bugfix for SF-Request ID 762961 July 2nd, 2003 - 17:51 dbu --- 1212,1217 ---- // get console window pos from registry ! char s[512] = ""; ! RegReadKey( "Console", s, sizeof(s) ); RECT pos; memset( &pos, 0, sizeof(pos) ); // bugfix for SF-Request ID 762961 July 2nd, 2003 - 17:51 dbu |