summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-02-23 21:09:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-02-23 21:09:52 +0000
commit2a8b6d62bf9ec0fea791ef53f335284ce94b7325 (patch)
tree848c62297a46ef76539bbc571cfa9f566b216e6e /src
parent3f07df04e697882e2bb8778642b3644782b01434 (diff)
ugly self-drawn color selection dialog finally died
git-svn-id: http://svn.miranda-ng.org/main/trunk@12256 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/fonts/FontOptions.cpp54
-rw-r--r--src/resource.h1
-rw-r--r--src/resource.rc28
3 files changed, 24 insertions, 59 deletions
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index 097b71a356..f04fa38939 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -244,19 +244,21 @@ void OptionsChanged()
TOOLINFO ti;
int x, y;
-UINT_PTR CALLBACK CFHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) {
- switch(uiMsg) {
- case WM_INITDIALOG: {
- CHOOSEFONT* cf = (CHOOSEFONT *)lParam;
-
- TranslateDialogDefault(hdlg);
- ShowWindow( GetDlgItem(hdlg, 1095), SW_HIDE);
- if (cf && (cf->lCustData & FIDF_DISABLESTYLES)) {
- EnableWindow( GetDlgItem(hdlg, 1137), FALSE);
- ShowWindow( GetDlgItem(hdlg, 1137), SW_HIDE);
- ShowWindow( GetDlgItem(hdlg, 1095), SW_SHOW);
+UINT_PTR CALLBACK CFHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+ if (uiMsg == WM_INITDIALOG) {
+ CHOOSEFONT* cf = (CHOOSEFONT *)lParam;
+ if (cf != NULL) {
+ if (cf->lCustData & FIDF_DISABLESTYLES) {
+ EnableWindow(GetDlgItem(hdlg, 1137), FALSE);
+ ShowWindow(GetDlgItem(hdlg, 1137), SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, 1095), SW_SHOW);
+ }
+ else if (cf->lCustData & FIDF_ALLOWEFFECTS) {
+ EnableWindow(GetDlgItem(hdlg, 1139), FALSE);
+ ShowWindow(GetDlgItem(hdlg, 1139), SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, 1091), SW_HIDE);
}
- return 0;
}
}
@@ -986,25 +988,19 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
cf.lStructSize = sizeof(cf);
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
- cf.lCustData = 0;
+ cf.lCustData = F.flags;
+ cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
- if (F.flags & FIDF_ALLOWEFFECTS) {
- cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
- // use custom font dialog to disable colour selection
- cf.hInstance = hInst;
- cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
+ if (F.flags & FIDF_ALLOWEFFECTS) { // enable effects section
+ cf.Flags |= CF_EFFECTS | CF_ENABLEHOOK;
cf.lpfnHook = CFHookProc;
}
- else if (F.flags & FIDF_DISABLESTYLES) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS
- cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK | CF_TTONLY | CF_NOOEMFONTS;
- cf.lCustData = F.flags;
- cf.hInstance = hInst;
- cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
+ else if (F.flags & FIDF_DISABLESTYLES) { // mutually exclusive with FIDF_ALLOWEFFECTS
+ cf.Flags |= CF_TTONLY | CF_NOOEMFONTS | CF_ENABLEHOOK;
cf.lpfnHook = CFHookProc;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE;
}
- else cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
if (ChooseFont(&cf)) {
for (i=0; i < selCount; i++) {
@@ -1331,7 +1327,6 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
case IDC_CHOOSEFONTGENERAL:
case IDC_CHOOSEFONTSMALL:
{
- CHOOSEFONT cf = { 0 };
FontInternal *pf = NULL;
switch (LOWORD(wParam)) {
case IDC_CHOOSEFONTHEADER:
@@ -1347,15 +1342,14 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
CreateFromFontSettings(&pf->value, &lf);
+ CHOOSEFONT cf = { 0 };
cf.lStructSize = sizeof(cf);
cf.hwndOwner = hwndDlg;
cf.lpLogFont = &lf;
+ cf.lCustData = pf->flags;
cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS;
if (pf->flags & FIDF_ALLOWEFFECTS) {
- cf.Flags |= CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK;
- // use custom font dialog to disable colour selection
- cf.hInstance = hInst;
- cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT);
+ cf.Flags |= CF_EFFECTS | CF_ENABLEHOOK;
cf.lpfnHook = CFHookProc;
}
@@ -1370,8 +1364,8 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
InvalidateRect( GetDlgItem(hwndDlg, IDC_PREVIEWSMALL), NULL, TRUE);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- return TRUE;
}
+ return TRUE;
}
break;
diff --git a/src/resource.h b/src/resource.h
index f7c544191e..361ca5dcc8 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -12,7 +12,6 @@
#define IDI_SMS 103
#define IDI_ONLINE 104
#define IDI_OFFLINE 105
-#define IDD_CUSTOM_FONT 106
#define IDD_OPT_FONTS 107
#define IDD_OPT_GENMENU 108
#define IDD_OPT_PROTOCOLORDER 109
diff --git a/src/resource.rc b/src/resource.rc
index 346178c68c..5eb20c37f5 100644
--- a/src/resource.rc
+++ b/src/resource.rc
@@ -454,34 +454,6 @@ BEGIN
LTEXT "Choose font",IDC_STATIC,231,231,79,14,SS_CENTERIMAGE
END
-IDD_CUSTOM_FONT DIALOGEX 13, 54, 287, 196
-STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Font"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- LTEXT "&Font:",1088,7,7,40,9
- COMBOBOX 1136,7,16,98,76,CBS_SIMPLE | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
- LTEXT "Font st&yle:",1089,110,7,44,9
- COMBOBOX 1137,110,16,74,76,CBS_SIMPLE | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- LTEXT "\nStyles and effects are disabled for this font.",1095,110,16,74,76
- LTEXT "&Size:",1090,189,7,30,9
- COMBOBOX 1138,190,16,36,76,CBS_SIMPLE | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "Effects",1072,7,97,98,72,WS_GROUP
- CONTROL "Stri&keout",1040,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,110,49,10
- CONTROL "&Underline",1041,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,123,51,10
- LTEXT "&Color:",1091,13,136,30,9,NOT WS_VISIBLE
- COMBOBOX 1139,13,146,82,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | NOT WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "Sample",1073,110,97,116,43,WS_GROUP
- CTEXT "AaBbYyZz",1092,118,111,100,23,SS_NOPREFIX | NOT WS_VISIBLE
- LTEXT "",1093,7,172,219,20,SS_NOPREFIX | NOT WS_GROUP
- LTEXT "Sc&ript:",1094,110,147,30,9
- COMBOBOX 1140,110,157,116,30,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- DEFPUSHBUTTON "OK",IDOK,231,16,45,14,WS_GROUP
- PUSHBUTTON "Cancel",IDCANCEL,231,32,45,14,WS_GROUP
- PUSHBUTTON "&Apply",1026,231,48,45,14,WS_GROUP
- PUSHBUTTON "&Help",1038,231,64,45,14,WS_GROUP
-END
-
IDD_OPT_ICOLIB DIALOGEX 0, 0, 316, 251
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT