diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-17 21:37:53 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-17 21:37:53 +0300 |
commit | 88b04fed4966b0f1686690cb6101854afb52a5ee (patch) | |
tree | 79b4e574c0849f24907168075c8d0babfde2fde4 /plugins/RecentContacts | |
parent | 5ebe9c34375bce857ad3160abba67d6ed2beadaf (diff) |
Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin
Diffstat (limited to 'plugins/RecentContacts')
-rw-r--r-- | plugins/RecentContacts/src/RecentContacts.cpp | 69 | ||||
-rw-r--r-- | plugins/RecentContacts/src/options.cpp | 3 | ||||
-rw-r--r-- | plugins/RecentContacts/src/stdafx.h | 8 |
3 files changed, 37 insertions, 43 deletions
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 8a8cbf3003..d65e97e226 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -7,8 +7,8 @@ using namespace std; static const basic_string <char>::size_type npos = -1;
char *szProto;
-HINSTANCE hInst = nullptr;
int hLangpack = 0;
+CMPlugin g_plugin;
CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
@@ -20,13 +20,7 @@ const INT_PTR boo = 0; LastUCOptions LastUCOpt = {0};
-/////////////////////////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
+static IconItem icon = { LPGEN("Main icon"), "recent_main", IDI_SHOWRECENT };
/////////////////////////////////////////////////////////////////////////////////////////
@@ -44,8 +38,6 @@ PLUGININFOEX pluginInfo = {0x0e5f3b9d, 0xebcd, 0x44d7, {0x93, 0x74, 0xd8, 0xe5, 0xd8, 0x8d, 0xf4, 0xe3}}
};
-static IconItem icon = { LPGEN("Main icon"), "recent_main", IDI_SHOWRECENT };
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -251,13 +243,12 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lvi.iImage = Clist_GetContactIcon(curContact->second);
ListView_InsertItem(hList, &lvi);
i++;
-
}
+
if (LastUCOpt.MaxShownContacts > 0 && i >= LastUCOpt.MaxShownContacts)
break;
}
-
// window autosize/autopos - ike blaster
bool restorePos = !LastUCOpt.WindowAutoSize;
@@ -300,37 +291,35 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_NOTIFY:
- {
- LPNMHDR lpNmhdr;
- lpNmhdr = (LPNMHDR)lParam;
- if (lpNmhdr->hwndFrom == hList) {
- if (lpNmhdr->code == NM_CLICK || lpNmhdr->code == NM_RCLICK) {
- RECT r;
- POINT p;
- GetCursorPos(&p);
- GetWindowRect(hList, &r);
- if (PtInRect(&r, p)) {
- LVHITTESTINFO lvh;
- memset(&lvh, 0, sizeof(lvh));
- lvh.pt = p;
- ScreenToClient(hList, &lvh.pt);
- ListView_HitTest(hList, &lvh);
- if ((lvh.flags & (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)) && lvh.iItem != -1) {
- if (lpNmhdr->code == NM_CLICK) {
- if (ShowListMainDlgProc_OpenContact(hList, lvh.iItem))
- SendMessage(hDlg, WM_CLOSE, 0, 0);
- }
- else ShowListMainDlgProc_OpenContactMenu(hDlg, hList, lvh.iItem, DlgDat);
+ LPNMHDR lpNmhdr;
+ lpNmhdr = (LPNMHDR)lParam;
+ if (lpNmhdr->hwndFrom == hList) {
+ if (lpNmhdr->code == NM_CLICK || lpNmhdr->code == NM_RCLICK) {
+ RECT r;
+ POINT p;
+ GetCursorPos(&p);
+ GetWindowRect(hList, &r);
+ if (PtInRect(&r, p)) {
+ LVHITTESTINFO lvh;
+ memset(&lvh, 0, sizeof(lvh));
+ lvh.pt = p;
+ ScreenToClient(hList, &lvh.pt);
+ ListView_HitTest(hList, &lvh);
+ if ((lvh.flags & (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)) && lvh.iItem != -1) {
+ if (lpNmhdr->code == NM_CLICK) {
+ if (ShowListMainDlgProc_OpenContact(hList, lvh.iItem))
+ SendMessage(hDlg, WM_CLOSE, 0, 0);
}
+ else ShowListMainDlgProc_OpenContactMenu(hDlg, hList, lvh.iItem, DlgDat);
}
}
- else if (lpNmhdr->code == NM_RETURN) {
- if (ShowListMainDlgProc_OpenContact(hList, ListView_GetNextItem(hList, -1, LVIS_SELECTED)))
- SendMessage(hDlg, WM_CLOSE, 0, 0);
- }
}
- break;
+ else if (lpNmhdr->code == NM_RETURN) {
+ if (ShowListMainDlgProc_OpenContact(hList, ListView_GetNextItem(hList, -1, LVIS_SELECTED)))
+ SendMessage(hDlg, WM_CLOSE, 0, 0);
+ }
}
+ break;
case WM_MEASUREITEM:
return Menu_MeasureItem(lParam);
@@ -415,7 +404,7 @@ INT_PTR OnMenuCommandShowList(WPARAM, LPARAM) contacts->insert(cpair(curTime, curContact));
}
- HWND hWndMain = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LASTUC_DIALOG), nullptr, ShowListMainDlgProc, (LPARAM)contacts);
+ HWND hWndMain = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_LASTUC_DIALOG), nullptr, ShowListMainDlgProc, (LPARAM)contacts);
if (hWndMain == nullptr)
return -1;
@@ -562,7 +551,7 @@ extern "C" __declspec(dllexport) int Load(void) CoInitialize(nullptr);
- Icon_Register(hInst, "Recent Contacts", &icon, 1);
+ Icon_Register(g_plugin.getInst(), "Recent Contacts", &icon, 1);
CreateServiceFunction(msLastUC_ShowList, OnMenuCommandShowList);
CreateServiceFunction(V_RECENTCONTACTS_TOGGLE_IGNORE, ToggleIgnore);
diff --git a/plugins/RecentContacts/src/options.cpp b/plugins/RecentContacts/src/options.cpp index da67bff9bd..3a833f4ba4 100644 --- a/plugins/RecentContacts/src/options.cpp +++ b/plugins/RecentContacts/src/options.cpp @@ -1,6 +1,5 @@ #include "stdafx.h"
-extern HINSTANCE hInst;
void LoadDBSettings();
static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -59,7 +58,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP int onOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Contacts");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_LASTUC_OPT);
odp.szTitle.a = LPGEN("Recent Contacts");
diff --git a/plugins/RecentContacts/src/stdafx.h b/plugins/RecentContacts/src/stdafx.h index 9e809a6b23..e52935fc47 100644 --- a/plugins/RecentContacts/src/stdafx.h +++ b/plugins/RecentContacts/src/stdafx.h @@ -8,7 +8,6 @@ #include <map>
#include <time.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_clistint.h>
#include <m_chat_int.h>
@@ -49,6 +48,13 @@ void wfree(char **Data); #define msLastUC_IgnoreOff "RecentContacts/SetIgnoreOff"
#define msLastUC_IgnoreOn "RecentContacts/SetIgnoreOn"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
+
/////////////////////////////////////////////////////////////////////////////////////////
struct LastUCOptions
|