Immediately refresh child windows after changing the font.

This commit is contained in:
Martin Fuchs 2004-10-07 04:20:04 +00:00 committed by Alexandre Julliard
parent 3a3307d4b2
commit e5d414ea38
6 changed files with 30 additions and 23 deletions

View File

@ -181,7 +181,6 @@ FONT 8, "MS Shell Dlg"
STRINGTABLE STRINGTABLE
{ {
IDS_FONT_SEL_DLG_NAME "Applying font settings" 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_FONT_SEL_ERROR "Error while selecting new font."
IDS_FILE_MOVE_ERROR "Error while moving file or directory." IDS_FILE_MOVE_ERROR "Error while moving file or directory."
} }

View File

@ -182,7 +182,6 @@ FONT 8, "MS Shell Dlg"
STRINGTABLE STRINGTABLE
{ {
IDS_FONT_SEL_DLG_NAME "Applica le impostazioni dei font" 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_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." IDS_FILE_MOVE_ERROR "Si è verificato un errore durante lo spostamento del file o della directory."
} }

View File

@ -182,7 +182,6 @@ FONT 8, "MS Shell Dlg"
STRINGTABLE STRINGTABLE
{ {
IDS_FONT_SEL_DLG_NAME "Wprowadzanie ustawień czcionki" 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_FONT_SEL_ERROR "Błšd przy wybieraniu czcionki"
IDS_FILE_MOVE_ERROR "Błšd przy przenoszeniu pliku." IDS_FILE_MOVE_ERROR "Błšd przy przenoszeniu pliku."
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2000 Martin Fuchs * Copyright 2000, 2003 Martin Fuchs
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -72,7 +72,6 @@
/* string table */ /* string table */
#define IDS_FONT_SEL_DLG_NAME 1101 #define IDS_FONT_SEL_DLG_NAME 1101
#define IDS_FONT_SEL_DLG_INFO 1102
#define IDS_FONT_SEL_ERROR 1103 #define IDS_FONT_SEL_ERROR 1103
#define IDS_FILE_MOVE_ERROR 1104 #define IDS_FILE_MOVE_ERROR 1104

View File

@ -1,7 +1,7 @@
/* /*
* Winefile * Winefile
* *
* Copyright 2000 Martin Fuchs * Copyright 2000, 2003, 2004 Martin Fuchs
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -1490,7 +1490,7 @@ static HWND create_child_window(ChildWnd* child)
mcs.y = child->pos.rcNormalPosition.top; mcs.y = child->pos.rcNormalPosition.top;
mcs.cx = child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left; mcs.cx = child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left;
mcs.cy = child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top; mcs.cy = child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top;
mcs.style = 1; mcs.style = 0;
mcs.lParam = 0; mcs.lParam = 0;
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId()); hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
@ -1819,10 +1819,11 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
break; break;
case ID_SELECT_FONT: { case ID_SELECT_FONT: {
TCHAR dlg_name[BUFFER_LEN], dlg_info[BUFFER_LEN];
CHOOSEFONT chFont; CHOOSEFONT chFont;
LOGFONT lFont; LOGFONT lFont;
HDC hdc = GetDC(hwnd); HDC hdc = GetDC(hwnd);
char dlg_name[255], dlg_info[255];
chFont.lStructSize = sizeof(CHOOSEFONT); chFont.lStructSize = sizeof(CHOOSEFONT);
chFont.hwndOwner = hwnd; chFont.hwndOwner = hwnd;
chFont.hDC = NULL; chFont.hDC = NULL;
@ -1837,20 +1838,32 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
chFont.nFontType = SIMULATED_FONTTYPE; chFont.nFontType = SIMULATED_FONTTYPE;
chFont.nSizeMin = 0; chFont.nSizeMin = 0;
chFont.nSizeMax = 24; chFont.nSizeMax = 24;
if(ChooseFont(&chFont)) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, MAX_LOAD_STRING); if (ChooseFont(&chFont)) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_INFO, dlg_info, MAX_LOAD_STRING); HWND childWnd;
MessageBox(hwnd,dlg_info,dlg_name,MB_OK|MB_ICONINFORMATION);
Globals.hfont = CreateFontIndirect(&lFont); Globals.hfont = CreateFontIndirect(&lFont);
SelectFont(hdc, Globals.hfont); SelectFont(hdc, Globals.hfont);
GetTextExtentPoint32(hdc, TEXT(" "), 1, &Globals.spaceSize); 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()) { else if (CommDlgExtendedError()) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, MAX_LOAD_STRING); LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN);
LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, MAX_LOAD_STRING); LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, BUFFER_LEN);
MessageBox(hwnd,dlg_info,dlg_name,MB_OK); MessageBox(hwnd, dlg_info, dlg_name, MB_OK);
} }
ReleaseDC(hwnd,hdc);
ReleaseDC(hwnd, hdc);
break; break;
} }

View File

@ -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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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, IMG_OPEN_FOLDER, IMG_FOLDER_PLUS,IMG_OPEN_PLUS, IMG_OPEN_MINUS,
IMG_FOLDER_UP, IMG_FOLDER_CUR IMG_FOLDER_UP, IMG_FOLDER_CUR
}; };
#ifndef MAX_LOAD_STRING
#define MAX_LOAD_STRING 256
#endif
#define IMAGE_WIDTH 16 #define IMAGE_WIDTH 16
#define IMAGE_HEIGHT 13 #define IMAGE_HEIGHT 13
#define SPLIT_WIDTH 5 #define SPLIT_WIDTH 5