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/MyDetails/src | |
parent | 5ebe9c34375bce857ad3160abba67d6ed2beadaf (diff) |
Db3x_mmap, Dbx_mdbx, Exchange, MyDetails, RecentContacts, TopToolBar, WebView => CMPlugin
Diffstat (limited to 'plugins/MyDetails/src')
-rw-r--r-- | plugins/MyDetails/src/frame.cpp | 32 | ||||
-rw-r--r-- | plugins/MyDetails/src/mydetails.cpp | 30 | ||||
-rw-r--r-- | plugins/MyDetails/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/MyDetails/src/services.cpp | 4 | ||||
-rw-r--r-- | plugins/MyDetails/src/stdafx.h | 10 |
5 files changed, 37 insertions, 41 deletions
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 505752efc4..fffd5399ee 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -262,7 +262,7 @@ int CreateFrame() wndclass.lpfnWndProc = FrameWindowProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hIcon = nullptr;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
@@ -272,7 +272,7 @@ int CreateFrame() if (g_bFramesExist) {
hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, pcli->hwndContactList, nullptr, hInst, nullptr);
+ 0, 0, 10, 10, pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
CLISTFrame Frame = { 0 };
@@ -307,7 +307,7 @@ int CreateFrame() wndclass.lpfnWndProc = FrameContainerWindowProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
+ wndclass.hInstance = g_plugin.getInst();
wndclass.hIcon = nullptr;
wndclass.hCursor = LoadCursor(nullptr, IDC_ARROW);
wndclass.hbrBackground = nullptr; //(HBRUSH)(COLOR_3DFACE+1);
@@ -317,10 +317,10 @@ int CreateFrame() hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, TranslateT("My details"),
(WS_THICKFRAME | WS_CAPTION | WS_SYSMENU) & ~WS_VISIBLE,
- 0, 0, 200, 130, pcli->hwndContactList, nullptr, hInst, nullptr);
+ 0, 0, 200, 130, pcli->hwndContactList, nullptr, g_plugin.getInst(), nullptr);
hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE,
- 0, 0, 10, 10, hwnd_container, nullptr, hInst, nullptr);
+ 0, 0, 10, 10, hwnd_container, nullptr, g_plugin.getInst(), nullptr);
SetWindowLongPtr(hwnd_container, GWLP_USERDATA, (LONG_PTR)hwnd_frame);
SendMessage(hwnd_container, WM_SIZE, 0, 0);
@@ -528,14 +528,14 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) /* CREATE A TOOLTIP WINDOW */
HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, nullptr, hInst, nullptr); // handle to the ToolTip control
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, nullptr, g_plugin.getInst(), nullptr); // handle to the ToolTip control
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwnd;
- ti.hinst = hInst;
+ ti.hinst = g_plugin.getInst();
ti.uId = uid;
ti.lpszText = LPSTR_TEXTCALLBACK;
// ToolTip control will cover the whole window
@@ -1187,7 +1187,7 @@ void Draw(HWND hwnd, HDC hdc_orig) HICON icon = IcoLib_GetIcon("MYDETAILS_NEXT_PROTOCOL");
if (icon == nullptr)
- icon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RIGHT_ARROW));
+ icon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_RIGHT_ARROW));
DrawIconEx(hdc, data->next_proto_rect.left, data->next_proto_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(icon);
@@ -1200,7 +1200,7 @@ void Draw(HWND hwnd, HDC hdc_orig) icon = IcoLib_GetIcon("MYDETAILS_PREV_PROTOCOL");
if (icon == nullptr)
- icon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RIGHT_ARROW));
+ icon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_RIGHT_ARROW));
DrawIconEx(hdc, data->prev_proto_rect.left, data->prev_proto_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(icon);
@@ -1324,7 +1324,7 @@ void Draw(HWND hwnd, HDC hdc_orig) HICON icon = IcoLib_GetIcon("LISTENING_TO_ICON");
if (icon == nullptr)
- icon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LISTENINGTO));
+ icon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LISTENINGTO));
DrawIconEx(hdc, data->listening_to_icon_rect.left, data->listening_to_icon_rect.top, icon, ICON_SIZE, ICON_SIZE, 0, nullptr, DI_NORMAL);
IcoLib_ReleaseIcon(icon);
@@ -1448,7 +1448,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto static unsigned statusModePf2List[] = { 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT,
PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH };
- menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
submenu = GetSubMenu(menu, 0);
TranslateMenu(submenu);
@@ -1472,7 +1472,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
{
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 5);
TranslateMenu(submenu);
@@ -1710,7 +1710,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // In image?
if (data->draw_img && InsideRect(&p, &data->img_rect)) {
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 4);
TranslateMenu(submenu);
@@ -1750,7 +1750,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
// In nick?
else if (data->draw_nick && InsideRect(&p, &data->nick_rect)) {
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 2);
TranslateMenu(submenu);
@@ -1798,7 +1798,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar else if (data->draw_away_msg && InsideRect(&p, &data->away_msg_rect)) {
wchar_t tmp[128];
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 3);
TranslateMenu(submenu);
@@ -1875,7 +1875,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
// Default context menu
else {
- HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
+ HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU1));
HMENU submenu = GetSubMenu(menu, 1);
TranslateMenu(submenu);
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 5f00d1a8dd..aad7b0c45f 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -19,12 +19,19 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
+int hLangpack;
+CMPlugin g_plugin;
CLIST_INTERFACE *pcli;
-HINSTANCE hInst;
-int hLangpack = 0;
bool g_bAvsExist;
+static IconItem iconList[] =
+{
+ { LPGEN("Listening to"), "LISTENING_TO_ICON", IDI_LISTENINGTO },
+ { LPGEN("Previous account"), "MYDETAILS_PREV_PROTOCOL", IDI_LEFT_ARROW },
+ { LPGEN("Next account"), "MYDETAILS_NEXT_PROTOCOL", IDI_RIGHT_ARROW }
+};
+
// Plugin data ////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
@@ -40,21 +47,6 @@ PLUGININFOEX pluginInfo = { { 0xa82baeb3, 0xa33c, 0x4036, { 0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab } }
};
-static IconItem iconList[] =
-{
- { LPGEN("Listening to"), "LISTENING_TO_ICON", IDI_LISTENINGTO },
- { LPGEN("Previous account"), "MYDETAILS_PREV_PROTOCOL", IDI_LEFT_ARROW },
- { LPGEN("Next account"), "MYDETAILS_NEXT_PROTOCOL", IDI_RIGHT_ARROW }
-};
-
-// Functions //////////////////////////////////////////////////////////////////////////////////////
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -153,9 +145,9 @@ extern "C" __declspec(dllexport) int Load() InitOptions();
if (IcoLib_GetIcon("LISTENING_TO_ICON") == nullptr)
- Icon_Register(hInst, LPGEN("Contact list"), iconList, 1);
+ Icon_Register(g_plugin.getInst(), LPGEN("Contact list"), iconList, 1);
- Icon_Register(hInst, LPGEN("My details"), iconList + 1, _countof(iconList) - 1);
+ Icon_Register(g_plugin.getInst(), LPGEN("My details"), iconList + 1, _countof(iconList) - 1);
// Register services
CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAME, PluginCommand_SetMyNickname);
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index 625984cf9f..67ad87d1f7 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -163,7 +163,7 @@ int InitOptionsCallback(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -200000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = DlgProcOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTS);
odp.szGroup.w = LPGENW("Contact list");
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index 807d901180..83b54b4c3c 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -147,7 +147,7 @@ INT_PTR PluginCommand_SetMyNicknameUI(WPARAM, LPARAM lParam) if (!nickname_dialog_open) {
InterlockedExchange(&nickname_dialog_open, 1);
- hwndSetNickname = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETNICKNAME), nullptr, DlgProcSetNickname);
+ hwndSetNickname = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETNICKNAME), nullptr, DlgProcSetNickname);
SendMessage(hwndSetNickname, WMU_SETDATA, proto_num, 0);
}
@@ -437,7 +437,7 @@ INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam) if (!status_msg_dialog_open) {
InterlockedExchange(&status_msg_dialog_open, 1);
- hwndSetStatusMsg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETSTATUSMESSAGE), nullptr, DlgProcSetStatusMessage);
+ hwndSetStatusMsg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETSTATUSMESSAGE), nullptr, DlgProcSetStatusMessage);
SendMessage(hwndSetStatusMsg, WMU_SETDATA, status, proto_num);
}
diff --git a/plugins/MyDetails/src/stdafx.h b/plugins/MyDetails/src/stdafx.h index f5ae61ac93..9383f39392 100644 --- a/plugins/MyDetails/src/stdafx.h +++ b/plugins/MyDetails/src/stdafx.h @@ -25,8 +25,6 @@ Boston, MA 02111-1307, USA. #include <windowsx.h>
#include <commctrl.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <m_skin.h>
#include <m_protosvc.h>
@@ -65,7 +63,13 @@ Boston, MA 02111-1307, USA. #define SETTING_FRAME_VISIBLE "FrameVisible"
#define SETTING_DEFAULT_NICK "DefaultNick"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE_NAME)
+ {}
+};
+
extern bool g_bFramesExist, g_bAvsExist;
#define PS_GETMYNICKNAMEMAXLENGTH "/GetMyNicknameMaxLength"
|