From 82097d8766b1681040983a93fee92319496ee9d7 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 5 Sep 2014 23:30:05 +0000 Subject: Minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@10378 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NotifyAnything/res/NotifyAnything.rc | 14 ++++++------ plugins/NotifyAnything/src/main.cpp | 33 ++++++++++++---------------- plugins/NotifyAnything/src/options.cpp | 4 ++-- 3 files changed, 23 insertions(+), 28 deletions(-) (limited to 'plugins') diff --git a/plugins/NotifyAnything/res/NotifyAnything.rc b/plugins/NotifyAnything/res/NotifyAnything.rc index a879c459a5..1d7b4dca19 100644 --- a/plugins/NotifyAnything/res/NotifyAnything.rc +++ b/plugins/NotifyAnything/res/NotifyAnything.rc @@ -80,19 +80,19 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Security",IDC_STATIC,7,7,222,77 CONTROL "Only listen to localhost",NA_LOCAL_CHECK,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,13,19,209,10 + RTEXT "Port:",IDC_STATIC,13,33,63,8 + EDITTEXT NA_PORT,81,31,40,14,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "(Default is 12001)",IDC_STATIC,127,34,95,8 + RTEXT "Password:",IDC_STATIC,13,51,63,8 + EDITTEXT NA_PASSWORD,81,48,141,14,ES_PASSWORD | ES_AUTOHSCROLL + CONTROL "Allow actions to execute programs",NA_ALLOW_EXECUTE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,66,209,10 GROUPBOX "Sound",IDC_STATIC,7,91,222,43 CONTROL "Play sounds",NA_SOUND_CHECK,"Button",BS_AUTO3STATE | WS_GROUP | WS_TABSTOP,13,102,209,10 CONTROL "Use internal speaker",NA_PCSPEAKER_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,118,209,10 GROUPBOX "Debug",IDC_STATIC,7,142,222,42 CONTROL "Log to file",NA_LOG_CHECK,"Button",BS_AUTO3STATE | WS_GROUP | WS_TABSTOP,13,152,98,10 CONTROL "Message debugging",NA_DEBUG_MSG_CHECK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,118,152,102,10 - EDITTEXT NA_PORT,81,31,40,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "Port:",IDC_STATIC,13,33,63,8,0,WS_EX_RIGHT - LTEXT "(Default is 12001)",IDC_STATIC,131,34,91,8 - CONTROL "Allow actions to execute programs",NA_ALLOW_EXECUTE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,66,209,10 - EDITTEXT NA_PASSWORD,81,48,77,14,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "Password:",IDC_STATIC,13,51,63,8,0,WS_EX_RIGHT EDITTEXT NA_LOG_FILENAME,13,165,187,13,ES_AUTOHSCROLL PUSHBUTTON "...",NA_LOG_BROWSE,206,165,17,13 END diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 3eecb41673..096b3de9ea 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -3,18 +3,6 @@ #define EnterCS(cs) EnterCriticalSection(cs) #define LeaveCS(cs) LeaveCriticalSection(cs) -//--------------------------- -//---Internal Hooks -//---(Workaround till CallServiceSync is available) - -/* -Stolen from NewEventNotify: -The idea for this is taken from "NewStatusNotify" by Hrk, thx *g* -This is needed to send a message with safe multithrading. -We'll create a private hook and we'll call it via NotifyEventHooks, which brings execution -back to the main thread. -*/ - void cslog(const TCHAR *what, const TCHAR *file, int line) { if (g_settings.log_to_file) { @@ -113,7 +101,8 @@ void dbg_msg(std::tstring str, int type) str = strip(str); if (g_settings.debug_messages) - CallServiceSync(MS_POPUP_SHOWMESSAGE, (WPARAM)str.c_str(), (LPARAM)type); + // Execute it in main thread + CallServiceSync(MS_POPUP_SHOWMESSAGEW, (WPARAM)str.c_str(), (LPARAM)type); if (g_settings.log_to_file) { time_t t_; @@ -170,7 +159,15 @@ void registerSound(const std::tstring &name) std::tstring id = _T("NotifyAnything_") + name; std::tstring desc = _T("NotifyAnything: ") + name; std::tstring file = name + _T(".wav"); - SkinAddNewSound(_T2A(id.c_str()), _T2A(desc.c_str()), _T2A(file.c_str())); + + SKINSOUNDDESCEX ssd = { 0 }; + ssd.cbSize = sizeof(ssd); + ssd.dwFlags = SSDF_TCHAR; + ssd.pszName = _T2A(id.c_str()); + ssd.ptszSection = LPGENT("Notify Anything"); + ssd.ptszDescription = desc.c_str(); + ssd.ptszDefaultFile = file.c_str(); + Skin_AddSound(&ssd); } HICON getIcon(const std::tstring &name) @@ -872,7 +869,7 @@ void initWinsock() LeaveCS(&g_wsocklock); } -DWORD udptcpThreadFunc(LPVOID useUdp) +DWORD WINAPI udptcpThreadFunc(LPVOID useUdp) { try { @@ -984,10 +981,8 @@ void start_threads() { g_exit_threads = false; DWORD id; - g_udp_thread = CreateThread(NULL, 0, - (LPTHREAD_START_ROUTINE)udptcpThreadFunc, (LPVOID)1, 0, &id); - g_tcp_thread = CreateThread(NULL, 0, - (LPTHREAD_START_ROUTINE)udptcpThreadFunc, NULL, 0, &id); + g_udp_thread = CreateThread(NULL, 0, udptcpThreadFunc, (void *) 1, 0, &id); + g_tcp_thread = CreateThread(NULL, 0, udptcpThreadFunc, NULL, 0, &id); } void stop_threads() diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index bf7009a0f4..99ce325044 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -174,8 +174,8 @@ int OptionsInitialize(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.pszTemplate = MAKEINTRESOURCEA(NA_OPTIONS); odp.pfnDlgProc = DlgProcOpts; - odp.pszTitle = "Notify Anything"; - odp.pszGroup = Translate("Plugins"); + odp.pszTitle = LPGEN("Notify Anything"); + odp.pszGroup = LPGEN("Plugins"); odp.position = 100000000; odp.hInstance = hInst; odp.groupPosition = 910000000; -- cgit v1.2.3