summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-09-11 22:27:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-09-12 12:43:48 +0300
commitf2656f118f63643151e53694bd223018c29b4a55 (patch)
tree2733f155bb5fd9313ea08255209da75f738bcedf /include
parent69409021aced78b31da0c9f2def7332a4c4b973e (diff)
old good sound services became finally functions
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_helpers.inc21
-rw-r--r--include/delphi/m_skin.inc57
-rw-r--r--include/m_skin.h80
3 files changed, 12 insertions, 146 deletions
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc
index d5160da04c..f155f94866 100644
--- a/include/delphi/m_helpers.inc
+++ b/include/delphi/m_helpers.inc
@@ -33,9 +33,6 @@ function Langpack_Register:int_ptr;
function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; serviceProc: TMIRANDASERVICE): int_ptr;
-function SkinAddNewSound(const name, description, defaultFile: PAnsiChar): int_ptr;
-function SkinPlaySound (const name: PAnsiChar): int_ptr;
-
function Menu_AddContextFrameMenuItem(mi:PMO_MenuItem):HGENMENU;
function Menu_AddMainMenuItem (mi:PMO_MenuItem):HGENMENU;
function Menu_AddContactMenuItem (mi:PMO_MenuItem):HGENMENU;
@@ -276,24 +273,6 @@ begin
Result := CreateServiceFunction(szStr, @serviceProc);
end;
-function SkinAddNewSound(const name, description, defaultFile: PAnsiChar): int_ptr;
-var
- ssd: TSKINSOUNDDESCEX;
-begin
- FillChar(ssd,SizeOf(ssd),0);
- ssd.cbSize := sizeof(ssd);
- ssd.pszName := name;
- ssd.pszDescription.a := description;
- ssd.pszDefaultFile.a := defaultFile;
- Result := CallService(MS_SKIN_ADDNEWSOUND, hLangpack, lParam(@ssd));
-end;
-
-function SkinPlaySound (const name: PAnsiChar): int_ptr;
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- Result := CallService(MS_SKIN_PLAYSOUND, 0, lParam(name));
-end;
-
function Menu_AddContextFrameMenuItem(mi:PMO_MenuItem):HGENMENU;
begin
diff --git a/include/delphi/m_skin.inc b/include/delphi/m_skin.inc
index 5c07d87008..0aa6d537e9 100644
--- a/include/delphi/m_skin.inc
+++ b/include/delphi/m_skin.inc
@@ -115,19 +115,6 @@ function Skin_LoadProtoIcon(protoName:PAnsiChar; iconId:int; big:byte) : HICON;
external AppDLL name 'Skin_LoadProtoIcon';
const
- SSDF_UNICODE = $0001;
-type
- PSKINSOUNDDESCEX = ^TSKINSOUNDDESCEX;
- TSKINSOUNDDESCEX = record
- cbSize : int;
- pszName : PAnsiChar; // name to refer to sound when playing and in DB
- pszDescription: TChar; // [TRANSLATED-BY-CORE] description to use for it in options dialog
- pszDefaultFile: TChar; // the default sound file to use, WITHOUT path
- pszSection : TChar; // [TRANSLATED-BY-CORE] section name used to group sounds (NULL is acceptable)
- dwFlags : dword; // if Miranda ver >=9.0
- end;
-
-const
{
Affect : Load an icon from the user's custom skin lib, or from the exe
if there isn't one loaded, see notes
@@ -137,40 +124,6 @@ const
MS_SKIN_LOADICON:PAnsiChar = 'Skin/Icons/Load';
{
- Affect : Load an icon representing the status_wanted for a particular protocol, see notes
- Returns: an HICON for the new icon, do NOT DestroyIcon() the return value
- returns NULL(0) on failure.
- Notes : If wParam is NULL(0) the service will load the user's selected
- 'all protocols' status icon
- }
-
- {
- wParam : hLangpack
- lParam : Pointer to a initialised SKINSOUNDDESC
- Affect : Add a new sound so it has a default and can be changed in the
- options dialog
- Returns: 0 on success, [non zero] on failure
- }
- MS_SKIN_ADDNEWSOUND:PAnsiChar = 'Skin/Sounds/AddNew';
-
- {
- wParam : 0
- lParam : Pointer to a null terminated string containing the name of the
- sound to play
- Affect : plays a named sound event, play name should of been added
- with MS_SKIN_ADDNEWSOUND, see notes
- Notes : function will not fail, it will play the Windows
- }
- MS_SKIN_PLAYSOUND:PAnsiChar = 'Skin/Sounds/Play';
-
- {
- wParam = 0
- lParam = (WideChar *) ptszFileName
- Affect: plays any sound file
- }
- MS_SKIN_PLAYSOUNDFILE:PAnsiChar = 'Skin/Sounds/PlayFile';
-
- {
wParam : 0
lParam : 0
Affect : Sent when the icons DLL has been changed in the options dialog
@@ -178,14 +131,4 @@ const
}
ME_SKIN_ICONSCHANGED:PAnsiChar = 'Skin/IconsChanged';
- {
- wParam: 0 when playing sound (1 when sound is being previewed)
- lParam: (AnsiChar*) pszSoundFile
- 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()
- Version: 0.3.4a (2004/09/15)
- }
- ME_SKIN_PLAYINGSOUND:PAnsiChar = 'Skin/Sounds/Playing';
-
{$ENDIF}
diff --git a/include/m_skin.h b/include/m_skin.h
index 1d9f4d23a0..155b887ed6 100644
--- a/include/m_skin.h
+++ b/include/m_skin.h
@@ -117,84 +117,26 @@ 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);
/////////////////////////////////////////////////////////////////////////////////////////
-// add a new sound so it has a default and can be changed in the options dialog
-// wParam = hLangpack
-// lParam = (LPARAM)(SKINSOUNDDESC*)ssd;
+// adds a new sound so it has a default and can be changed in the options dialog
// returns 0 on success, nonzero otherwise
-#define SSDF_UNICODE 0x0001
-
-typedef struct {
- int cbSize;
- const char *pszName; // name to refer to sound when playing and in db
- union {
- const char *pszDescription; // [TRANSLATED-BY-CORE] description for options dialog
- const wchar_t *pwszDescription;
- };
- union {
- const char *pszDefaultFile; // default sound file to use
- const wchar_t *pwszDefaultFile;
- };
- union {
- const char *pszSection; // [TRANSLATED-BY-CORE] section name used to group sounds (NULL is acceptable)
- const wchar_t *pwszSection;
- };
- DWORD dwFlags;
-}
- SKINSOUNDDESCEX;
-
-__forceinline INT_PTR SkinAddNewSoundEx(const char *name, const char *section, const char *description, const char *defaultFile = NULL)
-{
- SKINSOUNDDESCEX ssd = { 0 };
- ssd.cbSize = sizeof(ssd);
- ssd.pszName = name;
- ssd.pszSection = section;
- ssd.pszDescription = description;
- ssd.pszDefaultFile = defaultFile;
- return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd);
-}
-
-__forceinline INT_PTR SkinAddNewSoundExW(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = NULL)
-{
- SKINSOUNDDESCEX ssd = { 0 };
- ssd.cbSize = sizeof(ssd);
- ssd.dwFlags = SSDF_UNICODE;
- ssd.pszName = name;
- ssd.pwszSection = section;
- ssd.pwszDescription = description;
- ssd.pwszDefaultFile = defaultFile;
- return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd);
-}
-
-__forceinline INT_PTR Skin_AddSound(SKINSOUNDDESCEX *ssd)
-{
- return CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)ssd);
-}
-
-#define MS_SKIN_PLAYSOUND "Skin/Sounds/Play"
+EXTERN_C MIR_APP_DLL(int) Skin_AddSound(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = nullptr, int = hLangpack);
/////////////////////////////////////////////////////////////////////////////////////////
-// 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.
-__forceinline INT_PTR SkinPlaySound(const char *name) {
- return CallService(MS_SKIN_PLAYSOUND, 0, (LPARAM)name);
-}
+// plays a registered sound
+// returns 0 on success, nonzero otherwise
-#define MS_SKIN_PLAYSOUNDFILE "Skin/Sounds/PlayFile"
+EXTERN_C MIR_APP_DLL(int) Skin_PlaySound(const char *name);
/////////////////////////////////////////////////////////////////////////////////////////
-// plays any sound file
-// wParam = 0
-// lParam = (LPARAM)(const wchar_t*)ptszFileName
-__forceinline INT_PTR SkinPlaySoundFile(const wchar_t *ptszFileName) {
- return CallService(MS_SKIN_PLAYSOUNDFILE, 0, (LPARAM)ptszFileName);
-}
+// plays the sound file (non-registered)
+// returns 0 on success, nonzero otherwise
+
+EXTERN_C MIR_APP_DLL(int) Skin_PlaySoundFile(const wchar_t *pwszFileName);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -204,6 +146,7 @@ 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"
/////////////////////////////////////////////////////////////////////////////////////////
@@ -212,6 +155,7 @@ 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__