summaryrefslogtreecommitdiff
path: root/splashscreen/src/splash.cpp
diff options
context:
space:
mode:
authormataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-06-02 12:56:17 +0000
committermataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-06-02 12:56:17 +0000
commit1d4c82315785aa0d61216483bae4a2511d303bea (patch)
tree29a2ad00472365527cbcb5ebb1004bb9f60f9735 /splashscreen/src/splash.cpp
parentcc3c75d89cc4658ed9903775e422523873d697e0 (diff)
fixed sounds playing
fixed random splash cosmetic fix git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@136 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'splashscreen/src/splash.cpp')
-rw-r--r--splashscreen/src/splash.cpp142
1 files changed, 69 insertions, 73 deletions
diff --git a/splashscreen/src/splash.cpp b/splashscreen/src/splash.cpp
index a0389f2..05df53d 100644
--- a/splashscreen/src/splash.cpp
+++ b/splashscreen/src/splash.cpp
@@ -147,14 +147,14 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_PAINT:
{
if (!MyUpdateLayeredWindow) // Win 9x
- {
+ {
#ifdef _DEBUG
logMessage(_T("WM_PAINT"), _T("painting.."));
#endif
PAINTSTRUCT ps;
BeginPaint(hwndSplash, &ps);
BitBlt(ps.hdc, 0, 0, SplashBmp->getWidth(), SplashBmp->getHeight(), tmpBmp->getDC(), 0, 0, SRCCOPY);
- EndPaint(hwndSplash, &ps);
+ EndPaint(hwndSplash, &ps);
}
break;
}
@@ -174,10 +174,9 @@ int SplashThread(void *arg)
if (options.playsnd)
{
TCHAR cmd[MAX_PATH];
- mir_sntprintf(cmd, SIZEOF(cmd), _T("open \"%s\" type mpegvideo alias %s"), szSoundFile, szSoundFile);
- mciSendString(cmd, NULL, 0, 0);
- mir_sntprintf(cmd, SIZEOF(cmd), _T("play %s from 0"), szSoundFile);
+ mir_sntprintf(cmd, SIZEOF(cmd), _T("open \"%s\" type mpegvideo alias song1"), szSoundFile);
mciSendString(cmd, NULL, 0, 0);
+ mciSendString(_T("play song1"), NULL, 0, 0);
}
WNDCLASSEX wcl;
@@ -243,55 +242,55 @@ int SplashThread(void *arg)
int splashWidth = SplashBmp->getWidth();
for (i = 0; i < splashWidth; ++i)
if (SplashBmp->getRow(0)[i] & 0xFF000000)
- {
- if (x < 0)
- {
- x = i-1; // 1 pixel for marker line
- splashWithMarkers = true;
- } else
- {
- x = -1;
- splashWithMarkers = false;
- break;
- }
- }
- int splashHeight = SplashBmp->getHeight();
- for (i = 0; splashWithMarkers && (i < splashHeight); ++i)
- if (SplashBmp->getRow(i)[0] & 0xFF000000)
- {
- if (y < 0)
- {
- y = i-1; // 1 pixel for marker line
- splashWithMarkers = true;
- } else
- {
- y = -1;
- splashWithMarkers = false;
- break;
- }
- }
-
- TCHAR verString[256] = {0};
- TCHAR* mirandaVerString = mir_a2t(szVersion);
- mir_sntprintf(verString, SIZEOF(verString), _T("%s%s"), szPrefix, mirandaVerString);
- mir_free(mirandaVerString);
- LOGFONT lf = {0};
- lf.lfHeight = 14;
- _tcscpy_s(lf.lfFaceName, _T("Verdana"));
- SelectObject(SplashBmp->getDC(), CreateFontIndirect(&lf));
- if (!splashWithMarkers)
- {
- SIZE v_sz = {0,0};
- GetTextExtentPoint32(SplashBmp->getDC(), verString, (int)_tcslen(verString), &v_sz);
- x = SplashBmp->getWidth()/2-(v_sz.cx/2);
- y = SplashBmp->getHeight()-(SplashBmp->getHeight()*(100-90)/100);
- }
-
- SetTextColor(SplashBmp->getDC(), (0xFFFFFFFFUL-SplashBmp->getRow(y)[x])&0x00FFFFFFUL);
- //SplashBmp->DrawText(verString,SplashBmp->getWidth()/2-(v_sz.cx/2),SplashBmp->getHeight()-30);
- SetBkMode(SplashBmp->getDC(), TRANSPARENT);
- SplashBmp->DrawText(verString, x, y);
- //free (ptr_verString);
+ {
+ if (x < 0)
+ {
+ x = i-1; // 1 pixel for marker line
+ splashWithMarkers = true;
+ } else
+ {
+ x = -1;
+ splashWithMarkers = false;
+ break;
+ }
+ }
+ int splashHeight = SplashBmp->getHeight();
+ for (i = 0; splashWithMarkers && (i < splashHeight); ++i)
+ if(SplashBmp->getRow(i)[0] & 0xFF000000)
+ {
+ if (y < 0)
+ {
+ y = i-1; // 1 pixel for marker line
+ splashWithMarkers = true;
+ } else
+ {
+ y = -1;
+ splashWithMarkers = false;
+ break;
+ }
+ }
+
+ TCHAR verString[256] = {0};
+ TCHAR* mirandaVerString = mir_a2t(szVersion);
+ mir_sntprintf(verString, SIZEOF(verString), _T("%s%s"), szPrefix, mirandaVerString);
+ mir_free(mirandaVerString);
+ LOGFONT lf = {0};
+ lf.lfHeight = 14;
+ _tcscpy_s(lf.lfFaceName, _T("Verdana"));
+ SelectObject(SplashBmp->getDC(), CreateFontIndirect(&lf));
+ if (!splashWithMarkers)
+ {
+ SIZE v_sz = {0,0};
+ GetTextExtentPoint32(SplashBmp->getDC(), verString, (int)_tcslen(verString), &v_sz);
+ x = SplashBmp->getWidth()/2-(v_sz.cx/2);
+ y = SplashBmp->getHeight()-(SplashBmp->getHeight()*(100-90)/100);
+ }
+
+ SetTextColor(SplashBmp->getDC(), (0xFFFFFFFFUL-SplashBmp->getRow(y)[x])&0x00FFFFFFUL);
+ //SplashBmp->DrawText(verString,SplashBmp->getWidth()/2-(v_sz.cx/2),SplashBmp->getHeight()-30);
+ SetBkMode(SplashBmp->getDC(), TRANSPARENT);
+ SplashBmp->DrawText(verString, x, y);
+ //free (ptr_verString);
}
if (MyUpdateLayeredWindow) // Win 2000+
@@ -309,7 +308,7 @@ int SplashThread(void *arg)
ShowWindow(hwndSplash, SW_SHOWNORMAL);
}
else // Win 9x
- {
+ {
tmpBmp = new MyBitmap(SplashBmp->getWidth(),SplashBmp->getHeight());
HDC dtDC = GetDC(GetDesktopWindow());
@@ -340,7 +339,7 @@ int SplashThread(void *arg)
blend.SourceConstantAlpha = i;
MyUpdateLayeredWindow(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);
@@ -366,26 +365,23 @@ int SplashThread(void *arg)
}
}
- // The Message Pump
- MSG msg;
- while (GetMessage(&msg, NULL, 0, 0) == TRUE) //NULL means every window in the thread; == TRUE means a safe pump.
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-
- if (options.playsnd)
+ // The Message Pump
+ MSG msg;
+ while (GetMessage(&msg, NULL, 0, 0) == TRUE) //NULL means every window in the thread; == TRUE means a safe pump.
{
- TCHAR cmd[MAX_PATH];
- mir_sntprintf(cmd, SIZEOF(cmd), _T("close %s"), szSoundFile);
- mciSendString(cmd, NULL, 0, 0);
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
}
- ExitThread(0);
- return 1;
+
+ if (options.playsnd)
+ mciSendString(_T("close song1"), NULL, 0, 0);
+
+ ExitThread(0);
+ return 1;
}
BOOL ShowSplash(BOOL bpreview)
-{
+{
if (bpreview && bpreviewruns) return 0;
if (bpreview) bpreviewruns = true;
@@ -416,8 +412,8 @@ BOOL ShowSplash(BOOL bpreview)
#endif
}
else
- {
- timeout = options.showtime;
+ {
+ timeout = options.showtime;
#ifdef _DEBUG
TCHAR b [40];
mir_sntprintf(b, SIZEOF(b), _T("%d"), options.showtime);