summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp18
-rw-r--r--plugins/BossKeyPlus/src/Options.cpp2
-rw-r--r--plugins/BossKeyPlus/src/stdafx.h11
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp10
-rw-r--r--plugins/BuddyExpectator/src/options.cpp4
-rw-r--r--plugins/BuddyExpectator/src/stdafx.h10
-rw-r--r--plugins/BuddyPounce/src/dialog.cpp214
-rw-r--r--plugins/BuddyPounce/src/main.cpp125
-rw-r--r--plugins/BuddyPounce/src/stdafx.h11
-rw-r--r--plugins/ChangeKeyboardLayout/src/hook_events.cpp4
-rw-r--r--plugins/ChangeKeyboardLayout/src/main.cpp18
-rw-r--r--plugins/ChangeKeyboardLayout/src/stdafx.h11
-rw-r--r--plugins/ClientChangeNotify/src/ClientChangeNotify.cpp46
-rw-r--r--plugins/ClientChangeNotify/src/OptDlg.cpp64
-rw-r--r--plugins/ClientChangeNotify/src/stdafx.h11
-rw-r--r--plugins/Cln_skinedit/src/main.cpp387
-rw-r--r--plugins/Cln_skinedit/src/stdafx.h9
-rw-r--r--plugins/CmdLine/src/CmdLine.cpp11
-rw-r--r--plugins/CmdLine/src/stdafx.h12
-rw-r--r--plugins/MimCmd/src/stdafx.h1
20 files changed, 482 insertions, 497 deletions
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index cbfca55369..dcf4da6bd6 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -19,7 +19,6 @@
#include "stdafx.h"
-HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
HGENMENU g_hMenuItem;
HWINEVENTHOOK g_hWinHook;
@@ -31,6 +30,7 @@ WORD g_wMask, g_wMaskAdv;
bool g_bWindowHidden, g_fPassRequested, g_TrayIcon;
char g_password[MAXPASSLEN + 1];
HKL oldLangID, oldLayout;
+CMPlugin g_plugin;
int protoCount, hLangpack;
PROTOACCOUNT **proto;
unsigned *oldStatus;
@@ -54,12 +54,6 @@ static PLUGININFOEX pluginInfo = {
{ 0x4fac353d, 0x0a36, 0x44a4, { 0x90, 0x64, 0x67, 0x59, 0xc5, 0x3a, 0xe7, 0x82 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -80,7 +74,7 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
switch (uMsg){
case WM_INITDIALOG:
g_hDlgPass = hDlg;
- hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DLGPASSWD));
+ hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_DLGPASSWD));
dwOldIcon = SetClassLongPtr(hDlg, GCLP_HICON, (INT_PTR)hIcon); // set alt+tab icon
SendDlgItemMessage(hDlg, IDC_EDIT1, EM_LIMITTEXT, MAXPASSLEN, 0);
@@ -378,7 +372,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
db_free(&dbVar);
- int res = DialogBox(g_hInstance, (MAKEINTRESOURCE(IDD_PASSDIALOGNEW)), GetForegroundWindow(), DlgStdInProc);
+ int res = DialogBox(g_plugin.getInst(), (MAKEINTRESOURCE(IDD_PASSDIALOGNEW)), GetForegroundWindow(), DlgStdInProc);
g_fPassRequested = false;
if (res != IDOK) return 0;
@@ -638,13 +632,13 @@ int MirandaLoaded(WPARAM, LPARAM)
WNDCLASS winclass = { 0 };
winclass.lpfnWndProc = ListenWndProc;
- winclass.hInstance = g_hInstance;
+ winclass.hInstance = g_plugin.getInst();
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
winclass.lpszClassName = BOSSKEY_LISTEN_INFO;
if (RegisterClass(&winclass))
{
- g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, nullptr, g_hInstance, nullptr);
+ g_hListenWindow = CreateWindow(BOSSKEY_LISTEN_INFO, BOSSKEY_LISTEN_INFO, WS_POPUP, 0, 0, 5, 5, pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
WTSRegisterSessionNotification(g_hListenWindow, 0);
}
@@ -702,7 +696,7 @@ extern "C" int __declspec(dllexport) Load(void)
db_set_b(NULL, "Popup", "ModuleIsEnabled", 0);
}
- Icon_Register(g_hInstance, "BossKey", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "BossKey", iconList, _countof(iconList));
CreateServiceFunction(MS_BOSSKEY_HIDE, BossKeyHideMiranda); // Create service
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp
index bf973c734a..2779438530 100644
--- a/plugins/BossKeyPlus/src/Options.cpp
+++ b/plugins/BossKeyPlus/src/Options.cpp
@@ -318,7 +318,7 @@ int OptsDlgInit(WPARAM wParam, LPARAM)
optDi.position = 920000000;
optDi.pfnDlgProc = MainOptDlg;
optDi.pszTemplate = MAKEINTRESOURCEA(IDD_OPTDIALOGMAIN);
- optDi.hInstance = g_hInstance;
+ optDi.hInstance = g_plugin.getInst();
optDi.szTitle.a = LPGEN("BossKey");
optDi.szGroup.a = LPGEN("Events");
optDi.szTab.a = LPGEN("Main");
diff --git a/plugins/BossKeyPlus/src/stdafx.h b/plugins/BossKeyPlus/src/stdafx.h
index 77ec28d37c..5694e71e65 100644
--- a/plugins/BossKeyPlus/src/stdafx.h
+++ b/plugins/BossKeyPlus/src/stdafx.h
@@ -28,8 +28,6 @@
#include <shellapi.h>
#include <Wtsapi32.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_utils.h>
#include <m_langpack.h>
@@ -50,6 +48,14 @@
#include "version.h"
#define MOD_NAME "BossKey"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MOD_NAME)
+ {}
+};
+
#define KEY_DOWN(key) ((GetAsyncKeyState(key) & 0x8000) ? (true) : (false))
#define MAXPASSLEN 16
#define DEFAULTSETTING (OPT_SETONLINEBACK | OPT_DISABLESNDS | OPT_ONLINEONLY | OPT_USEDEFMSG)
@@ -81,7 +87,6 @@
const unsigned STATUS_ARR_TO_ID[8] = { ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE };
extern bool g_fOptionsOpen; // options dialog is open. be sure not to hide anything while we're there.
extern WORD g_wMask, g_wMaskAdv;
-extern HINSTANCE g_hInstance;
extern bool g_bWindowHidden;
extern UINT minutes;
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index e7a9de1dae..17ec545ef8 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -22,7 +22,7 @@
#include "stdafx.h"
CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
DWORD timer_id = 0;
@@ -60,12 +60,6 @@ static IconItem iconList[] =
{ LPGEN("Never hide"), "neverhide_icon", IDI_NEVERHIDE }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
time_t getLastSeen(MCONTACT hContact)
{
return db_get_dw(hContact, MODULE_NAME, "LastSeen", db_get_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)-1));
@@ -679,7 +673,7 @@ extern "C" int __declspec(dllexport) Load(void)
db_set_dw(hContact, MODULE_NAME, "CreationTime", current_time);
}
- Icon_Register(hInst, "BuddyExpectator", iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), "BuddyExpectator", iconList, _countof(iconList));
HookEvent(ME_SKIN2_ICONSCHANGED, onIconsChanged);
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp
index 2cf090f633..576fabd1dd 100644
--- a/plugins/BuddyExpectator/src/options.cpp
+++ b/plugins/BuddyExpectator/src/options.cpp
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP
static int OptionsInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.w = LPGENW("Contacts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPANEL);
odp.szTitle.w = LPGENW("Buddy Expectator");
@@ -529,7 +529,7 @@ int UserinfoInit(WPARAM wparam, LPARAM lparam)
{
if (lparam > 0) {
OPTIONSDIALOGPAGE uip = { sizeof(uip) };
- uip.hInstance = hInst;
+ uip.hInstance = g_plugin.getInst();
uip.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO);
uip.szTitle.a = LPGEN("Buddy Expectator");
uip.pfnDlgProc = UserinfoDlgProc;
diff --git a/plugins/BuddyExpectator/src/stdafx.h b/plugins/BuddyExpectator/src/stdafx.h
index d5e606febe..ba7a01892f 100644
--- a/plugins/BuddyExpectator/src/stdafx.h
+++ b/plugins/BuddyExpectator/src/stdafx.h
@@ -27,8 +27,6 @@
#include <time.h>
#include <locale.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_skin.h>
#include <m_clistint.h>
@@ -49,7 +47,13 @@
#define MODULE_NAME "BuddyExpectator"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
+ {}
+};
+
extern HANDLE hExtraIcon;
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp
index 724d740347..714a392324 100644
--- a/plugins/BuddyPounce/src/dialog.cpp
+++ b/plugins/BuddyPounce/src/dialog.cpp
@@ -77,30 +77,30 @@ void getDefaultMessage(HWND hwnd, UINT control, MCONTACT hContact)
INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); // windowInfo*
TranslateDialogDefault(hwnd);
return FALSE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
- windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ windowInfo * wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
wchar_t type[32];
GetDlgItemText(hwnd, IDC_CHECK1, type, _countof(type));
WORD flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
- |(IsDlgButtonChecked(hwnd, IDC_CHECK2)<<1)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK3)<<2)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK4)<<3)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK5)<<4)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK6)<<5)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK7)<<6)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK8)<<7)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK9)<<8)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK10)<<9);
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK2) << 1)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK3) << 2)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK4) << 3)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK5) << 4)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK6) << 5)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK7) << 6)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK8) << 7)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK9) << 8)
+ | (IsDlgButtonChecked(hwnd, IDC_CHECK10) << 9);
if (!mir_wstrcmp(type, L"Any")) {
if (LOWORD(wParam) == IDOK)
@@ -111,7 +111,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
if (LOWORD(wParam) == IDOK)
db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", flag);
wi->SendWhenThey = nullptr;
- }
+ }
DestroyWindow(hwnd);
}
break;
@@ -129,7 +129,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta
return;
}
else {
- hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), nullptr, StatusModesDlgProc, (LPARAM)wi);
+ hwnd = wi->SendIfMy = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_STATUSMODES), nullptr, StatusModesDlgProc, (LPARAM)wi);
statusFlag = db_get_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", 0);
SetWindowText(hwnd, TranslateT("Send If My Status Is"));
SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("Any"));
@@ -150,7 +150,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta
return;
}
else {
- hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),nullptr,StatusModesDlgProc, (LPARAM)wi);
+ hwnd = wi->SendWhenThey = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_STATUSMODES), nullptr, StatusModesDlgProc, (LPARAM)wi);
statusFlag = db_get_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", 0);
SetWindowText(hwnd, TranslateT("Send If Their Status changes"));
SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("From Offline"));
@@ -166,23 +166,23 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta
}
}
CheckDlgButton(hwnd, IDC_CHECK1, statusFlag&ANY ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK2, (statusFlag&ONLINE)>>1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK3, (statusFlag&AWAY)>>2 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK4, (statusFlag&NA)>>3 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK5, (statusFlag&OCCUPIED)>>4 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK6, (statusFlag&DND)>>5 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK7, (statusFlag&FFC)>>6 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK8, (statusFlag&INVISIBLE)>>7 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK9, (statusFlag&PHONE)>>8 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_CHECK10, (statusFlag&LUNCH)>>9 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK2, (statusFlag&ONLINE) >> 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK3, (statusFlag&AWAY) >> 2 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK4, (statusFlag&NA) >> 3 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK5, (statusFlag&OCCUPIED) >> 4 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK6, (statusFlag&DND) >> 5 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK7, (statusFlag&FFC) >> 6 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK8, (statusFlag&INVISIBLE) >> 7 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK9, (statusFlag&PHONE) >> 8 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwnd, IDC_CHECK10, (statusFlag&LUNCH) >> 9 ? BST_CHECKED : BST_UNCHECKED);
}
void deletePounce(MCONTACT hContact)
{
- db_unset(hContact,modname, "PounceMsg");
- db_unset(hContact,modname, "SendIfMyStatusIsFLAG");
- db_unset(hContact,modname, "SendIfTheirStatusIsFLAG");
- db_unset(hContact,modname, "Reuse");
+ db_unset(hContact, modname, "PounceMsg");
+ db_unset(hContact, modname, "SendIfMyStatusIsFLAG");
+ db_unset(hContact, modname, "SendIfTheirStatusIsFLAG");
+ db_unset(hContact, modname, "Reuse");
db_unset(hContact, modname, "GiveUpDays");
db_unset(hContact, modname, "GiveUpDate");
db_unset(hContact, modname, "ConfirmTimeout");
@@ -194,7 +194,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
wchar_t msg[1024];
- switch(uMsg) {
+ switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
hContact = lParam;
@@ -202,11 +202,11 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
- SetDlgItemText(hwnd, GRP_MSG, msg);
+ SetDlgItemText(hwnd, GRP_MSG, msg);
return FALSE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
@@ -219,19 +219,19 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
// fall through
case IDOK:
- {
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
- if (length>1) {
- wchar_t *text = (wchar_t*)_alloca(length*sizeof(wchar_t));
- GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, modname, "PounceMsg", text);
- }
- else db_unset(hContact, modname, "PounceMsg");
+ {
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
+ if (length > 1) {
+ wchar_t *text = (wchar_t*)_alloca(length * sizeof(wchar_t));
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
+ db_set_ws(hContact, modname, "PounceMsg", text);
}
- // fall through
+ else db_unset(hContact, modname, "PounceMsg");
+ }
+ // fall through
case IDCANCEL:
if (LOWORD(wParam) == IDC_ADVANCED)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
DestroyWindow(hwnd);
}
break;
@@ -244,7 +244,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
wchar_t msg[1024];
- switch(uMsg) {
+ switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
wi = (windowInfo *)mir_alloc(sizeof(windowInfo));
@@ -259,7 +259,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
- SetDlgItemText(hwnd, GRP_MSG, msg);
+ SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
populateContacts(wi->hContact, GetDlgItem(hwnd, IDC_CONTACTS));
@@ -268,7 +268,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
return FALSE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
@@ -279,25 +279,25 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
case IDC_SIMPLE:
case IDOK:
- {
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0);
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
- if (length>1) {
- wchar_t *text = (wchar_t*)mir_alloc(length*sizeof(wchar_t));
- if (!text) {
- msg(TranslateT("Couldn't allocate enough memory"), L"");
- break;
- }
- GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, modname, "PounceMsg", text);
- mir_free(text);
+ {
+ MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0);
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
+ if (length > 1) {
+ wchar_t *text = (wchar_t*)mir_alloc(length * sizeof(wchar_t));
+ if (!text) {
+ msg(TranslateT("Couldn't allocate enough memory"), L"");
+ break;
}
- else db_unset(hContact, modname, "PounceMsg");
- saveLastSetting(hContact, hwnd);
- } // fall through
- if (LOWORD(wParam) == IDC_SIMPLE)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
- // fall through
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
+ db_set_ws(hContact, modname, "PounceMsg", text);
+ mir_free(text);
+ }
+ else db_unset(hContact, modname, "PounceMsg");
+ saveLastSetting(hContact, hwnd);
+ } // fall through
+ if (LOWORD(wParam) == IDC_SIMPLE)
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
+ // fall through
case IDCANCEL:
if (wi->SendIfMy) DestroyWindow(wi->SendIfMy);
@@ -318,16 +318,16 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
- db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",0));
- db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",0));
- db_set_b(wi->hContact, modname, "Reuse",(BYTE)db_get_b(NULL, modname, "Reuse",0));
- db_set_b(wi->hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays",0));
- db_set_dw(wi->hContact, modname, "GiveUpDate", (DWORD)db_get_dw(NULL, modname, "GiveUpDate",0));
- db_set_w(wi->hContact, modname, "ConfirmTimeout", (WORD)db_get_w(NULL, modname, "ConfirmTimeout",0));
+ db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG", 0));
+ db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG", 0));
+ db_set_b(wi->hContact, modname, "Reuse", (BYTE)db_get_b(NULL, modname, "Reuse", 0));
+ db_set_b(wi->hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays", 0));
+ db_set_dw(wi->hContact, modname, "GiveUpDate", (DWORD)db_get_dw(NULL, modname, "GiveUpDate", 0));
+ db_set_w(wi->hContact, modname, "ConfirmTimeout", (WORD)db_get_w(NULL, modname, "ConfirmTimeout", 0));
break;
case IDC_SETTINGS:
- if (HIWORD(wParam) == LBN_SELCHANGE) {
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
int item = SendDlgItemMessage(hwnd, IDC_SETTINGS, LB_GETCURSEL, 0, 0);
wchar_t temp[5];
saveLastSetting(wi->hContact, hwnd);
@@ -379,7 +379,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam,
{
wchar_t msg[1024];
- switch(uMsg) {
+ switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
{
@@ -391,7 +391,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam,
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
mir_snwprintf(msg, TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
- SetDlgItemText(hwnd, GRP_MSG, msg);
+ SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
SendDlgItemMessage(hwnd, IDC_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((short)1024, (short)0));
CheckDlgButton(hwnd, IDC_USEADVANCED, db_get_b(NULL, modname, "UseAdvanced", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -401,15 +401,15 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam,
return FALSE;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ windowInfo * wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
MCONTACT hContact = ((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
if (length > 1) {
- wchar_t *text = (wchar_t*)mir_alloc(length*sizeof(wchar_t));
+ wchar_t *text = (wchar_t*)mir_alloc(length * sizeof(wchar_t));
if (!text) {
msg(TranslateT("Couldn't allocate enough memory"), L"");
break;
@@ -429,7 +429,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam,
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
@@ -445,7 +445,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam,
break;
case IDC_SETTINGS:
- if (HIWORD(wParam) == LBN_SELCHANGE) {
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
int item = SendDlgItemMessage(hwnd, IDC_SETTINGS, LB_GETCURSEL, 0, 0);
wchar_t temp[5];
@@ -499,7 +499,7 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
SendPounceDlgProcStruct *spdps = (SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
spdps = (SendPounceDlgProcStruct*)lParam;
@@ -513,36 +513,36 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
if (db_get_ws(spdps->hContact, modname, "PounceMsg", &dbv))
DestroyWindow(hwnd);
else {
- SetDlgItemText(hwnd,IDC_MESSAGE, dbv.ptszVal);
+ SetDlgItemText(hwnd, IDC_MESSAGE, dbv.ptszVal);
db_free(&dbv);
}
}
- SetTimer(hwnd,1,1000,nullptr);
- SendMessage(hwnd,WM_TIMER,0,0);
+ SetTimer(hwnd, 1, 1000, nullptr);
+ SendMessage(hwnd, WM_TIMER, 0, 0);
break;
case WM_TIMER:
- {
- wchar_t message[1024];
- mir_snwprintf(message, TranslateT("Pounce being sent to %s in %d seconds"), Clist_GetContactDisplayName(spdps->hContact), spdps->timer);
- SetDlgItemText(hwnd, LBL_CONTACT, message);
- }
- spdps->timer--;
- if (spdps->timer < 0) {
- KillTimer(hwnd,1);
- SendPounce(spdps->message, spdps->hContact);
- DestroyWindow(hwnd);
- }
- break;
+ {
+ wchar_t message[1024];
+ mir_snwprintf(message, TranslateT("Pounce being sent to %s in %d seconds"), Clist_GetContactDisplayName(spdps->hContact), spdps->timer);
+ SetDlgItemText(hwnd, LBL_CONTACT, message);
+ }
+ spdps->timer--;
+ if (spdps->timer < 0) {
+ KillTimer(hwnd, 1);
+ SendPounce(spdps->message, spdps->hContact);
+ DestroyWindow(hwnd);
+ }
+ break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
- KillTimer(hwnd,1);
+ KillTimer(hwnd, 1);
SendPounce(spdps->message, spdps->hContact);
// fall through
case IDCANCEL:
- KillTimer(hwnd,1);
+ KillTimer(hwnd, 1);
DestroyWindow(hwnd);
break;
}
@@ -560,7 +560,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)lParam);
TranslateDialogDefault(hwnd);
@@ -577,17 +577,17 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
- {
- wchar_t text[2048];
- GetDlgItemText(hwnd, IDOK, text, _countof(text));
- if (!mir_wstrcmp(text, TranslateT("Retry"))) {
- GetDlgItemText(hwnd, IDC_MESSAGE, text, _countof(text));
- SendPounce(text, hContact);
- }
+ {
+ wchar_t text[2048];
+ GetDlgItemText(hwnd, IDOK, text, _countof(text));
+ if (!mir_wstrcmp(text, TranslateT("Retry"))) {
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, _countof(text));
+ SendPounce(text, hContact);
}
- // fall through
+ }
+ // fall through
case IDCANCEL:
DestroyWindow(hwnd);
}
@@ -598,7 +598,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
void CreateMessageAcknowlegedWindow(MCONTACT hContact, int SentSuccess)
{
- HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, PounceSentDlgProc, hContact);
+ HWND hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, PounceSentDlgProc, hContact);
wchar_t msg[256];
if (SentSuccess) {
mir_snwprintf(msg, TranslateT("Message successfully sent to %s"), Clist_GetContactDisplayName(hContact));
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp
index e2c5bd5ec9..daa4c73022 100644
--- a/plugins/BuddyPounce/src/main.cpp
+++ b/plugins/BuddyPounce/src/main.cpp
@@ -1,10 +1,10 @@
#include "stdafx.h"
+CMPlugin g_plugin;
int hLangpack;
-HINSTANCE hInst;
MWindowList hWindowList;
-PLUGININFOEX pluginInfo={
+PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -18,15 +18,6 @@ PLUGININFOEX pluginInfo={
};
//========================
-// WINAPI DllMain
-//========================
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-//========================
// MirandaPluginInfo
//========================
@@ -45,26 +36,26 @@ int MainInit(WPARAM, LPARAM)
CMenuItem mi;
SET_UID(mi, 0x719c1596, 0xb0fd, 0x4c74, 0xb7, 0xe4, 0xeb, 0x22, 0xf4, 0x99, 0xd7, 0x68);
mi.position = 10;
- mi.hIcolibItem = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POUNCE));
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_POUNCE));
mi.name.a = LPGEN("&Buddy Pounce");
mi.pszService = "BuddyPounce/MenuCommand";
Menu_AddContactMenuItem(&mi);
return 0;
}
-int MsgAck(WPARAM, LPARAM lParam)
-{
- ACKDATA *ack=(ACKDATA*)lParam;
+int MsgAck(WPARAM, LPARAM lParam)
+{
+ ACKDATA *ack = (ACKDATA*)lParam;
if (ack && ack->type == ACKTYPE_MESSAGE) {
- if (ack->hProcess == (HANDLE)WindowList_Find(hWindowList,ack->hContact)) {
+ if (ack->hProcess == (HANDLE)WindowList_Find(hWindowList, ack->hContact)) {
if (db_get_b(NULL, modname, "ShowDeliveryMessages", 1))
- CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS);
+ CreateMessageAcknowlegedWindow(ack->hContact, ack->result == ACKRESULT_SUCCESS);
if (ack->result == ACKRESULT_SUCCESS) {
// wrtie it to the DB
DBEVENTINFO dbei = {};
DBVARIANT dbv;
- int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
+ int reuse = db_get_b(ack->hContact, modname, "Reuse", 0);
if (!db_get_ws(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
T2Utf pszUtf(dbv.ptszVal);
dbei.eventType = EVENTTYPE_MESSAGE;
@@ -77,23 +68,23 @@ int MsgAck(WPARAM, LPARAM lParam)
}
// check to reuse
if (reuse > 1)
- db_set_b(ack->hContact, modname, "Reuse", (BYTE)(reuse-1));
+ db_set_b(ack->hContact, modname, "Reuse", (BYTE)(reuse - 1));
else {
- db_set_b(ack->hContact,modname, "Reuse", 0);
+ db_set_b(ack->hContact, modname, "Reuse", 0);
db_set_ws(ack->hContact, modname, "PounceMsg", L"");
}
}
- WindowList_Remove(hWindowList,(HWND)ack->hProcess);
+ WindowList_Remove(hWindowList, (HWND)ack->hProcess);
}
- }
- return 0;
-}
+ }
+ return 0;
+}
int BuddyPounceOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.szGroup.w = LPGENW("Message sessions");
odp.szTitle.w = LPGENW("Buddy Pounce");
@@ -105,63 +96,63 @@ int BuddyPounceOptInit(WPARAM wParam, LPARAM)
int statusCheck(int statusFlag, int status)
{
if (statusFlag == ANY || !statusFlag) return 1;
- switch(status) {
- case ID_STATUS_OFFLINE:
- return 0;
- case ID_STATUS_ONLINE:
- return (statusFlag & ONLINE);
- case ID_STATUS_AWAY:
- return (statusFlag & AWAY);
- case ID_STATUS_NA:
- return (statusFlag & NA);
- case ID_STATUS_OCCUPIED:
- return (statusFlag & OCCUPIED);
- case ID_STATUS_DND:
- return (statusFlag & DND);
- case ID_STATUS_FREECHAT:
- return (statusFlag & FFC);
- case ID_STATUS_INVISIBLE:
- return (statusFlag & INVISIBLE);
- case ID_STATUS_OUTTOLUNCH:
- return (statusFlag & LUNCH);
- case ID_STATUS_ONTHEPHONE:
- return (statusFlag & PHONE);
+ switch (status) {
+ case ID_STATUS_OFFLINE:
+ return 0;
+ case ID_STATUS_ONLINE:
+ return (statusFlag & ONLINE);
+ case ID_STATUS_AWAY:
+ return (statusFlag & AWAY);
+ case ID_STATUS_NA:
+ return (statusFlag & NA);
+ case ID_STATUS_OCCUPIED:
+ return (statusFlag & OCCUPIED);
+ case ID_STATUS_DND:
+ return (statusFlag & DND);
+ case ID_STATUS_FREECHAT:
+ return (statusFlag & FFC);
+ case ID_STATUS_INVISIBLE:
+ return (statusFlag & INVISIBLE);
+ case ID_STATUS_OUTTOLUNCH:
+ return (statusFlag & LUNCH);
+ case ID_STATUS_ONTHEPHONE:
+ return (statusFlag & PHONE);
}
return 0;
}
int CheckDate(MCONTACT hContact)
{
- time_t curtime = time (nullptr);
- if(!db_get_b(hContact,modname,"GiveUpDays",0))
+ time_t curtime = time(nullptr);
+ if (!db_get_b(hContact, modname, "GiveUpDays", 0))
return 1;
- if(db_get_b(hContact,modname,"GiveUpDays",0) && ( abs((time_t)db_get_dw(hContact,modname,"GiveUpDate",0)) > curtime))
+ if (db_get_b(hContact, modname, "GiveUpDays", 0) && (abs((time_t)db_get_dw(hContact, modname, "GiveUpDate", 0)) > curtime))
return 1;
return 0;
}
void SendPounce(wchar_t *text, MCONTACT hContact)
{
- if (HANDLE hSendId = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(text)))
+ if (HANDLE hSendId = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, T2Utf(text)))
WindowList_Add(hWindowList, (HWND)hSendId, hContact);
}
int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
{
- DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
char *szProto = GetContactProto(hContact);
- if(hContact == NULL || strcmp(cws->szSetting,"Status")) return 0;
+ if (hContact == NULL || strcmp(cws->szSetting, "Status")) return 0;
if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) {
int newStatus = cws->value.wVal;
- int oldStatus = db_get_w(hContact,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
-
+ int oldStatus = db_get_w(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
+
if (newStatus != oldStatus && hContact != NULL && newStatus != ID_STATUS_OFFLINE) {
DBVARIANT dbv;
if (!db_get_ws(hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0')) {
// check my status
if (statusCheck(db_get_w(hContact, modname, "SendIfMyStatusIsFLAG", 0), Proto_GetStatus(szProto))
- // check the contacts status
- && statusCheck(db_get_w(hContact, modname, "SendIfTheirStatusIsFLAG", 0), newStatus)) {
+ // check the contacts status
+ && statusCheck(db_get_w(hContact, modname, "SendIfTheirStatusIsFLAG", 0), newStatus)) {
// check if we r giving up after x days
if (CheckDate(hContact)) {
if (db_get_w(hContact, modname, "ConfirmTimeout", 0)) {
@@ -169,7 +160,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
wchar_t *message = mir_wstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
spdps->hContact = hContact;
spdps->message = message;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, SendPounceDlgProc, (LPARAM)spdps);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONFIRMSEND), nullptr, SendPounceDlgProc, (LPARAM)spdps);
// set the confirmation window to send the msg when the timeout is done
mir_free(message);
}
@@ -186,9 +177,9 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM)
{
if (db_get_b(NULL, modname, "UseAdvanced", 0) || db_get_b(hContact, modname, "UseAdvanced", 0))
- CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),nullptr,BuddyPounceDlgProc, hContact);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, hContact);
else
- CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),nullptr,BuddyPounceSimpleDlgProc, hContact);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, hContact);
return 0;
}
@@ -197,11 +188,11 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam)
MCONTACT hContact = wParam;
wchar_t* message = (wchar_t*)lParam;
db_set_ws(hContact, modname, "PounceMsg", message);
- db_set_w(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",1));
- db_set_w(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",1));
- db_set_b(hContact, modname, "Reuse", (BYTE)db_get_b(NULL, modname, "Reuse",0));
- db_set_b(hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays",0));
- db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(db_get_b(hContact, modname, "GiveUpDays",0)*SECONDSINADAY));
+ db_set_w(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG", 1));
+ db_set_w(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG", 1));
+ db_set_b(hContact, modname, "Reuse", (BYTE)db_get_b(NULL, modname, "Reuse", 0));
+ db_set_b(hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays", 0));
+ db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(db_get_b(hContact, modname, "GiveUpDays", 0)*SECONDSINADAY));
return 0;
}
@@ -210,7 +201,7 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam)
MCONTACT hContact = wParam;
wchar_t* message = (wchar_t*)lParam;
DBVARIANT dbv;
- if (!db_get_ws(hContact, modname, "PounceMsg",&dbv))
+ if (!db_get_ws(hContact, modname, "PounceMsg", &dbv))
{
wchar_t* newPounce = (wchar_t*)mir_alloc(mir_wstrlen(dbv.ptszVal) + mir_wstrlen(message) + 1);
if (!newPounce) return 1;
@@ -232,7 +223,7 @@ extern "C" __declspec(dllexport) int Load(void)
mir_getLP(&pluginInfo);
HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UserOnlineSettingChanged);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UserOnlineSettingChanged);
HookEvent(ME_OPT_INITIALISE, BuddyPounceOptInit);
HookEvent(ME_PROTO_ACK, MsgAck);
@@ -243,7 +234,7 @@ extern "C" __declspec(dllexport) int Load(void)
/* service funcitons for other devs... */
CreateServiceFunction("BuddyPounce/AddSimplePounce", AddSimpleMessage); // add a simple pounce to a contact
CreateServiceFunction("BuddyPounce/AddToPounce", AddToPounce); // add to the exsisitng pounce, if there isnt 1 then add a new simple pounce.
- return 0;
+ return 0;
}
diff --git a/plugins/BuddyPounce/src/stdafx.h b/plugins/BuddyPounce/src/stdafx.h
index f69b5981ba..50f8e76057 100644
--- a/plugins/BuddyPounce/src/stdafx.h
+++ b/plugins/BuddyPounce/src/stdafx.h
@@ -8,8 +8,6 @@
#include <time.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_clist.h>
#include <m_langpack.h>
@@ -29,6 +27,13 @@
#define modFullname "Buddy Pounce"
#define msg(a,b) MessageBox(0,a,b,MB_OK)
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(modname)
+ {}
+};
+
#define SECONDSINADAY 86400
/* flags for the sending and recieving.... */
@@ -61,8 +66,6 @@ struct SendPounceDlgProcStruct
wchar_t *message;
};
-extern HINSTANCE hInst;
-
//=======================================================
// Functions
//=======================================================
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
index ab73812bd7..c7148fb985 100644
--- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp
+++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
@@ -123,7 +123,7 @@ int ModulesLoaded(WPARAM, LPARAM)
// Зарегим звук
Skin_AddSound(SND_ChangeLayout, ModuleNameW, LPGENW("Changing Layout"));
- Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
+ Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case"));
// Хук на нажатие клавиши
kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId());
@@ -141,7 +141,7 @@ int ModulesLoaded(WPARAM, LPARAM)
int OnOptionsInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAIN_OPTION_FORM);
odp.szTitle.a = ModuleName;
odp.szGroup.a = LPGEN("Message sessions");
diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp
index 5286a2f871..9d53aed4b1 100644
--- a/plugins/ChangeKeyboardLayout/src/main.cpp
+++ b/plugins/ChangeKeyboardLayout/src/main.cpp
@@ -1,12 +1,12 @@
#include "stdafx.h"
+CMPlugin g_plugin;
int hLangpack;
LPTSTR ptszLayStrings[20];
HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout;
HICON hPopupIcon, hCopyIcon;
HKL hklLayouts[20];
BYTE bLayNum;
-HINSTANCE hInst;
HHOOK kbHook_All;
MainOptions moOptions;
PopupOptions poOptions, poOptionsTemp;
@@ -31,12 +31,6 @@ LPCTSTR ptszSeparators = L" \t\n\r";
HANDLE hOptionsInitialize;
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
@@ -49,18 +43,18 @@ static IconItem iconList[] =
};
extern "C" __declspec(dllexport) int Load(void)
-{
+{
mir_getLP(&pluginInfoEx);
memset(hklLayouts, 0, sizeof(hklLayouts));
bLayNum = GetKeyboardLayoutList(20, hklLayouts);
- if (bLayNum < 2)
+ if (bLayNum < 2)
return 1;
-
+
HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
// IcoLib support
- Icon_Register(hInst, ModuleName, iconList, _countof(iconList));
+ Icon_Register(g_plugin.getInst(), ModuleName, iconList, _countof(iconList));
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
@@ -71,7 +65,7 @@ extern "C" __declspec(dllexport) int Load(void)
extern "C" __declspec(dllexport) int Unload(void)
{
- for (int i = 0; i < bLayNum; i++)
+ for (int i = 0; i < bLayNum; i++)
mir_free(ptszLayStrings[i]);
DestroyServiceFunction(hChangeLayout);
diff --git a/plugins/ChangeKeyboardLayout/src/stdafx.h b/plugins/ChangeKeyboardLayout/src/stdafx.h
index 7be6d07a35..fc572a11c8 100644
--- a/plugins/ChangeKeyboardLayout/src/stdafx.h
+++ b/plugins/ChangeKeyboardLayout/src/stdafx.h
@@ -5,8 +5,6 @@
#include <commctrl.h>
#include <richedit.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_options.h>
#include <m_langpack.h>
@@ -31,6 +29,13 @@
#define ModuleName LPGEN("ChangeKeyboardLayout")
#define ModuleNameW LPGENW("ChangeKeyboardLayout")
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ModuleName)
+ {}
+};
+
// History++ API
#define MS_HPP_EG_WINDOW "History++/ExtGrid/NewWindow"
#define MS_HPP_EG_EVENT "History++/ExtGrid/Event"
@@ -90,8 +95,6 @@ typedef struct
POPUPACTION paActions[1];
} PopupOptions;
-extern HINSTANCE hInst;
-
extern HICON hPopupIcon, hCopyIcon;
extern LPCTSTR ptszKeybEng;
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;
diff --git a/plugins/Cln_skinedit/src/main.cpp b/plugins/Cln_skinedit/src/main.cpp
index 145cfaf87f..ed135b36fa 100644
--- a/plugins/Cln_skinedit/src/main.cpp
+++ b/plugins/Cln_skinedit/src/main.cpp
@@ -39,11 +39,11 @@ PLUGININFOEX pluginInfo = {
{0x21948c89, 0xb549, 0x4c9d, {0x8b, 0x4f, 0x3f, 0x37, 0x26, 0xec, 0x6b, 0x4b}}
};
-HINSTANCE g_hInst = nullptr;
+CMPlugin g_plugin;
int hLangpack;
StatusItems_t **StatusItems;
-ChangedSItems_t ChangedSItems = {0};
+ChangedSItems_t ChangedSItems = { 0 };
static int LastModifiedItem = -1;
static int last_selcount = 0;
@@ -73,7 +73,8 @@ static void ReActiveCombo(HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BR), IsDlgButtonChecked(hwndDlg, IDC_CORNER));
EnableWindow(GetDlgItem(hwndDlg, IDC_CORNER_BL), IsDlgButtonChecked(hwndDlg, IDC_CORNER));
ChangeControlItems(hwndDlg, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE);
- } else {
+ }
+ else {
ChangeControlItems(hwndDlg, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_IGNORE), IDC_IGNORE);
EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_LR), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT));
EnableWindow(GetDlgItem(hwndDlg, IDC_GRADIENT_RL), IsDlgButtonChecked(hwndDlg, IDC_GRADIENT));
@@ -206,7 +207,8 @@ static void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item)
if (item->ALPHA == -1) {
SetDlgItemTextA(hwndDlg, IDC_ALPHA, "");
- } else {
+ }
+ else {
ret = item->ALPHA;
_itoa(ret, itoabuf, 10);
SetDlgItemTextA(hwndDlg, IDC_ALPHA, itoabuf);
@@ -247,23 +249,23 @@ static void FillOptionDialogByStatusItem(HWND hwndDlg, StatusItems_t *item)
SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, 0, 0);
else {
index = 0;
- switch(item->BORDERSTYLE) {
- case 0:
- case -1:
- index = 0;
- break;
- case BDR_RAISEDOUTER:
- index = 1;
- break;
- case BDR_SUNKENINNER:
- index = 2;
- break;
- case EDGE_BUMP:
- index = 3;
- break;
- case EDGE_ETCHED:
- index = 4;
- break;
+ switch (item->BORDERSTYLE) {
+ case 0:
+ case -1:
+ index = 0;
+ break;
+ case BDR_RAISEDOUTER:
+ index = 1;
+ break;
+ case BDR_SUNKENINNER:
+ index = 2;
+ break;
+ case EDGE_BUMP:
+ index = 3;
+ break;
+ case EDGE_ETCHED:
+ index = 4;
+ break;
}
SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_SETCURSEL, (WPARAM)index, 0);
}
@@ -289,7 +291,8 @@ static BOOL CheckItem(int item, HWND hwndDlg)
if (StatusItems[item]->statusID == ID_EXTBKSEPARATOR) {
ChangeControlItems(hwndDlg, 0, 0);
return FALSE;
- } else {
+ }
+ else {
ChangeControlItems(hwndDlg, 1, 0);
return TRUE;
}
@@ -298,69 +301,69 @@ static BOOL CheckItem(int item, HWND hwndDlg)
static void SetChangedStatusItemFlag(WPARAM wParam, HWND hwndDlg)
{
if (LOWORD(wParam) != IDC_ITEMS
- && (GetDlgItem(hwndDlg, LOWORD(wParam)) == GetFocus() || HIWORD(wParam) == CPN_COLOURCHANGED)
- && (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == CPN_COLOURCHANGED)) {
+ && (GetDlgItem(hwndDlg, LOWORD(wParam)) == GetFocus() || HIWORD(wParam) == CPN_COLOURCHANGED)
+ && (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE || HIWORD(wParam) == CPN_COLOURCHANGED)) {
switch (LOWORD(wParam)) {
- case IDC_IGNORE:
- ChangedSItems.bIGNORED = TRUE; break;
- case IDC_GRADIENT:
- ChangedSItems.bGRADIENT = TRUE; break;
- case IDC_GRADIENT_LR:
- ChangedSItems.bGRADIENT = TRUE;break;
- case IDC_GRADIENT_RL:
- ChangedSItems.bGRADIENT = TRUE; break;
- case IDC_GRADIENT_BT:
- ChangedSItems.bGRADIENT = TRUE; break;
- case IDC_GRADIENT_TB:
- ChangedSItems.bGRADIENT = TRUE; break;
-
- case IDC_CORNER:
- ChangedSItems.bCORNER = TRUE; break;
- case IDC_CORNER_TL:
- ChangedSItems.bCORNER = TRUE; break;
- case IDC_CORNER_TR:
- ChangedSItems.bCORNER = TRUE; break;
- case IDC_CORNER_BR:
- ChangedSItems.bCORNER = TRUE; break;
- case IDC_CORNER_BL:
- ChangedSItems.bCORNER = TRUE; break;
-
- case IDC_BASECOLOUR:
- ChangedSItems.bCOLOR = TRUE; break;
- case IDC_BASECOLOUR2:
- ChangedSItems.bCOLOR2 = TRUE; break;
- case IDC_COLOR2_TRANSPARENT:
- ChangedSItems.bCOLOR2_TRANSPARENT = TRUE; break;
- case IDC_TEXTCOLOUR:
- ChangedSItems.bTEXTCOLOR = TRUE; break;
-
- case IDC_ALPHA:
- ChangedSItems.bALPHA = TRUE; break;
- case IDC_ALPHASPIN:
- ChangedSItems.bALPHA = TRUE; break;
-
- case IDC_MRGN_LEFT:
- ChangedSItems.bMARGIN_LEFT = TRUE; break;
- case IDC_MRGN_LEFT_SPIN:
- ChangedSItems.bMARGIN_LEFT = TRUE; break;
-
- case IDC_MRGN_TOP:
- ChangedSItems.bMARGIN_TOP = TRUE; break;
- case IDC_MRGN_TOP_SPIN:
- ChangedSItems.bMARGIN_TOP = TRUE; break;
-
- case IDC_MRGN_RIGHT:
- ChangedSItems.bMARGIN_RIGHT = TRUE; break;
- case IDC_MRGN_RIGHT_SPIN:
- ChangedSItems.bMARGIN_RIGHT = TRUE; break;
-
- case IDC_MRGN_BOTTOM:
- ChangedSItems.bMARGIN_BOTTOM = TRUE; break;
- case IDC_MRGN_BOTTOM_SPIN:
- ChangedSItems.bMARGIN_BOTTOM = TRUE; break;
-
- case IDC_BORDERTYPE:
- ChangedSItems.bBORDERSTYLE = TRUE; break;
+ case IDC_IGNORE:
+ ChangedSItems.bIGNORED = TRUE; break;
+ case IDC_GRADIENT:
+ ChangedSItems.bGRADIENT = TRUE; break;
+ case IDC_GRADIENT_LR:
+ ChangedSItems.bGRADIENT = TRUE; break;
+ case IDC_GRADIENT_RL:
+ ChangedSItems.bGRADIENT = TRUE; break;
+ case IDC_GRADIENT_BT:
+ ChangedSItems.bGRADIENT = TRUE; break;
+ case IDC_GRADIENT_TB:
+ ChangedSItems.bGRADIENT = TRUE; break;
+
+ case IDC_CORNER:
+ ChangedSItems.bCORNER = TRUE; break;
+ case IDC_CORNER_TL:
+ ChangedSItems.bCORNER = TRUE; break;
+ case IDC_CORNER_TR:
+ ChangedSItems.bCORNER = TRUE; break;
+ case IDC_CORNER_BR:
+ ChangedSItems.bCORNER = TRUE; break;
+ case IDC_CORNER_BL:
+ ChangedSItems.bCORNER = TRUE; break;
+
+ case IDC_BASECOLOUR:
+ ChangedSItems.bCOLOR = TRUE; break;
+ case IDC_BASECOLOUR2:
+ ChangedSItems.bCOLOR2 = TRUE; break;
+ case IDC_COLOR2_TRANSPARENT:
+ ChangedSItems.bCOLOR2_TRANSPARENT = TRUE; break;
+ case IDC_TEXTCOLOUR:
+ ChangedSItems.bTEXTCOLOR = TRUE; break;
+
+ case IDC_ALPHA:
+ ChangedSItems.bALPHA = TRUE; break;
+ case IDC_ALPHASPIN:
+ ChangedSItems.bALPHA = TRUE; break;
+
+ case IDC_MRGN_LEFT:
+ ChangedSItems.bMARGIN_LEFT = TRUE; break;
+ case IDC_MRGN_LEFT_SPIN:
+ ChangedSItems.bMARGIN_LEFT = TRUE; break;
+
+ case IDC_MRGN_TOP:
+ ChangedSItems.bMARGIN_TOP = TRUE; break;
+ case IDC_MRGN_TOP_SPIN:
+ ChangedSItems.bMARGIN_TOP = TRUE; break;
+
+ case IDC_MRGN_RIGHT:
+ ChangedSItems.bMARGIN_RIGHT = TRUE; break;
+ case IDC_MRGN_RIGHT_SPIN:
+ ChangedSItems.bMARGIN_RIGHT = TRUE; break;
+
+ case IDC_MRGN_BOTTOM:
+ ChangedSItems.bMARGIN_BOTTOM = TRUE; break;
+ case IDC_MRGN_BOTTOM_SPIN:
+ ChangedSItems.bMARGIN_BOTTOM = TRUE; break;
+
+ case IDC_BORDERTYPE:
+ ChangedSItems.bBORDERSTYLE = TRUE; break;
}
}
}
@@ -391,9 +394,9 @@ static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index)
if (ChangedSItems.bCORNER) {
p->CORNER = CORNER_NONE;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER))
- p->CORNER |= CORNER_ACTIVE ;
+ p->CORNER |= CORNER_ACTIVE;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TL))
- p->CORNER |= CORNER_TL ;
+ p->CORNER |= CORNER_TL;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_TR))
p->CORNER |= CORNER_TR;
if (IsDlgButtonChecked(hwndDlg, IDC_CORNER_BR))
@@ -417,54 +420,54 @@ static void UpdateStatusStructSettingsFromOptDlg(HWND hwndDlg, int index)
if (ChangedSItems.bALPHA) {
GetDlgItemTextA(hwndDlg, IDC_ALPHA, buf, 10); // can be removed now
if (buf[0] != 0)
- p->ALPHA = (BYTE) SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0);
+ p->ALPHA = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ALPHASPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_LEFT) {
GetDlgItemTextA(hwndDlg, IDC_MRGN_LEFT, buf, 10);
if (buf[0] != 0)
- p->MARGIN_LEFT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_LEFT = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MRGN_LEFT_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_TOP) {
GetDlgItemTextA(hwndDlg, IDC_MRGN_TOP, buf, 10);
if (buf[0] != 0)
- p->MARGIN_TOP = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_TOP = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MRGN_TOP_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_RIGHT) {
GetDlgItemTextA(hwndDlg, IDC_MRGN_RIGHT, buf, 10);
if (buf[0] != 0)
- p->MARGIN_RIGHT = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_RIGHT = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MRGN_RIGHT_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bMARGIN_BOTTOM) {
GetDlgItemTextA(hwndDlg, IDC_MRGN_BOTTOM, buf, 10);
if (buf[0] != 0)
- p->MARGIN_BOTTOM = (BYTE) SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0);
+ p->MARGIN_BOTTOM = (BYTE)SendDlgItemMessage(hwndDlg, IDC_MRGN_BOTTOM_SPIN, UDM_GETPOS, 0, 0);
}
if (ChangedSItems.bBORDERSTYLE) {
bdrtype = SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_GETCURSEL, 0, 0);
if (bdrtype == CB_ERR)
p->BORDERSTYLE = 0;
else {
- switch(bdrtype) {
- case 0:
+ switch (bdrtype) {
+ case 0:
p->BORDERSTYLE = 0;
break;
- case 1:
+ case 1:
p->BORDERSTYLE = BDR_RAISEDOUTER;
break;
- case 2:
+ case 2:
p->BORDERSTYLE = BDR_SUNKENINNER;
break;
- case 3:
+ case 3:
p->BORDERSTYLE = EDGE_BUMP;
break;
- case 4:
+ case 4:
p->BORDERSTYLE = EDGE_ETCHED;
break;
- default:
+ default:
p->BORDERSTYLE = 0;
break;
}
@@ -540,7 +543,7 @@ static UINT _controls_to_refresh[] = {
static void RefreshControls(HWND hwnd)
{
- for(int i = 0; _controls_to_refresh[i]; i++)
+ for (int i = 0; _controls_to_refresh[i]; i++)
InvalidateRect(GetDlgItem(hwnd, _controls_to_refresh[i]), nullptr, FALSE);
}
@@ -556,7 +559,7 @@ static void OnListItemsChange(HWND hwndDlg)
int n, itemData, first_item;
// get selected indizes
- SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETSELITEMS, 64, (LPARAM) last_indizes);
+ SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_GETSELITEMS, 64, (LPARAM)last_indizes);
// initialize with first items value
@@ -600,7 +603,8 @@ static void OnListItemsChange(HWND hwndDlg)
if (last_selcount == 1 && pFirst->statusID == ID_EXTBKSEPARATOR) {
ChangeControlItems(hwndDlg, 0, 0);
last_selcount = 0;
- } else
+ }
+ else
ChangeControlItems(hwndDlg, 1, 0);
FillOptionDialogByStatusItem(hwndDlg, &DialogSettingForMultiSel);
InvalidateRect(GetDlgItem(hwndDlg, IDC_ITEMS), nullptr, FALSE);
@@ -680,105 +684,105 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Bumped"));
SendDlgItemMessage(hwndDlg, IDC_BORDERTYPE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Etched"));
- SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3ddark", RGB(224,224,224)));
- SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3dbright", RGB(224,224,224)));
+ SendDlgItemMessage(hwndDlg, IDC_3DDARKCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3ddark", RGB(224, 224, 224)));
+ SendDlgItemMessage(hwndDlg, IDC_3DLIGHTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, "CLCExt", "3dbright", RGB(224, 224, 224)));
return 0;
case WM_DRAWITEM:
- {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
- int iItem = dis->itemData;
- StatusItems_t *item = nullptr;
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
+ int iItem = dis->itemData;
+ StatusItems_t *item = nullptr;
- SetBkMode(dis->hDC, TRANSPARENT);
- FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
+ SetBkMode(dis->hDC, TRANSPARENT);
+ FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
- if (iItem >= ID_EXTBK_FIRST && iItem < ID_EXTBK_LAST)
- item = StatusItems[iItem - ID_EXTBK_FIRST];
+ if (iItem >= ID_EXTBK_FIRST && iItem < ID_EXTBK_LAST)
+ item = StatusItems[iItem - ID_EXTBK_FIRST];
- if (dis->itemState & ODS_SELECTED && iItem != ID_EXTBKSEPARATOR) {
- FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
- SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- }
- else {
- FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
- if (item && item->IGNORED)
- SetTextColor(dis->hDC, RGB(255, 0, 0));
- else
- SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT));
- }
- if (iItem == ID_EXTBKSEPARATOR) {
- HPEN hPen, hPenOld;
- POINT pt;
+ if (dis->itemState & ODS_SELECTED && iItem != ID_EXTBKSEPARATOR) {
+ FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
+ SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ }
+ else {
+ FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_WINDOW));
+ if (item && item->IGNORED)
+ SetTextColor(dis->hDC, RGB(255, 0, 0));
+ else
+ SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT));
+ }
+ if (iItem == ID_EXTBKSEPARATOR) {
+ HPEN hPen, hPenOld;
+ POINT pt;
- hPen = CreatePen(PS_SOLID, 2, GetSysColor(COLOR_WINDOWTEXT));
- hPenOld = (HPEN)SelectObject(dis->hDC, hPen);
+ hPen = CreatePen(PS_SOLID, 2, GetSysColor(COLOR_WINDOWTEXT));
+ hPenOld = (HPEN)SelectObject(dis->hDC, hPen);
- MoveToEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom) / 2, &pt);
- LineTo(dis->hDC, dis->rcItem.right, (dis->rcItem.top + dis->rcItem.bottom) / 2);
- SelectObject(dis->hDC, hPenOld);
- DeleteObject((HGDIOBJ)hPen);
- }
- else if (item) {
- char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName;
- TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, (int)mir_strlen(szName));
- }
- return TRUE;
+ MoveToEx(dis->hDC, dis->rcItem.left, (dis->rcItem.top + dis->rcItem.bottom) / 2, &pt);
+ LineTo(dis->hDC, dis->rcItem.right, (dis->rcItem.top + dis->rcItem.bottom) / 2);
+ SelectObject(dis->hDC, hPenOld);
+ DeleteObject((HGDIOBJ)hPen);
}
+ else if (item) {
+ char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName;
+ TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, (int)mir_strlen(szName));
+ }
+ return TRUE;
+ }
case WM_CONTEXTMENU:
- {
- HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS);
-
- POINT pt;
- GetCursorPos(&pt);
-
- RECT rc;
- GetWindowRect(hwndList, &rc);
-
- if (PtInRect(&rc, pt)) {
- int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr);
-
- if (iSelection >= ID_EXTBK_FIRST && iSelection < ID_EXTBK_LAST) {
- iSelection -= ID_EXTBK_FIRST;
- StatusItems_t *pSel = StatusItems[iSelection];
-
- for(int i = ID_EXTBK_FIRST; i < ID_EXTBK_LAST; i++) {
- if ( SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) <= 0)
- continue;
-
- int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0);
- iIndex -= ID_EXTBK_FIRST;
- if (iIndex < 0)
- continue;
-
- StatusItems_t *p = StatusItems[iIndex];
- p->ALPHA = pSel->ALPHA;
- p->BORDERSTYLE = pSel->BORDERSTYLE;
- p->COLOR = pSel->COLOR;
- p->COLOR2 = pSel->COLOR2;
- p->COLOR2_TRANSPARENT = pSel->COLOR2_TRANSPARENT;
- p->CORNER = pSel->CORNER;
- p->GRADIENT = pSel->GRADIENT;
- p->IGNORED = pSel->IGNORED;
- p->imageItem = pSel->imageItem;
- p->MARGIN_BOTTOM = pSel->MARGIN_BOTTOM;
- p->MARGIN_LEFT = pSel->MARGIN_LEFT;
- p->MARGIN_RIGHT = pSel->MARGIN_RIGHT;
- p->MARGIN_TOP = pSel->MARGIN_TOP;
- p->TEXTCOLOR = pSel->TEXTCOLOR;
- }
- OnListItemsChange(hwndDlg);
+ {
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_ITEMS);
+
+ POINT pt;
+ GetCursorPos(&pt);
+
+ RECT rc;
+ GetWindowRect(hwndList, &rc);
+
+ if (PtInRect(&rc, pt)) {
+ int iSelection = (int)TrackPopupMenu(psd->hMenuItems, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr);
+
+ if (iSelection >= ID_EXTBK_FIRST && iSelection < ID_EXTBK_LAST) {
+ iSelection -= ID_EXTBK_FIRST;
+ StatusItems_t *pSel = StatusItems[iSelection];
+
+ for (int i = ID_EXTBK_FIRST; i < ID_EXTBK_LAST; i++) {
+ if (SendMessage(hwndList, LB_GETSEL, i - ID_EXTBK_FIRST, 0) <= 0)
+ continue;
+
+ int iIndex = SendMessage(hwndList, LB_GETITEMDATA, i - ID_EXTBK_FIRST, 0);
+ iIndex -= ID_EXTBK_FIRST;
+ if (iIndex < 0)
+ continue;
+
+ StatusItems_t *p = StatusItems[iIndex];
+ p->ALPHA = pSel->ALPHA;
+ p->BORDERSTYLE = pSel->BORDERSTYLE;
+ p->COLOR = pSel->COLOR;
+ p->COLOR2 = pSel->COLOR2;
+ p->COLOR2_TRANSPARENT = pSel->COLOR2_TRANSPARENT;
+ p->CORNER = pSel->CORNER;
+ p->GRADIENT = pSel->GRADIENT;
+ p->IGNORED = pSel->IGNORED;
+ p->imageItem = pSel->imageItem;
+ p->MARGIN_BOTTOM = pSel->MARGIN_BOTTOM;
+ p->MARGIN_LEFT = pSel->MARGIN_LEFT;
+ p->MARGIN_RIGHT = pSel->MARGIN_RIGHT;
+ p->MARGIN_TOP = pSel->MARGIN_TOP;
+ p->TEXTCOLOR = pSel->TEXTCOLOR;
}
+ OnListItemsChange(hwndDlg);
}
}
- break;
+ }
+ break;
case WM_COMMAND:
// this will check if the user changed some actual statusitems values
// if yes the flag bChanged will be set to TRUE
SetChangedStatusItemFlag(wParam, hwndDlg);
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_ITEMS:
if (HIWORD(wParam) != LBN_SELCHANGE)
return FALSE;
@@ -806,15 +810,15 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
case IDC_BORDERTYPE:
break;
}
- if ((LOWORD(wParam) == IDC_ALPHA || LOWORD(wParam) == IDC_MRGN_LEFT || LOWORD(wParam) == IDC_MRGN_BOTTOM || LOWORD(wParam) == IDC_MRGN_TOP || LOWORD(wParam) == IDC_MRGN_RIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()))
+ if ((LOWORD(wParam) == IDC_ALPHA || LOWORD(wParam) == IDC_MRGN_LEFT || LOWORD(wParam) == IDC_MRGN_BOTTOM || LOWORD(wParam) == IDC_MRGN_TOP || LOWORD(wParam) == IDC_MRGN_RIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
return 0;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
// save user made changes
SaveLatestChanges(hwndDlg);
@@ -828,7 +832,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
psd->pfnClcOptionsChanged();
if (psd->hwndCLUI) {
SendMessage(psd->hwndCLUI, WM_SIZE, 0, 0);
- PostMessage(psd->hwndCLUI, WM_USER+100, 0, 0); // CLUIINTM_REDRAW
+ PostMessage(psd->hwndCLUI, WM_USER + 100, 0, 0); // CLUIINTM_REDRAW
}
break;
}
@@ -865,7 +869,7 @@ static INT_PTR SkinEdit_FillByCurrentSel(WPARAM wParam, LPARAM)
static INT_PTR SkinEdit_Invoke(WPARAM, LPARAM lParam)
{
SKINDESCRIPTION *psd = (SKINDESCRIPTION *)lParam;
- TCITEM tci = {0};
+ TCITEM tci = { 0 };
RECT rcClient;
int iTabs;
@@ -875,8 +879,8 @@ static INT_PTR SkinEdit_Invoke(WPARAM, LPARAM lParam)
iTabs = TabCtrl_GetItemCount(psd->hWndTab);
GetClientRect(psd->hWndParent, &rcClient);
- tci.mask = TCIF_PARAM|TCIF_TEXT;
- tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SKINITEMEDIT), psd->hWndParent, SkinEdit_ExtBkDlgProc, (LPARAM)psd);
+ tci.mask = TCIF_PARAM | TCIF_TEXT;
+ tci.lParam = (LPARAM)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SKINITEMEDIT), psd->hWndParent, SkinEdit_ExtBkDlgProc, (LPARAM)psd);
tci.pszText = TranslateT("Skin items");
TabCtrl_InsertItem(psd->hWndTab, iTabs++, &tci);
@@ -917,10 +921,3 @@ extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
}
-
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
-{
- g_hInst = hInstDLL;
- DisableThreadLibraryCalls(g_hInst);
- return TRUE;
-}
diff --git a/plugins/Cln_skinedit/src/stdafx.h b/plugins/Cln_skinedit/src/stdafx.h
index 19170158d3..ff936b7ce6 100644
--- a/plugins/Cln_skinedit/src/stdafx.h
+++ b/plugins/Cln_skinedit/src/stdafx.h
@@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <commctrl.h>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_database.h>
#include <m_langpack.h>
@@ -38,3 +36,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "version.h"
#include "skineditres.h"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>("Skin editor")
+ {}
+};
diff --git a/plugins/CmdLine/src/CmdLine.cpp b/plugins/CmdLine/src/CmdLine.cpp
index b84d0e75e5..745c9fb389 100644
--- a/plugins/CmdLine/src/CmdLine.cpp
+++ b/plugins/CmdLine/src/CmdLine.cpp
@@ -20,8 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-char ModuleName[] = "CmdLine";
-HINSTANCE hInstance;
+CMPlugin g_plugin;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -46,7 +45,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- pcli = Clist_GetInterface();
+ pcli = Clist_GetInterface();
if (InitServer())
MessageBox(nullptr, TranslateT("Could not initialize CmdLine plugin property"), TranslateT("Error"), MB_ICONEXCLAMATION | MB_OK);
@@ -64,9 +63,3 @@ extern "C" int __declspec(dllexport) Unload()
DestroyServer();
return 0;
}
-
-bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInstance = hinstDLL;
- return TRUE;
-}
diff --git a/plugins/CmdLine/src/stdafx.h b/plugins/CmdLine/src/stdafx.h
index 23ae2a12fb..5e2f33eed5 100644
--- a/plugins/CmdLine/src/stdafx.h
+++ b/plugins/CmdLine/src/stdafx.h
@@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <time.h>
#include <stdlib.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include "newpluginapi.h"
#include "m_database.h"
#include "m_clist.h"
@@ -56,8 +54,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mimcmd_handlers.h"
#include "mimcmd_data.h"
-extern char ModuleName[];
-extern HINSTANCE hInstance;
+#define ModuleName "CmdLine"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(ModuleName)
+ {}
+};
extern int bUseANSIStrings;
diff --git a/plugins/MimCmd/src/stdafx.h b/plugins/MimCmd/src/stdafx.h
index 2a1000d9e2..d6aa7d304c 100644
--- a/plugins/MimCmd/src/stdafx.h
+++ b/plugins/MimCmd/src/stdafx.h
@@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fcntl.h>
#define NO_MIMCMD_COMMANDS
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_langpack.h>