changeset 1036:c2013f1ef354

Remove creation of bold default font at startup. Remove setting bold font on groupbox title. Change dw_window_get_font() to use grouphwnd for groupbox; doesn't work however.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 26 May 2011 07:49:54 +0000
parents 31dc5b4f6cfc
children 6ad811834512
files win/dw.c
diffstat 1 files changed, 23 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Thu May 26 06:08:14 2011 +0000
+++ b/win/dw.c	Thu May 26 07:49:54 2011 +0000
@@ -39,9 +39,6 @@
 DWTID _dwtid = -1;
 SECURITY_DESCRIPTOR _dwsd;
 
-static HFONT DefaultBoldFont;
-static LOGFONT lfDefaultBoldFont = { 0 };
-
 #define PACKVERSION(major,minor) MAKELONG(minor,major)
 
 #define IS_XPPLUS (dwComctlVer >= PACKVERSION(5,82))
@@ -3674,13 +3671,6 @@
     */
    screenx = GetSystemMetrics(SM_CXSCREEN);
    screeny = GetSystemMetrics(SM_CYSCREEN);
-   /*
-    * Create a default bold font
-    */
-   oldfont = GetStockObject(DEFAULT_GUI_FONT);
-   GetObject( oldfont, sizeof(lfDefaultBoldFont), &lfDefaultBoldFont );
-   lfDefaultBoldFont.lfWeight = FW_BOLD;
-   DefaultBoldFont = CreateFontIndirect(&lfDefaultBoldFont);
    return 0;
 }
 
@@ -4123,12 +4113,25 @@
  */
 char * API dw_window_get_font(HWND handle)
 {
-   HFONT oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0);
+   HFONT oldfont = NULL;
    char *str = NULL;
    char *bold = "";
    char *italic = "";
    LOGFONT lf = { 0 };
-
+   Box *thisbox;
+   char tmpbuf[100];
+
+   GetClassName(handle, tmpbuf, 99);
+   if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)) == 0 )
+   {
+      /* groupbox */
+      thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA );
+      if ( thisbox && thisbox->grouphwnd != (HWND)NULL )
+      {
+         handle = thisbox->grouphwnd;
+      }
+   }
+   oldfont = (HFONT)SendMessage(handle, WM_GETFONT, 0, 0);
    if ( GetObject( oldfont, sizeof(lf), &lf ) )
    {
       str = (char *)malloc( 100 );
@@ -4500,10 +4503,7 @@
                             NULL);
 
    SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox);
-   /*
-    * Set the text on the frame to our default bold font
-    */
-   SendMessage(newbox->grouphwnd, WM_SETFONT, (WPARAM)DefaultBoldFont, (LPARAM)TRUE);
+fprintf(stderr,"in groupbox\n");
    return hwndframe;
 }
 
@@ -5821,17 +5821,17 @@
    int len;
 
    GetClassName(handle, tmpbuf, 99);
-   
+
    if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 )
    {
       ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
-      
+
       if( cinfo && cinfo->buddy )
         handle = cinfo->buddy;
       else
         return NULL;
    }
-   
+
    len = GetWindowTextLength(handle);
    tempbuf = calloc(1, len + 2);
 
@@ -8299,7 +8299,7 @@
 
    value = _internal_color(value);
    foreground = RGB(DW_RED_VALUE(value), DW_GREEN_VALUE(value), DW_BLUE_VALUE(value));
-   
+
    DeleteObject(hPen);
    DeleteObject(hBrush);
    TlsSetValue(_foreground, (LPVOID)foreground);
@@ -8677,7 +8677,7 @@
         return 0;
     }
 
-    if(header.bfType != 'MB')	/* Check for BM reversed... */
+    if(header.bfType != 'MB') /* Check for BM reversed... */
     {
         /* Not a bitmap file */
         fclose(fp);
@@ -9389,7 +9389,6 @@
  */
 void API dw_exit(int exitcode)
 {
-   DeleteObject( DefaultBoldFont );
    OleUninitialize();
    if ( dbgfp != NULL )
    {
@@ -10014,12 +10013,12 @@
     if(!_user_dir[0])
     {
         HANDLE hToken = 0;
-        
+
         /* Use the Windows API to get the user's profile directory */
         if(OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
         {
             DWORD BufSize = 1024;
-        
+
             GetUserProfileDirectory(hToken, _user_dir, &BufSize);
             CloseHandle(hToken);
         }