From 0af868f41fbbac3d9808441a5115966f7f616c4c Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 29 Nov 2015 22:06:16 +0000 Subject: Core: SkinAddNewSound removed and replaced by SkinAddNewSoundEx git-svn-id: http://svn.miranda-ng.org/main/trunk@15788 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_skin.h | 77 +++++++++++------------------ plugins/ContactsPlus/src/main.cpp | 4 +- plugins/Ping/src/ping.cpp | 4 +- plugins/SecureIM/src/main.cpp | 4 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 16 +++--- 5 files changed, 43 insertions(+), 62 deletions(-) diff --git a/include/m_skin.h b/include/m_skin.h index ef82c12b00..ce27885f35 100644 --- a/include/m_skin.h +++ b/include/m_skin.h @@ -1,26 +1,25 @@ -/* +// Miranda NG: the free IM client for Microsoft* Windows* +// +// Copyright (c) 2012-15 Miranda NG project (http://miranda-ng.org) +// Copyright (c) 2000-08 Miranda ICQ/IM project, +// all portions of this codebase are copyrighted to the people +// listed in contributors.txt. +// +// 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. -Miranda NG: the free IM client for Microsoft* Windows* -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org) -Copyright (c) 2000-08 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -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. -*/ #ifndef M_SKIN_H__ #define M_SKIN_H__ 1 @@ -98,7 +97,6 @@ extern int hLangpack; ///////////////////////////////////////////////////////////////////////////////////////// // Miranda skin // in all these functions idx = SKINICON_* constant - EXTERN_C MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big = false); EXTERN_C MIR_APP_DLL(HANDLE) Skin_GetIconHandle(int idx); EXTERN_C MIR_APP_DLL(char*) Skin_GetIconName(int idx); @@ -121,7 +119,6 @@ EXTERN_C MIR_APP_DLL(char*) Skin_GetIconName(int idx); // returns NULL on failure // if szProto is NULL the function will load the user's selected 'all protocols' // status icon. - EXTERN_C MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big = false); ///////////////////////////////////////////////////////////////////////////////////////// @@ -150,34 +147,25 @@ typedef struct { const TCHAR *ptszDefaultFile; }; union { - const char *pszSection; // [TRANSLATED-BY-CORE] section name used to group sounds (NULL is acceptable) (added during 0.3.4+ (2004/10/*)) + const char *pszSection; // [TRANSLATED-BY-CORE] section name used to group sounds (NULL is acceptable) const TCHAR *ptszSection; }; DWORD dwFlags; } SKINSOUNDDESCEX; -__forceinline INT_PTR SkinAddNewSoundEx(const char *name, const char *section, const char *description) +__forceinline INT_PTR SkinAddNewSoundEx(const char *name, const char *section, const char *description = NULL, const char *defaultFile = NULL) { SKINSOUNDDESCEX ssd = { 0 }; ssd.cbSize = sizeof(ssd); ssd.pszName = name; ssd.pszSection = section; ssd.pszDescription = description; - return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd); -} - -__forceinline INT_PTR SkinAddNewSound(const char *name, const char *description, const char *defaultFile) -{ - SKINSOUNDDESCEX ssd = { 0 }; - ssd.cbSize = sizeof(ssd); - ssd.pszName = name; - ssd.pszDescription = description; ssd.pszDefaultFile = defaultFile; return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd); } -__forceinline INT_PTR SkinAddNewSoundExT(const char *name, const TCHAR *section, const TCHAR *description) +__forceinline INT_PTR SkinAddNewSoundExT(const char *name, const TCHAR *section, const TCHAR *description = NULL, const TCHAR *defaultFile = NULL) { SKINSOUNDDESCEX ssd = { 0 }; ssd.cbSize = sizeof(ssd); @@ -185,6 +173,7 @@ __forceinline INT_PTR SkinAddNewSoundExT(const char *name, const TCHAR *section, ssd.pszName = name; ssd.ptszSection = section; ssd.ptszDescription = description; + ssd.ptszDefaultFile = defaultFile; return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd); } @@ -193,29 +182,25 @@ __forceinline INT_PTR Skin_AddSound(SKINSOUNDDESCEX *ssd) return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)ssd); } +#define MS_SKIN_PLAYSOUND "Skin/Sounds/Play" + ///////////////////////////////////////////////////////////////////////////////////////// // plays a named sound event // wParam = 0 // lParam = (LPARAM)(const char*)pszName // pszName should have been added with Skin/Sounds/AddNew, but if not the // function will not fail, it will play the Windows default sound instead. - -#define MS_SKIN_PLAYSOUND "Skin/Sounds/Play" - -__forceinline INT_PTR SkinPlaySound(const char *name) -{ +__forceinline INT_PTR SkinPlaySound(const char *name) { return CallService(MS_SKIN_PLAYSOUND, 0, (LPARAM)name); } +#define MS_SKIN_PLAYSOUNDFILE "Skin/Sounds/PlayFile" + ///////////////////////////////////////////////////////////////////////////////////////// // plays any sound file // wParam = 0 // lParam = (LPARAM)(const TCHAR*)ptszFileName - -#define MS_SKIN_PLAYSOUNDFILE "Skin/Sounds/PlayFile" - -__forceinline INT_PTR SkinPlaySoundFile(const TCHAR *ptszFileName) -{ +__forceinline INT_PTR SkinPlaySoundFile(const TCHAR *ptszFileName) { return CallService(MS_SKIN_PLAYSOUNDFILE, 0, (LPARAM)ptszFileName); } @@ -227,7 +212,6 @@ EXTERN_C MIR_APP_DLL(void) KillModuleSounds(int hLangpack); // sent when the icons DLL has been changed in the options dialog, and everyone // should re-make their image lists // wParam = lParam = 0 - #define ME_SKIN_ICONSCHANGED "Skin/IconsChanged" ///////////////////////////////////////////////////////////////////////////////////////// @@ -236,7 +220,6 @@ EXTERN_C MIR_APP_DLL(void) KillModuleSounds(int hLangpack); // Affect: This hook is fired when the sound module needs to play a sound // Note : This event has default processing, if no one HookEvent()'s this event then it will // use the default hook code, which uses PlaySound() - #define ME_SKIN_PLAYINGSOUND "Skin/Sounds/Playing" #endif //M_SKIN_H__ diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index b276d21bc7..d695488cbe 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -219,8 +219,8 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_CONTACTS_RECEIVE, ServiceReceiveCommand); //define event sounds - SkinAddNewSound("RecvContacts", LPGEN("Incoming Contacts"), "contacts.wav"); - SkinAddNewSound("SentContacts", LPGEN("Outgoing Contacts"), "ocontacts.wav"); + SkinAddNewSoundEx("RecvContacts", LPGEN("Incoming Contacts"), LPGEN("Events"), "contacts.wav"); + SkinAddNewSoundEx("SentContacts", LPGEN("Outgoing Contacts"), LPGEN("Events"), "ocontacts.wav"); return 0; } diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 73a143fbc3..c4cc057978 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -144,8 +144,8 @@ extern "C" __declspec(dllexport) int Load(void) LoadOptions(); - SkinAddNewSound("PingTimeout", "Ping Timeout", 0); - SkinAddNewSound("PingReply", "Ping Reply", 0); + SkinAddNewSoundEx("PingTimeout", LPGEN("Timeout"), LPGEN("Ping")); + SkinAddNewSoundEx("PingReply", LPGEN("Reply"), LPGEN("Ping")); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 77094f61f1..7bfafb983d 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -209,8 +209,8 @@ static int onModulesLoaded(WPARAM, LPARAM) loadContactList(); // add new skin sound - SkinAddNewSound("IncomingSecureMessage", LPGEN("Incoming Secure Message"), "Sounds\\iSecureMessage.wav"); - SkinAddNewSound("OutgoingSecureMessage", LPGEN("Outgoing Secure Message"), "Sounds\\oSecureMessage.wav"); + SkinAddNewSoundEx("IncomingSecureMessage", LPGEN("Incoming Secure Message"), LPGEN("SecureIM"), "Sounds\\iSecureMessage.wav"); + SkinAddNewSoundEx("OutgoingSecureMessage", LPGEN("Outgoing Secure Message"), LPGEN("SecureIM"), "Sounds\\oSecureMessage.wav"); // init extra icons for (int i = 0; i < _countof(g_IEC); i++) diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index cf5aa7d4dc..64752a8759 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -138,12 +138,12 @@ int CTooltipNotify::ModulesLoaded(WPARAM, LPARAM) db_set_b(NULL, MODULENAME, "firstrun", 0); } - // register fonts - SkinAddNewSound(SND_ONLINE, LPGEN("Tooltip Notify: Online"), "online.wav"); - SkinAddNewSound(SND_OFFLINE, LPGEN("Tooltip Notify: Offline"), "offline.wav"); - SkinAddNewSound(SND_OTHER, LPGEN("Tooltip Notify: Other"), "other.wav"); - SkinAddNewSound(SND_TYPING, LPGEN("Tooltip Notify: Typing"), "typing.wav"); + SkinAddNewSoundEx(SND_ONLINE, LPGEN("Online"), LPGEN("Tooltip Notify"), "online.wav"); + SkinAddNewSoundEx(SND_OFFLINE, LPGEN("Offline"), LPGEN("Tooltip Notify"), "offline.wav"); + SkinAddNewSoundEx(SND_OTHER, LPGEN("Other"), LPGEN("Tooltip Notify"), "other.wav"); + SkinAddNewSoundEx(SND_TYPING, LPGEN("Typing"), LPGEN("Tooltip Notify"), "typing.wav"); + // register fonts RegisterFonts(); return 0; @@ -834,10 +834,8 @@ TCHAR* CTooltipNotify::MakeTooltipString(MCONTACT hContact, int iStatus, TCHAR * const TCHAR *szFormatString = m_sOptions.bPrefixProto ? _T("%s%s%s") : _T("%.0s%.0s%s"); const TCHAR* szIs = TranslateT("is"); - const char* szProto = - hContact == 0 ? "Proto" : (char*)::GetContactProto(hContact); - const TCHAR* szContactName = - (TCHAR *)::pcli->pfnGetContactDisplayName(hContact, 0); + const char* szProto = hContact == 0 ? "Proto" : ::GetContactProto(hContact); + const TCHAR* szContactName = ::pcli->pfnGetContactDisplayName(hContact, 0); memset(szString, 0, iBufSize*sizeof(TCHAR)); -- cgit v1.2.3