diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-08-19 15:12:03 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-08-19 15:12:03 +0000 |
commit | 7056d9f7bf15b9e9d8e21bb8f38688733a73920d (patch) | |
tree | a36e623e51faafe2613cfff096a8eb3aa4026a7d | |
parent | dc9bcdf426102a9a8c00ce5ad5d33551b27d608c (diff) |
own function replaced by winapi
git-svn-id: http://svn.miranda-ng.org/main/trunk@5748 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/SplashScreen/src/headers.h | 5 | ||||
-rw-r--r-- | plugins/SplashScreen/src/main.cpp | 20 | ||||
-rw-r--r-- | plugins/SplashScreen/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/SplashScreen/src/services.cpp | 3 | ||||
-rw-r--r-- | plugins/SplashScreen/src/splash.cpp | 76 |
5 files changed, 40 insertions, 68 deletions
diff --git a/plugins/SplashScreen/src/headers.h b/plugins/SplashScreen/src/headers.h index 8211b3eaff..127635df8b 100644 --- a/plugins/SplashScreen/src/headers.h +++ b/plugins/SplashScreen/src/headers.h @@ -83,16 +83,13 @@ extern BOOL bserviceinvoked, bmodulesloaded, png2dibavail; extern HANDLE hSplashThread;
extern HINSTANCE hInst;
-extern BOOL (WINAPI *MyUpdateLayeredWindow)
- (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc,
- COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
// png2dib interface
typedef BOOL ( *pfnConvertPng2dib )( char*, size_t, BITMAPINFOHEADER** );
extern pfnConvertPng2dib png2dibConvertor;
extern int OptInit(WPARAM wParam, LPARAM lParam);
extern BOOL ShowSplash(BOOL bpreview);
-extern VOID ReadIniConfig();
+extern VOID ReadDbConfig();
extern INT_PTR ShowSplashService(WPARAM wparam,LPARAM lparam);
#ifdef _DEBUG
extern INT_PTR TestService(WPARAM wParam,LPARAM lParam);
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 4a09734466..f84164153e 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -23,7 +23,6 @@ HINSTANCE hInst = 0; int hLangpack;
-static HMODULE hUserDll = NULL;
static HMODULE hAdvaimg = NULL;
pfnConvertPng2dib png2dibConvertor = NULL;
@@ -42,9 +41,6 @@ char szVersion[MAX_PATH]; #endif
SPLASHOPTS options;
HWND hwndSplash;
-BOOL (WINAPI *MyUpdateLayeredWindow)
- (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc,
- COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
HANDLE hSplashThread;
PLUGININFOEX pluginInfo={
@@ -86,7 +82,7 @@ void SplashMain() logMessage(_T("Advaimg path"), szhAdvaimgPath);
#endif
- ReadIniConfig();
+ ReadDbConfig();
}
if (bstartup & (options.active == 1))
@@ -97,13 +93,6 @@ void SplashMain() db_set_b(NULL, MODNAME, "DisableAfterStartup", 0);
}
- if (hUserDll == NULL)
- {
- hUserDll = LoadLibrary(_T("user32.dll"));
- if (hUserDll)
- MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))GetProcAddress(hUserDll, "UpdateLayeredWindow");
- }
-
if (hAdvaimg == NULL)
{
hAdvaimg = LoadLibrary(szhAdvaimgPath);
@@ -351,13 +340,14 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- if (hSplashThread) CloseHandle(hSplashThread);
+ if (hSplashThread)
+ CloseHandle(hSplashThread);
UnregisterClass(_T(SPLASH_CLASS), hInst);
// Freeing loaded libraries
- if (hUserDll) FreeLibrary(hUserDll);
- if (hAdvaimg) FreeLibrary(hAdvaimg);
+ if (hAdvaimg)
+ FreeLibrary(hAdvaimg);
#ifdef _DEBUG
logMessage(_T("Unload"), _T("Job done"));
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 128b0d4856..df819697aa 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA TCHAR szPath2Spash [MAX_PATH], szSoundFilePath[MAX_PATH];
// Reads values from db
-void ReadIniConfig()
+void ReadDbConfig()
{
options.active = db_get_b(NULL, MODNAME, "Active", 1);
options.playsnd = db_get_b(NULL, MODNAME, "PlaySound", 0);
@@ -57,7 +57,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hwndDlg, IDC_SPLASHPATH), false);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSESPLASH), false);
}
- ReadIniConfig();
+ ReadDbConfig();
TCHAR inBuf[80];
DBVARIANT dbv = {0};
db_get_ts(NULL, MODNAME, "Path", &dbv);
diff --git a/plugins/SplashScreen/src/services.cpp b/plugins/SplashScreen/src/services.cpp index def64f0684..010094f8bf 100644 --- a/plugins/SplashScreen/src/services.cpp +++ b/plugins/SplashScreen/src/services.cpp @@ -23,14 +23,13 @@ INT_PTR ShowSplashService(WPARAM wparam,LPARAM lparam) {
bserviceinvoked = true;
TCHAR szOldfn [256];
- TCHAR* pos;
TCHAR* filename = (TCHAR*) wparam;
int timetoshow = (int) lparam;
_tcscpy_s(szOldfn, szSplashFile);
options.showtime = timetoshow;
- pos = _tcsrchr(filename, _T(':'));
+ TCHAR *pos = _tcsrchr(filename, _T(':'));
if (pos == NULL)
mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szMirDir, filename);
else
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp index 196c4adedd..9738fe005b 100644 --- a/plugins/SplashScreen/src/splash.cpp +++ b/plugins/SplashScreen/src/splash.cpp @@ -32,7 +32,6 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM logMessage(_T("WM_LOADED"), _T("called"));
#endif
- if (!MyUpdateLayeredWindow) ShowWindow(hwndSplash, SW_SHOWNORMAL);
if (!options.showtime) SetTimer(hwnd, 7, 2000, 0);
break;
@@ -91,29 +90,26 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_CLOSE:
{
- if (MyUpdateLayeredWindow) // Win 2000+
+ RECT rc; GetWindowRect(hwndSplash, &rc);
+ POINT ptDst = { rc.left, rc.top };
+ POINT ptSrc = { 0, 0 };
+ SIZE sz = { rc.right - rc.left, rc.bottom - rc.top };
+
+ BLENDFUNCTION blend;
+ blend.BlendOp = AC_SRC_OVER;
+ blend.BlendFlags = 0;
+ blend.SourceConstantAlpha = 255;
+ blend.AlphaFormat = AC_SRC_ALPHA;
+
+ // Fade Out
+ if (options.fadeout)
{
- RECT rc; GetWindowRect(hwndSplash, &rc);
- POINT ptDst = { rc.left, rc.top };
- POINT ptSrc = { 0, 0 };
- SIZE sz = { rc.right - rc.left, rc.bottom - rc.top };
-
- BLENDFUNCTION blend;
- blend.BlendOp = AC_SRC_OVER;
- blend.BlendFlags = 0;
- blend.SourceConstantAlpha = 255;
- blend.AlphaFormat = AC_SRC_ALPHA;
-
- // Fade Out
- if (options.fadeout)
+ int i;
+ for (i = 255; i>=0; i -= options.fosteps)
{
- int i;
- for (i = 255; i>=0; i -= options.fosteps)
- {
- blend.SourceConstantAlpha = i;
- MyUpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
- Sleep(1);
- }
+ blend.SourceConstantAlpha = i;
+ UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ Sleep(1);
}
}
if (bserviceinvoked) bserviceinvoked = false;
@@ -283,34 +279,24 @@ int SplashThread(void *arg) //free (ptr_verString);
}
- if (MyUpdateLayeredWindow) // Win 2000+
- {
- SetWindowLongPtr(hwndSplash, GWL_EXSTYLE, GetWindowLongPtr(hwndSplash, GWL_EXSTYLE) | WS_EX_LAYERED);
- /*
- if (splashWithMarkers)
- {
- ++ptSrc.x;
- ++ptSrc.y;
- }
- */
- MyUpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ SetWindowLongPtr(hwndSplash, GWL_EXSTYLE, GetWindowLongPtr(hwndSplash, GWL_EXSTYLE) | WS_EX_LAYERED);
+ UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
- ShowWindow(hwndSplash, SW_SHOWNORMAL);
+ ShowWindow(hwndSplash, SW_SHOWNORMAL);
- if (options.fadein)
+ if (options.fadein)
+ {
+ // Fade in
+ int i;
+ for (i = 0; i < 255; i += options.fisteps)
{
- // Fade in
- int i;
- for (i = 0; i < 255; i += options.fisteps)
- {
- blend.SourceConstantAlpha = i;
- MyUpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
- Sleep(1);
- }
+ blend.SourceConstantAlpha = i;
+ UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
+ Sleep(1);
}
- blend.SourceConstantAlpha = 255;
- MyUpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
}
+ blend.SourceConstantAlpha = 255;
+ UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
if (DWORD(arg) > 0)
{
|