wine/programs/wineconsole winecon_user.h user. ...

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 3 03:51:00 CST 2005


ChangeSet ID:	21065
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/03 03:51:00

Modified files:
	programs/wineconsole: winecon_user.h user.c dialog.c 

Log message:
	Eric Pouech <eric.pouech at wanadoo.fr>
	Now filling external leading in font cells.

Patch: http://cvs.winehq.org/patch.py?id=21065

Old revision  New revision  Changes     Path
 1.8           1.9           +3 -1       wine/programs/wineconsole/winecon_user.h
 1.25          1.26          +17 -2      wine/programs/wineconsole/user.c
 1.21          1.22          +2 -2       wine/programs/wineconsole/dialog.c

Index: wine/programs/wineconsole/winecon_user.h
diff -u -p wine/programs/wineconsole/winecon_user.h:1.8 wine/programs/wineconsole/winecon_user.h:1.9
--- wine/programs/wineconsole/winecon_user.h:1.8	3 Nov 2005  9:51: 0 -0000
+++ wine/programs/wineconsole/winecon_user.h	3 Nov 2005  9:51: 0 -0000
@@ -30,6 +30,7 @@ struct inner_data_user {
     /* the following fields are only user by the USER backend (should be hidden in user) */
     HWND		hWnd;		/* handle to windows for rendering */
     HFONT		hFont;		/* font used for rendering, usually fixed */
+    LONG                ext_leading;    /* external leading for hFont */
     HDC			hMemDC;		/* memory DC holding the bitmap below */
     HBITMAP		hBitmap;	/* bitmap of display window content */
     HMENU               hPopMenu;       /* popup menu triggered by right mouse click */
@@ -50,7 +51,8 @@ extern BOOL WCUSER_ValidateFontMetric(co
                                       const TEXTMETRIC* tm, DWORD fontType);
 extern BOOL WCUSER_AreFontsEqual(const struct config_data* config,
                                  const LOGFONT* lf);
-extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf);
+extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf,
+                             LONG* el);
 extern void WCUSER_FillLogFont(LOGFONT* lf, const WCHAR* name,
                                UINT height, UINT weight);
 
Index: wine/programs/wineconsole/user.c
diff -u -p wine/programs/wineconsole/user.c:1.25 wine/programs/wineconsole/user.c:1.26
--- wine/programs/wineconsole/user.c:1.25	3 Nov 2005  9:51: 0 -0000
+++ wine/programs/wineconsole/user.c	3 Nov 2005  9:51: 0 -0000
@@ -50,6 +50,8 @@ static void WCUSER_FillMemDC(const struc
     HFONT		hOldFont;
     WORD		attr;
     WCHAR*		line;
+    RECT                r;
+    HBRUSH              hbr;
 
     /* no font has been set up yet, don't worry about filling the bitmap,
      * we'll do it once a font is chosen
@@ -77,6 +79,16 @@ static void WCUSER_FillMemDC(const struc
 	    }
 	    TextOut(PRIVATE(data)->hMemDC, i * data->curcfg.cell_width, j * data->curcfg.cell_height,
 		    line, k - i);
+            if (PRIVATE(data)->ext_leading && 
+                (hbr = CreateSolidBrush(WCUSER_ColorMap[(attr>>4)&0x0F])))
+            {
+                r.left   = i * data->curcfg.cell_width;
+                r.top    = (j + 1) * data->curcfg.cell_height - PRIVATE(data)->ext_leading;
+                r.right  = k * data->curcfg.cell_width;
+                r.bottom = (j + 1) * data->curcfg.cell_height;
+                FillRect(PRIVATE(data)->hMemDC, &r, hbr);
+                DeleteObject(hbr);
+            }
 	    i = k - 1;
 	}
     }
@@ -410,7 +422,7 @@ static int CALLBACK get_first_font_enum(
  * get the relevant information from the font described in lf and store them
  * in config
  */
-HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf)
+HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf, LONG* el)
 {
     TEXTMETRIC  tm;
     HDC         hDC;
@@ -461,6 +473,7 @@ HFONT WCUSER_CopyFont(struct config_data
     config->cell_height = tm.tmHeight + tm.tmExternalLeading;
     config->font_weight = tm.tmWeight;
     lstrcpy(config->face_name, lf->lfFaceName);
+    if (el) *el = tm.tmExternalLeading;
 
     return hFont;
  err:
@@ -503,15 +516,17 @@ void    WCUSER_FillLogFont(LOGFONT* lf, 
 BOOL	WCUSER_SetFont(struct inner_data* data, const LOGFONT* logfont)
 {
     HFONT       hFont;
+    LONG        el;
 
     if (PRIVATE(data)->hFont != 0 && WCUSER_AreFontsEqual(&data->curcfg, logfont))
         return TRUE;
 
-    hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont);
+    hFont = WCUSER_CopyFont(&data->curcfg, PRIVATE(data)->hWnd, logfont, &el);
     if (!hFont) {WINE_ERR("wrong font\n"); return FALSE;}
 
     if (PRIVATE(data)->hFont) DeleteObject(PRIVATE(data)->hFont);
     PRIVATE(data)->hFont = hFont;
+    PRIVATE(data)->ext_leading = el;
 
     WCUSER_ComputePositions(data);
     WCUSER_NewBitmap(data);
Index: wine/programs/wineconsole/dialog.c
diff -u -p wine/programs/wineconsole/dialog.c:1.21 wine/programs/wineconsole/dialog.c:1.22
--- wine/programs/wineconsole/dialog.c:1.21	3 Nov 2005  9:51: 0 -0000
+++ wine/programs/wineconsole/dialog.c	3 Nov 2005  9:51: 0 -0000
@@ -432,7 +432,7 @@ static BOOL  select_font(struct dialog_i
 
     WCUSER_FillLogFont(&lf, di->font[size_idx].faceName,
                        di->font[size_idx].height, di->font[size_idx].weight);
-    hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf);
+    hFont = WCUSER_CopyFont(&config, PRIVATE(di->data)->hWnd, &lf, NULL);
     if (!hFont) return FALSE;
 
     if (config.cell_height != di->font[size_idx].height)
@@ -571,7 +571,7 @@ static BOOL WINAPI WCUSER_FontDlgProc(HW
                 WCUSER_FillLogFont(&lf, di->font[val].faceName,
                                    di->font[val].height, di->font[val].weight);
                 DeleteObject(WCUSER_CopyFont(&di->config,
-                                             PRIVATE(di->data)->hWnd, &lf));
+                                             PRIVATE(di->data)->hWnd, &lf, NULL));
             }
 
             val = (GetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_BK), 0) << 4) |



More information about the wine-cvs mailing list