From 8a74e7495ce5ad39de4f5c25121a84d35df90c36 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 15:08:48 +0300 Subject: CMPlugin to receive a reference to PLUGININFOEX --- plugins/MyDetails/src/data.cpp | 4 ++-- plugins/MyDetails/src/frame.cpp | 20 ++++++++++---------- plugins/MyDetails/src/mydetails.cpp | 10 +++++++--- plugins/MyDetails/src/options.cpp | 4 ++-- plugins/MyDetails/src/stdafx.h | 6 ++---- 5 files changed, 23 insertions(+), 21 deletions(-) (limited to 'plugins/MyDetails/src') diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index 813041948d..00928f4c71 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -442,7 +442,7 @@ void ProtocolArray::SetNicks(const wchar_t *nick) mir_wstrncpy(default_nick, nick, _countof(default_nick)); - db_set_ws(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick); + db_set_ws(0, MODULENAME, SETTING_DEFAULT_NICK, nick); for (int i = 0; i < buffer_len; i++) buffer[i]->SetNick(default_nick); @@ -475,7 +475,7 @@ void ProtocolArray::SetStatusMsgs(int status, const wchar_t *message) void ProtocolArray::GetDefaultNick() { - ptrW tszNick(db_get_wsa(0, MODULE_NAME, SETTING_DEFAULT_NICK)); + ptrW tszNick(db_get_wsa(0, MODULENAME, SETTING_DEFAULT_NICK)); if (tszNick) mir_wstrncpy(default_nick, tszNick, _countof(default_nick)); else diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index fffd5399ee..4664af7a7a 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -74,8 +74,8 @@ BYTE font_styles[] = { DBFONTF_BOLD, 0, 0, DBFONTF_ITALIC, DBFONTF_ITALIC }; COLORREF font_colors[] = { RGB(0, 0, 0), RGB(0, 0, 0), RGB(0, 0, 0), RGB(150, 150, 150), RGB(150, 150, 150) }; static ColourID -bg_colour = { sizeof(bg_colour), LPGEN("My details"), LPGEN("Background"), MODULE_NAME, "BackgroundColor", 0, GetSysColor(COLOR_BTNFACE) }, -av_colour = { sizeof(av_colour), LPGEN("My details"), LPGEN("Avatar border"), MODULE_NAME, "AvatarBorderColor", 0, RGB(0, 0, 0) }; +bg_colour = { sizeof(bg_colour), LPGEN("My details"), LPGEN("Background"), MODULENAME, "BackgroundColor", 0, GetSysColor(COLOR_BTNFACE) }, +av_colour = { sizeof(av_colour), LPGEN("My details"), LPGEN("Avatar border"), MODULENAME, "AvatarBorderColor", 0, RGB(0, 0, 0) }; int CreateFrame(); void FixMainMenu(); @@ -236,7 +236,7 @@ int CreateFrame() font_id[i].cbSize = sizeof(FontIDW); mir_wstrncpy(font_id[i].group, LPGENW("My details"), _countof(font_id[i].group)); mir_wstrncpy(font_id[i].name, font_names[i], _countof(font_id[i].name)); - mir_strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, _countof(font_id[i].dbSettingsGroup)); + mir_strncpy(font_id[i].dbSettingsGroup, MODULENAME, _countof(font_id[i].dbSettingsGroup)); mir_wstrncpy(font_id[i].backgroundName, LPGENW("Background"), _countof(font_id[i].backgroundName)); mir_wstrncpy(font_id[i].backgroundGroup, LPGENW("My details"), _countof(font_id[i].backgroundGroup)); @@ -336,11 +336,11 @@ int CreateFrame() mi.position = 1; mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_USERDETAILS); mi.name.w = LPGENW("Show my details"); - mi.pszService = MODULE_NAME"/ShowHideMyDetails"; + mi.pszService = MODULENAME"/ShowHideMyDetails"; hMenuShowHideFrame = Menu_AddMainMenuItem(&mi); Menu_ConfigureItem(hMenuShowHideFrame, MCI_OPT_EXECPARAM, -0x7FFFFFFF); - if (db_get_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1) == 1) { + if (db_get_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 1) == 1) { ShowWindow(hwnd_container, SW_SHOW); FixMainMenu(); } @@ -365,9 +365,9 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP switch (msg) { case WM_SHOWWINDOW: if ((BOOL)wParam) - Utils_RestoreWindowPosition(hwnd, 0, MODULE_NAME, WINDOW_NAME_PREFIX); + Utils_RestoreWindowPosition(hwnd, 0, MODULENAME, WINDOW_NAME_PREFIX); else - Utils_SaveWindowPosition(hwnd, 0, MODULE_NAME, WINDOW_NAME_PREFIX); + Utils_SaveWindowPosition(hwnd, 0, MODULENAME, WINDOW_NAME_PREFIX); break; case WM_ERASEBKGND: @@ -386,7 +386,7 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP return TRUE; case WM_CLOSE: - db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 0); + db_set_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 0); ShowWindow(hwnd, SW_HIDE); FixMainMenu(); return TRUE; @@ -2186,7 +2186,7 @@ INT_PTR ShowHideFrameFunc(WPARAM, LPARAM) SendMessage(hwnd_container, WM_CLOSE, 0, 0); else { ShowWindow(hwnd_container, SW_SHOW); - db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); + db_set_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 1); } FixMainMenu(); @@ -2204,7 +2204,7 @@ INT_PTR ShowFrameFunc(WPARAM, LPARAM) else { if (!MyDetailsFrameVisible()) { ShowWindow(hwnd_container, SW_SHOW); - db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); + db_set_b(0, MODULENAME, SETTING_FRAME_VISIBLE, 1); FixMainMenu(); } diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 555a623f91..993499c4e9 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -34,7 +34,7 @@ static IconItem iconList[] = // Plugin data //////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = { +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -47,9 +47,13 @@ PLUGININFOEX pluginInfo = { { 0xa82baeb3, 0xa33c, 0x4036, { 0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab } } }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { - return &pluginInfo; + return &pluginInfoEx; } // Services /////////////////////////////////////////////////////////////////////////////////////// @@ -134,7 +138,7 @@ static int MainUninit(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load() { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); pcli = Clist_GetInterface(); // Hook event to load messages and show first one diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index 67ad87d1f7..827a598056 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -60,7 +60,7 @@ static OptPageControl pageControls[] = { // Initializations needed by options void LoadOptions() { - LoadOpts(pageControls, _countof(pageControls), MODULE_NAME); + LoadOpts(pageControls, _countof(pageControls), MODULENAME); // This is created here to assert that this key always exists opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12); @@ -72,7 +72,7 @@ void LoadOptions() static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - BOOL ret = SaveOptsDlgProc(pageControls, _countof(pageControls), MODULE_NAME, hwndDlg, msg, wParam, lParam); + BOOL ret = SaveOptsDlgProc(pageControls, _countof(pageControls), MODULENAME, hwndDlg, msg, wParam, lParam); switch (msg) { case WM_INITDIALOG: diff --git a/plugins/MyDetails/src/stdafx.h b/plugins/MyDetails/src/stdafx.h index 9383f39392..091cd05e56 100644 --- a/plugins/MyDetails/src/stdafx.h +++ b/plugins/MyDetails/src/stdafx.h @@ -58,16 +58,14 @@ Boston, MA 02111-1307, USA. #include "options.h" #include "frame.h" -#define MODULE_NAME "MyDetails" +#define MODULENAME "MyDetails" #define SETTING_FRAME_VISIBLE "FrameVisible" #define SETTING_DEFAULT_NICK "DefaultNick" struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(MODULE_NAME) - {} + CMPlugin(); }; extern bool g_bFramesExist, g_bAvsExist; -- cgit v1.2.3