diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-15 21:47:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-15 21:47:10 +0000 |
commit | 9d482ed81c2a6a3361a5a9b2d0efbfc4b6b815c5 (patch) | |
tree | e5b304c159f7c79ab44926eee439eb93288acec6 /plugins/TabSRMM/src | |
parent | 7fe6e93058f0e9253e2a79d7fc2d7a136784f791 (diff) |
- POPUPDATAT_V2 replaced with POPUPDATAT in all possible cases;
- fix: wrong popup initialization code;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4057 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/chat/tools.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/eventpopups.cpp | 32 | ||||
-rw-r--r-- | plugins/TabSRMM/src/functions.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/mim.cpp | 67 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgoptions.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/nen.h | 34 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendlater.cpp | 7 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.cpp | 38 | ||||
-rw-r--r-- | plugins/TabSRMM/src/typingnotify.cpp | 655 | ||||
-rw-r--r-- | plugins/TabSRMM/src/typingnotify.h | 42 |
12 files changed, 423 insertions, 465 deletions
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index e6576b39e9..254459ccd7 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -190,7 +190,7 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA static int ShowPopup(HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
{
- POPUPDATAT_V2 pd = {0};
+ POPUPDATAT pd = {0};
va_list marker;
static TCHAR szBuf[4*1024];
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 362adf97b3..9a7d8cf45c 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -669,12 +669,6 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType, HWND hContainer)
{
- POPUPDATAT_V2 pud = {0};
- PLUGIN_DATAT *pdata;
- DBEVENTINFO dbe;
- long iSeconds = 0;
- TCHAR *szPreview = NULL;
-
//there has to be a maximum number of popups shown at the same time
if (PopupList.size() >= MAX_POPUPS)
return(2);
@@ -682,6 +676,8 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent if (!PluginConfig.g_PopupAvail)
return 0;
+ POPUPDATAT pud = {0};
+ long iSeconds;
switch (eventType) {
case EVENTTYPE_MESSAGE:
pud.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
@@ -699,23 +695,18 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent return 1;
}
- ZeroMemory(&dbe, sizeof(dbe));
- dbe.pBlob = NULL;
- dbe.cbSize = sizeof(dbe);
-
+ DBEVENTINFO dbe = { sizeof(dbe) };
// fix for a crash
if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
dbe.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hEvent, 0);
dbe.pBlob = (PBYTE)malloc(dbe.cbBlob);
- } else
- dbe.cbBlob = 0;
+ }
CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbe);
if (hEvent == 0 && hContact == 0)
dbe.szModule = Translate("Unknown module or contact");
- pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
-
+ PLUGIN_DATAT *pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
pdata->eventType = eventType;
pdata->hContact = hContact;
pdata->pluginOptions = pluginOptions;
@@ -737,7 +728,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent mir_free(szModule);
}
- szPreview = GetPreviewT((WORD)eventType, &dbe);
+ TCHAR *szPreview = GetPreviewT((WORD)eventType, &dbe);
if (szPreview) {
mir_sntprintf(pud.lptzText, MAX_SECONDLINE, _T("%s"), szPreview);
mir_free(szPreview);
@@ -753,14 +744,11 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent pdata->nrMerged = 1;
// fix for broken popups -- process failures
- if (CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pud, 0) < 0) {
- // failed to display, perform cleanup
- if (pdata->eventData)
- mir_free(pdata->eventData);
+ if ( PUAddPopUpT(&pud) < 0) {
+ mir_free(pdata->eventData);
mir_free(pdata);
}
- else
- PopupList.push_back(pdata);
+ else PopupList.push_back(pdata);
if (dbe.pBlob)
free(dbe.pBlob);
@@ -936,7 +924,7 @@ int tabSRMM_ShowPopup(WPARAM wParam, LPARAM lParam, WORD eventType, int windowOp return 0;
}
passed:
- if (!(PluginConfig.g_PopupAvail && PluginConfig.g_PopupWAvail))
+ if ( !PluginConfig.g_PopupAvail)
return 0;
if (PU_GetByContact((HANDLE)wParam) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index 5b440cb7aa..d5746cca5a 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -176,7 +176,7 @@ int TSAPI LoadLocalFlags(HWND hwnd, TWindowData *dat); int TN_ModuleInit();
int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam);
int TN_ModuleDeInit();
-int TN_TypingMessage(WPARAM wParam, LPARAM lParam);
+void TN_TypingMessage(HANDLE hContact, int iMode);
// mod plus
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 9fad90a235..f358f550bd 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -202,7 +202,6 @@ void CGlobals::reloadSystemModulesChanged() }
g_PopupAvail = ServiceExists(MS_POPUP_ADDPOPUP);
- g_PopupWAvail = ServiceExists(MS_POPUP_ADDPOPUPW);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000090000;
@@ -404,7 +403,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) ::RegisterFontServiceFonts();
::CacheLogFonts();
::Chat_ModulesLoaded(wParam, lParam);
- if (PluginConfig.g_PopupWAvail||PluginConfig.g_PopupAvail)
+ if (PluginConfig.g_PopupAvail)
TN_ModuleInit();
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 279016b8df..10a22aed0e 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -111,7 +111,7 @@ public: HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
HBITMAP g_hbmUnknown;
- int g_MetaContactsAvail, g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_PopupWAvail, g_WantHPP;
+ int g_MetaContactsAvail, g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP;
int g_FlashAvatarAvail;
HIMAGELIST g_hImageList;
HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index f57c312a5a..0c9f5a33f9 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -502,14 +502,12 @@ void CMimAPI::InitAPI() int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam)
{
- HWND hwnd = 0;
- int issplit = 1, foundWin = 0, preTyping = 0;
- struct TContainerData *pContainer = NULL;
- BOOL fShowOnClist = TRUE;
+ HWND hwnd = 0;
+ int issplit = 1, foundWin = 0, preTyping = 0;
+ BOOL fShowOnClist = TRUE;
if (wParam) {
-
- if ((hwnd = M->FindWindow((HANDLE) wParam)) && M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
+ if ((hwnd = M->FindWindow((HANDLE)wParam)) && M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
preTyping = SendMessage(hwnd, DM_TYPING, 0, lParam);
if (hwnd && IsWindowVisible(hwnd))
@@ -517,59 +515,54 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) else
foundWin = 0;
-
+ TContainerData *pContainer = NULL;
if (hwnd) {
SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
if (pContainer == NULL)
return 0; // should never happen
}
- if (M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) {
+ if ( M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) {
if (!hwnd && !M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1))
fShowOnClist = FALSE;
if (hwnd && !M->GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1))
fShowOnClist = FALSE;
}
- else
- fShowOnClist = FALSE;
+ else fShowOnClist = FALSE;
- if ((!foundWin || !(pContainer->dwFlags&CNT_NOSOUND)) && preTyping != (lParam != 0)) {
- if (lParam)
- SkinPlaySound("TNStart");
- else
- SkinPlaySound("TNStop");
- }
+ if ((!foundWin || !(pContainer->dwFlags&CNT_NOSOUND)) && preTyping != (lParam != 0))
+ SkinPlaySound((lParam) ? "TNStart" : "TNStop");
if (M->GetByte(SRMSGMOD, "ShowTypingPopup", 0)) {
- BOOL fShow = FALSE;
- int iMode = M->GetByte("MTN_PopupMode", 0);
+ BOOL fShow = FALSE;
+ int iMode = M->GetByte("MTN_PopupMode", 0);
switch(iMode) {
- case 0:
+ case 0:
+ fShow = TRUE;
+ break;
+ case 1:
+ if (!foundWin || !(pContainer && pContainer->hwndActive == hwnd && GetForegroundWindow() == pContainer->hwnd))
fShow = TRUE;
- break;
- case 1:
- if (!foundWin || !(pContainer && pContainer->hwndActive == hwnd && GetForegroundWindow() == pContainer->hwnd))
- fShow = TRUE;
- break;
- case 2:
- if (hwnd == 0)
- fShow = TRUE;
- else {
- if (PluginConfig.m_HideOnClose) {
- struct TContainerData *pContainer = 0;
- SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
- if (pContainer && pContainer->fHidden)
- fShow = TRUE;
- }
+ break;
+ case 2:
+ if (hwnd == 0)
+ fShow = TRUE;
+ else {
+ if (PluginConfig.m_HideOnClose) {
+ struct TContainerData *pContainer = 0;
+ SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer);
+ if (pContainer && pContainer->fHidden)
+ fShow = TRUE;
}
- break;
+ }
+ break;
}
if (fShow)
- TN_TypingMessage(wParam, lParam);
+ TN_TypingMessage((HANDLE)wParam, lParam);
}
- if ((int) lParam) {
+ if (lParam) {
TCHAR szTip[256];
_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message."), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR));
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 77d73409db..f4abde6c78 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M->GetByte("MTN_PopupMode", 0), 0);
- if (!PluginConfig.g_PopupWAvail) {
+ if (!PluginConfig.g_PopupAvail) {
Utils::showDlgControl(hwndDlg, IDC_NOTIFYPOPUP, SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_STATIC111, SW_HIDE);
Utils::showDlgControl(hwndDlg, IDC_MTN_POPUPMODE, SW_HIDE);
@@ -1265,7 +1265,7 @@ struct { static int OptInitialise(WPARAM wParam, LPARAM lParam)
{
- if (PluginConfig.g_PopupWAvail||PluginConfig.g_PopupAvail)
+ if (PluginConfig.g_PopupAvail)
TN_OptionsInitialize(wParam, lParam);
OPTIONSDIALOGPAGE odp = { 0 };
diff --git a/plugins/TabSRMM/src/nen.h b/plugins/TabSRMM/src/nen.h index d21f2533b6..815737feb7 100644 --- a/plugins/TabSRMM/src/nen.h +++ b/plugins/TabSRMM/src/nen.h @@ -133,26 +133,28 @@ struct NEN_OPTIONS { DWORD dwRemoveMask;
};
-typedef struct {
+struct EVENT_DATAT
+{
HANDLE hEvent;
- TCHAR szText[MAX_SECONDLINE + 2];
- DWORD timestamp;
-} EVENT_DATAT;
+ TCHAR szText[MAX_SECONDLINE + 2];
+ DWORD timestamp;
+};
-typedef struct {
- UINT eventType;
- HANDLE hContact;
+struct PLUGIN_DATAT
+{
+ UINT eventType;
+ HANDLE hContact;
NEN_OPTIONS *pluginOptions;
- POPUPDATAT_V2* pud;
- HWND hWnd;
- long iSeconds;
- TCHAR szHeader[256];
- int nrMerged;
+ POPUPDATAT *pud;
+ HWND hWnd;
+ long iSeconds;
+ TCHAR szHeader[256];
+ int nrMerged;
EVENT_DATAT *eventData;
- int nrEventsAlloced;
- int iActionTaken;
- HWND hContainer;
-} PLUGIN_DATAT;
+ int nrEventsAlloced;
+ int iActionTaken;
+ HWND hContainer;
+};
#define NR_MERGED 5
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 4b62744ec7..709198ef4f 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -125,8 +125,6 @@ void CSendLaterJob::writeFlags() CSendLaterJob::~CSendLaterJob()
{
if (fSuccess || fFailed) {
- POPUPDATAT_V2 ppd = {0};
-
if ((sendLater->haveErrorPopups() && fFailed) || (sendLater->haveSuccessPopups() && fSuccess)) {
bool fShowPopup = true;
@@ -138,9 +136,8 @@ CSendLaterJob::~CSendLaterJob() if (PluginConfig.g_PopupAvail && fShowPopup) {
TCHAR *tszName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR);
- ZeroMemory((void*)&ppd, sizeof(ppd));
+ POPUPDATAT ppd = {0};
ppd.lchContact = hContact;
- ppd.cbSize = sizeof(ppd);
mir_sntprintf(ppd.lptzContactName, MAX_CONTACTNAME, _T("%s"), tszName ? tszName : TranslateT("'(Unknown Contact)'"));
TCHAR *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<TCHAR *>(&pBuf[lstrlenA((char *)pBuf) + 1]), 100);
if (fSuccess) {
@@ -162,7 +159,7 @@ CSendLaterJob::~CSendLaterJob() ppd.lchIcon = fFailed ? PluginConfig.g_iconErr : PluginConfig.g_IconMsgEvent;
ppd.PluginData = (void*)hContact;
ppd.iSeconds = fFailed ? -1 : nen_options.iDelayMsg;
- CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, 0);
+ PUAddPopUpT(&ppd);
}
}
if (fFailed && (bCode == JOB_AGE || bCode == JOB_REMOVABLE) && szId[0] == 'S')
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 49a095064e..e2a609db61 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -690,30 +690,28 @@ void SendQueue::UpdateSaveAndSendButton(TWindowData *dat) void SendQueue::NotifyDeliveryFailure(const TWindowData *dat)
{
- POPUPDATAT_V2 ppd = {0};
- int ibsize = 1023;
-
if (M->GetByte("adv_noErrorPopups", 0))
return;
- if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) {
- ZeroMemory((void*)&ppd, sizeof(ppd));
- ppd.lchContact = dat->hContact;
- mir_sntprintf(ppd.lptzContactName, MAX_CONTACTNAME, _T("%s"), dat->cache->getNick());
- mir_sntprintf(ppd.lptzText, MAX_SECONDLINE, _T("%s"), TranslateT("A message delivery has failed.\nClick to open the message window."));
- if (!(BOOL)M->GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE))
- {
- ppd.colorText = (COLORREF)M->GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
- ppd.colorBack = (COLORREF)M->GetDword(MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
- }
- else
- ppd.colorText = ppd.colorBack = 0;
- ppd.PluginWindowProc = reinterpret_cast<WNDPROC>(Utils::PopupDlgProcError);
- ppd.lchIcon = PluginConfig.g_iconErr;
- ppd.PluginData = (void*)dat->hContact;
- ppd.iSeconds = (int)M->GetDword(MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
+ if ( CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) != 1)
+ return;
+
+ POPUPDATAT ppd = { 0 };
+ ppd.lchContact = dat->hContact;
+ lstrcpyn(ppd.lptzContactName, dat->cache->getNick(), MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, TranslateT("A message delivery has failed.\nClick to open the message window."), MAX_SECONDLINE);
+
+ if (!(BOOL)M->GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE)) {
+ ppd.colorText = (COLORREF)M->GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
+ ppd.colorBack = (COLORREF)M->GetDword(MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
}
+ else ppd.colorText = ppd.colorBack = 0;
+
+ ppd.PluginWindowProc = reinterpret_cast<WNDPROC>(Utils::PopupDlgProcError);
+ ppd.lchIcon = PluginConfig.g_iconErr;
+ ppd.PluginData = (void*)dat->hContact;
+ ppd.iSeconds = (int)M->GetDword(MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
+ PUAddPopUpT(&ppd);
}
/*
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 4ce0796936..d42c2cac8c 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -2,11 +2,49 @@ HANDLE hTypingNotify;
+static HANDLE hDisableMenu = NULL;
+static HANDLE hPopUpsList = NULL;
+
+static BYTE OnePopUp;
+static BYTE ShowMenu;
+static BYTE StartDisabled;
+static BYTE StopDisabled;
+static BYTE Disabled;
+static BYTE ColorMode;
+static BYTE TimeoutMode;
+static BYTE TimeoutMode2;
+static int Timeout;
+static int Timeout2;
+static int newTimeout;
+static int newTimeout2;
+static BYTE newTimeoutMode;
+static BYTE newTimeoutMode2;
+static BYTE newColorMode;
+static TCHAR szStart[128];
+static TCHAR szStop[128];
+
+static HANDLE hntfStarted = 0;
+static HANDLE hntfStopped = 0;
+
+struct
+{
+ int res;
+ char desc[10];
+ COLORREF color;
+}
+static colorPicker[4] =
+{
+ { IDC_TYPEON_BG, "ON_BG", RGB(255,255,255)},
+ { IDC_TYPEON_TX, "ON_TX", RGB(0,0,0)},
+ { IDC_TYPEOFF_BG, "OFF_BG", RGB(255,255,255)},
+ { IDC_TYPEOFF_TX, "OFF_TX", RGB(0,0,0)}
+};
+
static INT_PTR EnableDisableMenuCommand(WPARAM wParam,LPARAM lParam)
{
- Disabled = !(Disabled);
+ Disabled = !Disabled;
- if (PopupService) {
+ if (PluginConfig.g_PopupAvail) {
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON | CMIM_NAME;
@@ -55,161 +93,156 @@ static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM return DefWindowProc(hWnd, message, wParam, lParam);
}
-int TN_TypingMessage(WPARAM wParam, LPARAM lParam)
+void TN_TypingMessage(HANDLE hContact, int iMode)
{
- POPUPDATAT_V2 ppd = { 0 };
- TCHAR *szContactName = NULL;
- HWND hPopUpWnd = NULL;
- int notyping;
-
// hidden & ignored contacts check
- if (M->GetByte((HANDLE)wParam, "CList", "Hidden", 0) || (M->GetDword((HANDLE)wParam, "Ignore", "Mask1",0) & 1)) // 9 - online notification
- return 0;
+ if (M->GetByte(hContact, "CList", "Hidden", 0) || (M->GetDword(hContact, "Ignore", "Mask1",0) & 1)) // 9 - online notification
+ return;
- szContactName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GSMDF_TCHAR);
+ if (!PluginConfig.g_PopupAvail || Disabled)
+ return;
- if (PopupService && !Disabled) {
- if (OnePopUp) {
- hPopUpWnd = WindowList_Find(hPopUpsList, (HANDLE) wParam);
- while (hPopUpWnd) {
- PUDeletePopUp(hPopUpWnd);
- hPopUpWnd = WindowList_Find(hPopUpsList, (HANDLE) wParam);
- }
- }
+ TCHAR *szContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GSMDF_TCHAR);
- switch (lParam) {
- case PROTOTYPE_CONTACTTYPING_OFF:
- if (StopDisabled)
- return 0;
- lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
- ppd.hNotification = hntfStopped;
- notyping = 1;
- break;
- default:
- if (StartDisabled)
- return 0;
- lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
- ppd.hNotification = hntfStarted;
- notyping = 0;
- break;
+ if (OnePopUp) {
+ HWND hPopUpWnd = WindowList_Find(hPopUpsList, hContact);
+ while (hPopUpWnd) {
+ PUDeletePopUp(hPopUpWnd);
+ hPopUpWnd = WindowList_Find(hPopUpsList, hContact);
}
+ }
- switch (ColorMode) {
- case COLOR_OWN:
- ppd.colorBack = colorPicker[2* notyping ].color;
- ppd.colorText = colorPicker[2* notyping + 1].color;
- break;
- case COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case COLOR_POPUP:
- default:
- ppd.colorBack = ppd.colorText = 0;
- break;
- }
+ int notyping;
+ POPUPDATAT_V2 ppd = { 0 };
- if (notyping)
- switch (TimeoutMode2) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = Timeout2;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
- else
- switch (TimeoutMode) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = Timeout;
- break;
- case TIMEOUT_PROTO:
- ppd.iSeconds = (DWORD) lParam;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
+ if (iMode == PROTOTYPE_CONTACTTYPING_OFF) {
+ if (StopDisabled)
+ return;
+ lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
+ ppd.hNotification = hntfStopped;
+ notyping = 1;
+ }
+ else {
+ if (StartDisabled)
+ return;
+ lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
+ lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
+ ppd.hNotification = hntfStarted;
+ notyping = 0;
+ }
- ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
- ppd.lchContact = (HANDLE) wParam;
- ppd.PluginWindowProc = (WNDPROC) PopupDlgProc;
- ppd.PluginData = NULL;
+ switch (ColorMode) {
+ case COLOR_OWN:
+ ppd.colorBack = colorPicker[2* notyping ].color;
+ ppd.colorText = colorPicker[2* notyping + 1].color;
+ break;
+ case COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case COLOR_POPUP:
+ default:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
- ppd.cbSize = sizeof(ppd);
+ if (notyping)
+ switch (TimeoutMode2) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = Timeout2;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
+ else
+ switch (TimeoutMode) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = Timeout;
+ break;
+ case TIMEOUT_PROTO:
+ ppd.iSeconds = iMode;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NEWDATA);
- }
- return 0;
+ ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
+ ppd.lchContact = hContact;
+ ppd.PluginWindowProc = (WNDPROC) PopupDlgProc;
+ ppd.PluginData = NULL;
+ ppd.cbSize = sizeof(ppd);
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NEWDATA);
}
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- WORD i;
+ int i;
switch (msg) {
- case WM_INITDIALOG: {
- TranslateDialogDefault(hwndDlg);
-
- if (ColorMode == COLOR_WINDOWS) {
- CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_CHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, TRUE);
- CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_UNCHECKED);
- } else if (ColorMode == COLOR_POPUP) {
- CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_UNCHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, TRUE);
- CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
- }
-
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) {
- SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
- Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
- }
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ if (ColorMode == COLOR_WINDOWS) {
+ CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_CHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, TRUE);
+ CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_UNCHECKED);
+ }
+ else if (ColorMode == COLOR_POPUP) {
+ CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, BST_UNCHECKED);
+ Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, FALSE);
+ Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, TRUE);
+ CheckDlgButton(hwndDlg, IDC_USEPOPUPCOLORS, BST_CHECKED);
+ }
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT, (TimeoutMode == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP, (TimeoutMode == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_PROTO, (TimeoutMode == TIMEOUT_PROTO) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM, (TimeoutMode == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE, Timeout, 0);
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, TimeoutMode == TIMEOUT_CUSTOM);
-
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT2, (TimeoutMode2 == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP2, (TimeoutMode2 == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM2, (TimeoutMode2 == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE2, Timeout2, 0);
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, TimeoutMode2 == TIMEOUT_CUSTOM);
-
- CheckDlgButton(hwndDlg, IDC_START, (StartDisabled) ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_STOP, (StopDisabled) ? BST_UNCHECKED : BST_CHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopUp) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED);
-
- Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PopupService);
- Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PopupService);
- Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PopupService/*&&!ServiceExists(MS_POPUP_REGISTERNOTIFICATION)*/);
-
- newTimeout = Timeout;
- newTimeoutMode = TimeoutMode;
- newTimeout2 = Timeout2;
- newTimeoutMode2 = TimeoutMode2;
- newColorMode = ColorMode;
+ for (i=0; i < SIZEOF(colorPicker); i++) {
+ SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_SETCOLOUR, 0, colorPicker[i].color);
+ Utils::enableDlgControl(hwndDlg, colorPicker[i].res, (ColorMode == COLOR_OWN));
}
- break;
- case WM_COMMAND: {
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT, (TimeoutMode == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP, (TimeoutMode == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_PROTO, (TimeoutMode == TIMEOUT_PROTO) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM, (TimeoutMode == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE, Timeout, 0);
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, TimeoutMode == TIMEOUT_CUSTOM);
+
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_PERMANENT2, (TimeoutMode2 == TIMEOUT_PERMANENT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_POPUP2, (TimeoutMode2 == TIMEOUT_POPUP) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TIMEOUT_CUSTOM2, (TimeoutMode2 == TIMEOUT_CUSTOM) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_TIMEOUT_VALUE2, Timeout2, 0);
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, TimeoutMode2 == TIMEOUT_CUSTOM);
+
+ CheckDlgButton(hwndDlg, IDC_START, (StartDisabled) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_STOP, (StopDisabled) ? BST_UNCHECKED : BST_CHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopUp) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED);
+
+ Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PluginConfig.g_PopupAvail);
+ Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PluginConfig.g_PopupAvail);
+ Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PluginConfig.g_PopupAvail/*&&!ServiceExists(MS_POPUP_REGISTERNOTIFICATION)*/);
+
+ newTimeout = Timeout;
+ newTimeoutMode = TimeoutMode;
+ newTimeout2 = Timeout2;
+ newTimeoutMode2 = TimeoutMode2;
+ newColorMode = ColorMode;
+ break;
+
+ case WM_COMMAND:
+ {
WORD idCtrl = LOWORD(wParam), wNotifyCode = HIWORD(wParam);
if (wNotifyCode == CPN_COLOURCHANGED) {
@@ -218,37 +251,37 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
switch (idCtrl) {
- case IDC_USEWINCOLORS: {
- BOOL bEnableOthers = FALSE;
-
- if (wNotifyCode != BN_CLICKED)
- break;
+ case IDC_USEWINCOLORS:
+ if (wNotifyCode == BN_CLICKED) {
+ BOOL bEnableOthers;
if (IsDlgButtonChecked(hwndDlg, IDC_USEWINCOLORS)) {
newColorMode = COLOR_WINDOWS;
bEnableOthers = FALSE;
- } else {
+ }
+ else {
newColorMode = COLOR_OWN;
bEnableOthers = TRUE;
}
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++)
+ for (i=0; i < SIZEOF(colorPicker); i++)
Utils::enableDlgControl(hwndDlg, colorPicker[i].res, bEnableOthers);
Utils::enableDlgControl(hwndDlg, IDC_USEPOPUPCOLORS, bEnableOthers);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
- case IDC_USEPOPUPCOLORS: {
- BOOL bEnableOthers = FALSE;
- if (wNotifyCode != BN_CLICKED)
- break;
+ break;
+
+ case IDC_USEPOPUPCOLORS:
+ if (wNotifyCode == BN_CLICKED) {
+ BOOL bEnableOthers;
if (IsDlgButtonChecked(hwndDlg, IDC_USEPOPUPCOLORS)) {
newColorMode = COLOR_POPUP;
bEnableOthers = FALSE;
- } else {
+ }
+ else {
newColorMode = COLOR_OWN;
bEnableOthers = TRUE;
}
@@ -259,156 +292,157 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA Utils::enableDlgControl(hwndDlg, IDC_USEWINCOLORS, bEnableOthers);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
- case IDC_ONEPOPUP:
- case IDC_CLIST:
- case IDC_DISABLED:
- case IDC_SHOWMENU:
- case IDC_START:
- case IDC_STOP:
- case IDC_WOCL:
- if (wNotifyCode == BN_CLICKED)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case IDC_PREVIEW: {
- POPUPDATAT_V2 ppd = { 0 };
- char *szProto = NULL;
- int i, notyping;
-
- HANDLE hContact = db_find_first();
+ break;
- if (!PopupService)
- break;
+ case IDC_ONEPOPUP:
+ case IDC_CLIST:
+ case IDC_DISABLED:
+ case IDC_SHOWMENU:
+ case IDC_START:
+ case IDC_STOP:
+ case IDC_WOCL:
+ if (wNotifyCode == BN_CLICKED)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ case IDC_PREVIEW:
+ if (PluginConfig.g_PopupAvail) {
+ HANDLE hContact = db_find_first();
while (hContact) {
- szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto != NULL)
break;
hContact = db_find_next(hContact);
}
+ POPUPDATAT ppd = { 0 };
for (i=0; i < 2; i++) {
-
- switch (i) {
- case PROTOTYPE_CONTACTTYPING_OFF:
- lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
- lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
- notyping = 1;
- break;
- default:
- lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
- lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
- notyping = 0;
- break;
+ int notyping;
+ if (i == PROTOTYPE_CONTACTTYPING_OFF) {
+ lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
+ lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
+ notyping = 1;
+ }
+ else {
+ lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
+ lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
+ notyping = 0;
}
switch (newColorMode) {
- case COLOR_OWN:
- ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2* notyping + 1].res, CPM_GETCOLOUR, 0, 0);
- ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2* notyping ].res, CPM_GETCOLOUR, 0, 0);
+ case COLOR_OWN:
+ ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2*notyping + 1].res, CPM_GETCOLOUR, 0, 0);
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2*notyping ].res, CPM_GETCOLOUR, 0, 0);
+ break;
+ case COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case COLOR_POPUP:
+ default:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
+
+ if (notyping)
+ switch (newTimeoutMode2) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout2;
break;
- case COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
break;
- case COLOR_POPUP:
+ case TIMEOUT_POPUP:
default:
- ppd.colorBack = ppd.colorText = 0;
+ ppd.iSeconds = 0;
break;
}
-
- if (notyping)
- switch (newTimeoutMode2) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout2;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
else
switch (newTimeoutMode) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout;
- break;
- case TIMEOUT_PROTO:
- ppd.iSeconds = 10;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout;
+ break;
+ case TIMEOUT_PROTO:
+ ppd.iSeconds = 10;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
ppd.lchContact = (HANDLE) wParam;
ppd.PluginWindowProc = NULL;
ppd.PluginData = NULL;
-
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
-
+ PUAddPopUpT(&ppd);
}
- break;
}
- case IDC_TIMEOUT_POPUP2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_POPUP;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_POPUP2:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_CUSTOM2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_CUSTOM;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 1);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode2 = TIMEOUT_POPUP;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_CUSTOM2:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_POPUP:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_POPUP;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode2 = TIMEOUT_CUSTOM;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 1);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_POPUP:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_PERMANENT:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_PERMANENT;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode = TIMEOUT_POPUP;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_PERMANENT:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_PERMANENT2:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode2 = TIMEOUT_PERMANENT;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode = TIMEOUT_PERMANENT;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_PERMANENT2:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_CUSTOM:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_CUSTOM;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 1);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode2 = TIMEOUT_PERMANENT;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE2, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_CUSTOM:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_PROTO:
- if (wNotifyCode != BN_CLICKED)
- break;
- newTimeoutMode = TIMEOUT_PROTO;
- Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ newTimeoutMode = TIMEOUT_CUSTOM;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 1);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_PROTO:
+ if (wNotifyCode != BN_CLICKED)
break;
- case IDC_TIMEOUT_VALUE:
- case IDC_TIMEOUT_VALUE2: {
+ newTimeoutMode = TIMEOUT_PROTO;
+ Utils::enableDlgControl(hwndDlg, IDC_TIMEOUT_VALUE, 0);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TIMEOUT_VALUE:
+ case IDC_TIMEOUT_VALUE2:
+ {
int newValue = GetDlgItemInt(hwndDlg, idCtrl, NULL, 0);
if (wNotifyCode == EN_KILLFOCUS) {
@@ -437,51 +471,45 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA newTimeout2 = newValue;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
}
-
}
- break;
}
- case WM_NOTIFY: {
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) {
- colorPicker[i].color = SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_GETCOLOUR, 0, 0);
- M->WriteDword(Module, colorPicker[i].desc, colorPicker[i].color);
- }
-
- Timeout = newTimeout;
- TimeoutMode = newTimeoutMode;
- Timeout2 = newTimeout2;
- TimeoutMode2 = newTimeoutMode2;
- ColorMode = newColorMode;
-
- if (Disabled != IsDlgButtonChecked(hwndDlg, IDC_DISABLED))
- EnableDisableMenuCommand(0, 0);
-
- StartDisabled = IsDlgButtonChecked(hwndDlg, IDC_START) ? 0 : 2;
- StopDisabled = IsDlgButtonChecked(hwndDlg, IDC_STOP) ? 0 : 4;
- OnePopUp = IsDlgButtonChecked(hwndDlg, IDC_ONEPOPUP);
- ShowMenu = IsDlgButtonChecked(hwndDlg, IDC_SHOWMENU);
-
- M->WriteByte(Module, SET_ONEPOPUP, OnePopUp);
- M->WriteByte(Module, SET_SHOWDISABLEMENU, ShowMenu);
- M->WriteByte(Module, SET_DISABLED, (BYTE) (StartDisabled | StopDisabled));
- M->WriteByte(Module, SET_COLOR_MODE, ColorMode);
- M->WriteByte(Module, SET_TIMEOUT_MODE, TimeoutMode);
- M->WriteByte(Module, SET_TIMEOUT, (BYTE) Timeout);
- M->WriteByte(Module, SET_TIMEOUT_MODE2, TimeoutMode2);
- M->WriteByte(Module, SET_TIMEOUT2, (BYTE) Timeout2);
-
- return TRUE;
- }
- break;
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++) {
+ colorPicker[i].color = SendDlgItemMessage(hwndDlg, colorPicker[i].res, CPM_GETCOLOUR, 0, 0);
+ M->WriteDword(Module, colorPicker[i].desc, colorPicker[i].color);
+ }
+
+ Timeout = newTimeout; TimeoutMode = newTimeoutMode;
+ Timeout2 = newTimeout2; TimeoutMode2 = newTimeoutMode2;
+ ColorMode = newColorMode;
+
+ if (Disabled != IsDlgButtonChecked(hwndDlg, IDC_DISABLED))
+ EnableDisableMenuCommand(0, 0);
+
+ StartDisabled = IsDlgButtonChecked(hwndDlg, IDC_START) ? 0 : 2;
+ StopDisabled = IsDlgButtonChecked(hwndDlg, IDC_STOP) ? 0 : 4;
+ OnePopUp = IsDlgButtonChecked(hwndDlg, IDC_ONEPOPUP);
+ ShowMenu = IsDlgButtonChecked(hwndDlg, IDC_SHOWMENU);
+
+ M->WriteByte(Module, SET_ONEPOPUP, OnePopUp);
+ M->WriteByte(Module, SET_SHOWDISABLEMENU, ShowMenu);
+ M->WriteByte(Module, SET_DISABLED, (BYTE) (StartDisabled | StopDisabled));
+ M->WriteByte(Module, SET_COLOR_MODE, ColorMode);
+ M->WriteByte(Module, SET_TIMEOUT_MODE, TimeoutMode);
+ M->WriteByte(Module, SET_TIMEOUT, (BYTE) Timeout);
+ M->WriteByte(Module, SET_TIMEOUT_MODE2, TimeoutMode2);
+ M->WriteByte(Module, SET_TIMEOUT2, (BYTE) Timeout2);
+ return TRUE;
}
- break;
}
+ break;
}
return FALSE;
}
@@ -505,16 +533,12 @@ int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam) int TN_ModuleInit()
{
- WORD i;
-
- PopupService = (PluginConfig.g_PopupWAvail || PluginConfig.g_PopupAvail);
-
hPopUpsList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST,0,0);
OnePopUp = M->GetByte(Module,SET_ONEPOPUP,DEF_ONEPOPUP);
ShowMenu = M->GetByte(Module,SET_SHOWDISABLEMENU,DEF_SHOWDISABLEMENU);
- i = M->GetByte(Module,SET_DISABLED,DEF_DISABLED);
+ int i = M->GetByte(Module,SET_DISABLED,DEF_DISABLED);
Disabled = i & 1;
StartDisabled = i & 2;
StopDisabled = i & 4;
@@ -526,22 +550,21 @@ int TN_ModuleInit() Timeout2 = M->GetByte(Module,SET_TIMEOUT2,DEF_TIMEOUT2);
if (!(M->GetDword(Module, colorPicker[0].desc, 1) && !M->GetDword(Module, colorPicker[0].desc, 0)))
- for (i=0; i < sizeof(colorPicker) / sizeof(colorPicker[0]); i++)
+ for (i=0; i < SIZEOF(colorPicker); i++)
colorPicker[i].color = M->GetDword(Module,colorPicker[i].desc,0);
mir_sntprintf(szStart, sizeof(szStart), TranslateT("...is typing a message."));
mir_sntprintf(szStop, sizeof(szStop), TranslateT("...has stopped typing."));
- if (PopupService && ShowMenu) {
+ if (PluginConfig.g_PopupAvail && ShowMenu) {
hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand);
CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = 0;
-
if (!Disabled) {
mi.pszName = LPGEN("Disable &typing notification");
mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED));
- } else {
+ }
+ else {
mi.pszName = LPGEN("Enable &typing notification");
mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED));
}
diff --git a/plugins/TabSRMM/src/typingnotify.h b/plugins/TabSRMM/src/typingnotify.h index 03fb9851b7..e825002b73 100644 --- a/plugins/TabSRMM/src/typingnotify.h +++ b/plugins/TabSRMM/src/typingnotify.h @@ -32,45 +32,3 @@ #define DEF_SHOWDISABLEMENU 1
#define SET_ONEPOPUP "OnePopUp"
#define DEF_ONEPOPUP 1
-
-
-static HANDLE hDisableMenu = NULL;
-static HANDLE hPopUpsList = NULL;
-
-static BYTE OnePopUp;
-static BYTE ShowMenu;
-static BYTE PopupService=0;
-static BYTE StartDisabled;
-static BYTE StopDisabled;
-static BYTE Disabled;
-static BYTE ColorMode;
-static BYTE TimeoutMode;
-static BYTE TimeoutMode2;
-static int Timeout;
-static int Timeout2;
-static int newTimeout;
-static int newTimeout2;
-static BYTE newTimeoutMode;
-static BYTE newTimeoutMode2;
-static BYTE newColorMode;
-static TCHAR szStart[128];
-static TCHAR szStop[128];
-
-static HANDLE hntfStarted = 0;
-static HANDLE hntfStopped = 0;
-
-
-struct colors_s
-{
- int res;
- char desc[10];
- COLORREF color;
-};
-
-static struct colors_s colorPicker[4] =
-{
- {IDC_TYPEON_BG, "ON_BG", RGB(255,255,255)},
- {IDC_TYPEON_TX, "ON_TX", RGB(0,0,0)},
- {IDC_TYPEOFF_BG, "OFF_BG", RGB(255,255,255)},
- {IDC_TYPEOFF_TX, "OFF_TX", RGB(0,0,0)}
-};
|