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/SplashScreen/src/main.cpp | 20 ++++++----- plugins/SplashScreen/src/options.cpp | 70 ++++++++++++++++++------------------ plugins/SplashScreen/src/stdafx.h | 6 ++-- 3 files changed, 49 insertions(+), 47 deletions(-) (limited to 'plugins/SplashScreen/src') diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index fe3b0fef96..b7f9fd03fd 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -38,7 +38,7 @@ HWND hwndSplash; ///////////////////////////////////////////////////////////////////////////////////////// -PLUGININFOEX pluginInfo = { +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), @@ -51,9 +51,13 @@ PLUGININFOEX pluginInfo = { { 0xc64cc8e0, 0xcf03, 0x474a, { 0x8b, 0x11, 0x8b, 0xd4, 0x56, 0x5c, 0xcf, 0x04 } } }; +CMPlugin::CMPlugin() : + PLUGIN(MODULENAME, pluginInfoEx) +{} + extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { - return &pluginInfo; + return &pluginInfoEx; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -79,14 +83,14 @@ void SplashMain() if (bstartup & (options.active == 1)) { DBVARIANT dbv = { 0 }; - if (!db_get_ws(NULL, MODNAME, "VersionPrefix", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "VersionPrefix", &dbv)) { mir_wstrcpy(szPrefix, dbv.ptszVal); db_free(&dbv); } else mir_wstrcpy(szPrefix, L""); - if (!db_get_ws(NULL, MODNAME, "Path", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "Path", &dbv)) { mir_wstrcpy(inBuf, dbv.ptszVal); db_free(&dbv); } @@ -103,7 +107,7 @@ void SplashMain() else mir_wstrcpy(szSplashFile, inBuf); - if (!db_get_ws(NULL, MODNAME, "Sound", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "Sound", &dbv)) { mir_wstrcpy(inBuf, dbv.ptszVal); db_free(&dbv); } @@ -194,10 +198,10 @@ int PlugDisableHook(WPARAM wParam, LPARAM lParam) if (options.inheritGS) { if (!strcmp(cws->szModule, "Skin") && !strcmp(cws->szSetting, "UseSound")) - db_set_b(NULL, MODNAME, "PlaySound", cws->value.bVal); + db_set_b(NULL, MODULENAME, "PlaySound", cws->value.bVal); if (!strcmp(cws->szModule, "PluginDisable") && !strcmp(cws->szSetting, _T2A(szDllName))) - db_set_b(NULL, MODNAME, "Active", cws->value.bVal); + db_set_b(NULL, MODULENAME, "Active", cws->value.bVal); } return 0; @@ -231,7 +235,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { - mir_getLP(&pluginInfo); + mir_getLP(&pluginInfoEx); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 851c660c93..46e2941b42 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -24,16 +24,16 @@ wchar_t szPath2Spash[MAX_PATH], szSoundFilePath[MAX_PATH]; // Reads values from db void ReadDbConfig() { - options.active = db_get_b(NULL, MODNAME, "Active", 1); - options.playsnd = db_get_b(NULL, MODNAME, "PlaySound", 0); - options.fadein = db_get_b(NULL, MODNAME, "FadeIn", 1); - options.fadeout = db_get_b(NULL, MODNAME, "FadeOut", 1); - options.showtime = db_get_dw(NULL, MODNAME, "TimeToShow", 2000); - options.fisteps = db_get_dw(NULL, MODNAME, "FadeinSpeed", 5); - options.fosteps = db_get_dw(NULL, MODNAME, "FadeoutSpeed", 5); - options.inheritGS = db_get_b(NULL, MODNAME, "InheritGlobalSound", 1); - options.showversion = db_get_b(NULL, MODNAME, "ShowVersion", 0); - options.random = db_get_b(NULL, MODNAME, "Random", 0); + options.active = db_get_b(NULL, MODULENAME, "Active", 1); + options.playsnd = db_get_b(NULL, MODULENAME, "PlaySound", 0); + options.fadein = db_get_b(NULL, MODULENAME, "FadeIn", 1); + options.fadeout = db_get_b(NULL, MODULENAME, "FadeOut", 1); + options.showtime = db_get_dw(NULL, MODULENAME, "TimeToShow", 2000); + options.fisteps = db_get_dw(NULL, MODULENAME, "FadeinSpeed", 5); + options.fosteps = db_get_dw(NULL, MODULENAME, "FadeoutSpeed", 5); + options.inheritGS = db_get_b(NULL, MODULENAME, "InheritGlobalSound", 1); + options.showversion = db_get_b(NULL, MODULENAME, "ShowVersion", 0); + options.random = db_get_b(NULL, MODULENAME, "Random", 0); } BOOL Exists(LPCTSTR strName) @@ -53,21 +53,21 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP wchar_t inBuf[80]; { DBVARIANT dbv = { 0 }; - if (!db_get_ws(NULL, MODNAME, "Path", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "Path", &dbv)) { mir_wstrcpy(inBuf, dbv.ptszVal); db_free(&dbv); } else mir_wstrcpy(inBuf, L"splash\\splash.png"); SetDlgItemText(hwndDlg, IDC_SPLASHPATH, inBuf); - if (!db_get_ws(NULL, MODNAME, "Sound", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "Sound", &dbv)) { mir_wstrcpy(inBuf, dbv.ptszVal); db_free(&dbv); } else mir_wstrcpy(inBuf, L"sounds\\startup.wav"); SetDlgItemText(hwndDlg, IDC_SNDPATH, inBuf); - if (!db_get_ws(NULL, MODNAME, "VersionPrefix", &dbv)) { + if (!db_get_ws(NULL, MODULENAME, "VersionPrefix", &dbv)) { mir_wstrcpy(inBuf, dbv.ptszVal); db_free(&dbv); } @@ -243,86 +243,86 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, _countof(tmp)); - db_set_ws(NULL, MODNAME, "Path", tmp); + db_set_ws(NULL, MODULENAME, "Path", tmp); GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, _countof(tmp)); - db_set_ws(NULL, MODNAME, "Sound", tmp); + db_set_ws(NULL, MODULENAME, "Sound", tmp); GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp)); - db_set_ws(NULL, MODNAME, "VersionPrefix", tmp); + db_set_ws(NULL, MODULENAME, "VersionPrefix", tmp); mir_wstrcpy(szPrefix, tmp); GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp)); - db_set_dw(NULL, MODNAME, "TimeToShow", _wtoi(tmp)); + db_set_dw(NULL, MODULENAME, "TimeToShow", _wtoi(tmp)); options.showtime = _wtoi(tmp); GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, _countof(tmp)); - db_set_dw(NULL, MODNAME, "FadeinSpeed", _wtoi(tmp)); + db_set_dw(NULL, MODULENAME, "FadeinSpeed", _wtoi(tmp)); options.fisteps = _wtoi(tmp); GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, _countof(tmp)); - db_set_dw(NULL, MODNAME, "FadeoutSpeed", _wtoi(tmp)); + db_set_dw(NULL, MODULENAME, "FadeoutSpeed", _wtoi(tmp)); options.fosteps = _wtoi(tmp); if (IsDlgButtonChecked(hwndDlg, IDC_ACTIVE)) { - db_set_b(NULL, MODNAME, "Active", 1); + db_set_b(NULL, MODULENAME, "Active", 1); options.active = 1; } else { - db_set_b(NULL, MODNAME, "Active", 0); + db_set_b(NULL, MODULENAME, "Active", 0); options.active = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND)) { - db_set_b(NULL, MODNAME, "PlaySound", 1); + db_set_b(NULL, MODULENAME, "PlaySound", 1); options.playsnd = 1; - db_set_b(NULL, MODNAME, "InheritGlobalSound", 1); + db_set_b(NULL, MODULENAME, "InheritGlobalSound", 1); options.inheritGS = 1; } else { - db_set_b(NULL, MODNAME, "PlaySound", 0); + db_set_b(NULL, MODULENAME, "PlaySound", 0); options.playsnd = 0; - db_set_b(NULL, MODNAME, "InheritGlobalSound", 0); + db_set_b(NULL, MODULENAME, "InheritGlobalSound", 0); options.inheritGS = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_PLAYSND) == BST_INDETERMINATE) { - db_set_b(NULL, MODNAME, "PlaySound", 1); + db_set_b(NULL, MODULENAME, "PlaySound", 1); options.playsnd = 1; - db_set_b(NULL, MODNAME, "InheritGlobalSound", 0); + db_set_b(NULL, MODULENAME, "InheritGlobalSound", 0); options.inheritGS = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_FADEIN)) { - db_set_b(NULL, MODNAME, "FadeIn", 1); + db_set_b(NULL, MODULENAME, "FadeIn", 1); options.fadein = 1; } else { - db_set_b(NULL, MODNAME, "FadeIn", 0); + db_set_b(NULL, MODULENAME, "FadeIn", 0); options.fadein = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_FADEOUT)) { - db_set_b(NULL, MODNAME, "FadeOut", 1); + db_set_b(NULL, MODULENAME, "FadeOut", 1); options.fadeout = 1; } else { - db_set_b(NULL, MODNAME, "FadeOut", 0); + db_set_b(NULL, MODULENAME, "FadeOut", 0); options.fadeout = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_RANDOM)) { - db_set_b(NULL, MODNAME, "Random", 1); + db_set_b(NULL, MODULENAME, "Random", 1); options.random = 1; } else { - db_set_b(NULL, MODNAME, "Random", 0); + db_set_b(NULL, MODULENAME, "Random", 0); options.random = 0; } if (IsDlgButtonChecked(hwndDlg, IDC_SHOWVERSION)) { - db_set_b(NULL, MODNAME, "ShowVersion", 1); + db_set_b(NULL, MODULENAME, "ShowVersion", 1); options.showversion = 1; } else { - db_set_b(NULL, MODNAME, "ShowVersion", 0); + db_set_b(NULL, MODULENAME, "ShowVersion", 0); options.showversion = 0; } return TRUE; diff --git a/plugins/SplashScreen/src/stdafx.h b/plugins/SplashScreen/src/stdafx.h index f2630ef5e9..a0841de240 100644 --- a/plugins/SplashScreen/src/stdafx.h +++ b/plugins/SplashScreen/src/stdafx.h @@ -49,14 +49,12 @@ // Internal defines #define SPLASH_CLASS L"MirandaSplash" -#define MODNAME "SplashScreen" +#define MODULENAME "SplashScreen" #define WM_LOADED (WM_USER + 10) struct CMPlugin : public PLUGIN { - CMPlugin() : - PLUGIN(MODNAME) - {} + CMPlugin(); }; struct SPLASHOPTS -- cgit v1.2.3