diff options
author | Mataes <mataes2007@gmail.com> | 2018-05-16 19:12:38 +0300 |
---|---|---|
committer | Mataes <mataes2007@gmail.com> | 2018-05-16 19:12:38 +0300 |
commit | b12321b9897b511e94301b73c1c48c533412d739 (patch) | |
tree | aeec4c481dc82376e22879e76a81fd2abb7138f5 /plugins/ClientChangeNotify | |
parent | 3c4beeb99d4324fb453e928421c9b13d70ab4923 (diff) |
BossKey, BuddyExpectator, BuddyPounce, ChangeKeyboardLayout, ClientChangeNotify, Cln_skinedit, CmdLine: cmplugin adaptation
Diffstat (limited to 'plugins/ClientChangeNotify')
-rw-r--r-- | plugins/ClientChangeNotify/src/ClientChangeNotify.cpp | 46 | ||||
-rw-r--r-- | plugins/ClientChangeNotify/src/OptDlg.cpp | 64 | ||||
-rw-r--r-- | plugins/ClientChangeNotify/src/stdafx.h | 11 |
3 files changed, 60 insertions, 61 deletions
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 2e1b3c7a7e..df8509c519 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -2,26 +2,26 @@ ClientChangeNotify - Plugin for Miranda IM
Copyright (c) 2006-2008 Chervov Dmitry
- 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.
-
- 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
+ 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.
+
+ 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 "stdafx.h"
-HINSTANCE g_hInstance;
HANDLE g_hMainThread;
HGENMENU g_hTogglePopupsMenuItem;
+CMPlugin g_plugin;
int hLangpack;
COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview)
@@ -40,12 +40,6 @@ PLUGININFOEX pluginInfo = { {0xb68a8906, 0x748b, 0x435d, {0x93, 0xe, 0x21, 0xcc, 0x6e, 0x8f, 0x3b, 0x3f}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -68,7 +62,7 @@ static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) // wParam = hContact
{
POINT pt;
- HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MOD_NAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_hInstance, nullptr);
+ HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", _A2W(MOD_NAME) L"_MenuWindow", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc);
HMENU hMenu = Menu_BuildContactMenu(wParam);
GetCursorPos(&pt);
@@ -156,7 +150,7 @@ void ShowPopup(SHOWPOPUP_DATA *sd) }
PLUGIN_DATA *pdata = (PLUGIN_DATA*)calloc(1, sizeof(PLUGIN_DATA));
- POPUPDATAT ppd = {0};
+ POPUPDATAT ppd = { 0 };
ppd.lchContact = sd->hContact;
char *szProto = GetContactProto(sd->hContact);
pdata->hIcon = ppd.lchIcon = Finger_GetClientIcon(sd->MirVer, false);
@@ -184,7 +178,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (strcmp(cws->szSetting, DB_MIRVER))
return 0;
- SHOWPOPUP_DATA sd = {0};
+ SHOWPOPUP_DATA sd = { 0 };
char *szProto = GetContactProto(hContact);
if (g_PreviewOptPage)
sd.MirVer = L"Miranda NG ICQ 0.93.5.3007";
@@ -229,7 +223,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) sd.PopupOptPage = &PopupOptPage;
if (!PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) || !PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWVER)) {
if (bFingerprintExists) {
- LPCTSTR ptszOldClient = Finger_GetClientDescr(sd.OldMirVer);
+ LPCTSTR ptszOldClient = Finger_GetClientDescr(sd.OldMirVer);
LPCTSTR ptszClient = Finger_GetClientDescr(sd.MirVer);
if (ptszOldClient && ptszClient) {
if (PerContactSetting != NOTIFY_ALMOST_ALWAYS && PerContactSetting != NOTIFY_ALWAYS && !PopupOptPage.GetValue(IDC_POPUPOPTDLG_VERCHGNOTIFY) && !wcscmp(ptszClient, ptszOldClient))
@@ -326,7 +320,7 @@ int MirandaLoaded(WPARAM, LPARAM) if (bPopupExists) {
CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups);
HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu);
-
+
CMenuItem mi;
SET_UID(mi, 0xfabb9181, 0xdb92, 0x43f4, 0x86, 0x40, 0xca, 0xb6, 0x4c, 0x93, 0x34, 0x27);
mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Popups"), 0);
@@ -342,7 +336,7 @@ int MirandaLoaded(WPARAM, LPARAM) // seems that Fingerprint is not installed
if (!bFingerprintExists && !db_get_b(NULL, MOD_NAME, DB_NO_FINGERPRINT_ERROR, 0))
- CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_CCN_ERROR), nullptr, CCNErrorDlgProc);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CCN_ERROR), nullptr, CCNErrorDlgProc);
return 0;
}
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 21761ed59e..55ce10cbd2 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -2,19 +2,19 @@ ClientChangeNotify - Plugin for Miranda IM
Copyright (c) 2006-2008 Chervov Dmitry
- 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.
-
- 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
+ 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.
+
+ 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 "stdafx.h"
@@ -76,25 +76,25 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara static int ChangeLock = 0;
switch (msg) {
case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- ChangeLock++;
- g_PopupOptPage.SetWnd(hwndDlg);
- SendDlgItemMessage(hwndDlg, IDC_POPUPOPTDLG_POPUPDELAY, EM_LIMITTEXT, 4, 0);
- SendDlgItemMessage(hwndDlg, IDC_POPUPOPTDLG_IGNORESTRINGS, EM_LIMITTEXT, IGNORESTRINGS_MAX_LEN, 0);
- SendDlgItemMessage(hwndDlg, IDC_POPUPOPTDLG_POPUPDELAY_SPIN, UDM_SETRANGE32, -1, 9999);
-
- HWND hLCombo = GetDlgItem(hwndDlg, IDC_POPUPOPTDLG_LCLICK_ACTION);
- HWND hRCombo = GetDlgItem(hwndDlg, IDC_POPUPOPTDLG_RCLICK_ACTION);
- for (int i = 0; i < _countof(PopupActions); i++) {
- SendMessage(hLCombo, CB_SETITEMDATA, SendMessage(hLCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(PopupActions[i].Text)), PopupActions[i].Action);
- SendMessage(hRCombo, CB_SETITEMDATA, SendMessage(hRCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(PopupActions[i].Text)), PopupActions[i].Action);
- }
- g_PopupOptPage.DBToMemToPage();
- EnablePopupOptDlgControls();
- ChangeLock--;
+ {
+ TranslateDialogDefault(hwndDlg);
+ ChangeLock++;
+ g_PopupOptPage.SetWnd(hwndDlg);
+ SendDlgItemMessage(hwndDlg, IDC_POPUPOPTDLG_POPUPDELAY, EM_LIMITTEXT, 4, 0);
+ SendDlgItemMessage(hwndDlg, IDC_POPUPOPTDLG_IGNORESTRINGS, EM_LIMITTEXT, IGNORESTRINGS_MAX_LEN, 0);
+ SendDlgItemMessage(hwndDlg, IDC_POPUPOPTDLG_POPUPDELAY_SPIN, UDM_SETRANGE32, -1, 9999);
+
+ HWND hLCombo = GetDlgItem(hwndDlg, IDC_POPUPOPTDLG_LCLICK_ACTION);
+ HWND hRCombo = GetDlgItem(hwndDlg, IDC_POPUPOPTDLG_RCLICK_ACTION);
+ for (int i = 0; i < _countof(PopupActions); i++) {
+ SendMessage(hLCombo, CB_SETITEMDATA, SendMessage(hLCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(PopupActions[i].Text)), PopupActions[i].Action);
+ SendMessage(hRCombo, CB_SETITEMDATA, SendMessage(hRCombo, CB_ADDSTRING, 0, (LPARAM)TranslateW(PopupActions[i].Text)), PopupActions[i].Action);
}
- return true;
+ g_PopupOptPage.DBToMemToPage();
+ EnablePopupOptDlgControls();
+ ChangeLock--;
+ }
+ return true;
case WM_NOTIFY:
switch (((NMHDR*)lParam)->code) {
@@ -167,7 +167,7 @@ int OptionsDlgInit(WPARAM wParam, LPARAM) optDi.szTitle.a = LPGEN("ClientChangeNotify");
optDi.pfnDlgProc = PopupOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPOPTDLG);
- optDi.hInstance = g_hInstance;
+ optDi.hInstance = g_plugin.getInst();
optDi.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &optDi);
}
diff --git a/plugins/ClientChangeNotify/src/stdafx.h b/plugins/ClientChangeNotify/src/stdafx.h index 53493b51e1..2b9c9168d1 100644 --- a/plugins/ClientChangeNotify/src/stdafx.h +++ b/plugins/ClientChangeNotify/src/stdafx.h @@ -31,8 +31,6 @@ #include <WinSock.h>
#include <commdlg.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include "newpluginapi.h"
#include "statusmodes.h"
#include "m_popup.h"
@@ -85,6 +83,14 @@ #define NOTIFYTIMER_INTERVAL 3500
#define MOD_NAME "ClientChangeNotify"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MOD_NAME)
+ {}
+};
+
#define LOG_ID MOD_NAME
#define LOG_PREFIX MOD_NAME ": " // for netlib.log
@@ -104,7 +110,6 @@ #define CLIENTCHANGED_SOUND "ClientChanged"
-extern HINSTANCE g_hInstance;
extern BOOL bPopupExists, bFingerprintExists;
extern COptPage g_PopupOptPage;
|