summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-08-19 19:47:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-08-19 19:47:29 +0300
commit53d8307e4f7912e7ad38c49d140f44b48b71ee72 (patch)
tree95bccf132c654629d4085b01372e7a0258e30add /plugins
parentdf0928b64c9b32e5c2becf657055d905869eb207 (diff)
fixes #3166 (VoiceService: настройки автоматических действий)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/VoiceService/VoiceService.vcxproj6
-rw-r--r--plugins/VoiceService/VoiceService.vcxproj.filters3
-rw-r--r--plugins/VoiceService/res/resource.rc215
-rw-r--r--plugins/VoiceService/src/frame.cpp724
-rw-r--r--plugins/VoiceService/src/frame.h29
-rw-r--r--plugins/VoiceService/src/options.cpp425
-rw-r--r--plugins/VoiceService/src/options.h3
7 files changed, 296 insertions, 1109 deletions
diff --git a/plugins/VoiceService/VoiceService.vcxproj b/plugins/VoiceService/VoiceService.vcxproj
index 0816a9cc42..3c37d1bfb9 100644
--- a/plugins/VoiceService/VoiceService.vcxproj
+++ b/plugins/VoiceService/VoiceService.vcxproj
@@ -25,6 +25,11 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
+ <ItemDefinitionGroup>
+ <ResourceCompile>
+ <PreprocessorDefinitions>WINVER=0x0501;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
+ </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\hooks.cpp" />
<ClCompile Include="src\main.cpp" />
@@ -43,6 +48,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="res\resource.h" />
<ClInclude Include="src\options.h" />
<ClInclude Include="src\popup.h" />
<ClInclude Include="src\resource.h" />
diff --git a/plugins/VoiceService/VoiceService.vcxproj.filters b/plugins/VoiceService/VoiceService.vcxproj.filters
index 2b465b04b6..108386e584 100644
--- a/plugins/VoiceService/VoiceService.vcxproj.filters
+++ b/plugins/VoiceService/VoiceService.vcxproj.filters
@@ -59,6 +59,9 @@
<ClInclude Include="src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="res\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\stdafx.cxx">
diff --git a/plugins/VoiceService/res/resource.rc b/plugins/VoiceService/res/resource.rc
index 9820d23cd3..d64cc7a87c 100644
--- a/plugins/VoiceService/res/resource.rc
+++ b/plugins/VoiceService/res/resource.rc
@@ -1,7 +1,5 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
-#include <windows.h>
-#include <commctrl.h>
#include "..\src\resource.h"
#define APSTUDIO_READONLY_SYMBOLS
@@ -9,19 +7,17 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
-#include "afxres.h"
+#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -29,17 +25,14 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
IDD_CALLS DIALOGEX 0, 0, 195, 225
-STYLE DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPCHILDREN
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LISTBOX IDC_CALLS,0,0,195,126,LBS_SORT | LBS_OWNERDRAWFIXED |
- LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_NOSEL | NOT
- WS_BORDER | WS_VSCROLL | WS_TABSTOP
- CONTROL "",IDC_DIALPAD,"MButtonClass",0x0,0,126,20,14,
- 0x18000000L
+ LISTBOX IDC_CALLS,0,0,195,126,LBS_SORT | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_NOSEL | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_DIALPAD,"MButtonClass",0x0,0,126,20,14,WS_EX_NOACTIVATE | 0x10000000L
EDITTEXT IDC_NUMBER,20,126,155,14,ES_AUTOHSCROLL
- CONTROL "",IDC_CALL,"MButtonClass",0x0,175,126,20,14,0x18000000L
+ CONTROL "",IDC_CALL,"MButtonClass",0x0,175,126,20,14,WS_EX_NOACTIVATE | 0x10000000L
PUSHBUTTON "1",IDC_1,67,143,18,18
PUSHBUTTON "2",IDC_2,87,143,18,18
PUSHBUTTON "3",IDC_3,107,143,18,18
@@ -55,121 +48,101 @@ BEGIN
END
IDD_POPUPS DIALOGEX 0, 0, 314, 240
-STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Enable popups",IDC_POPUPS,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,3,3,308,12
+ CONTROL "Enable popups",IDC_POPUPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,3,308,12
GROUPBOX "Colors",IDC_COLOURS_G,3,25,158,75
CONTROL "",IDC_BGCOLOR,"ColourPicker",WS_TABSTOP,11,37,35,14
LTEXT "Background color",IDC_BGCOLOR_L,55,41,66,8
CONTROL "",IDC_TEXTCOLOR,"ColourPicker",WS_TABSTOP,11,55,35,14
LTEXT "Text color",IDC_TEXTCOLOR_L,55,59,66,8
- CONTROL "Use Windows colors",IDC_WINCOLORS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,11,74,108,10
- CONTROL "Use default colors",IDC_DEFAULTCOLORS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,11,84,107,10
+ CONTROL "Use Windows colors",IDC_WINCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,74,108,10
+ CONTROL "Use default colors",IDC_DEFAULTCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,84,107,10
GROUPBOX "Timeout",IDC_DELAY_G,166,25,145,75
- CONTROL "Default",IDC_DELAYFROMPU,"Button",
- BS_AUTORADIOBUTTON | WS_GROUP,175,38,122,10
- CONTROL "Custom",IDC_DELAYCUSTOM,"Button",BS_AUTORADIOBUTTON,175,
- 52,54,10
- CONTROL "Permanent",IDC_DELAYPERMANENT,"Button",
- BS_AUTORADIOBUTTON,175,66,122,10
+ CONTROL "Default",IDC_DELAYFROMPU,"Button",BS_AUTORADIOBUTTON | WS_GROUP,175,38,122,10
+ CONTROL "Custom",IDC_DELAYCUSTOM,"Button",BS_AUTORADIOBUTTON,175,52,54,10
+ CONTROL "Permanent",IDC_DELAYPERMANENT,"Button",BS_AUTORADIOBUTTON,175,66,122,10
EDITTEXT IDC_DELAY,233,50,31,14,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "Spin1",IDC_DELAY_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
- UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS |
- UDS_HOTTRACK,268,51,11,11
+ CONTROL "Spin1",IDC_DELAY_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,268,51,11,11
GROUPBOX "Actions",IDC_ACTIONS_G,3,103,308,47
RTEXT "On right click:",IDC_RIGHT_ACTION_L,13,118,62,9
- COMBOBOX IDC_RIGHT_ACTION,83,116,156,60,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_RIGHT_ACTION,83,116,156,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "On left click:",IDC_LEFT_ACTION_L,13,132,62,9
- COMBOBOX IDC_LEFT_ACTION,83,132,156,60,CBS_DROPDOWNLIST |
- WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_LEFT_ACTION,83,132,156,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Preview",IDC_PREV,131,161,50,14
END
-IDD_NEW_CALL DIALOG DISCARDABLE 0, 0, 229, 87
-STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION |
- WS_SYSMENU
+IDD_NEW_CALL DIALOG 0, 0, 229, 87
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Voice Call"
FONT 8, "MS Shell Dlg"
BEGIN
- CTEXT "%s wants to start a voice call with you. What you want to do?\n\nIf you answer the call, the current call will be put on hold.",
- IDC_TEXT,7,7,215,36
+ CTEXT "%s wants to start a voice call with you. What you want to do?\n\nIf you answer the call, the current call will be put on hold.",IDC_TEXT,7,7,215,36
DEFPUSHBUTTON "Answer",ID_ANSWER,58,47,50,14
PUSHBUTTON "Drop",ID_DROP,121,47,50,14
- CONTROL "From now on, repeat this action for this contact",
- IDC_AUTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,67,215,
- 12
+ CONTROL "From now on, repeat this action for this contact",IDC_AUTO,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,67,215,12
END
IDD_OPTS DIALOGEX 0, 0, 233, 41
-STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Frame",IDC_STATIC,3,3,227,30
- CONTROL "Auto-size frame",IDC_FRAME_AUTOSIZE,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,11,15,214,12
+ CONTROL "Auto-size frame",IDC_FRAME_AUTOSIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,15,214,12
END
IDD_OPT_AUTO DIALOGEX 0, 0, 313, 240
-STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Automatic Actions",IDC_STATIC,0,0,313,240
- CONTROL "",IDC_LIST,"CListControl",WS_TABSTOP | 0x1f0,8,14,297,
- 183,WS_EX_CLIENTEDGE
- ICON IDI_ACTION_ANSWER,IDC_ANSWER,8,204,20,20
- LTEXT "Auto accept this contact calls",IDC_STATIC,26,205,279,8,
- SS_NOPREFIX | SS_CENTERIMAGE
- ICON IDI_ACTION_DROP,IDC_DROP,8,219,20,20
- LTEXT "Auto drop this contacts calls",IDC_STATIC,26,220,279,8,
- SS_NOPREFIX | SS_CENTERIMAGE
+ CONTROL "",IDC_LIST,"CListControl",WS_TABSTOP | 0x1f0,8,14,297,183,WS_EX_CLIENTEDGE
+ LTEXT "Auto accept this contact calls",IDC_STATIC,26,206,279,8,SS_NOPREFIX | SS_CENTERIMAGE
+ ICON IDI_ACTION_ANSWER,IDC_ANSWER,5,205,16,16
+ LTEXT "Auto drop this contacts calls",IDC_STATIC,26,224,279,8,SS_NOPREFIX | SS_CENTERIMAGE
+ ICON IDI_ACTION_DROP,IDC_DROP,5,223,16,16
END
IDD_OPT_DEVICES DIALOGEX 0, 0, 295, 221
-STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Audio",IDC_STATIC,3,3,289,78
LTEXT "Input:",IDC_STATIC,11,16,42,12
- COMBOBOX IDC_INPUT,58,15,228,13,CBS_DROPDOWNLIST | CBS_SORT |
- WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_INPUT,58,15,228,13,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Output:",IDC_STATIC,11,33,42,12
- COMBOBOX IDC_OUTPUT,58,32,228,13,CBS_DROPDOWNLIST | CBS_SORT |
- WS_VSCROLL | WS_TABSTOP
- CONTROL "Echo cancelation",IDC_ECHO,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,11,49,275,12
- CONTROL "Microphone boost",IDC_MIC_BOOST,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,11,64,275,12
+ COMBOBOX IDC_OUTPUT,58,32,228,13,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Echo cancelation",IDC_ECHO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,49,275,12
+ CONTROL "Microphone boost",IDC_MIC_BOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,64,275,12
END
IDD_VOICECALL DIALOGEX 0, 0, 160, 109
-STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Unknown call"
-FONT 8, "Ms Shell Dlg", 0, 0, 1
-{
- LTEXT "Call will disclose IP address to the peer and his server", -1, 25, 89, 130, 15, SS_LEFT, WS_EX_LEFT
- ICON 32515, -1, 5, 89, 15, 15, SS_ICON | SS_REALSIZECONTROL, WS_EX_LEFT
- CTEXT "Established", IDC_STATUS, 6, 49, 148, 10, SS_CENTER | SS_CENTERIMAGE, WS_EX_LEFT
- CONTROL "", -1, WC_STATIC, SS_BLACKFRAME, 5, 48, 150, 12, WS_EX_LEFT
- CONTROL "", -1, WC_STATIC, SS_ETCHEDHORZ, 0, 85, 163, 1, WS_EX_LEFT
- AUTOCHECKBOX "M", IDC_MUTE, 128, 30, 12, 12, NOT WS_VISIBLE | BS_ICON | BS_PUSHLIKE, WS_EX_LEFT
- AUTOCHECKBOX "V", IDC_GGG, 143, 30, 12, 12, NOT WS_VISIBLE | BS_ICON | BS_PUSHLIKE, WS_EX_LEFT
- ICON "", IDC_VIDEO, 113, 30, 12, 12, SS_ICON | SS_REALSIZECONTROL, WS_EX_LEFT
- LTEXT "", IDC_DESCR, 45, 4, 115, 10, SS_LEFT | SS_WORDELLIPSIS, WS_EX_LEFT
- LTEXT "", IDC_ADDRESS, 45, 13, 115, 10, SS_LEFT | SS_WORDELLIPSIS, WS_EX_LEFT
- ICON "", IDC_ENCRYPTED, 98, 30, 12, 12, SS_ICON | SS_REALSIZECONTROL, WS_EX_LEFT
- CONTROL "", IDC_AVATAR, WC_STATIC, SS_BITMAP | SS_REALSIZECONTROL, 5, 6, 35, 35, WS_EX_LEFT
- PUSHBUTTON "Drop", IDC_DROPBTN, 90, 66, 65, 13, 0, WS_EX_LEFT
- DEFPUSHBUTTON "Answer", IDC_ANSWERBTN, 5, 66, 65, 13, 0, WS_EX_LEFT
-}
+FONT 8, "Ms Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "Call will disclose IP address to the peer and his server",-1,25,89,130,15
+ ICON 32515,-1,5,89,20,20,SS_REALSIZECONTROL
+ CTEXT "Established",IDC_STATUS,6,49,148,10,SS_CENTERIMAGE
+ CONTROL "",-1,"Static",SS_BLACKFRAME,5,48,150,12
+ CONTROL "",-1,"Static",SS_ETCHEDHORZ,0,85,163,1
+ CONTROL "M",IDC_MUTE,"Button",BS_AUTOCHECKBOX | BS_ICON | BS_PUSHLIKE | NOT WS_VISIBLE | WS_TABSTOP,128,30,12,12
+ CONTROL "V",IDC_GGG,"Button",BS_AUTOCHECKBOX | BS_ICON | BS_PUSHLIKE | NOT WS_VISIBLE | WS_TABSTOP,143,30,12,12
+ ICON "",IDC_VIDEO,113,30,20,20,SS_REALSIZECONTROL
+ LTEXT "",IDC_DESCR,45,4,115,10,SS_WORDELLIPSIS
+ LTEXT "",IDC_ADDRESS,45,13,115,10,SS_WORDELLIPSIS
+ ICON "",IDC_ENCRYPTED,98,30,20,20,SS_REALSIZECONTROL
+ CONTROL "",IDC_AVATAR,"Static",SS_BITMAP | SS_REALSIZECONTROL,5,6,35,35
+ PUSHBUTTON "Drop",IDC_DROPBTN,90,66,65,13
+ DEFPUSHBUTTON "Answer",IDC_ANSWERBTN,5,66,65,13
+END
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -177,7 +150,7 @@ FONT 8, "Ms Shell Dlg", 0, 0, 1
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
+GUIDELINES DESIGNINFO
BEGIN
IDD_POPUPS, DIALOG
BEGIN
@@ -216,6 +189,10 @@ BEGIN
TOPMARGIN, 3
BOTTOMMARGIN, 218
END
+
+ IDD_VOICECALL, DIALOG
+ BEGIN
+ END
END
#endif // APSTUDIO_INVOKED
@@ -225,7 +202,7 @@ END
// Menu
//
-IDR_MENUS MENU DISCARDABLE
+IDR_MENUS MENU
BEGIN
POPUP "Frame Popup"
BEGIN
@@ -243,21 +220,51 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDI_TALKING ICON DISCARDABLE "res\\Talking.ico"
-IDI_RINGING ICON DISCARDABLE "res\\Rinning.ico"
-IDI_ENDED ICON DISCARDABLE "res\\ended.ico"
-IDI_BUSY ICON DISCARDABLE "res\\Busy.ico"
-IDI_ON_HOLD ICON DISCARDABLE "res\\On hold.ico"
-IDI_ACTION_CALL ICON DISCARDABLE "res\\Call.ico"
-IDI_ACTION_ANSWER ICON DISCARDABLE "res\\Answer.ico"
-IDI_ACTION_HOLD ICON DISCARDABLE "res\\Hold.ico"
-IDI_ACTION_DROP ICON DISCARDABLE "res\\Drop.ico"
-IDI_MAIN ICON DISCARDABLE "res\\Main.ico"
-IDI_CALLING ICON DISCARDABLE "res\\Calling.ico"
-IDI_DIALPAD ICON DISCARDABLE "res\\dialpad.ico"
-IDI_SMALLDOT ICON DISCARDABLE "res/smalldot.ico"
-IDI_SECURE ICON DISCARDABLE "res\\secure.ico"
-#endif // English (U.S.) resources
+IDI_TALKING ICON "Talking.ico"
+
+IDI_RINGING ICON "Rinning.ico"
+
+IDI_ENDED ICON "ended.ico"
+
+IDI_BUSY ICON "Busy.ico"
+
+IDI_ON_HOLD ICON "On hold.ico"
+
+IDI_ACTION_CALL ICON "Call.ico"
+
+IDI_ACTION_ANSWER ICON "Answer.ico"
+
+IDI_ACTION_HOLD ICON "Hold.ico"
+
+IDI_ACTION_DROP ICON "Drop.ico"
+
+IDI_MAIN ICON "Main.ico"
+
+IDI_CALLING ICON "Calling.ico"
+
+IDI_DIALPAD ICON "dialpad.ico"
+
+IDI_SMALLDOT ICON "smalldot.ico"
+
+IDI_SECURE ICON "secure.ico"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AFX_DIALOG_LAYOUT
+//
+
+IDD_OPT_AUTO AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+IDD_VOICECALL AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
@@ -265,10 +272,8 @@ IDI_SECURE ICON DISCARDABLE "res\\secure.ico"
// Portuguese (Brazil) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PTB)
-#ifdef _WIN32
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -276,18 +281,18 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
// TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE
BEGIN
- "resource.h\0"
+ "..\\src\\resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE
BEGIN
- "#include ""afxres.h""\r\n"
+ "#include ""winres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
diff --git a/plugins/VoiceService/src/frame.cpp b/plugins/VoiceService/src/frame.cpp
deleted file mode 100644
index 79b2d9b35a..0000000000
--- a/plugins/VoiceService/src/frame.cpp
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
-Copyright (C) 2005 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-#define H_SPACE 2
-
-// Prototypes /////////////////////////////////////////////////////////////////////////////////////
-
-int frame_id = -1;
-
-// Functions //////////////////////////////////////////////////////////////////////////////////////
-
-static int GetMaxLineHeight()
-{
- return max(ICON_SIZE, font_max_height) + 1;
-}
-
-BOOL FrameIsFloating(int id)
-{
- if (id == -1)
- return TRUE; // no frames, always floating
-
- return CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLOATING, id), 0);
-}
-
-void ResizeFrame(int id, HWND hwnd)
-{
- int height = calls.getCount() * GetMaxLineHeight();
- if (height > 0)
- height += 2;
-
- if (CanCallNumber()) {
- height += 23 + 2;
-
- if (SendMessage(GetDlgItem(hwnd, IDC_DIALPAD), BM_GETCHECK, 0, 0) == BST_CHECKED) {
- RECT first, last;
- GetWindowRect(GetDlgItem(hwnd, IDC_1), &first);
- GetWindowRect(GetDlgItem(hwnd, IDC_SHARP), &last);
-
- height += last.bottom - first.top + 1;
- }
- }
-
- if (FrameIsFloating(id)) {
- HWND parent = GetParent(hwnd);
- if (parent == NULL)
- return;
-
- RECT r_client;
- GetClientRect(hwnd, &r_client);
-
- if (r_client.bottom - r_client.top == height)
- return;
-
- RECT parent_client, parent_window, r_window;
- GetClientRect(parent, &parent_client);
- GetWindowRect(parent, &parent_window);
- GetWindowRect(hwnd, &r_window);
-
- int diff = (parent_window.bottom - parent_window.top) - (parent_client.bottom - parent_client.top);
- if (g_plugin.bFramesExist)
- diff += (r_window.top - parent_window.top);
-
- SetWindowPos(parent, 0, 0, 0, parent_window.right - parent_window.left, height + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
- }
- else {
- int old_height = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, id), 0);
- if (old_height == height)
- return;
-
- CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, id), (LPARAM)height);
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)id, (LPARAM)(FU_TBREDRAW | FU_FMREDRAW | FU_FMPOS));
- }
-}
-
-static void ShowFrame(int id, HWND hwnd, int show)
-{
- if (!g_plugin.bFramesExist || id == -1) {
- ShowWindow(GetParent(hwnd), show);
- return;
- }
-
- BOOL bIsVisible = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id)) & F_VISIBLE;
- if ((bIsVisible && show == SW_HIDE) || (!bIsVisible && show == SW_SHOW))
- CallService(MS_CLIST_FRAMES_SHFRAME, id, 0);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static int dialCtrls[] = {
- IDC_DIALPAD, IDC_NUMBER, IDC_CALL,
- IDC_1, IDC_2, IDC_3,
- IDC_4, IDC_5, IDC_6,
- IDC_7, IDC_8, IDC_9,
- IDC_AST, IDC_0, IDC_SHARP
-};
-
-static wchar_t *lstrtrim(wchar_t *str)
-{
- int len = lstrlen(str);
-
- int i;
- for (i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i);
- if (i < len - 1) {
- ++i;
- str[i] = _T('\0');
- len = i;
- }
-
- for (i = 0; i < len && (str[i] == ' ' || str[i] == '\t'); ++i);
- if (i > 0)
- memmove(str, &str[i], (len - i + 1) * sizeof(wchar_t));
-
- return str;
-}
-
-static void InvalidateAll(HWND hwnd)
-{
- InvalidateRect(GetDlgItem(hwnd, IDC_CALLS), NULL, FALSE);
- for (auto &it : dialCtrls)
- InvalidateRect(GetDlgItem(hwnd, it), NULL, FALSE);
- InvalidateRect(hwnd, NULL, FALSE);
-
- if (frame_id != -1)
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)frame_id, (LPARAM)(FU_FMREDRAW));
-}
-
-static int sttCompareProvidesByDescription(const VoiceProvider *p1, const VoiceProvider *p2)
-{
- return lstrcmp(p2->description, p1->description);
-}
-
-static void DrawIconLib(HDC hDC, const RECT &rc, int iconId)
-{
- HICON hIcon = g_plugin.getIcon(iconId);
- if (hIcon == NULL)
- return;
-
- DrawIconEx(hDC, rc.left, (rc.top + rc.bottom - ICON_SIZE) / 2, hIcon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
-}
-
-class CFrameDlg : public CDlgBase
-{
- CCtrlEdit edtNumber;
- CCtrlListBox m_calls;
- CCtrlMButton btnDialpad, btnCall;
-
- void ResizeFrame(bool bResizeAll)
- {
- ShowHideDialpad(0);
-
- if (bResizeAll)
- SendMessage(m_hwnd, WM_SIZE, 0, 0);
-
- if (opts.resize_frame) {
- if (calls.getCount() == 0 && !CanCallNumber()) {
- ShowFrame(frame_id, m_hwnd, SW_HIDE);
- }
- else {
- ::ResizeFrame(frame_id, m_hwnd);
- ShowFrame(frame_id, m_hwnd, SW_SHOW);
- }
- }
- }
-
- void ShowHideDialpad(CCtrlEdit *)
- {
- SendMessage(m_hwnd, WM_SETREDRAW, FALSE, 0);
-
- if (!CanCallNumber()) {
- for (auto &it : dialCtrls)
- ShowWindow(GetDlgItem(m_hwnd, it), SW_HIDE);
- }
- else {
- for (int i = 0; i < 3; ++i)
- ShowWindow(GetDlgItem(m_hwnd, dialCtrls[i]), SW_SHOW);
-
- bool showDialpad = (SendMessage(GetDlgItem(m_hwnd, IDC_DIALPAD), BM_GETCHECK, 0, 0) == BST_CHECKED);
-
- for (int i = 3; i < _countof(dialCtrls); ++i)
- ShowWindow(GetDlgItem(m_hwnd, dialCtrls[i]), showDialpad ? SW_SHOW : SW_HIDE);
-
- VoiceCall *talking = NULL;
- bool ringing = false;
- bool calling = false;
- for (auto &call : calls) {
- if (call->state == VOICE_STATE_TALKING)
- talking = call;
- else if (call->state == VOICE_STATE_CALLING)
- calling = true;
- else if (call->state == VOICE_STATE_RINGING)
- ringing = true;
- }
-
- wchar_t number[1024];
- GetDlgItemText(m_hwnd, IDC_NUMBER, number, _countof(number));
- lstrtrim(number);
-
- if (ringing && number[0] != 0) {
- SetWindowText(GetDlgItem(m_hwnd, IDC_NUMBER), _T(""));
- number[0] = 0;
- }
-
- if (ringing || calling) {
- for (auto &it : dialCtrls)
- EnableWindow(GetDlgItem(m_hwnd, it), FALSE);
- }
- else if (talking) {
- if (!showDialpad || !talking->CanSendDTMF()) {
- for (auto &it : dialCtrls)
- EnableWindow(GetDlgItem(m_hwnd, it), FALSE);
-
- EnableWindow(GetDlgItem(m_hwnd, IDC_DIALPAD), TRUE);
- }
- else {
- for (auto &it : dialCtrls)
- EnableWindow(GetDlgItem(m_hwnd, it), TRUE);
-
- EnableWindow(GetDlgItem(m_hwnd, IDC_NUMBER), FALSE);
- EnableWindow(GetDlgItem(m_hwnd, IDC_CALL), FALSE);
- }
- }
- else {
- for (auto &it : dialCtrls)
- EnableWindow(GetDlgItem(m_hwnd, it), TRUE);
-
- EnableWindow(GetDlgItem(m_hwnd, IDC_CALL), CanCall(number));
- }
- }
-
- SendMessage(m_hwnd, WM_SETREDRAW, TRUE, 0);
-
- InvalidateAll(m_hwnd);
- }
-
-public:
- CFrameDlg() :
- CDlgBase(g_plugin, IDD_CALLS),
- m_calls(this, IDC_CALLS),
- edtNumber(this, IDC_NUMBER),
- btnCall(this, IDC_CALL, g_plugin.getIcon(IDI_ACTION_CALL), "Make call"),
- btnDialpad(this, IDC_DIALPAD, g_plugin.getIcon(IDI_DIALPAD), LPGEN("Show dialpad"))
- {
- SetParent(g_clistApi.hwndContactList);
-
- btnCall.OnClick = Callback(this, &CFrameDlg::onClick_Call);
- btnDialpad.OnClick = Callback(this, &CFrameDlg::onClick_DialPad);
-
- edtNumber.OnChange = Callback(this, &CFrameDlg::ShowHideDialpad);
-
- m_calls.OnSelChange = Callback(this, &CFrameDlg::onSelChange_Calls);
- }
-
- bool OnInitDialog() override
- {
- btnCall.MakeFlat();
- btnDialpad.MakePush();
-
- ResizeFrame(true);
- return true;
- }
-
- void OnResize() override
- {
- SendMessage(m_hwnd, WM_SETREDRAW, FALSE, 0);
-
- RECT rc;
- GetClientRect(m_hwnd, &rc);
-
- int width = rc.right - rc.left;
- int height = rc.bottom - rc.top;
-
- if (CanCallNumber()) {
- bool showDialpad = btnDialpad.IsPushed();
-
- GetWindowRect(m_hwnd, &rc);
-
- RECT first = { 0 }, last = { 0 };
- GetWindowRect(GetDlgItem(m_hwnd, IDC_1), &first);
- GetWindowRect(GetDlgItem(m_hwnd, IDC_SHARP), &last);
-
- int dialpad_height = last.bottom - first.top;
- int dialpad_width = last.right - first.left;
-
-
- int call_height = 23;
- int call_width = 25;
- int top = height - call_height - 1;
-
- if (showDialpad)
- top -= dialpad_height + 1;
-
- MoveWindow(btnDialpad.GetHwnd(), 1, top, call_width - 2, call_height, FALSE);
- MoveWindow(GetDlgItem(m_hwnd, IDC_NUMBER), call_width, top, width - 2 * call_width, call_height, FALSE);
- MoveWindow(btnCall.GetHwnd(), width - call_width, top, call_width, call_height + 1, FALSE);
-
- int dialpad_top = top + call_height + 1;
- int dialpad_left = ((rc.right - rc.left) - dialpad_width) / 2;
- int deltaX = dialpad_left - first.left;
- int deltaY = dialpad_top - first.top;
- for (int i = 3; i < _countof(dialCtrls); ++i) {
- GetWindowRect(GetDlgItem(m_hwnd, dialCtrls[i]), &rc);
- MoveWindow(GetDlgItem(m_hwnd, dialCtrls[i]), rc.left + deltaX, rc.top + deltaY, rc.right - rc.left, rc.bottom - rc.top, FALSE);
- }
-
- height -= call_height + 2;
- if (showDialpad)
- height -= dialpad_height + 1;
- }
-
- if (height <= 2) {
- m_calls.Hide();
- }
- else {
- MoveWindow(m_calls.GetHwnd(), 1, 1, width - 2, height - 2, FALSE);
- m_calls.Show();
- }
-
- SendMessage(m_hwnd, WM_SETREDRAW, TRUE, 0);
- InvalidateAll(m_hwnd);
- }
-
- void onClick_DialPad(CCtrlMButton *)
- {
- ShowHideDialpad(0);
- ResizeFrame(false);
- }
-
- void onClick_Call(CCtrlMButton *)
- {
- wchar_t number[1024];
- GetDlgItemText(m_hwnd, IDC_NUMBER, number, _countof(number));
- lstrtrim(number);
-
- LIST<VoiceProvider> candidates(10, &sttCompareProvidesByDescription);
-
- for (auto &it: modules) {
- if (!it->CanCall(number))
- continue;
-
- candidates.insert(it);
- }
-
- if (candidates.getCount() < 1)
- return;
-
- int selected;
- if (candidates.getCount() == 1) {
- selected = 0;
- }
- else {
- HMENU menu = CreatePopupMenu();
-
- for (int i = 0; i < candidates.getCount(); ++i) {
- wchar_t text[1024];
- mir_snwprintf(text, _countof(text), TranslateT("Call with %s"), candidates[i]->description);
-
- MENUITEMINFO mii = { 0 };
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_ID | MIIM_TYPE;
- mii.fType = MFT_STRING;
- mii.dwTypeData = text;
- mii.cch = lstrlen(text);
- mii.wID = i + 1;
-
- // TODO: Add icon to menu
-
- InsertMenuItem(menu, 0, TRUE, &mii);
- }
-
- RECT rc;
- GetWindowRect(GetDlgItem(m_hwnd, IDC_CALL), &rc);
-
- POINT p;
- p.x = rc.right;
- p.y = rc.bottom + 1;
-
- selected = TrackPopupMenu(menu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_RIGHTALIGN, p.x, p.y, 0, m_hwnd, 0);
-
- DestroyMenu(menu);
-
- if (selected == 0)
- return;
-
- selected--;
- }
-
- candidates[selected]->Call(0, number);
- }
-
- void onChange_Dialpad(CCtrlCheck *pCheck)
- {
- wchar_t text[2];
- switch (pCheck->GetCtrlId()) {
- case IDC_1: text[0] = _T('1'); break;
- case IDC_2: text[0] = _T('2'); break;
- case IDC_3: text[0] = _T('3'); break;
- case IDC_4: text[0] = _T('4'); break;
- case IDC_5: text[0] = _T('5'); break;
- case IDC_6: text[0] = _T('6'); break;
- case IDC_7: text[0] = _T('7'); break;
- case IDC_8: text[0] = _T('8'); break;
- case IDC_9: text[0] = _T('9'); break;
- case IDC_AST: text[0] = _T('*'); break;
- case IDC_0: text[0] = _T('0'); break;
- case IDC_SHARP: text[0] = _T('#'); break;
- }
- text[1] = 0;
-
- Skin_PlaySound("voice_dialpad");
-
- VoiceCall *call = GetTalkingCall();
- if (call == NULL) {
- SendMessage(GetDlgItem(m_hwnd, IDC_NUMBER), EM_REPLACESEL, TRUE, (LPARAM)text);
- }
- else {
- wchar_t tmp[1024];
-
- GetWindowText(GetDlgItem(m_hwnd, IDC_NUMBER), tmp, _countof(tmp));
-
- tmp[_countof(tmp) - 2] = 0;
- lstrcat(tmp, text);
-
- SetWindowText(GetDlgItem(m_hwnd, IDC_NUMBER), tmp);
-
- call->SendDTMF(text[0]);
- }
- }
-
- void onSelChange_Calls(CCtrlListBox*)
- {
- int pos = m_calls.GetCurSel();
- if (pos == LB_ERR)
- return;
-
- POINT p;
- GetCursorPos(&p);
- ScreenToClient(m_calls.GetHwnd(), &p);
-
- int ret = m_calls.SendMsg(LB_ITEMFROMPOINT, 0, MAKELONG(p.x, p.y));
- if (HIWORD(ret))
- return;
- if (pos != LOWORD(ret))
- return;
-
- RECT rc;
- m_calls.GetItemRect(pos, &rc);
- int x = rc.right - p.x;
-
- int action;
- if (x >= H_SPACE && x <= ICON_SIZE + H_SPACE)
- action = 2;
- else if (x >= ICON_SIZE + 2 * H_SPACE && x <= 2 * (ICON_SIZE + H_SPACE))
- action = 1;
- else
- return;
-
- VoiceCall *call = (VoiceCall *)m_calls.GetItemData(pos);
- switch (call->state) {
- case VOICE_STATE_TALKING:
- if (action == 1)
- call->Hold();
- else
- call->Drop();
- break;
-
- case VOICE_STATE_RINGING:
- case VOICE_STATE_ON_HOLD:
- if (action == 1)
- Answer(call);
- else
- call->Drop();
- break;
-
- case VOICE_STATE_CALLING:
- if (action == 2)
- call->Drop();
- break;
- }
- }
-
- void onMenu_Calls(CContextMenuPos *pPos)
- {
- int pos = pPos->iCurr;
- if (pos >= calls.getCount())
- return;
-
- if (IsFinalState(calls[pos].state))
- return;
-
- // Just to get things strait
- m_calls.SetCurSel(pos);
-
- HMENU menu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENUS));
- HMENU submenu = GetSubMenu(menu, 0);
- TranslateMenu(submenu);
-
- switch (calls[pos].state) {
- case VOICE_STATE_CALLING:
- DeleteMenu(menu, ID_FRAMEPOPUP_ANSWERCALL, MF_BYCOMMAND);
- DeleteMenu(menu, ID_FRAMEPOPUP_HOLDCALL, MF_BYCOMMAND);
- break;
-
- case VOICE_STATE_TALKING:
- DeleteMenu(menu, ID_FRAMEPOPUP_ANSWERCALL, MF_BYCOMMAND);
- if (!calls[pos].module->CanHold())
- DeleteMenu(menu, ID_FRAMEPOPUP_HOLDCALL, MF_BYCOMMAND);
- break;
- }
-
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pPos->pt.x, pPos->pt.y, 0, m_hwnd, NULL);
- DestroyMenu(menu);
-
- switch (ret) {
- case ID_FRAMEPOPUP_DROPCALL:
- calls[pos].Drop();
- break;
-
- case ID_FRAMEPOPUP_ANSWERCALL:
- Answer(&calls[pos]);
- break;
-
- case ID_FRAMEPOPUP_HOLDCALL:
- calls[pos].Hold();
- break;
- }
- }
-
- INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
- {
- switch (msg) {
- case WM_MEASUREITEM:
- {
- LPMEASUREITEMSTRUCT mis = (LPMEASUREITEMSTRUCT)lParam;
- if (mis->CtlID != IDC_CALLS)
- break;
-
- mis->itemHeight = GetMaxLineHeight();
- }
- return TRUE;
-
- case WM_CTLCOLORLISTBOX:
- return (LRESULT)bk_brush;
-
- case WM_DRAWITEM:
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
- if (dis->CtlID != IDC_CALLS || dis->itemID == -1)
- break;
-
- VoiceCall *call = (VoiceCall *)dis->itemData;
- if (call == NULL)
- break;
-
- RECT rc = dis->rcItem;
-
- FillRect(dis->hDC, &rc, bk_brush);
-
- rc.left += H_SPACE;
- rc.right -= H_SPACE;
- rc.bottom--;
-
- int old_bk_mode = SetBkMode(dis->hDC, TRANSPARENT);
-
- // Draw status
- DrawIconLib(dis->hDC, rc, IDI_TALKING + call->state);
-
- if (call->secure)
- DrawIconLib(dis->hDC, rc, IDI_SECURE);
-
- // Draw voice provider icon
- rc.left += ICON_SIZE + H_SPACE;
-
- HICON hIcon = call->module->GetIcon();
- if (hIcon != NULL) {
- DrawIconEx(dis->hDC, rc.left, (rc.top + rc.bottom - ICON_SIZE) / 2, hIcon, ICON_SIZE, ICON_SIZE, 0, NULL, DI_NORMAL);
- call->module->ReleaseIcon(hIcon);
- }
-
- // Draw contact
- rc.left += ICON_SIZE + H_SPACE;
-
- int numIcons = 0;
- switch (call->state) {
- case VOICE_STATE_CALLING:
- numIcons = 1;
- break;
-
- case VOICE_STATE_TALKING:
- if (call->module->CanHold())
- numIcons = 2;
- else
- numIcons = 1;
- break;
-
- case VOICE_STATE_RINGING:
- case VOICE_STATE_ON_HOLD:
- numIcons = 2;
- break;
- }
-
- rc.right -= numIcons * (ICON_SIZE + H_SPACE);
-
- HFONT old_font = (HFONT)SelectObject(dis->hDC, fonts[call->state]);
- COLORREF old_color = SetTextColor(dis->hDC, font_colors[call->state]);
-
- DrawText(dis->hDC, call->displayName, -1, &rc, DT_SINGLELINE | DT_NOPREFIX | DT_END_ELLIPSIS | DT_VCENTER);
-
- SelectObject(dis->hDC, old_font);
- SetTextColor(dis->hDC, old_color);
-
- // Draw action icons
- rc = dis->rcItem;
- rc.right -= H_SPACE;
- rc.bottom--;
-
- switch (call->state) {
- case VOICE_STATE_CALLING:
- rc.left = rc.right - ICON_SIZE;
- DrawIconLib(dis->hDC, rc, IDI_ACTION_DROP);
- break;
-
- case VOICE_STATE_TALKING:
- rc.left = rc.right - ICON_SIZE;
- DrawIconLib(dis->hDC, rc, IDI_ACTION_DROP);
-
- if (call->module->CanHold()) {
- rc.right -= ICON_SIZE + H_SPACE;
- rc.left = rc.right - ICON_SIZE;
- DrawIconLib(dis->hDC, rc, IDI_ACTION_HOLD);
- }
- break;
-
- case VOICE_STATE_RINGING:
- case VOICE_STATE_ON_HOLD:
- rc.left = rc.right - ICON_SIZE;
- DrawIconLib(dis->hDC, rc, IDI_ACTION_DROP);
-
- rc.right -= ICON_SIZE + H_SPACE;
- rc.left = rc.right - ICON_SIZE;
- DrawIconLib(dis->hDC, rc, IDI_ACTION_ANSWER);
- break;
- }
-
- SetBkMode(dis->hDC, old_bk_mode);
- return TRUE;
- }
-
- return CDlgBase::DlgProc(msg, wParam, lParam);
- }
-
- void Refresh()
- {
- if (m_calls.GetCount() == calls.getCount())
- return;
-
- m_calls.SendMsg(WM_SETREDRAW, FALSE, 0);
- m_calls.ResetContent();
-
- for (auto &call : calls) {
- wchar_t text[512];
- mir_snwprintf(text, _countof(text), _T("%d %s"), call->state, call->displayName);
- m_calls.AddString(text, (LPARAM)call);
- }
-
- m_calls.SendMsg(WM_SETREDRAW, TRUE, 0);
- ResizeFrame(false);
- }
-};
-
-// Module entry point /////////////////////////////////////////////////////////////////////////////
-
-static CFrameDlg *pDialog = nullptr;
-
-void InitFrames()
-{
- if (g_plugin.bFramesExist) {
- pDialog = new CFrameDlg();
-
- CLISTFrame Frame = {};
- Frame.cbSize = sizeof(CLISTFrame);
- Frame.szName.w = TranslateT("Voice Calls");
- Frame.hWnd = pDialog->GetHwnd();
- Frame.height = ICON_SIZE;
- Frame.align = alBottom;
- Frame.Flags = F_NOBORDER | F_LOCKED | F_UNICODE;
- Frame.hIcon = g_plugin.getIcon(IDI_MAIN, true);
- frame_id = g_plugin.addFrame(&Frame);
-
- ShowFrame(frame_id, pDialog->GetHwnd(), SW_HIDE);
- }
-}
-
-void RefreshFrame()
-{
- if (pDialog)
- pDialog->Refresh();
-}
-
-void DeInitFrames()
-{
- if (g_plugin.bFramesExist && frame_id != -1)
- CallService(MS_CLIST_FRAMES_REMOVEFRAME, frame_id, 0);
-
- if (pDialog)
- pDialog->Close();
-}
diff --git a/plugins/VoiceService/src/frame.h b/plugins/VoiceService/src/frame.h
deleted file mode 100644
index d5850f484e..0000000000
--- a/plugins/VoiceService/src/frame.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-Copyright (C) 2006 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-
-#ifndef __FRAME_H__
-# define __FRAME_H__
-
-void InitFrames();
-void DeInitFrames();
-
-void RefreshFrame();
-
-#endif // __FRAME_H__ \ No newline at end of file
diff --git a/plugins/VoiceService/src/options.cpp b/plugins/VoiceService/src/options.cpp
index 9cec44611d..3de9ffc247 100644
--- a/plugins/VoiceService/src/options.cpp
+++ b/plugins/VoiceService/src/options.cpp
@@ -29,15 +29,8 @@ HANDLE hOptHook = NULL;
Options opts;
-static OptPageControl optionsControls[] =
-{
- { &opts.resize_frame, CONTROL_CHECKBOX, IDC_FRAME_AUTOSIZE, "FrameAutoSize", TRUE }
-};
-
-static OptPageControl devicesControls[] = {
- { NULL, CONTROL_CHECKBOX, IDC_ECHO, "EchoCancelation", TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_MIC_BOOST, "MicBoost", TRUE },
-};
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup options
static OptPageControl popupsControls[] = {
{ &opts.popup_enable, CONTROL_CHECKBOX, IDC_POPUPS, "PopupsEnable", FALSE },
@@ -53,13 +46,6 @@ static OptPageControl popupsControls[] = {
{ &opts.popup_left_click_action, CONTROL_COMBO, IDC_LEFT_ACTION, "PopupsLeftClick", POPUP_ACTION_CLOSEPOPUP }
};
-// Functions //////////////////////////////////////////////////////////////////////////////////////
-
-static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- return SaveOptsDlgProc(optionsControls, _countof(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
-}
-
static void PopupsEnableDisableCtrls(HWND hwndDlg)
{
BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_POPUPS);
@@ -84,13 +70,10 @@ static void PopupsEnableDisableCtrls(HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg, IDC_TEXTCOLOR), enabled &&
!IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) &&
!IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULTCOLORS), enabled &&
- !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_WINCOLORS), enabled &&
- !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULTCOLORS), enabled && !IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_WINCOLORS), enabled && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), enabled &&
- IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), enabled && IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM));
}
static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -155,248 +138,202 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
return SaveOptsDlgProc(popupsControls, _countof(popupsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
}
-static void SetAllContactIcons(HWND hwndList)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int ImageList_AddIcon_NotShared(HIMAGELIST hIml, int iconId)
{
- for (auto &cc : Contacts()) {
- HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)cc, 0);
- if (hItem) {
- // Some Module can handle it?
- if (!CanCall(cc, FALSE)) {
- SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
- }
- else {
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, g_plugin.getWord(cc, "AutoAccept", AUTO_NOTHING) == AUTO_ACCEPT ? 1 : 0));
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, g_plugin.getWord(cc, "AutoAccept", AUTO_NOTHING) == AUTO_DROP ? 2 : 0));
- }
- }
- }
+ HICON hIcon = g_plugin.getIcon(iconId);
+ int res = ImageList_AddIcon(hIml, hIcon);
+ IcoLib_ReleaseIcon(hIcon);
+ return res;
}
-
-static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
+class CAutoOptsDlg : public CDlgBase
{
- int typeOfFirst;
- int iconOn[2] = { 1,1 };
- int childCount[2] = { 0,0 }, i;
- int iImage;
- HANDLE hItem, hChildItem;
-
- typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- //check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem) {
- hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for (i = 0; i < _countof(iconOn); i++)
- if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i] = 0;
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
+ void ResetListOptions(CCtrlClc* = 0)
+ {
+ m_clist.SetBkColor(GetSysColor(COLOR_WINDOW));
}
- //check contacts
- if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while (hItem) {
- for (i = 0; i < _countof(iconOn); i++) {
- iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
- if (iconOn[i] && iImage == 0) iconOn[i] = 0;
- if (iImage != 0xFF) childCount[i]++;
+
+ void SetAllContactIcons()
+ {
+ for (auto &cc : Contacts()) {
+ HANDLE hItem = m_clist.FindContact(cc);
+ if (hItem) {
+ // Some Module can handle it?
+ if (!CanCall(cc, FALSE))
+ m_clist.DeleteItem(hItem);
+ else
+ m_clist.SetExtraImage(hItem, 0, g_plugin.getWord(cc, "AutoAccept"));
+ }
}
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
- //set icons
- if (hParentItem != NULL) {
- for (i = 0; i < _countof(iconOn); i++) {
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i] ? (iconOn[i] ? i + 1 : 0) : 0xFF));
- if (groupChildCount) groupChildCount[i] += childCount[i];
+
+ void SetListGroupIcons(HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
+ {
+ int iconOn[2] = { 1,1 };
+ int childCount[2] = { 0,0 };
+
+ int typeOfFirst = m_clist.GetItemType(hFirstItem);
+
+ // check groups
+ HANDLE hItem;
+ if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
+ else hItem = m_clist.GetNextItem(hFirstItem, CLGN_NEXTGROUP);
+ while (hItem) {
+ HANDLE hChildItem = m_clist.GetNextItem(hItem, CLGN_CHILD);
+ if (hChildItem) SetListGroupIcons(hChildItem, hItem, childCount);
+ for (int i = 0; i < _countof(iconOn); i++)
+ if (iconOn[i] && m_clist.GetExtraImage(hItem, i) == 0)
+ iconOn[i] = 0;
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTGROUP);
+ }
+
+ // check contacts
+ if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
+ else hItem = m_clist.GetNextItem(hFirstItem, CLGN_NEXTCONTACT);
+ while (hItem) {
+ for (int i = 0; i < _countof(iconOn); i++) {
+ int iImage = m_clist.GetExtraImage(hItem, i);
+ if (iconOn[i] && iImage == 0)
+ iconOn[i] = 0;
+ if (iImage != 0xFF) childCount[i]++;
+ }
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTCONTACT);
+ }
+
+ // set icons
+ if (hParentItem != NULL) {
+ for (int i = 0; i < _countof(iconOn); i++) {
+ m_clist.GetExtraImage(hParentItem, MAKELPARAM(i, childCount[i] ? (iconOn[i] ? i + 1 : 0) : 0xFF));
+ if (groupChildCount)
+ groupChildCount[i] += childCount[i];
+ }
}
}
-}
+ void SetAllChildIcons(HANDLE hFirstItem, int iColumn, int iImage)
+ {
+ HANDLE hItem;
-static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage)
-{
- int typeOfFirst, iOldIcon;
- HANDLE hItem, hChildItem;
-
- typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- //check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem) {
- hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem) SetAllChildIcons(hwndList, hChildItem, iColumn, iImage);
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
+ int typeOfFirst = m_clist.GetItemType(hFirstItem);
+
+ // check groups
+ if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
+ else hItem = m_clist.GetNextItem(hFirstItem, CLGN_NEXTGROUP);
+ while (hItem) {
+ HANDLE hChildItem = m_clist.GetNextItem(hItem, CLGN_CHILD);
+ if (hChildItem)
+ SetAllChildIcons(hChildItem, iColumn, iImage);
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTGROUP);
+ }
+
+ // check contacts
+ if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
+ else hItem = m_clist.GetNextItem(hFirstItem, CLGN_NEXTCONTACT);
+ while (hItem) {
+ int iOldIcon = m_clist.GetExtraImage(hItem, iColumn);
+ if (iOldIcon != 0xFF && iOldIcon != iImage)
+ m_clist.SetExtraImage(hItem, iColumn, iImage);
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTCONTACT);
+ }
}
- //check contacts
- if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while (hItem) {
- iOldIcon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
- if (iOldIcon != 0xFF && iOldIcon != iImage) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage));
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
+
+ CCtrlClc m_clist;
+ HICON hAnswerIcon, hDropIcon;
+
+public:
+ CAutoOptsDlg() :
+ CDlgBase(g_plugin, IDD_OPT_AUTO),
+ m_clist(this, IDC_LIST)
+ {
+ m_clist.OnClick = Callback(this, &CAutoOptsDlg::onClick_List);
+ m_clist.OnNewContact = m_clist.OnListRebuilt = Callback(this, &CAutoOptsDlg::onListRebuilt);
+ m_clist.OnOptionsChanged = Callback(this, &CAutoOptsDlg::ResetListOptions);
}
-}
+ bool OnInitDialog() override
+ {
+ HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3, 3);
+ ImageList_AddIcon(hIml, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
+ ImageList_AddIcon_NotShared(hIml, IDI_ACTION_ANSWER);
+ ImageList_AddIcon_NotShared(hIml, IDI_ACTION_DROP);
+ m_clist.SetExtraImageList(hIml);
-static void ResetListOptions(HWND hwndList)
-{
- SendMessage(hwndList, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0);
-}
+ hAnswerIcon = ImageList_GetIcon(hIml, 1, ILD_NORMAL);
+ SendDlgItemMessage(m_hwnd, IDC_ANSWER, STM_SETICON, (WPARAM)hAnswerIcon, 0);
+ hDropIcon = ImageList_GetIcon(hIml, 2, ILD_NORMAL);
+ SendDlgItemMessage(m_hwnd, IDC_DROP, STM_SETICON, (WPARAM)hDropIcon, 0);
-int ImageList_AddIcon_NotShared(HIMAGELIST hIml, HINSTANCE hInstance, LPCTSTR szResource)
-{
- HICON hIcon = LoadIcon(hInstance, szResource);
- int res = ImageList_AddIcon(hIml, hIcon);
- DestroyIcon(hIcon);
- return res;
-}
+ ResetListOptions();
+ m_clist.SetExtraColumns(1);
+ onListRebuilt(0);
+ return true;
+ }
-int ImageList_AddIcon_NotShared(HIMAGELIST hIml, int iconId)
-{
- HICON hIcon = g_plugin.getIcon(iconId);
- int res = ImageList_AddIcon(hIml, hIcon);
- IcoLib_ReleaseIcon(hIcon);
- return res;
-}
-
-
-static INT_PTR CALLBACK AutoDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
-{
- static HICON hAnswerIcon, hDropIcon;
-
- switch (msg) {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3, 3);
-
- ImageList_AddIcon_NotShared(hIml, GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SMALLDOT));
- ImageList_AddIcon_NotShared(hIml, IDI_ACTION_ANSWER);
- ImageList_AddIcon_NotShared(hIml, IDI_ACTION_DROP);
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
-
- hAnswerIcon = ImageList_GetIcon(hIml, 1, ILD_NORMAL);
- SendDlgItemMessage(hwndDlg, IDC_ANSWER, STM_SETICON, (WPARAM)hAnswerIcon, 0);
+ bool OnApply() override
+ {
+ for (auto &cc : Contacts()) {
+ HANDLE hItem = m_clist.FindContact(cc);
+ if (hItem)
+ g_plugin.setWord(cc, "AutoAccept", m_clist.GetExtraImage(hItem, 0));
+ }
+ return true;
+ }
- hDropIcon = ImageList_GetIcon(hIml, 2, ILD_NORMAL);
- SendDlgItemMessage(hwndDlg, IDC_DROP, STM_SETICON, (WPARAM)hDropIcon, 0);
+ void OnDestroy() override
+ {
+ DestroyIcon(hAnswerIcon);
+ DestroyIcon(hDropIcon);
+ ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(m_hwnd, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0));
+ }
- ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, 2, 0);
+ void onListRebuilt(CCtrlClc *)
+ {
+ SetAllContactIcons();
+ SetListGroupIcons(m_clist.GetNextItem(0, CLGN_ROOT), 0, 0);
+ }
- SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), NULL, NULL);
- return TRUE;
+ void onClick_List(CCtrlClc::TEventInfo *pInfo)
+ {
+ // Make sure we have an extra column
+ NMCLISTCONTROL *nm = pInfo->info;
+ if (nm->iColumn == -1)
+ return;
+
+ // Find clicked item
+ uint32_t hitFlags = 0;
+ HANDLE hItem = m_clist.HitTest(nm->pt.x, nm->pt.y, &hitFlags);
+ if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ return;
+
+ // Get image in clicked column (0=none, 1=visible, 2=invisible)
+ int iImage = m_clist.GetExtraImage(hItem, nm->iColumn);
+ if (iImage == 2)
+ iImage = 0;
+ else
+ iImage++;
+
+ // Get item type (contact, group, etc...)
+ int itemType = m_clist.GetItemType(hItem);
+
+ // Update list, making sure that the options are mutually exclusive
+ if (itemType == CLCIT_CONTACT) { // A contact
+ m_clist.SetExtraImage(hItem, nm->iColumn, iImage);
}
- case WM_SETFOCUS:
- SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_LIST:
- switch (((LPNMHDR)lParam)->code) {
- case CLN_NEWCONTACT:
- case CLN_LISTREBUILT:
- SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- //fall through
-
- case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), NULL, NULL);
- break;
-
- case CLN_OPTIONSCHANGED:
- ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
- break;
-
- case NM_CLICK:
- {
- HANDLE hItem;
- NMCLISTCONTROL *nm = (NMCLISTCONTROL *)lParam;
- DWORD hitFlags;
- int iImage;
- int itemType;
-
- // Make sure we have an extra column
- if (nm->iColumn == -1)
- break;
-
- // Find clicked item
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- // Nothing was clicked
- if (hItem == NULL) break;
- // It was not a visbility icon
- if (!(hitFlags & CLCHT_ONITEMEXTRA)) break;
-
- // Get image in clicked column (0=none, 1=visible, 2=invisible)
- iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
- if (iImage == 0)
- iImage = nm->iColumn + 1;
- else
- if (iImage == 1 || iImage == 2)
- iImage = 0;
-
- // Get item type (contact, group, etc...)
- itemType = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
-
- // Update list, making sure that the options are mutually exclusive
- if (itemType == CLCIT_CONTACT) { // A contact
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
- if (iImage && SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn ? 0 : 1, 0)) != 0xFF)
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn ? 0 : 1, 0));
- }
- else if (itemType == CLCIT_GROUP) { // A group
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hItem) {
- SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
- if (iImage)
- SetAllChildIcons(GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn ? 0 : 1, 0);
- }
- }
- // Update the all/none icons
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), NULL, NULL);
-
- // Activate Apply button
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
- break;
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- for (auto &cc : Contacts()) {
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, cc, 0);
- if (hItem) {
- int set = 0;
- for (int i = 0; i < 2; i++) {
- int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (iImage == i + 1) {
- g_plugin.setWord(cc, "AutoAccept", iImage == 1 ? AUTO_ACCEPT : AUTO_DROP);
- set = 1;
- break;
- }
- }
- if (!set)
- g_plugin.setWord(cc, "AutoAccept", AUTO_NOTHING);
- }
- }
- return TRUE;
- }
- break;
+ else if (itemType == CLCIT_GROUP) { // A group
+ hItem = m_clist.GetNextItem(hItem, CLGN_CHILD);
+ if (hItem)
+ SetAllChildIcons(hItem, nm->iColumn, iImage);
}
- break;
-
-case WM_DESTROY:
- DestroyIcon(hAnswerIcon);
- DestroyIcon(hDropIcon);
- ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0));
- break;
+
+ // Update the all/none icons
+ SetListGroupIcons(m_clist.GetNextItem(0, CLGN_ROOT), 0, 0);
+ NotifyChange();
}
- return FALSE;
-}
+};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -415,15 +352,8 @@ int InitOptionsCallback(WPARAM wParam, LPARAM)
ZeroMemory(&odp, sizeof(odp));
odp.szGroup.a = LPGEN("Voice Calls");
- odp.szTitle.a = LPGEN("General");
- odp.pfnDlgProc = OptionsDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTS);
- g_plugin.addOptions(wParam, &odp);
-
- odp.szGroup.a = LPGEN("Voice Calls");
odp.szTitle.a = LPGEN("Auto actions");
- odp.pfnDlgProc = AutoDlgProc;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTO);
+ odp.pDialog = new CAutoOptsDlg();
g_plugin.addOptions(wParam, &odp);
return 0;
}
@@ -442,6 +372,5 @@ void DeInitOptions()
void LoadOptions()
{
- LoadOpts(optionsControls, _countof(optionsControls), MODULE_NAME);
LoadOpts(popupsControls, _countof(popupsControls), MODULE_NAME);
}
diff --git a/plugins/VoiceService/src/options.h b/plugins/VoiceService/src/options.h
index 4ba1131ed9..89667ed586 100644
--- a/plugins/VoiceService/src/options.h
+++ b/plugins/VoiceService/src/options.h
@@ -43,9 +43,6 @@ struct Options {
COLORREF popup_text_color;
WORD popup_left_click_action;
WORD popup_right_click_action;
-
- // Frame
- BOOL resize_frame;
};
extern Options opts;