diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-01-04 14:55:01 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-01-04 14:55:01 +0000 |
commit | e80e19734c3d9e70b5b95a24a8b142fce4a419f5 (patch) | |
tree | 634cab9f4f4bf49a75750bd8c198395fadaed7a1 | |
parent | 0bc7bd1b53ff6ca8cc32787fe7a4f16f6b0e1813 (diff) |
changed sounds playing (fixed crash with different filters)
code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@2960 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/SplashScreen/res/splash.rc | 33 | ||||
-rw-r--r-- | plugins/SplashScreen/splashscreen_11.vcxproj | 8 | ||||
-rw-r--r-- | plugins/SplashScreen/splashscreen_11.vcxproj.filters | 2 | ||||
-rw-r--r-- | plugins/SplashScreen/src/bitmap_funcs.cpp | 20 | ||||
-rw-r--r-- | plugins/SplashScreen/src/headers.h | 17 | ||||
-rw-r--r-- | plugins/SplashScreen/src/main.cpp | 22 | ||||
-rw-r--r-- | plugins/SplashScreen/src/options.cpp | 10 | ||||
-rw-r--r-- | plugins/SplashScreen/src/services.cpp | 8 | ||||
-rw-r--r-- | plugins/SplashScreen/src/splash.cpp | 81 | ||||
-rw-r--r-- | plugins/SplashScreen/src/version.h | 10 |
10 files changed, 68 insertions, 143 deletions
diff --git a/plugins/SplashScreen/res/splash.rc b/plugins/SplashScreen/res/splash.rc index 262d4e1e9c..933d72393a 100644 --- a/plugins/SplashScreen/res/splash.rc +++ b/plugins/SplashScreen/res/splash.rc @@ -13,15 +13,6 @@ #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1251)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
@@ -99,47 +90,29 @@ BEGIN PUSHBUTTON "Preview...",IDC_PREVIEW,218,211,75,19
END
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Unknown language: 0x22, 0x1 resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_UKR)
-#ifdef _WIN32
-LANGUAGE 0x22, 0x1
-#pragma code_page(1251)
-#endif //_WIN32
-
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
-1 TEXTINCLUDE MOVEABLE PURE
+1 TEXTINCLUDE
BEGIN
"..\\src\\resource.h\0"
END
-3 TEXTINCLUDE MOVEABLE PURE
+3 TEXTINCLUDE
BEGIN
"\r\n"
END
-2 TEXTINCLUDE MOVEABLE PURE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
END
#endif // APSTUDIO_INVOKED
-#endif // Unknown language: 0x22, 0x1 resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/plugins/SplashScreen/splashscreen_11.vcxproj b/plugins/SplashScreen/splashscreen_11.vcxproj index b86c0d7510..f41f694ae0 100644 --- a/plugins/SplashScreen/splashscreen_11.vcxproj +++ b/plugins/SplashScreen/splashscreen_11.vcxproj @@ -91,7 +91,7 @@ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -121,7 +121,7 @@ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -150,7 +150,7 @@ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
@@ -174,7 +174,7 @@ <AdditionalIncludeDirectories>..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
diff --git a/plugins/SplashScreen/splashscreen_11.vcxproj.filters b/plugins/SplashScreen/splashscreen_11.vcxproj.filters index 1328973588..f85cc9490e 100644 --- a/plugins/SplashScreen/splashscreen_11.vcxproj.filters +++ b/plugins/SplashScreen/splashscreen_11.vcxproj.filters @@ -45,7 +45,7 @@ <Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\resource.h">
- <Filter>Resource Files</Filter>
+ <Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp index 3f69e77ca5..f6f2ce5f4b 100644 --- a/plugins/SplashScreen/src/bitmap_funcs.cpp +++ b/plugins/SplashScreen/src/bitmap_funcs.cpp @@ -1,5 +1,23 @@ +/*
+Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
+(c) 2004-2007 nullbie, (c) 2005-2007 Thief
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
#include "headers.h"
-#include "bitmap_funcs.h"
BOOL (WINAPI *_mempng2dib) (BYTE*, DWORD, BITMAPINFOHEADER**);
diff --git a/plugins/SplashScreen/src/headers.h b/plugins/SplashScreen/src/headers.h index 5c0a4f0713..8942202679 100644 --- a/plugins/SplashScreen/src/headers.h +++ b/plugins/SplashScreen/src/headers.h @@ -1,5 +1,5 @@ /*
- Splash Screen Plugin for Miranda-IM (www.miranda-im.org)
+ Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
(c) 2004-2007 nullbie, (c) 2005-2007 Thief
This program is free software; you can redistribute it and/or modify
@@ -15,18 +15,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- File name : $URL: http://svn.miranda.im/mainrepo/splashscreen/trunk/src/headers.h $
- Revision : $Rev: 1587 $
- Last change on : $Date: 2010-04-09 14:01:30 +0400 (Пт, 09 апр 2010) $
- Last change by : $Author: Thief $
*/
#ifndef HEADERS_H
#define HEADERS_H
-#define MIRANDA_VER 0x0A00
-
#define _WIN32_WINNT 0x0500
#define WINVER 0x0400
#define AC_SRC_ALPHA 0x01
@@ -34,20 +27,18 @@ #define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
-#include <stdio.h>
-#include <commctrl.h>
+#include <tchar.h>
#include <time.h>
-#include <mmsystem.h>
+#include <dshow.h>
// Miranda API headers
#include <win2k.h>
#include <newpluginapi.h>
#include <m_database.h>
#include <m_options.h>
-#include <m_utils.h>
#include <m_langpack.h>
-#include <m_system.h>
#include <m_png.h>
+
#include "m_splash.h"
// Common headers
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 0b3f842812..4a18a103c1 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -1,5 +1,5 @@ /*
- Splash Screen Plugin for Miranda-IM (www.miranda-im.org)
+ Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
(c) 2004-2007 nullbie, (c) 2005-2007 Thief
This program is free software; you can redistribute it and/or modify
@@ -15,12 +15,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- File name : $URL: http://svn.miranda.im/mainrepo/splashscreen/trunk/src/main.cpp $
- Revision : $Rev: 1586 $
- Last change on : $Date: 2010-04-09 13:34:01 +0400 (Пт, 09 апр 2010) $
- Last change by : $Author: Thief $
-
*/
#include "headers.h"
@@ -64,10 +58,11 @@ PLUGININFOEX pluginInfo={ __COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE,
- MIID_SPLASHSCREEN
+ // C64CC8E0-CF03-474A-8B11-8BD4565CCF04
+ {0xc64cc8e0, 0xcf03, 0x474a, {0x8b, 0x11, 0x8b, 0xd4, 0x56, 0x5c, 0xcf, 0x04}}
};
-extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;
return TRUE;
@@ -83,7 +78,7 @@ void SplashMain() CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
#ifdef _DEBUG
- mir_sntprintf(szLogFile, SIZEOF(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__INTERNAL_NAME));
+ mir_sntprintf(szLogFile, SIZEOF(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
initLog();
TCHAR* mirandaVerString = mir_a2t(szVersion);
logMessage(_T("Miranda version"), mirandaVerString);
@@ -125,8 +120,8 @@ void SplashMain() {
FreeLibrary(hAdvaimg); hAdvaimg = NULL;
MessageBox(NULL,
- _T("Your advaimg.dll is either obsolete or damaged. Get latest from Miranda alpha builds."),
- _T("Error"),
+ TranslateT("Your advaimg.dll is either obsolete or damaged. Get latest from Miranda alpha builds."),
+ TranslateT("Error"),
MB_OK | MB_ICONSTOP);
}
#ifdef _DEBUG
@@ -137,7 +132,6 @@ void SplashMain() }
//for 9x "alfa" testing
- //MyUpdateLayeredWindow = 0;
DBVARIANT dbv = {0};
DBGetContactSettingTString(NULL, MODNAME, "VersionPrefix", &dbv);
if (lstrcmp(dbv.ptszVal, NULL) == 0)
@@ -344,7 +338,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
mi.hotKey = 0;
mi.position = -0x7FFFFFFF;
- mi.ptszName = _T("Call Splash Service");
+ mi.ptszName = LPGENT("Call Splash Service");
mi.pszService = "Splash/Test";
Menu_AddMainMenuItem(&mi);
#endif
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index cf70b8558f..6d5cf7c553 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -1,5 +1,5 @@ /*
-Splash Screen Plugin for Miranda-IM (www.miranda-im.org)
+Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
(c) 2004-2007 nullbie, (c) 2005-2007 Thief
This program is free software; you can redistribute it and/or modify
@@ -15,14 +15,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-File name : $URL: http://svn.miranda.im/mainrepo/splashscreen/trunk/src/options.cpp $
-Revision : $Rev: 951 $
-Last change on : $Date: 2007-10-16 18:46:53 +0400 (Вт, 16 окт 2007) $
-Last change by : $Author: Thief $
-
-DESCRIPTION: Options dialog handling code
-
*/
#include "headers.h"
diff --git a/plugins/SplashScreen/src/services.cpp b/plugins/SplashScreen/src/services.cpp index d9981d7f2e..f38c8eeb8f 100644 --- a/plugins/SplashScreen/src/services.cpp +++ b/plugins/SplashScreen/src/services.cpp @@ -1,5 +1,5 @@ /*
- Splash Screen Plugin for Miranda-IM (www.miranda-im.org)
+ Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
(c) 2004-2007 nullbie, (c) 2005-2007 Thief
This program is free software; you can redistribute it and/or modify
@@ -15,12 +15,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- File name : $URL: http://svn.miranda.im/mainrepo/splashscreen/trunk/src/services.cpp $
- Revision : $Rev: 951 $
- Last change on : $Date: 2007-10-16 18:46:53 +0400 (Вт, 16 окт 2007) $
- Last change by : $Author: Thief $
-
*/
#include "headers.h"
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp index 05df53d142..196c4adedd 100644 --- a/plugins/SplashScreen/src/splash.cpp +++ b/plugins/SplashScreen/src/splash.cpp @@ -1,5 +1,5 @@ /*
-Splash Screen Plugin for Miranda-IM (www.miranda-im.org)
+Splash Screen Plugin for Miranda NG (www.miranda-ng.org)
(c) 2004-2007 nullbie, (c) 2005-2007 Thief
This program is free software; you can redistribute it and/or modify
@@ -15,12 +15,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-File name : $URL: http://svn.miranda.im/mainrepo/splashscreen/trunk/src/splash.cpp $
-Revision : $Rev: 1585 $
-Last change on : $Date: 2010-04-09 13:13:29 +0400 (Пт, 09 апр 2010) $
-Last change by : $Author: ghazan $
-
*/
#include "headers.h"
@@ -144,24 +138,9 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM break;
}
- 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);
- }
- break;
- }
-
- ShowWindow(hwndSplash, SW_HIDE);
- DestroyWindow(hwndSplash);
- break;
+ ShowWindow(hwndSplash, SW_HIDE);
+ DestroyWindow(hwndSplash);
+ break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -169,14 +148,25 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM int SplashThread(void *arg)
{
- // Old code, doesn't support mp3 files
- //if (options.playsnd) PlaySound(szSoundFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
+ IGraphBuilder *pGraph = NULL;
+ IMediaControl *pControl = NULL;
+
if (options.playsnd)
{
- TCHAR cmd[MAX_PATH];
- 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);
+ // Initialize the COM library.
+ CoInitialize(NULL);
+
+ // Create the filter graph manager and query for interfaces.
+ CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
+
+ // Get MediaControl Interface
+ pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
+
+ // Build the graph. IMPORTANT: Change this string to a file on your system.
+ pGraph->RenderFile(szSoundFile, NULL);
+
+ // Run the graph.
+ pControl->Run();
}
WNDCLASSEX wcl;
@@ -306,30 +296,7 @@ int SplashThread(void *arg) MyUpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
ShowWindow(hwndSplash, SW_SHOWNORMAL);
- }
- else // Win 9x
- {
- tmpBmp = new MyBitmap(SplashBmp->getWidth(),SplashBmp->getHeight());
- HDC dtDC = GetDC(GetDesktopWindow());
-
- BitBlt(tmpBmp->getDC(),
- 0,
- 0,
- SplashBmp->getWidth(),
- SplashBmp->getHeight(),
- dtDC,
- (DesktopRect.left + DesktopRect.right - SplashBmp->getWidth()) / 2,
- (DesktopRect.top + DesktopRect.bottom - SplashBmp->getHeight()) / 2,
- SRCCOPY);
-
- ReleaseDC(GetDesktopWindow(), dtDC);
- tmpBmp->Blend(SplashBmp, (splashWithMarkers?-1:0), (splashWithMarkers?-1:0), SplashBmp->getWidth(), SplashBmp->getHeight());
-
- }
-
- if (MyUpdateLayeredWindow) // Win 2000+
- {
if (options.fadein)
{
// Fade in
@@ -374,7 +341,11 @@ int SplashThread(void *arg) }
if (options.playsnd)
- mciSendString(_T("close song1"), NULL, 0, 0);
+ {
+ pControl->Release();
+ pGraph->Release();
+ CoUninitialize();
+ }
ExitThread(0);
return 1;
diff --git a/plugins/SplashScreen/src/version.h b/plugins/SplashScreen/src/version.h index 1b04eed57f..1431bbe216 100644 --- a/plugins/SplashScreen/src/version.h +++ b/plugins/SplashScreen/src/version.h @@ -4,19 +4,11 @@ #define __BUILD_NUM 3
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
-#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-
-#define __STRINGIFY_IMPL(x) #x
-#define __STRINGIFY(x) __STRINGIFY_IMPL(x)
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS)
#define __PLUGIN_NAME "Splash Screen"
-#define __INTERNAL_NAME "AdvSplashScreen"
-#define __FILENAME "AdvSplashScreen.dll"
+#define __FILENAME "SplashScreen.dll"
#define __DESCRIPTION "Shows a splash at Miranda startup."
#define __AUTHOR "nullbie, Thief"
#define __AUTHOREMAIL "thief@miranda.im"
#define __AUTHORWEB "http://miranda-ng.org/"
#define __COPYRIGHT "© 2004-2007 Victor Pavlychko, 2005-2011 Alexander Turyak"
-/* C64CC8E0-CF03-474A-8B11-8BD4565CCF04 */
-#define MIID_SPLASHSCREEN {0xc64cc8e0, 0xcf03, 0x474a, {0x8b, 0x11, 0x8b, 0xd4, 0x56, 0x5c, 0xcf, 0x04}}
|