From 4021c096c2acf83f4671edbb4e212796bd662491 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 6 Aug 2012 20:05:14 +0000 Subject: added default popups in options git-svn-id: http://svn.miranda-ng.org/main/trunk@1387 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/icq_constants.h | 1 + protocols/IcqOscarJ/icq_popups.cpp | 76 +++++++++++++++++++++++++++++++++---- protocols/IcqOscarJ/resource.h | 2 + protocols/IcqOscarJ/resources.rc | 59 ++++++++++++++-------------- 4 files changed, 101 insertions(+), 37 deletions(-) (limited to 'protocols') diff --git a/protocols/IcqOscarJ/icq_constants.h b/protocols/IcqOscarJ/icq_constants.h index aae88a8f69..4da90f1bc0 100644 --- a/protocols/IcqOscarJ/icq_constants.h +++ b/protocols/IcqOscarJ/icq_constants.h @@ -103,6 +103,7 @@ #define DEFAULT_SPAM_BACK_COLORS RGB(213,209,208) #define DEFAULT_SPAM_TIMEOUT 0 #define DEFAULT_POPUPS_WIN_COLORS 0 +#define DEFAULT_POPUPS_DEF_COLORS (BYTE)!DEFAULT_POPUPS_WIN_COLORS /* Database setting names */ #define DBSETTING_CAPABILITIES "caps" diff --git a/protocols/IcqOscarJ/icq_popups.cpp b/protocols/IcqOscarJ/icq_popups.cpp index f7c70569e1..21ca36348d 100644 --- a/protocols/IcqOscarJ/icq_popups.cpp +++ b/protocols/IcqOscarJ/icq_popups.cpp @@ -40,7 +40,7 @@ void InitPopUps() } static const UINT icqPopupsControls[] = { - IDC_POPUPS_LOG_ENABLED, IDC_POPUPS_SPAM_ENABLED, IDC_PREVIEW, IDC_USEWINCOLORS, IDC_USESYSICONS, IDC_POPUP_LOG0_TIMEOUT, + IDC_POPUPS_LOG_ENABLED, IDC_POPUPS_SPAM_ENABLED, IDC_PREVIEW, IDC_USESYSICONS, IDC_POPUP_LOG0_TIMEOUT, IDC_POPUP_LOG1_TIMEOUT, IDC_POPUP_LOG2_TIMEOUT, IDC_POPUP_LOG3_TIMEOUT, IDC_POPUP_SPAM_TIMEOUT }; @@ -82,12 +82,27 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, ppro->getSettingDword(NULL,"PopupsSpamTimeout",DEFAULT_SPAM_TIMEOUT),FALSE); bEnabled = ppro->getSettingByte(NULL,"PopupsWinColors",DEFAULT_POPUPS_WIN_COLORS); CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, bEnabled); + bEnabled |= ppro->getSettingByte(NULL,"PopupsDefColors",DEFAULT_POPUPS_DEF_COLORS); + CheckDlgButton(hwndDlg, IDC_USEDEFCOLORS, bEnabled); icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled); CheckDlgButton(hwndDlg, IDC_USESYSICONS, ppro->getSettingByte(NULL,"PopupsSysIcons",DEFAULT_POPUPS_SYS_ICONS)); bEnabled = ppro->getSettingByte(NULL,"PopupsEnabled",DEFAULT_POPUPS_ENABLED); CheckDlgButton(hwndDlg, IDC_POPUPS_ENABLED, bEnabled); icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled); - icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); + if (bEnabled) + { + if (IsDlgButtonChecked(hwndDlg, IDC_USEDEFCOLORS)) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), !WM_ENABLE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), WM_ENABLE); + } + else + { + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), WM_ENABLE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE); + } + } + icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & (!IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS) && !IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS))); bInitDone = true; return TRUE; @@ -105,11 +120,47 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_POPUPS_ENABLED: bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED); + if (bEnabled) + { + if (IsDlgButtonChecked(hwndDlg, IDC_USEDEFCOLORS)) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), !WM_ENABLE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), WM_ENABLE); + } + else + { + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), WM_ENABLE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE); + } + } + else + { + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), !WM_ENABLE); + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE); + } icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled); case IDC_USEWINCOLORS: bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED); + if (bEnabled) + { + if (IsDlgButtonChecked(hwndDlg, IDC_USEWINCOLORS)) + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE); + else + EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), WM_ENABLE); + } icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); + + case IDC_USEDEFCOLORS: + bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED); + if (bEnabled) + { + if (IsDlgButtonChecked(hwndDlg, IDC_USEDEFCOLORS)) + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), !WM_ENABLE); + else + EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), WM_ENABLE); + } + icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & !IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_POPUP_LOG0_TIMEOUT: @@ -148,6 +199,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ppro->setSettingDword(NULL,"PopupsSpamBackColor",SendDlgItemMessage(hwndDlg,IDC_POPUP_SPAM_BACKCOLOR,CPM_GETCOLOUR,0,0)); ppro->setSettingDword(NULL,"PopupsSpamTimeout",GetDlgItemInt(hwndDlg, IDC_POPUP_SPAM_TIMEOUT, NULL, FALSE)); ppro->setSettingByte(NULL,"PopupsWinColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS)); + ppro->setSettingByte(NULL,"PopupsDefColors",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)); ppro->setSettingByte(NULL,"PopupsSysIcons",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USESYSICONS)); return TRUE; } @@ -217,12 +269,20 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz } else { - strcpy(szSetting, szPrefix); - strcat(szSetting, "TextColor"); - ppd.colorText = getSettingDword(NULL, szSetting, ppd.colorText); - strcpy(szSetting, szPrefix); - strcat(szSetting, "BackColor"); - ppd.colorBack = getSettingDword(NULL, szSetting, ppd.colorBack); + if (getSettingByte(NULL, "PopupsDefColors", DEFAULT_POPUPS_DEF_COLORS)) + { + ppd.colorText = NULL; + ppd.colorBack = NULL; + } + else + { + strcpy(szSetting, szPrefix); + strcat(szSetting, "TextColor"); + ppd.colorText = getSettingDword(NULL, szSetting, ppd.colorText); + strcpy(szSetting, szPrefix); + strcat(szSetting, "BackColor"); + ppd.colorBack = getSettingDword(NULL, szSetting, ppd.colorBack); + } } strcpy(szSetting, szPrefix); strcat(szSetting, "Timeout"); diff --git a/protocols/IcqOscarJ/resource.h b/protocols/IcqOscarJ/resource.h index 5798642af2..2bdec69fe0 100644 --- a/protocols/IcqOscarJ/resource.h +++ b/protocols/IcqOscarJ/resource.h @@ -156,6 +156,8 @@ #define IDC_DCPASSIVE 1021 #define IDC_OLDPASS 1021 #define IDC_ICQNUM 1022 +#define IDC_USEPOPUPCOLORS 1023 +#define IDC_USEDEFCOLORS 1024 #define IDC_AIMENABLE 1030 #define IDC_CLIST 1035 #define IDC_XSTATUSENABLE 1040 diff --git a/protocols/IcqOscarJ/resources.rc b/protocols/IcqOscarJ/resources.rc index 44db670813..563f6eeb5e 100644 --- a/protocols/IcqOscarJ/resources.rc +++ b/protocols/IcqOscarJ/resources.rc @@ -199,40 +199,41 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Options",IDC_STATIC,4,4,305,81 + GROUPBOX "Options",IDC_STATIC,4,4,305,71 CONTROL "Enable popup support",IDC_POPUPS_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,19,216,10 CONTROL "Display errors using popups",IDC_POPUPS_LOG_ENABLED, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,37,216,10 CONTROL "Display popup when spambot is detected",IDC_POPUPS_SPAM_ENABLED, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,50,216,10 - GROUPBOX "Look && Feel",IDC_STATIC,4,91,305,143 - LTEXT "Back Color",IDC_STATIC,80,104,42,8 - LTEXT "Text Color",IDC_STATIC,130,104,40,8 - LTEXT "Timeout (*)",IDC_STATIC,182,104,60,8 - LTEXT "Note",IDC_STATIC,12,116,60,8 - CONTROL "",IDC_POPUP_LOG0_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,115,39,10 - CONTROL "",IDC_POPUP_LOG0_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,115,39,10 - EDITTEXT IDC_POPUP_LOG0_TIMEOUT,182,114,34,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Warning",IDC_STATIC,12,131,60,8 - CONTROL "",IDC_POPUP_LOG1_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,130,39,10 - CONTROL "",IDC_POPUP_LOG1_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,130,39,10 - EDITTEXT IDC_POPUP_LOG1_TIMEOUT,182,129,34,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Error",IDC_STATIC,12,146,60,8 - CONTROL "",IDC_POPUP_LOG2_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,145,39,10 - CONTROL "",IDC_POPUP_LOG2_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,145,39,10 - EDITTEXT IDC_POPUP_LOG2_TIMEOUT,182,144,34,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Fatal",IDC_STATIC,12,161,60,8 - CONTROL "",IDC_POPUP_LOG3_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,160,39,10 - CONTROL "",IDC_POPUP_LOG3_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,160,39,10 - EDITTEXT IDC_POPUP_LOG3_TIMEOUT,182,159,34,12,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Spam detected",IDC_STATIC,12,176,60,8 - CONTROL "",IDC_POPUP_SPAM_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,175,39,10 - CONTROL "",IDC_POPUP_SPAM_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,175,39,10 - EDITTEXT IDC_POPUP_SPAM_TIMEOUT,182,174,34,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "&Use Windows colors",IDC_USEWINCOLORS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,12,194,220,8 - CONTROL "Use system &icons",IDC_USESYSICONS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,12,207,220,8 - DEFPUSHBUTTON "Previe&w",IDC_PREVIEW,247,203,52,12 - LTEXT "(*) Timeouts require Popup v. 1.0.1.9 or later",IDC_STATIC,12,221,232,8 + GROUPBOX "Look && Feel",IDC_STATIC,4,80,305,160 + LTEXT "Back Color",IDC_STATIC,80,93,42,8 + LTEXT "Text Color",IDC_STATIC,130,93,40,8 + LTEXT "Timeout (*)",IDC_STATIC,182,93,60,8 + LTEXT "Note",IDC_STATIC,12,105,60,8 + CONTROL "",IDC_POPUP_LOG0_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,104,39,10 + CONTROL "",IDC_POPUP_LOG0_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,104,39,10 + EDITTEXT IDC_POPUP_LOG0_TIMEOUT,182,103,34,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Warning",IDC_STATIC,12,120,60,8 + CONTROL "",IDC_POPUP_LOG1_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,119,39,10 + CONTROL "",IDC_POPUP_LOG1_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,119,39,10 + EDITTEXT IDC_POPUP_LOG1_TIMEOUT,182,118,34,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Error",IDC_STATIC,12,135,60,8 + CONTROL "",IDC_POPUP_LOG2_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,134,39,10 + CONTROL "",IDC_POPUP_LOG2_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,134,39,10 + EDITTEXT IDC_POPUP_LOG2_TIMEOUT,182,133,34,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Fatal",IDC_STATIC,12,150,60,8 + CONTROL "",IDC_POPUP_LOG3_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,149,39,10 + CONTROL "",IDC_POPUP_LOG3_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,149,39,10 + EDITTEXT IDC_POPUP_LOG3_TIMEOUT,182,148,34,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Spam detected",IDC_STATIC,12,165,60,8 + CONTROL "",IDC_POPUP_SPAM_BACKCOLOR,"ColourPicker",WS_TABSTOP,80,164,39,10 + CONTROL "",IDC_POPUP_SPAM_TEXTCOLOR,"ColourPicker",WS_TABSTOP,130,164,39,10 + EDITTEXT IDC_POPUP_SPAM_TIMEOUT,182,163,34,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "&Use Windows colors",IDC_USEWINCOLORS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,12,183,220,8 + CONTROL "Use system &icons",IDC_USESYSICONS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,12,211,220,8 + DEFPUSHBUTTON "Previe&w",IDC_PREVIEW,247,192,52,12 + LTEXT "(*) Timeouts require Popup v. 1.0.1.9 or later",IDC_STATIC,12,225,232,8 + CONTROL "Use default colours",IDC_USEDEFCOLORS,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,12,196,221,10 END IDD_INFO_ICQ DIALOGEX 0, 0, 222, 132 -- cgit v1.2.3