diff options
author | George Hazan <george.hazan@gmail.com> | 2013-11-09 19:32:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-11-09 19:32:13 +0000 |
commit | 0c9992573c4ffc4126883f4cc347e2b5b27f2ba5 (patch) | |
tree | e6fa250270b2a28684cbba0779ae7282f1098e5e /plugins/NewEventNotify | |
parent | f63e8d8da08b8ccd0ca7fbff5bbe47b45d7ffa8b (diff) |
NewEventNotify: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6843 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewEventNotify')
-rw-r--r-- | plugins/NewEventNotify/src/main.cpp | 21 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/options.cpp | 512 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/popup.cpp | 126 |
3 files changed, 311 insertions, 348 deletions
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index fed94ffd9a..8323794ccf 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -57,9 +57,10 @@ HANDLE hHookedNewEvent; HANDLE hHookedDeletedEvent;
//---Called when a new event is added to the database
-int HookedNewEvent(WPARAM wParam, LPARAM lParam)
//wParam: contact-handle
//lParam: dbevent-handle
+
+int HookedNewEvent(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
PLUGIN_DATA* pdata;
@@ -81,11 +82,10 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) return 0;
//custom database event types
- if (ServiceExists(MS_DB_EVENT_GETTYPE))
- {
+ if (ServiceExists(MS_DB_EVENT_GETTYPE)) {
DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType);
- if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE && pei->flags & DETF_NONOTIFY)
// ignore events according to flags
+ if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE && pei->flags & DETF_NONOTIFY)
return 0;
}
@@ -94,10 +94,9 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) return 0;
//is it an event sent by the user? -> don't show
- if (dbe.flags & DBEF_SENT)
- {
- if (pluginOptions.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1)
- { // JK, only message event, do not influence others
+ if (dbe.flags & DBEF_SENT) {
+ // JK, only message event, do not influence others
+ if (pluginOptions.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1) {
pdata = PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
PopupAct(pdata->hWnd, MASK_DISMISS, pdata); // JK, only dismiss, i.e. do not kill event (e.g. file transfer)
}
@@ -112,13 +111,10 @@ int HookedNewEvent(WPARAM wParam, LPARAM lParam) //is another popup for this contact already present? -> merge message popups if enabled
if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMergePopup && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1))
- { // JK, only merge with message events, do not mess with others
PopupUpdate(hContact, (HANDLE)lParam);
- }
else
- { //now finally show a popup
PopupShow(&pluginOptions, hContact, (HANDLE)lParam, (UINT)dbe.eventType);
- }
+
return 0;
}
@@ -138,7 +134,6 @@ int HookedInit(WPARAM, LPARAM) int HookedOptions(WPARAM wParam, LPARAM lParam)
{
OptionsAdd(hInst, wParam);
-
return 0;
}
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 291eaa444d..1ac8b3eb2f 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -1,25 +1,25 @@ /*
- Name: NewEventNotify - Plugin for Miranda IM
- File: options.c - Manages Option Dialogs and Settings
- Version: 0.0.4
- Description: Notifies you about some events
- Author: icebreaker, <icebreaker@newmail.net>
- Date: 22.07.02 13:06 / Update: 16.09.02 17:45
- Copyright: (C) 2002 Starzinger Michael
+ Name: NewEventNotify - Plugin for Miranda IM
+ File: options.c - Manages Option Dialogs and Settings
+ Version: 0.0.4
+ Description: Notifies you about some events
+ Author: icebreaker, <icebreaker@newmail.net>
+ Date: 22.07.02 13:06 / Update: 16.09.02 17:45
+ Copyright: (C) 2002 Starzinger Michael
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "neweventnotify.h"
@@ -29,269 +29,261 @@ BOOL bWmNotify; int OptionsRead(void)
{
- options->bDisable = db_get_b(NULL, MODULE, OPT_DISABLE, FALSE);
- options->bPreview = db_get_b(NULL, MODULE, OPT_PREVIEW, TRUE);
- options->bMenuitem = db_get_b(NULL, MODULE, OPT_MENUITEM, FALSE);
- options->bDefaultColorMsg = db_get_b(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, FALSE);
- options->bDefaultColorUrl = db_get_b(NULL, MODULE, OPT_COLDEFAULT_URL, FALSE);
- options->bDefaultColorFile = db_get_b(NULL, MODULE, OPT_COLDEFAULT_FILE, FALSE);
- options->bDefaultColorOthers = db_get_b(NULL, MODULE, OPT_COLDEFAULT_OTHERS, FALSE);
- options->colBackMsg = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
- options->colTextMsg = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
- options->colBackUrl = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_URL, DEFAULT_COLBACK);
- options->colTextUrl = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_URL, DEFAULT_COLTEXT);
- options->colBackFile = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_FILE, DEFAULT_COLBACK);
- options->colTextFile = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
- options->colBackOthers = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
- options->colTextOthers = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
- options->maskNotify = (UINT)db_get_b(NULL, MODULE, OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
- options->maskActL = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
- options->maskActR = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
- options->maskActTE = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTE);
- options->bMsgWindowCheck = db_get_b(NULL, MODULE, OPT_MSGWINDOWCHECK, TRUE);
- options->bMsgReplyWindow = db_get_b(NULL, MODULE, OPT_MSGREPLYWINDOW, FALSE);
- options->bMergePopup = db_get_b(NULL, MODULE, OPT_MERGEPOPUP, TRUE);
- options->iDelayMsg = (int)db_get_dw(NULL, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
- options->iDelayUrl = (int)db_get_dw(NULL, MODULE, OPT_DELAY_URL, DEFAULT_DELAY);
- options->iDelayFile = (int)db_get_dw(NULL, MODULE, OPT_DELAY_FILE, DEFAULT_DELAY);
- options->iDelayOthers = (int)db_get_dw(NULL, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
- options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- options->bShowDate = db_get_b(NULL, MODULE, OPT_SHOW_DATE, TRUE);
- options->bShowTime = db_get_b(NULL, MODULE, OPT_SHOW_TIME, TRUE);
- options->bShowHeaders = db_get_b(NULL, MODULE, OPT_SHOW_HEADERS, TRUE);
- options->iNumberMsg = (BYTE)db_get_b(NULL, MODULE, OPT_NUMBER_MSG, TRUE);
- options->bShowON = db_get_b(NULL, MODULE, OPT_SHOW_ON, TRUE);
- options->bHideSend = db_get_b(NULL, MODULE, OPT_HIDESEND, TRUE);
- options->bNoRSS = db_get_b(NULL, MODULE, OPT_NORSS, FALSE);
- options->bReadCheck = db_get_b(NULL, MODULE, OPT_READCHECK, FALSE);
- return 0;
+ options->bDisable = db_get_b(NULL, MODULE, OPT_DISABLE, FALSE);
+ options->bPreview = db_get_b(NULL, MODULE, OPT_PREVIEW, TRUE);
+ options->bMenuitem = db_get_b(NULL, MODULE, OPT_MENUITEM, FALSE);
+ options->bDefaultColorMsg = db_get_b(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, FALSE);
+ options->bDefaultColorUrl = db_get_b(NULL, MODULE, OPT_COLDEFAULT_URL, FALSE);
+ options->bDefaultColorFile = db_get_b(NULL, MODULE, OPT_COLDEFAULT_FILE, FALSE);
+ options->bDefaultColorOthers = db_get_b(NULL, MODULE, OPT_COLDEFAULT_OTHERS, FALSE);
+ options->colBackMsg = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
+ options->colTextMsg = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
+ options->colBackUrl = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_URL, DEFAULT_COLBACK);
+ options->colTextUrl = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_URL, DEFAULT_COLTEXT);
+ options->colBackFile = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_FILE, DEFAULT_COLBACK);
+ options->colTextFile = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
+ options->colBackOthers = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
+ options->colTextOthers = (COLORREF)db_get_dw(NULL, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
+ options->maskNotify = (UINT)db_get_b(NULL, MODULE, OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
+ options->maskActL = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
+ options->maskActR = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
+ options->maskActTE = (UINT)db_get_b(NULL, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTE);
+ options->bMsgWindowCheck = db_get_b(NULL, MODULE, OPT_MSGWINDOWCHECK, TRUE);
+ options->bMsgReplyWindow = db_get_b(NULL, MODULE, OPT_MSGREPLYWINDOW, FALSE);
+ options->bMergePopup = db_get_b(NULL, MODULE, OPT_MERGEPOPUP, TRUE);
+ options->iDelayMsg = (int)db_get_dw(NULL, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
+ options->iDelayUrl = (int)db_get_dw(NULL, MODULE, OPT_DELAY_URL, DEFAULT_DELAY);
+ options->iDelayFile = (int)db_get_dw(NULL, MODULE, OPT_DELAY_FILE, DEFAULT_DELAY);
+ options->iDelayOthers = (int)db_get_dw(NULL, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
+ options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
+ options->bShowDate = db_get_b(NULL, MODULE, OPT_SHOW_DATE, TRUE);
+ options->bShowTime = db_get_b(NULL, MODULE, OPT_SHOW_TIME, TRUE);
+ options->bShowHeaders = db_get_b(NULL, MODULE, OPT_SHOW_HEADERS, TRUE);
+ options->iNumberMsg = (BYTE)db_get_b(NULL, MODULE, OPT_NUMBER_MSG, TRUE);
+ options->bShowON = db_get_b(NULL, MODULE, OPT_SHOW_ON, TRUE);
+ options->bHideSend = db_get_b(NULL, MODULE, OPT_HIDESEND, TRUE);
+ options->bNoRSS = db_get_b(NULL, MODULE, OPT_NORSS, FALSE);
+ options->bReadCheck = db_get_b(NULL, MODULE, OPT_READCHECK, FALSE);
+ return 0;
}
int OptionsWrite(void)
{
- db_set_b(NULL, MODULE, OPT_DISABLE, options->bDisable);
- db_set_b(NULL, MODULE, OPT_PREVIEW, options->bPreview);
- db_set_b(NULL, MODULE, OPT_MENUITEM, options->bMenuitem);
- db_set_b(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
- db_set_b(NULL, MODULE, OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
- db_set_b(NULL, MODULE, OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
- db_set_b(NULL, MODULE, OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
- db_set_dw(NULL, MODULE, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
- db_set_dw(NULL, MODULE, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
- db_set_dw(NULL, MODULE, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
- db_set_dw(NULL, MODULE, OPT_COLTEXT_URL, (DWORD)options->colTextUrl);
- db_set_dw(NULL, MODULE, OPT_COLBACK_FILE, (DWORD)options->colBackFile);
- db_set_dw(NULL, MODULE, OPT_COLTEXT_FILE, (DWORD)options->colTextFile);
- db_set_dw(NULL, MODULE, OPT_COLBACK_OTHERS, (DWORD)options->colBackOthers);
- db_set_dw(NULL, MODULE, OPT_COLTEXT_OTHERS, (DWORD)options->colTextOthers);
- db_set_b(NULL, MODULE, OPT_MASKNOTIFY, (BYTE)options->maskNotify);
- db_set_b(NULL, MODULE, OPT_MASKACTL, (BYTE)options->maskActL);
- db_set_b(NULL, MODULE, OPT_MASKACTR, (BYTE)options->maskActR);
- db_set_b(NULL, MODULE, OPT_MASKACTTE, (BYTE)options->maskActTE);
- db_set_b(NULL, MODULE, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
- db_set_b(NULL, MODULE, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
- db_set_b(NULL, MODULE, OPT_MERGEPOPUP, options->bMergePopup);
- db_set_dw(NULL, MODULE, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
- db_set_dw(NULL, MODULE, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
- db_set_dw(NULL, MODULE, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
- db_set_dw(NULL, MODULE, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
- db_set_b(NULL, MODULE, OPT_SHOW_DATE, options->bShowDate);
- db_set_b(NULL, MODULE, OPT_SHOW_TIME, options->bShowTime);
- db_set_b(NULL, MODULE, OPT_SHOW_HEADERS, options->bShowHeaders);
- db_set_b(NULL, MODULE, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
- db_set_b(NULL, MODULE, OPT_SHOW_ON, options->bShowON);
- db_set_b(NULL, MODULE, OPT_HIDESEND, options->bHideSend);
- db_set_b(NULL, MODULE, OPT_NORSS, options->bNoRSS);
- db_set_b(NULL, MODULE, OPT_READCHECK, options->bReadCheck);
- return 0;
+ db_set_b(NULL, MODULE, OPT_DISABLE, options->bDisable);
+ db_set_b(NULL, MODULE, OPT_PREVIEW, options->bPreview);
+ db_set_b(NULL, MODULE, OPT_MENUITEM, options->bMenuitem);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
+ db_set_b(NULL, MODULE, OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_URL, (DWORD)options->colTextUrl);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_FILE, (DWORD)options->colBackFile);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_FILE, (DWORD)options->colTextFile);
+ db_set_dw(NULL, MODULE, OPT_COLBACK_OTHERS, (DWORD)options->colBackOthers);
+ db_set_dw(NULL, MODULE, OPT_COLTEXT_OTHERS, (DWORD)options->colTextOthers);
+ db_set_b(NULL, MODULE, OPT_MASKNOTIFY, (BYTE)options->maskNotify);
+ db_set_b(NULL, MODULE, OPT_MASKACTL, (BYTE)options->maskActL);
+ db_set_b(NULL, MODULE, OPT_MASKACTR, (BYTE)options->maskActR);
+ db_set_b(NULL, MODULE, OPT_MASKACTTE, (BYTE)options->maskActTE);
+ db_set_b(NULL, MODULE, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
+ db_set_b(NULL, MODULE, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
+ db_set_b(NULL, MODULE, OPT_MERGEPOPUP, options->bMergePopup);
+ db_set_dw(NULL, MODULE, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
+ db_set_dw(NULL, MODULE, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
+ db_set_dw(NULL, MODULE, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
+ db_set_dw(NULL, MODULE, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
+ db_set_b(NULL, MODULE, OPT_SHOW_DATE, options->bShowDate);
+ db_set_b(NULL, MODULE, OPT_SHOW_TIME, options->bShowTime);
+ db_set_b(NULL, MODULE, OPT_SHOW_HEADERS, options->bShowHeaders);
+ db_set_b(NULL, MODULE, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
+ db_set_b(NULL, MODULE, OPT_SHOW_ON, options->bShowON);
+ db_set_b(NULL, MODULE, OPT_HIDESEND, options->bHideSend);
+ db_set_b(NULL, MODULE, OPT_NORSS, options->bNoRSS);
+ db_set_b(NULL, MODULE, OPT_READCHECK, options->bReadCheck);
+ return 0;
}
static void SetCheckBoxState(HWND hWnd, int iCtrl, BOOL bState)
{
- CheckDlgButton(hWnd, iCtrl, bState ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, iCtrl, bState ? BST_CHECKED : BST_UNCHECKED);
}
static void EnableDlgItem(HWND hWnd, int iCtrl, BOOL bEnable)
{
- EnableWindow(GetDlgItem(hWnd, iCtrl), bEnable);
+ EnableWindow(GetDlgItem(hWnd, iCtrl), bEnable);
}
static void UpdateOptionsDlgItemsState(HWND hWnd)
{
- //disable color picker when using default colors
- EnableDlgItem(hWnd, IDC_COLBACK_MESSAGE, !options->bDefaultColorMsg);
- EnableDlgItem(hWnd, IDC_COLTEXT_MESSAGE, !options->bDefaultColorMsg);
- EnableDlgItem(hWnd, IDC_COLBACK_URL, !options->bDefaultColorUrl);
- EnableDlgItem(hWnd, IDC_COLTEXT_URL, !options->bDefaultColorUrl);
- EnableDlgItem(hWnd, IDC_COLBACK_FILE, !options->bDefaultColorFile);
- EnableDlgItem(hWnd, IDC_COLTEXT_FILE, !options->bDefaultColorFile);
- EnableDlgItem(hWnd, IDC_COLBACK_OTHERS, !options->bDefaultColorOthers);
- EnableDlgItem(hWnd, IDC_COLTEXT_OTHERS, !options->bDefaultColorOthers);
+ //disable color picker when using default colors
+ EnableDlgItem(hWnd, IDC_COLBACK_MESSAGE, !options->bDefaultColorMsg);
+ EnableDlgItem(hWnd, IDC_COLTEXT_MESSAGE, !options->bDefaultColorMsg);
+ EnableDlgItem(hWnd, IDC_COLBACK_URL, !options->bDefaultColorUrl);
+ EnableDlgItem(hWnd, IDC_COLTEXT_URL, !options->bDefaultColorUrl);
+ EnableDlgItem(hWnd, IDC_COLBACK_FILE, !options->bDefaultColorFile);
+ EnableDlgItem(hWnd, IDC_COLTEXT_FILE, !options->bDefaultColorFile);
+ EnableDlgItem(hWnd, IDC_COLBACK_OTHERS, !options->bDefaultColorOthers);
+ EnableDlgItem(hWnd, IDC_COLTEXT_OTHERS, !options->bDefaultColorOthers);
//disable merge messages options when is not using
- EnableDlgItem(hWnd, IDC_CHKSHOWDATE, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_CHKSHOWTIME, options->bMergePopup);
+ EnableDlgItem(hWnd, IDC_CHKSHOWDATE, options->bMergePopup);
+ EnableDlgItem(hWnd, IDC_CHKSHOWTIME, options->bMergePopup);
EnableDlgItem(hWnd, IDC_CHKSHOWHEADERS, options->bMergePopup);
EnableDlgItem(hWnd, IDC_CMDEDITHEADERS, options->bMergePopup && options->bShowHeaders);
- EnableDlgItem(hWnd, IDC_NUMBERMSG, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_LBNUMBERMSG, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_RDNEW, options->bMergePopup && options->iNumberMsg);
- EnableDlgItem(hWnd, IDC_RDOLD, options->bMergePopup && options->iNumberMsg);
+ EnableDlgItem(hWnd, IDC_NUMBERMSG, options->bMergePopup);
+ EnableDlgItem(hWnd, IDC_LBNUMBERMSG, options->bMergePopup);
+ EnableDlgItem(hWnd, IDC_RDNEW, options->bMergePopup && options->iNumberMsg);
+ EnableDlgItem(hWnd, IDC_RDOLD, options->bMergePopup && options->iNumberMsg);
//disable delay textbox when infinite is checked
- EnableDlgItem(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1);
- EnableDlgItem(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1);
- EnableDlgItem(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1);
- EnableDlgItem(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1);
}
static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hWnd);
- //make dialog represent the current options
- bWmNotify = TRUE;
- SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, options->colBackMsg);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, options->colTextMsg);
- SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_SETCOLOUR, 0, options->colBackUrl);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_SETCOLOUR, 0, options->colTextUrl);
- SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, options->colBackFile);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, options->colTextFile);
- SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, options->colBackOthers);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, options->colTextOthers);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, options->bDefaultColorMsg);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_URL, options->bDefaultColorUrl);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE, options->bDefaultColorFile);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS, options->bDefaultColorOthers);
- SetCheckBoxState(hWnd, IDC_CHKMENUITEM, options->bMenuitem);
- SetCheckBoxState(hWnd, IDC_CHKDISABLE, options->bDisable);
- SetCheckBoxState(hWnd, IDC_CHKPREVIEW, options->bPreview);
- SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, options->bMergePopup);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, options->maskNotify & MASK_MESSAGE);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_URL, options->maskNotify & MASK_URL);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE, options->maskNotify & MASK_FILE);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER, options->maskNotify & MASK_OTHER);
- SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS, options->maskActL & MASK_DISMISS);
- SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN, options->maskActL & MASK_OPEN);
- SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE, options->maskActL & MASK_REMOVE);
- SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS, options->maskActR & MASK_DISMISS);
- SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN, options->maskActR & MASK_OPEN);
- SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE, options->maskActR & MASK_REMOVE);
- SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS, options->maskActTE & MASK_DISMISS);
- SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN, options->maskActTE & MASK_OPEN);
- SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE, options->maskActTE & MASK_REMOVE);
- SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK, options->bMsgWindowCheck);
- SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW, options->bMsgReplyWindow);
- SetCheckBoxState(hWnd, IDC_CHKSHOWDATE, options->bShowDate);
- SetCheckBoxState(hWnd, IDC_CHKSHOWTIME, options->bShowTime);
- SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS, options->bShowHeaders);
- SetCheckBoxState(hWnd, IDC_RDNEW, !options->bShowON);
- SetCheckBoxState(hWnd, IDC_RDOLD, options->bShowON);
- SetCheckBoxState(hWnd, IDC_CHKHIDESEND, options->bHideSend);
- SetCheckBoxState(hWnd, IDC_SUPRESSRSS, options->bNoRSS);
- SetCheckBoxState(hWnd, IDC_READCHECK, options->bReadCheck);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, options->iDelayMsg == -1);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_URL, options->iDelayUrl == -1);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE, options->iDelayFile == -1);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS, options->iDelayOthers == -1);
- SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1?options->iDelayMsg:0, TRUE);
- SetDlgItemInt(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1?options->iDelayUrl:0, TRUE);
- SetDlgItemInt(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1?options->iDelayFile:0, TRUE);
- SetDlgItemInt(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1?options->iDelayOthers:0, TRUE);
- SetDlgItemInt(hWnd, IDC_NUMBERMSG, options->iNumberMsg, FALSE);
- //update items' states
- UpdateOptionsDlgItemsState(hWnd);
- bWmNotify = FALSE;
- return TRUE;
+ switch (message) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWnd);
+ //make dialog represent the current options
+ bWmNotify = TRUE;
+ SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, options->colBackMsg);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, options->colTextMsg);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_SETCOLOUR, 0, options->colBackUrl);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_SETCOLOUR, 0, options->colTextUrl);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, options->colBackFile);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, options->colTextFile);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, options->colBackOthers);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, options->colTextOthers);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, options->bDefaultColorMsg);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_URL, options->bDefaultColorUrl);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE, options->bDefaultColorFile);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS, options->bDefaultColorOthers);
+ SetCheckBoxState(hWnd, IDC_CHKMENUITEM, options->bMenuitem);
+ SetCheckBoxState(hWnd, IDC_CHKDISABLE, options->bDisable);
+ SetCheckBoxState(hWnd, IDC_CHKPREVIEW, options->bPreview);
+ SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, options->bMergePopup);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, options->maskNotify & MASK_MESSAGE);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_URL, options->maskNotify & MASK_URL);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE, options->maskNotify & MASK_FILE);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER, options->maskNotify & MASK_OTHER);
+ SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS, options->maskActL & MASK_DISMISS);
+ SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN, options->maskActL & MASK_OPEN);
+ SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE, options->maskActL & MASK_REMOVE);
+ SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS, options->maskActR & MASK_DISMISS);
+ SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN, options->maskActR & MASK_OPEN);
+ SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE, options->maskActR & MASK_REMOVE);
+ SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS, options->maskActTE & MASK_DISMISS);
+ SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN, options->maskActTE & MASK_OPEN);
+ SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE, options->maskActTE & MASK_REMOVE);
+ SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK, options->bMsgWindowCheck);
+ SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW, options->bMsgReplyWindow);
+ SetCheckBoxState(hWnd, IDC_CHKSHOWDATE, options->bShowDate);
+ SetCheckBoxState(hWnd, IDC_CHKSHOWTIME, options->bShowTime);
+ SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS, options->bShowHeaders);
+ SetCheckBoxState(hWnd, IDC_RDNEW, !options->bShowON);
+ SetCheckBoxState(hWnd, IDC_RDOLD, options->bShowON);
+ SetCheckBoxState(hWnd, IDC_CHKHIDESEND, options->bHideSend);
+ SetCheckBoxState(hWnd, IDC_SUPRESSRSS, options->bNoRSS);
+ SetCheckBoxState(hWnd, IDC_READCHECK, options->bReadCheck);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, options->iDelayMsg == -1);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_URL, options->iDelayUrl == -1);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE, options->iDelayFile == -1);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS, options->iDelayOthers == -1);
+ SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1 ? options->iDelayMsg : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1 ? options->iDelayUrl : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1 ? options->iDelayFile : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1 ? options->iDelayOthers : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_NUMBERMSG, options->iNumberMsg, FALSE);
+ //update items' states
+ UpdateOptionsDlgItemsState(hWnd);
+ bWmNotify = FALSE;
+ return TRUE;
- case WM_COMMAND:
- if (!bWmNotify)
- {
- switch (LOWORD(wParam))
- {
- case IDC_PREVIEW:
- PopupPreview(options);
- break;
- default:
- //update options
- options->maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE)?MASK_MESSAGE:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_URL)?MASK_URL:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_FILE)?MASK_FILE:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_OTHER)?MASK_OTHER:0);
- options->maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS)?MASK_DISMISS:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKACTL_OPEN)?MASK_OPEN:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKACTL_REMOVE)?MASK_REMOVE:0);
- options->maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS)?MASK_DISMISS:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKACTR_OPEN)?MASK_OPEN:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKACTR_REMOVE)?MASK_REMOVE:0);
- options->maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS)?MASK_DISMISS:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_OPEN)?MASK_OPEN:0) |
- (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_REMOVE)?MASK_REMOVE:0);
- options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
- options->bDefaultColorUrl = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_URL);
- options->bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE);
- options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
- options->bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
- options->bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
- options->bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
- options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, NULL, FALSE);
- options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, NULL, FALSE);
- options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, NULL, FALSE);
- options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS)?-1:(DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, NULL, FALSE);
- options->bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
- options->bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
- options->bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
- options->bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE);
- options->bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME);
- options->bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS);
- options->bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
- options->bShowON = !IsDlgButtonChecked(hWnd, IDC_RDNEW);
- options->bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
- options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, NULL, FALSE);
- options->bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
- options->bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
- //update items' states
- UpdateOptionsDlgItemsState(hWnd);
- if (HIWORD(wParam) == CPN_COLOURCHANGED)
- {
- options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
- options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
- options->colBackUrl = SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_GETCOLOUR, 0, 0);
- options->colTextUrl = SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_GETCOLOUR, 0, 0);
- options->colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0);
- options->colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0);
- options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
- options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
- }
- //send changes to mi
- MenuitemUpdate(!options->bDisable);
- //enable "Apply" button
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- break;
- }
+ case WM_COMMAND:
+ if (!bWmNotify) {
+ switch (LOWORD(wParam)) {
+ case IDC_PREVIEW:
+ PopupPreview(options);
+ break;
+ default:
+ //update options
+ options->maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE) ? MASK_MESSAGE : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_URL) ? MASK_URL : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_FILE) ? MASK_FILE : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_OTHER) ? MASK_OTHER : 0);
+ options->maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS) ? MASK_DISMISS : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKACTL_OPEN) ? MASK_OPEN : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKACTL_REMOVE) ? MASK_REMOVE : 0);
+ options->maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS) ? MASK_DISMISS : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKACTR_OPEN) ? MASK_OPEN : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKACTR_REMOVE) ? MASK_REMOVE : 0);
+ options->maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS) ? MASK_DISMISS : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_OPEN) ? MASK_OPEN : 0) |
+ (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_REMOVE) ? MASK_REMOVE : 0);
+ options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
+ options->bDefaultColorUrl = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_URL);
+ options->bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE);
+ options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
+ options->bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
+ options->bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
+ options->bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
+ options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, NULL, FALSE);
+ options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, NULL, FALSE);
+ options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, NULL, FALSE);
+ options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, NULL, FALSE);
+ options->bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
+ options->bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
+ options->bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
+ options->bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE);
+ options->bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME);
+ options->bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS);
+ options->bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
+ options->bShowON = !IsDlgButtonChecked(hWnd, IDC_RDNEW);
+ options->bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
+ options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, NULL, FALSE);
+ options->bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
+ options->bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
+ //update items' states
+ UpdateOptionsDlgItemsState(hWnd);
+ if (HIWORD(wParam) == CPN_COLOURCHANGED) {
+ options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
+ options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
+ options->colBackUrl = SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_GETCOLOUR, 0, 0);
+ options->colTextUrl = SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_GETCOLOUR, 0, 0);
+ options->colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0);
+ options->colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0);
+ options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
+ options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
+ }
+ //send changes to mi
+ MenuitemUpdate(!options->bDisable);
+ //enable "Apply" button
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
}
- break;
+ }
+ break;
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- OptionsWrite();
- break;
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ OptionsWrite();
+ break;
- case PSN_RESET:
- OptionsRead();
+ case PSN_RESET:
+ OptionsRead();
- //maybe something changed with the mi
- MenuitemUpdate(!options->bDisable);
- break;
- }
+ //maybe something changed with the mi
+ MenuitemUpdate(!options->bDisable);
break;
-
- default:
- break;
- }
- return FALSE;
+ }
+ break;
+ }
+ return FALSE;
}
int OptionsAdd(HINSTANCE hInst, WPARAM addInfo)
@@ -304,7 +296,7 @@ int OptionsAdd(HINSTANCE hInst, WPARAM addInfo) odp.pszGroup = LPGEN("Popups");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = OptionsDlgProc;
- Options_AddPage( addInfo, &odp);
+ Options_AddPage(addInfo, &odp);
}
return 0;
@@ -312,20 +304,14 @@ int OptionsAdd(HINSTANCE hInst, WPARAM addInfo) int OptionsInit(PLUGIN_OPTIONS* pluginOptions)
{
- options = pluginOptions;
-
- OptionsRead();
-
- return 0;
+ options = pluginOptions;
+ OptionsRead();
+ return 0;
}
int Opt_DisableNEN(BOOL Status)
{
- options->bDisable = Status;
- OptionsWrite(); // JK: really necessary to write everything here ????
-
- //BUG!
- //Update options dialog if open!
-
+ options->bDisable = Status;
+ OptionsWrite(); // JK: really necessary to write everything here ????
return 0;
}
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 65bb908966..026ce4897c 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -74,30 +74,26 @@ static void FreePopupEventData(PLUGIN_DATA* pdata) int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
{
- EVENT_DATA_EX* eventData;
if (mask & MASK_OPEN) {
if (pdata) {
// do MS_MSG_SENDMESSAGE instead if wanted to reply and not read!
if (pdata->pluginOptions->bMsgReplyWindow && pdata->eventType == EVENTTYPE_MESSAGE)
CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pdata->hContact, 0); // JK, use core (since 0.3.3+)
else {
- CLISTEVENT* cle;
- int idx = 0;
-
- eventData = pdata->firstEventData;
- if (eventData)
- {
- do { //try to find the correct clist event //JK
- cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, (WPARAM)pdata->hContact, idx);
- if (cle && cle->hDbEvent == eventData->hEvent)
- {
- if (ServiceExists(cle->pszService))
- CallServiceSync(cle->pszService, 0, (LPARAM)cle); // JK, use core (since 0.3.3+)
- break;
- }
- idx++;
+ EVENT_DATA_EX *eventData = pdata->firstEventData;
+ if (eventData == NULL)
+ return 0;
+
+ for (int idx = 0;; idx++) {
+ CLISTEVENT *cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, (WPARAM)pdata->hContact, idx);
+ if (cle == NULL)
+ break;
+
+ if (cle->hDbEvent == eventData->hEvent) {
+ if (ServiceExists(cle->pszService))
+ CallServiceSync(cle->pszService, 0, (LPARAM)cle); // JK, use core (since 0.3.3+)
+ break;
}
- while (cle);
}
}
}
@@ -105,7 +101,7 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) if (mask & MASK_REMOVE) {
if (pdata) {
- eventData = pdata->firstEventData;
+ EVENT_DATA_EX *eventData = pdata->firstEventData;
pdata->iLock = 1;
while (eventData) {
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)pdata->hContact, (LPARAM)eventData->hEvent);
@@ -128,7 +124,8 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PLUGIN_DATA *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd);
- if (!pdata) return FALSE;
+ if (pdata == NULL)
+ return FALSE;
switch (message) {
case WM_COMMAND:
@@ -167,17 +164,15 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA break;
PopupAct(hWnd, pdata->pluginOptions->maskActTE, pdata);
break;
- default:
- break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
static TCHAR* GetEventPreview(DBEVENTINFO *dbei)
{
- TCHAR* comment1 = NULL;
- TCHAR* comment2 = NULL;
- char* commentFix = NULL;
+ TCHAR *comment1 = NULL;
+ TCHAR *comment2 = NULL;
+ char *commentFix = NULL;
//now get text
switch (dbei->eventType) {
@@ -205,26 +200,20 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) break;
case EVENTTYPE_FILE:
- // filenames
if (dbei->pBlob) {
- if (dbei->flags & DBEF_UTF)
- comment2 = mir_utf8decodeT((char*)dbei->pBlob + 4);
- else
- comment2 = mir_a2t((char*)dbei->pBlob + 4);
- }
- // description
- if (dbei->pBlob) {
- if (dbei->flags & DBEF_UTF)
- comment1 = mir_utf8decodeT((char *)dbei->pBlob + strlen((char *)dbei->pBlob + 4) + 1);
- else
- comment1 = mir_a2t((char *)dbei->pBlob + strlen((char *)dbei->pBlob + 4) + 1);
+ char *p = (char*)dbei->pBlob + sizeof(DWORD);
+ // filenames
+ comment2 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p);
+ p += strlen(p) + 1;
+ // description
+ comment1 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeT(p) : mir_a2t(p);
}
commentFix = POPUP_COMMENT_FILE;
break;
- //blob format is:
- //ASCIIZ nick
- //ASCIIZ UID
+ //blob format is:
+ //ASCIIZ nick
+ //ASCIIZ UID
case EVENTTYPE_CONTACTS:
if (dbei->pBlob) {
// count contacts in event
@@ -248,13 +237,13 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_CONTACTS;
break;
- //blob format is:
- //DWORD numeric uin (ICQ only afaik)
- //DWORD HANDLE to contact
- //ASCIIZ nick (or text UID)
- //ASCIIZ first name
- //ASCIIZ last name
- //ASCIIZ email (or YID)
+ //blob format is:
+ //DWORD numeric uin (ICQ only afaik)
+ //DWORD HANDLE to contact
+ //ASCIIZ nick (or text UID)
+ //ASCIIZ first name
+ //ASCIIZ last name
+ //ASCIIZ email (or YID)
case EVENTTYPE_ADDED:
if (dbei->pBlob) {
char szUin[16];
@@ -327,19 +316,19 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_AUTH;
break;
- //blob format is:
- //ASCIIZ text, usually "Sender IP: xxx.xxx.xxx.xxx\r\n%s"
- //ASCIIZ from name
- //ASCIIZ from e-mail
+ //blob format is:
+ //ASCIIZ text, usually "Sender IP: xxx.xxx.xxx.xxx\r\n%s"
+ //ASCIIZ from name
+ //ASCIIZ from e-mail
case ICQEVENTTYPE_WEBPAGER:
if (dbei->pBlob) comment1 = mir_a2t((const char *)dbei->pBlob);
commentFix = POPUP_COMMENT_WEBPAGER;
break;
- //blob format is:
- //ASCIIZ text, usually of the form "Subject: %s\r\n%s"
- //ASCIIZ from name
- //ASCIIZ from e-mail
+ //blob format is:
+ //ASCIIZ text, usually of the form "Subject: %s\r\n%s"
+ //ASCIIZ from name
+ //ASCIIZ from e-mail
case ICQEVENTTYPE_EMAILEXPRESS:
if (dbei->pBlob) comment1 = mir_a2t((const char *)dbei->pBlob);
commentFix = POPUP_COMMENT_EMAILEXP;
@@ -397,7 +386,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN switch (eventType) {
case EVENTTYPE_MESSAGE:
- if (!(pluginOptions->maskNotify&MASK_MESSAGE)) return 1;
+ if (!(pluginOptions->maskNotify & MASK_MESSAGE)) return 1;
pudw.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
pudw.colorBack = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colBackMsg;
pudw.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
@@ -406,7 +395,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN break;
case EVENTTYPE_URL:
- if (!(pluginOptions->maskNotify&MASK_URL)) return 1;
+ if (!(pluginOptions->maskNotify & MASK_URL)) return 1;
pudw.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_URL);
pudw.colorBack = pluginOptions->bDefaultColorUrl ? 0 : pluginOptions->colBackUrl;
pudw.colorText = pluginOptions->bDefaultColorUrl ? 0 : pluginOptions->colTextUrl;
@@ -415,7 +404,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN break;
case EVENTTYPE_FILE:
- if (!(pluginOptions->maskNotify&MASK_FILE)) return 1;
+ if (!(pluginOptions->maskNotify & MASK_FILE)) return 1;
pudw.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_FILE);
pudw.colorBack = pluginOptions->bDefaultColorFile ? 0 : pluginOptions->colBackFile;
pudw.colorText = pluginOptions->bDefaultColorFile ? 0 : pluginOptions->colTextFile;
@@ -424,7 +413,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN break;
default:
- if (!(pluginOptions->maskNotify&MASK_OTHER)) return 1;
+ if (!(pluginOptions->maskNotify & MASK_OTHER)) return 1;
pudw.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
pudw.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
pudw.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
@@ -475,9 +464,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN }
else { // get the needed event data
_tcsncpy(pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR), MAX_CONTACTNAME);
- TCHAR *szEventPreview = GetEventPreview(&dbe);
- _tcsncpy(pudw.lptzText, szEventPreview, MAX_SECONDLINE);
- mir_free(szEventPreview);
+ _tcsncpy(pudw.lptzText, ptrT(GetEventPreview(&dbe)), MAX_SECONDLINE);
}
PopupCount++;
@@ -485,10 +472,9 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN PopupList[NumberPopupData(NULL, -1)] = pdata;
// send data to popup plugin
- if (ServiceExists(MS_POPUP_ADDPOPUPT))
- {
- if (PUAddPopupW(&pudw) < 0)
- { // popup creation failed, release popupdata
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ // popup creation failed, release popupdata
+ if (PUAddPopupW(&pudw) < 0) {
FreePopupEventData(pdata);
mir_free(pdata);
}
@@ -535,13 +521,10 @@ int PopupUpdate(HANDLE hContact, HANDLE hEvent) int iEvent = 0;
while (true) {
- if (iEvent) {
- if (doReverse)
- eventData = eventData->next;
- else
- eventData = eventData->prev;
- }
+ if (iEvent)
+ eventData = (doReverse) ? eventData->next : eventData->prev;
iEvent++;
+
//get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
DBEVENTINFO dbe = {0};
dbe.cbSize = sizeof(dbe);
@@ -597,6 +580,5 @@ int PopupPreview(PLUGIN_OPTIONS* pluginOptions) PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_URL);
PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_FILE);
PopupShow(pluginOptions, NULL, NULL, -1);
-
return 0;
}
|