winefile: font selection

Martin Fuchs martin-fuchs at gmx.net
Wed Oct 6 04:00:18 CDT 2004


Changelog:
Immediatelly refresh child windows after changing the font


Index: En.rc
===================================================================
RCS file: /home/wine/wine/programs/winefile/En.rc,v
retrieving revision 1.5
diff -u -p -d -r1.5 En.rc
--- En.rc	27 Sep 2004 20:35:53 -0000	1.5
+++ En.rc	6 Oct 2004 08:50:41 -0000
@@ -181,7 +181,6 @@ FONT 8, "MS Shell Dlg"
 STRINGTABLE
 {
 	IDS_FONT_SEL_DLG_NAME	"Applying font settings"
-	IDS_FONT_SEL_DLG_INFO	"Changed font settings apply only to newly started windows."
 	IDS_FONT_SEL_ERROR	"Error while selecting new font."
 	IDS_FILE_MOVE_ERROR	"Error while moving file or directory."
 }
Index: It.rc
===================================================================
RCS file: /home/wine/wine/programs/winefile/It.rc,v
retrieving revision 1.3
diff -u -p -d -r1.3 It.rc
--- It.rc	28 Sep 2004 03:14:48 -0000	1.3
+++ It.rc	6 Oct 2004 08:50:41 -0000
@@ -182,7 +182,6 @@ FONT 8, "MS Shell Dlg"
 STRINGTABLE
 {
 	IDS_FONT_SEL_DLG_NAME	"Applica le impostazioni dei font"
-	IDS_FONT_SEL_DLG_INFO	"I cambiamenti alle impostazioni dei font vengono applicati solo alle finestre apertesuccesivamente."
 	IDS_FONT_SEL_ERROR	"Si è verificato un errore durante la selezione del nuovo font."
 	IDS_FILE_MOVE_ERROR	"Si è verificato un errore durante lo spostamento del file o della directory."
 }
Index: Pl.rc
===================================================================
RCS file: /home/wine/wine/programs/winefile/Pl.rc,v
retrieving revision 1.2
diff -u -p -d -r1.2 Pl.rc
--- Pl.rc	27 Sep 2004 20:35:53 -0000	1.2
+++ Pl.rc	6 Oct 2004 08:50:41 -0000
@@ -182,7 +182,6 @@ FONT 8, "MS Shell Dlg"
 STRINGTABLE
 {
 	IDS_FONT_SEL_DLG_NAME	"Wprowadzanie ustawieñ czcionki"
-	IDS_FONT_SEL_DLG_INFO	"Nowe ustawienia czcionki zadzia³aj¹ jedynie dla nowo otwartych okien."
 	IDS_FONT_SEL_ERROR	"B³¹d przy wybieraniu czcionki"
 	IDS_FILE_MOVE_ERROR	"B³¹d przy przenoszeniu pliku."
 }
Index: resource.h
===================================================================
RCS file: /home/wine/wine/programs/winefile/resource.h,v
retrieving revision 1.3
diff -u -p -d -r1.3 resource.h
--- resource.h	27 Sep 2004 20:35:53 -0000	1.3
+++ resource.h	6 Oct 2004 08:50:41 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000 Martin Fuchs
+ * Copyright 2000, 2003 Martin Fuchs
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -72,7 +72,6 @@
 
 /* string table */
 #define IDS_FONT_SEL_DLG_NAME				1101
-#define IDS_FONT_SEL_DLG_INFO				1102
 #define IDS_FONT_SEL_ERROR				1103
 #define IDS_FILE_MOVE_ERROR				1104
 
