summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-09-12 12:14:57 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-09-12 12:14:57 +0300
commit69409021aced78b31da0c9f2def7332a4c4b973e (patch)
tree3d9a6607f042acb8d44ece5f3fb08a4125a94e45 /src
parente09448dd03e3647717166e92ee818e395041993a (diff)
Revert "Merge branch 'master' of https://github.com/miranda-ng/miranda-ng"
This reverts commit e09448dd03e3647717166e92ee818e395041993a, reversing changes made to b0f44b16bd1138de85a5d17bb42151742f9c8298.
Diffstat (limited to 'src')
-rw-r--r--src/core/stdauth/src/auth.cpp8
-rw-r--r--src/core/stdfile/src/file.cpp10
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp2
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp6
-rw-r--r--src/core/stdmsg/src/globals.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp4
-rw-r--r--src/core/stdmsg/src/msgs.cpp24
-rw-r--r--src/core/stdmsg/src/msgtimedout.cpp2
-rw-r--r--src/core/stduseronline/src/useronline.cpp4
-rw-r--r--src/mir_app/src/button.cpp2
-rw-r--r--src/mir_app/src/chat_opts.cpp22
-rw-r--r--src/mir_app/src/chat_tools.cpp22
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/sounds.cpp104
15 files changed, 117 insertions, 101 deletions
diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp
index 7b5b3ae59b..e7074b4dbb 100644
--- a/src/core/stdauth/src/auth.cpp
+++ b/src/core/stdauth/src/auth.cpp
@@ -68,7 +68,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
ptrW szUid(Contact_GetInfo(CNF_UNIQUEID, hContact));
if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
- Skin_PlaySound("AuthRequest");
+ SkinPlaySound("AuthRequest");
if (szUid)
mir_snwprintf(szTooltip, TranslateT("%s requests authorization"), szUid);
else
@@ -79,7 +79,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
pcli->pfnAddEvent(&cli);
}
else if (dbei.eventType == EVENTTYPE_ADDED) {
- Skin_PlaySound("AddedEvent");
+ SkinPlaySound("AddedEvent");
if (szUid)
mir_snwprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid);
else
@@ -98,7 +98,7 @@ int LoadSendRecvAuthModule(void)
CreateServiceFunction(MS_AUTH_SHOWADDED, ShowAddedWindow);
HookEvent(ME_DB_EVENT_ADDED, AuthEventAdded);
- Skin_AddSound("AuthRequest", LPGENW("Alerts"), LPGENW("Authorization request"));
- Skin_AddSound("AddedEvent", LPGENW("Alerts"), LPGENW("Added event"));
+ SkinAddNewSoundEx("AuthRequest", LPGEN("Alerts"), LPGEN("Authorization request"));
+ SkinAddNewSoundEx("AddedEvent", LPGEN("Alerts"), LPGEN("Added event"));
return 0;
}
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 3d391dd7a7..bc68940dd9 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -105,7 +105,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
- Skin_PlaySound("RecvFile");
+ SkinPlaySound("RecvFile");
wchar_t szTooltip[256];
mir_snwprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
@@ -443,9 +443,9 @@ int LoadSendRecvFileModule(void)
CreateServiceFunction("SRFile/OpenContRecDir", openContRecDir);
CreateServiceFunction("SRFile/OpenRecDir", openRecDir);
- Skin_AddSound("RecvFile", LPGENW("File"), LPGENW("Incoming"));
- Skin_AddSound("FileDone", LPGENW("File"), LPGENW("Complete"));
- Skin_AddSound("FileFailed", LPGENW("File"), LPGENW("Error"));
- Skin_AddSound("FileDenied", LPGENW("File"), LPGENW("Denied"));
+ SkinAddNewSoundEx("RecvFile", LPGEN("File"), LPGEN("Incoming"));
+ SkinAddNewSoundEx("FileDone", LPGEN("File"), LPGEN("Complete"));
+ SkinAddNewSoundEx("FileFailed", LPGEN("File"), LPGEN("Error"));
+ SkinAddNewSoundEx("FileDenied", LPGEN("File"), LPGEN("Denied"));
return 0;
}
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 5f6baa2e04..7a9edaad87 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -388,7 +388,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hwndDlg, IDC_FILEDIR), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILEDIRBROWSE), FALSE);
SetDlgItemText(hwndDlg, IDC_MSG, TranslateT("This file transfer has been canceled by the other side"));
- Skin_PlaySound("FileDenied");
+ SkinPlaySound("FileDenied");
FlashWindow(hwndDlg, TRUE);
}
else if (ack->result != ACKRESULT_FILERESUME)
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index d3499bfcb8..ed875004c1 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -624,16 +624,16 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (ack->result == ACKRESULT_DENIED) {
dat->fs = NULL; /* protocol will free structure */
- Skin_PlaySound("FileDenied");
+ SkinPlaySound("FileDenied");
SetFtStatus(hwndDlg, LPGENW("File transfer denied"), FTS_TEXT);
}
else if (ack->result == ACKRESULT_FAILED) {
dat->fs = NULL; /* protocol will free structure */
- Skin_PlaySound("FileFailed");
+ SkinPlaySound("FileFailed");
SetFtStatus(hwndDlg, LPGENW("File transfer failed"), FTS_TEXT);
}
else {
- Skin_PlaySound("FileDone");
+ SkinPlaySound("FileDone");
if (dat->send) {
dat->fs = NULL; /* protocol will free structure */
SetFtStatus(hwndDlg, LPGENW("Transfer completed."), FTS_TEXT);
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 661837a1b2..4675677588 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -87,7 +87,7 @@ static int ackevent(WPARAM, LPARAM lParam)
msgQueue_processack(pAck->hContact, (INT_PTR)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam);
if (pAck->result == ACKRESULT_SUCCESS)
- Skin_PlaySound("SendMsg");
+ SkinPlaySound("SendMsg");
}
return 0;
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index e3834976ff..7f418e285d 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -1148,9 +1148,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
// Sounds *only* for sent messages, not for custom events
if (isMessage && !isSent) {
if (GetForegroundWindow() == m_pOwner->GetHwnd())
- Skin_PlaySound("RecvMsgActive");
+ SkinPlaySound("RecvMsgActive");
else
- Skin_PlaySound("RecvMsgInactive");
+ SkinPlaySound("RecvMsgInactive");
}
if (isMessage && !isSent) {
m_lastMessage = dbei.timestamp;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 1b2fa2a775..7df2891d00 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -72,18 +72,18 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
ShowWindow(hwnd, SW_RESTORE);
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
SetForegroundWindow(hwnd);
- Skin_PlaySound("RecvMsgActive");
+ SkinPlaySound("RecvMsgActive");
}
else {
if (GetForegroundWindow() == GetParent(hwnd))
- Skin_PlaySound("RecvMsgActive");
+ SkinPlaySound("RecvMsgActive");
else
- Skin_PlaySound("RecvMsgInactive");
+ SkinPlaySound("RecvMsgInactive");
}
return 0;
}
/* new message */
- Skin_PlaySound("AlertMsg");
+ SkinPlaySound("AlertMsg");
char *szProto = GetContactProto(hContact);
if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) {
@@ -164,7 +164,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)
hContact = db_mc_tryMeta(hContact);
- Skin_PlaySound((lParam) ? "TNStart" : "TNStop");
+ SkinPlaySound((lParam) ? "TNStart" : "TNStop");
HWND hwnd = Srmm_FindWindow(hContact);
if (hwnd)
@@ -511,13 +511,13 @@ int LoadSendRecvMessageModule(void)
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
CreateServiceFunction(MS_MSG_READMESSAGE, ReadMessageCommand);
- Skin_AddSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)"));
- Skin_AddSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)"));
- Skin_AddSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)"));
- Skin_AddSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing"));
- Skin_AddSound("SendError", LPGENW("Instant messages"), LPGENW("Message send error"));
- Skin_AddSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing"));
- Skin_AddSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing"));
+ SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (focused window)"));
+ SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (unfocused window)"));
+ SkinAddNewSoundEx("AlertMsg", LPGEN("Instant messages"), LPGEN("Incoming (new session)"));
+ SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing"));
+ SkinAddNewSoundEx("SendError", LPGEN("Instant messages"), LPGEN("Message send error"));
+ SkinAddNewSoundEx("TNStart", LPGEN("Instant messages"), LPGEN("Contact started typing"));
+ SkinAddNewSoundEx("TNStop", LPGEN("Instant messages"), LPGEN("Contact stopped typing"));
InitStatusIcons();
return 0;
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp
index e0ce1ad97c..7596198ce5 100644
--- a/src/core/stdmsg/src/msgtimedout.cpp
+++ b/src/core/stdmsg/src/msgtimedout.cpp
@@ -93,7 +93,7 @@ void MessageFailureProcess(TMsgQueue *item, const char* err)
}
else SendMessage(hwnd, DM_REMAKELOG, 0, 0);
- Skin_PlaySound("SendError");
+ SkinPlaySound("SendError");
ErrorDlgParam param = { err, item };
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwnd, ErrorDlgProc, (LPARAM)&param);
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp
index b7ff2473b0..3ac251408d 100644
--- a/src/core/stduseronline/src/useronline.cpp
+++ b/src/core/stduseronline/src/useronline.cpp
@@ -65,7 +65,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
pcli->pfnAddEvent(&cle);
IcoLib_ReleaseIcon(cle.hIcon, 0);
db_set_dw(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent);
- Skin_PlaySound("UserOnline");
+ SkinPlaySound("UserOnline");
}
}
}
@@ -117,6 +117,6 @@ int LoadUserOnlineModule(void)
HookEvent(ME_PROTO_ACK, UserOnlineAck);
HookEvent(ME_SYSTEM_MODULESLOADED, UserOnlineModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, UserOnlineAccountsChanged);
- Skin_AddSound("UserOnline", LPGENW("Alerts"), LPGENW("Online"));
+ SkinAddNewSoundEx("UserOnline", LPGEN("Alerts"), LPGEN("Online"));
return 0;
}
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp
index a39b55e5ce..ba0b4e8714 100644
--- a/src/mir_app/src/button.cpp
+++ b/src/mir_app/src/button.cpp
@@ -37,7 +37,7 @@ struct TTooltips
static LIST<TTooltips> lToolTips(1, NumericKeySortT);
static mir_cs csTips;
-static bool bModuleInitialized = false;
+static BOOL bModuleInitialized = FALSE;
// Used for our own cheap TrackMouseEvent
#define BUTTON_POLLID 100
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index 98ea06b72c..1b31dae8f5 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -323,17 +323,17 @@ int OptionsInit(void)
g_Settings->iWidth = db_get_dw(0, CHAT_MODULE, "roomwidth", -1);
g_Settings->iHeight = db_get_dw(0, CHAT_MODULE, "roomheight", -1);
- Skin_AddSound("ChatMessage", LPGENW("Group chats"), LPGENW("Incoming message"));
- Skin_AddSound("ChatHighlight", LPGENW("Group chats"), LPGENW("Message is highlighted"));
- Skin_AddSound("ChatAction", LPGENW("Group chats"), LPGENW("User has performed an action"));
- Skin_AddSound("ChatJoin", LPGENW("Group chats"), LPGENW("User has joined"));
- Skin_AddSound("ChatPart", LPGENW("Group chats"), LPGENW("User has left"));
- Skin_AddSound("ChatKick", LPGENW("Group chats"), LPGENW("User has kicked some other user"));
- Skin_AddSound("ChatMode", LPGENW("Group chats"), LPGENW("User's status was changed"));
- Skin_AddSound("ChatNick", LPGENW("Group chats"), LPGENW("User has changed name"));
- Skin_AddSound("ChatNotice", LPGENW("Group chats"), LPGENW("User has sent a notice"));
- Skin_AddSound("ChatQuit", LPGENW("Group chats"), LPGENW("User has disconnected"));
- Skin_AddSound("ChatTopic", LPGENW("Group chats"), LPGENW("The topic has been changed"));
+ SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message"));
+ SkinAddNewSoundEx("ChatHighlight", LPGEN("Group chats"), LPGEN("Message is highlighted"));
+ SkinAddNewSoundEx("ChatAction", LPGEN("Group chats"), LPGEN("User has performed an action"));
+ SkinAddNewSoundEx("ChatJoin", LPGEN("Group chats"), LPGEN("User has joined"));
+ SkinAddNewSoundEx("ChatPart", LPGEN("Group chats"), LPGEN("User has left"));
+ SkinAddNewSoundEx("ChatKick", LPGEN("Group chats"), LPGEN("User has kicked some other user"));
+ SkinAddNewSoundEx("ChatMode", LPGEN("Group chats"), LPGEN("User's status was changed"));
+ SkinAddNewSoundEx("ChatNick", LPGEN("Group chats"), LPGEN("User has changed name"));
+ SkinAddNewSoundEx("ChatNotice", LPGEN("Group chats"), LPGEN("User has sent a notice"));
+ SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected"));
+ SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed"));
return 0;
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 1bffbfb6a3..2b0ccdde6b 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -280,7 +280,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
if (bHighlight) {
gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatHighlight");
+ SkinPlaySound("ChatHighlight");
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
@@ -306,28 +306,28 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
switch (iEvent) {
case GC_EVENT_JOIN:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatJoin");
+ SkinPlaySound("ChatJoin");
break;
case GC_EVENT_PART:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatPart");
+ SkinPlaySound("ChatPart");
break;
case GC_EVENT_QUIT:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatQuit");
+ SkinPlaySound("ChatQuit");
break;
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatMode");
+ SkinPlaySound("ChatMode");
break;
case GC_EVENT_KICK:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatKick");
+ SkinPlaySound("ChatKick");
break;
case GC_EVENT_MESSAGE:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatMessage");
+ SkinPlaySound("ChatMessage");
if (bInactive && !(si->wState & STATE_TALK)) {
si->wState |= STATE_TALK;
@@ -338,19 +338,19 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
break;
case GC_EVENT_ACTION:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatAction");
+ SkinPlaySound("ChatAction");
break;
case GC_EVENT_NICK:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatNick");
+ SkinPlaySound("ChatNick");
break;
case GC_EVENT_NOTICE:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatNotice");
+ SkinPlaySound("ChatNotice");
break;
case GC_EVENT_TOPIC:
if (bInactive || !g_Settings->bSoundsFocus)
- Skin_PlaySound("ChatTopic");
+ SkinPlaySound("ChatTopic");
break;
}
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index f810bb6e0e..a0addf8ff5 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -453,6 +453,3 @@ Hotkey_Unsubclass @457
Hotkey_Check @458
?SetStatusText@CSrmmBaseDialog@@UAEXPB_WPAUHICON__@@@Z @459 NONAME
Srmm_SetStatusText @460
-Skin_AddSound @461
-Skin_PlaySound @462
-Skin_PlaySoundFile @463
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index ec9a39feb2..963f8cd9ad 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -453,6 +453,3 @@ Hotkey_Unsubclass @457
Hotkey_Check @458
?SetStatusText@CSrmmBaseDialog@@UEAAXPEB_WPEAUHICON__@@@Z @459 NONAME
Srmm_SetStatusText @460
-Skin_AddSound @461
-Skin_PlaySound @462
-Skin_PlaySoundFile @463
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index a6a964119f..9775a42965 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -53,7 +53,7 @@ static int CompareSounds(const SoundItem* p1, const SoundItem* p2)
static OBJLIST<SoundItem> arSounds(10, CompareSounds);
-/////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
MIR_APP_DLL(void) KillModuleSounds(int _hLang)
{
@@ -66,34 +66,66 @@ MIR_APP_DLL(void) KillModuleSounds(int _hLang)
}
}
-/////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name)
+{
+ wchar_t str[128];
+ TVITEM tvi;
+ tvi.mask = TVIF_TEXT;
+ tvi.pszText = str;
+ tvi.cchTextMax = _countof(str);
+ tvi.hItem = TreeView_GetRoot(hwndTree);
+ while (tvi.hItem != nullptr) {
+ SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
+ if (!mir_wstrcmpi(str, name))
+ return tvi.hItem;
+
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
+ }
+ return nullptr;
+}
+
+static BOOL bModuleInitialized = FALSE;
static HANDLE hPlayEvent = nullptr;
-MIR_APP_DLL(int) Skin_AddSound(const char *pszName, const wchar_t *pwszSection, const wchar_t *pwszDescription, const wchar_t *pwszDefaultFile, int _hLang)
+static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam)
{
- if (pszName == nullptr || pwszDescription == nullptr)
+ SKINSOUNDDESCEX *ssd = (SKINSOUNDDESCEX*)lParam;
+ if (ssd->cbSize != sizeof(SKINSOUNDDESCEX) || ssd->pszName == nullptr || ssd->pszDescription == nullptr)
return 1;
SoundItem *item = new SoundItem; // due to OBJLIST
- item->name = mir_strdup(pszName);
+ item->name = mir_strdup(ssd->pszName);
item->ptszTempFile = nullptr;
- item->hLangpack = _hLang;
+ item->hLangpack = (int)wParam;
arSounds.insert(item);
- item->pwszDescription = mir_wstrdup(pwszDescription);
- item->pwszSection = mir_wstrdup((pwszSection != nullptr) ? pwszSection : L"Other");
+ wchar_t *pwszDefaultFile;
+ if (ssd->dwFlags & SSDF_UNICODE) {
+ item->pwszDescription = mir_wstrdup(ssd->pwszDescription);
+ item->pwszSection = mir_wstrdup((ssd->pszSection != nullptr) ? ssd->pwszSection : L"Other");
+ pwszDefaultFile = mir_wstrdup(ssd->pwszDefaultFile);
+ }
+ else {
+ item->pwszDescription = mir_a2u(ssd->pszDescription);
+ item->pwszSection = mir_a2u((ssd->pszSection != nullptr) ? ssd->pszSection : "Other");
+ pwszDefaultFile = mir_a2u(ssd->pszDefaultFile);
+ }
if (pwszDefaultFile) {
- ptrW wszSavedValue(db_get_wsa(0, "SkinSounds", item->name));
- if (wszSavedValue == nullptr)
+ DBVARIANT dbv;
+ if (db_get_s(0, "SkinSounds", item->name, &dbv))
db_set_ws(0, "SkinSounds", item->name, pwszDefaultFile);
+ else
+ db_free(&dbv);
+ mir_free(pwszDefaultFile);
}
return 0;
}
-static int Skin_PlaySoundDefault(WPARAM wParam, LPARAM lParam)
+static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
wchar_t *pszFile = (wchar_t*) lParam;
if (pszFile && (db_get_b(0, "Skin", "UseSound", 0) || (int)wParam == 1))
@@ -102,23 +134,25 @@ static int Skin_PlaySoundDefault(WPARAM wParam, LPARAM lParam)
return 0;
}
-MIR_APP_DLL(int) Skin_PlaySoundFile(const wchar_t *pwszFileName)
+static INT_PTR ServiceSkinPlaySoundFile(WPARAM, LPARAM lParam)
{
- if (pwszFileName == nullptr)
+ wchar_t *ptszFileName = (wchar_t*)lParam;
+ if (ptszFileName == nullptr)
return 1;
wchar_t tszFull[MAX_PATH];
- PathToAbsoluteW(pwszFileName, tszFull);
+ PathToAbsoluteW(ptszFileName, tszFull);
NotifyEventHooks(hPlayEvent, 0, (LPARAM)tszFull);
return 0;
}
-MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName)
+static INT_PTR ServiceSkinPlaySound(WPARAM, LPARAM lParam)
{
+ char *pszSoundName = (char*)lParam;
if (pszSoundName == nullptr)
return 1;
- SoundItem tmp = { (char*)pszSoundName };
+ SoundItem tmp = { pszSoundName };
int idx = arSounds.getIndex(&tmp);
if (idx == -1)
return 1;
@@ -126,12 +160,13 @@ MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName)
if (db_get_b(0, "SkinSoundsOff", pszSoundName, 0))
return 1;
- ptrW wszFilePath(db_get_wsa(0, "SkinSounds", pszSoundName));
- if (wszFilePath == nullptr)
- return 1;
-
- Skin_PlaySoundFile(wszFilePath);
- return 0;
+ DBVARIANT dbv;
+ if (db_get_ws(0, "SkinSounds", pszSoundName, &dbv) == 0) {
+ ServiceSkinPlaySoundFile(0, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
+ return 0;
+ }
+ return 1;
}
#define DM_REBUILD_STREE (WM_USER+1)
@@ -139,24 +174,6 @@ MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName)
#define DM_SHOWPANE (WM_USER+3)
#define DM_CHECKENABLED (WM_USER+4)
-static HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name)
-{
- wchar_t str[128];
- TVITEM tvi;
- tvi.mask = TVIF_TEXT;
- tvi.pszText = str;
- tvi.cchTextMax = _countof(str);
- tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem != nullptr) {
- SendMessage(hwndTree, TVM_GETITEM, 0, (LPARAM)&tvi);
- if (!mir_wstrcmpi(str, name))
- return tvi.hItem;
-
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
- return nullptr;
-}
-
INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HWND hwndTree = nullptr;
@@ -457,9 +474,14 @@ static int SkinSystemModulesLoaded(WPARAM, LPARAM)
int LoadSkinSounds(void)
{
+ bModuleInitialized = TRUE;
+
+ CreateServiceFunction("Skin/Sounds/AddNew", ServiceSkinAddNewSound);
+ CreateServiceFunction(MS_SKIN_PLAYSOUND, ServiceSkinPlaySound);
+ CreateServiceFunction(MS_SKIN_PLAYSOUNDFILE, ServiceSkinPlaySoundFile);
HookEvent(ME_SYSTEM_MODULESLOADED, SkinSystemModulesLoaded);
hPlayEvent = CreateHookableEvent(ME_SKIN_PLAYINGSOUND);
- SetHookDefaultForHookableEvent(hPlayEvent, Skin_PlaySoundDefault);
+ SetHookDefaultForHookableEvent(hPlayEvent, SkinPlaySoundDefault);
return 0;
}