From 817fe8d07eb67428f0dd2f587eee002d6319fef8 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 16 May 2018 14:03:58 +0300 Subject: BasicHistory: cmplugin adaptation --- plugins/BasicHistory/src/BasicHistory.cpp | 13 ++----------- plugins/BasicHistory/src/HistoryWindow.cpp | 6 ++---- plugins/BasicHistory/src/Options.cpp | 7 ++----- plugins/BasicHistory/src/RichHtmlExport.cpp | 7 +++---- plugins/BasicHistory/src/stdafx.h | 11 +++++++++-- 5 files changed, 18 insertions(+), 26 deletions(-) (limited to 'plugins/BasicHistory/src') diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 0b18e83ab5..3504919eac 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -18,8 +18,6 @@ along with this program. If not, see . #include "stdafx.h" -HINSTANCE hInst; - #define MS_HISTORY_DELETEALLCONTACTHISTORY "BasicHistory/DeleteAllContactHistory" #define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask" @@ -36,8 +34,6 @@ bool g_SmileyAddAvail = false; char* metaContactProto = nullptr; const IID IID_ITextDocument = { 0x8CC497C0, 0xA1DF, 0x11ce, {0x80, 0x98, 0x00, 0xAA, 0x00, 0x47, 0xBE, 0x5D} }; -#define MODULE "BasicHistory" - PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -51,12 +47,7 @@ PLUGININFOEX pluginInfo = { {0xe25367a2, 0x51ae, 0x4044, {0xbe, 0x28, 0x13, 0x1b, 0xc1, 0x8b, 0x71, 0xa4}} }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ - hInst = hinstDLL; - return TRUE; -} - +CMPlugin g_plugin; int hLangpack = 0; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) @@ -260,7 +251,7 @@ extern "C" int __declspec(dllexport) Load(void) HistoryEventList::Init(); - Icon_Register(hInst, LPGEN("History"), iconList, _countof(iconList)); + Icon_Register(g_plugin.getInst(), LPGEN("History"), iconList, _countof(iconList)); return 0; } diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 25f8cd4f7a..1fbde4a55d 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -24,8 +24,6 @@ along with this program. If not, see . #include "ImageDataObject.h" #include "ExportManager.h" -#define MODULE "BasicHistory" -extern HINSTANCE hInst; extern HCURSOR hCurSplitNS, hCurSplitWE; extern int iconsNum; extern bool g_SmileyAddAvail; @@ -235,7 +233,7 @@ void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow) void HistoryWindow::Show() { - CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryWindow::DlgProcHistory, (LPARAM)this); + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HISTORY), nullptr, HistoryWindow::DlgProcHistory, (LPARAM)this); } void HistoryWindow::Focus() @@ -519,7 +517,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 380; case WM_SIZE: - Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HISTORY), HistoryWindow::HistoryDlgResizer); + Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_HISTORY), HistoryWindow::HistoryDlgResizer); ListView_SetColumnWidth(GetDlgItem(hwndDlg, IDC_LIST), 0, LVSCW_AUTOSIZE_USEHEADER); DlgReturn(TRUE); diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index ed1902db74..c0d3b16b94 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -20,12 +20,9 @@ along with this program. If not, see . #include "Options.h" #include "resource.h" -extern HINSTANCE hInst; extern bool g_SmileyAddAvail; extern bool bPopupsEnabled; -#define MODULE "BasicHistory" - Options *Options::instance; struct EventNamesType @@ -122,7 +119,7 @@ int Options::InitOptions(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 100000000; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.szTitle.w = LPGENW("History"); @@ -1473,7 +1470,7 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP DlgTaskOpt top; top.tasks = tasks; top.to = to; - if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_TASK), hwndDlg, DlgProcOptsTask, (LPARAM)&top) == IDOK) { + if (DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DLG_TASK), hwndDlg, DlgProcOptsTask, (LPARAM)&top) == IDOK) { if (LOWORD(wParam) == IDC_ADD_TASK) { tasks->push_back(*to); ListBox_AddString(listTasks, to->taskName.c_str()); diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 5cb2bd9d73..bc316393d8 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -26,7 +26,6 @@ RichHtmlExport::~RichHtmlExport() { } -extern HINSTANCE hInst; extern bool g_SmileyAddAvail; std::wstring MakeTextHtmled(const std::wstring& message, std::queue >* positionMap = nullptr) @@ -122,10 +121,10 @@ std::wstring GetName(const std::wstring &path) void ExtractFile(short int iRes, const std::wstring &fileName) { - HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(iRes), MAKEINTRESOURCE(CUSTOMRES)); + HRSRC rSrc = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(iRes), MAKEINTRESOURCE(CUSTOMRES)); if (rSrc != nullptr) { - HGLOBAL res = LoadResource(hInst, rSrc); - int size = SizeofResource(hInst, rSrc); + HGLOBAL res = LoadResource(g_plugin.getInst(), rSrc); + int size = SizeofResource(g_plugin.getInst(), rSrc); if (res != nullptr) { char* resData = (char*)LockResource(res); if (resData != nullptr) { diff --git a/plugins/BasicHistory/src/stdafx.h b/plugins/BasicHistory/src/stdafx.h index 7205088adf..ef90fecf03 100644 --- a/plugins/BasicHistory/src/stdafx.h +++ b/plugins/BasicHistory/src/stdafx.h @@ -31,8 +31,6 @@ #include #include -#define __NO_CMPLUGIN_NEEDED - #include #include #include @@ -91,3 +89,12 @@ #define HISTORY_HK_ALLCONTACTS 117 HICON LoadIconEx(int iconId, bool big = false); + +#define MODULE "BasicHistory" + +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULE) + {} +}; \ No newline at end of file -- cgit v1.2.3