Index: winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.20
diff -u -p -d -r1.20 winefile.c
--- winefile.c	27 Sep 2004 20:35:53 -0000	1.20
+++ winefile.c	6 Oct 2004 08:50:42 -0000
@@ -1,7 +1,7 @@
 /*
  * Winefile
  *
- * Copyright 2000 Martin Fuchs
+ * Copyright 2000, 2003, 2004 Martin Fuchs
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1488,7 +1488,7 @@ static HWND create_child_window(ChildWnd
 	mcs.y       = child->pos.rcNormalPosition.top;
 	mcs.cx      = child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left;
 	mcs.cy      = child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top;
-	mcs.style   = 1;
+	mcs.style   = 0;
 	mcs.lParam  = 0;
 
 	hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
@@ -1815,12 +1815,13 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd,
 				case ID_WINDOW_ARRANGE:
 					SendMessage(Globals.hmdiclient, WM_MDIICONARRANGE, 0, 0);
 					break;
-					
+
 				case ID_SELECT_FONT: {
+					TCHAR dlg_name[BUFFER_LEN], dlg_info[BUFFER_LEN];
 					CHOOSEFONT chFont;
-					LOGFONT    lFont;
+					LOGFONT lFont;
+
 					HDC hdc = GetDC(hwnd);
-					char dlg_name[255], dlg_info[255];
 					chFont.lStructSize = sizeof(CHOOSEFONT);
 					chFont.hwndOwner = hwnd;
 					chFont.hDC = NULL;
@@ -1835,20 +1836,32 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd,
 					chFont.nFontType = SIMULATED_FONTTYPE;
 					chFont.nSizeMin = 0;
 					chFont.nSizeMax = 24;
-					if(ChooseFont(&chFont)) {
-						LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, MAX_LOAD_STRING);
-						LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_INFO, dlg_info, MAX_LOAD_STRING);
-						MessageBox(hwnd,dlg_info,dlg_name,MB_OK|MB_ICONINFORMATION);
+
+					if (ChooseFont(&chFont)) {
+						HWND childWnd;
+
 						Globals.hfont = CreateFontIndirect(&lFont);
 						SelectFont(hdc, Globals.hfont);
 						GetTextExtentPoint32(hdc, TEXT(" "), 1, &Globals.spaceSize);
+
+						/* change font in all open child windows */
+						for(childWnd=GetWindow(Globals.hmdiclient,GW_CHILD); childWnd; childWnd=GetNextWindow(childWnd,GW_HWNDNEXT)) {
+							ChildWnd* child = (ChildWnd*) GetWindowLong(childWnd, GWL_USERDATA);
+							SetWindowFont(child->left.hwnd, Globals.hfont, TRUE);
+							SetWindowFont(child->right.hwnd, Globals.hfont, TRUE);
+							ListBox_SetItemHeight(child->left.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
+							ListBox_SetItemHeight(child->right.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
+							InvalidateRect(child->left.hwnd, NULL, TRUE);
+							InvalidateRect(child->right.hwnd, NULL, TRUE);
+						}
 					}
-					else if(CommDlgExtendedError()) {
-						LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, MAX_LOAD_STRING);
-						LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, MAX_LOAD_STRING);
-						MessageBox(hwnd,dlg_info,dlg_name,MB_OK);
+					else if (CommDlgExtendedError()) {
+						LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN);
+						LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, BUFFER_LEN);
+						MessageBox(hwnd, dlg_info, dlg_name, MB_OK);
 					}
-					ReleaseDC(hwnd,hdc);
+
+					ReleaseDC(hwnd, hdc);
 					break;
 				}
 
Index: winefile.h
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.h,v
retrieving revision 1.8
diff -u -p -d -r1.8 winefile.h
--- winefile.h	27 Sep 2004 20:35:53 -0000	1.8
+++ winefile.h	6 Oct 2004 08:50:43 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000 Martin Fuchs
+ * Copyright 2000, 2003, 2004 Martin Fuchs
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -75,9 +75,7 @@ enum IMAGE {
 	IMG_FOLDER,		IMG_OPEN_FOLDER,	IMG_FOLDER_PLUS,IMG_OPEN_PLUS,	IMG_OPEN_MINUS,
 	IMG_FOLDER_UP,	IMG_FOLDER_CUR
 };
-#ifndef MAX_LOAD_STRING
-#define MAX_LOAD_STRING		256
-#endif
+
 #define	IMAGE_WIDTH			16
 #define	IMAGE_HEIGHT			13
 #define	SPLIT_WIDTH			5





More information about the wine-patches mailing list