diff options
Diffstat (limited to 'plugins/!NotAdopted/sndVol/optionsdlg.cpp')
-rw-r--r-- | plugins/!NotAdopted/sndVol/optionsdlg.cpp | 121 |
1 files changed, 90 insertions, 31 deletions
diff --git a/plugins/!NotAdopted/sndVol/optionsdlg.cpp b/plugins/!NotAdopted/sndVol/optionsdlg.cpp index 88443448c0..0b194fc046 100644 --- a/plugins/!NotAdopted/sndVol/optionsdlg.cpp +++ b/plugins/!NotAdopted/sndVol/optionsdlg.cpp @@ -7,13 +7,39 @@ #pragma comment(lib, "comctl32.lib")
+extern void SetRadioVolume(int value);
+extern COLORREF g_clrback;
+extern HBRUSH g_HBRback;
+extern int g_mRadioMuted;
+extern HWND hwndMRadio;
+extern HICON hIconMRadio, hIconMRadio_off;
+
+void LoadBackgroundSettings()
+{
+ HWND hwnd;
+
+ if(g_HBRback)
+ DeleteObject(g_HBRback);
+
+ if(DBGetContactSettingByte(NULL, SERVICENAME, "def_bg", 1))
+ g_clrback = GetSysColor(COLOR_3DFACE);
+ else
+ g_clrback = DBGetContactSettingDword(NULL, SERVICENAME, "bgc", GetSysColor(COLOR_3DFACE));
+
+ g_HBRback = CreateSolidBrush(g_clrback);
+ hwnd = GetFocus();
+ InvalidateRect(hwndSlider, NULL, TRUE);
+ SetFocus(hwndSlider);
+ RedrawWindow(hwndFrame, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE);
+ SetFocus(hwnd);
+}
LRESULT CALLBACK GroupWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch( uMsg )
{
case WM_LBUTTONDOWN:
- ::MessageBox(0,"LB","",0);
+ ::MessageBox(0,_T("LB"),_T(""),0);
return 0;
case WM_PAINT:
{
@@ -21,7 +47,7 @@ LRESULT CALLBACK GroupWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam HDC hdc = GetDC(hwnd);
RECT rc;
- char szTitle[256];
+ TCHAR szTitle[256];
HFONT oldfont;
int oldBk;
ZeroMemory(&rc, sizeof(rc));
@@ -30,7 +56,7 @@ LRESULT CALLBACK GroupWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam oldBk = SetBkMode(hdc, TRANSPARENT);
oldfont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(hwnd, WM_GETFONT, 0,0));
SetBkMode(hdc, TRANSPARENT);
- GetWindowText(hwnd, szTitle, sizeof(szTitle));
+ GetWindowText(hwnd, szTitle, sizeof(szTitle) / sizeof(TCHAR));
DrawText(hdc, szTitle, lstrlen(szTitle), &rc, DT_SINGLELINE|DT_CALCRECT);
rc.left += 8; rc.right += 8 + 16 + 4;
@@ -54,15 +80,10 @@ LRESULT CALLBACK GroupWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam return CallWindowProc((WNDPROC)GetWindowLong(hwnd, GWL_USERDATA), hwnd, uMsg, wParam, lParam);
}
-//
-// OptionsDlgProc()
-// this handles the options page
-// verwaltet die Optionsseite
-//
+
LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
- switch( uMsg )
- {
+ switch( uMsg ) {
case WM_INITDIALOG:
{
HWND grp = GetDlgItem(hwndDlg, IDC_GRP);
@@ -70,6 +91,11 @@ LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_AUTO, DBGetContactSettingByte(NULL,SERVICENAME,"AutoPreview", TRUE)?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MUTE, DBGetContactSettingByte(NULL,SERVICENAME,"MuteBtn", TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MRADIO, DBGetContactSettingByte(NULL, SERVICENAME, "mRadioAdjust", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MUTERADIO, DBGetContactSettingByte(NULL, SERVICENAME, "mRadioMute", 0) ? BST_CHECKED : BST_UNCHECKED);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MRADIO), ServiceExists(MS_RADIO_SETVOL));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MUTERADIO), ServiceExists(MS_RADIO_SETVOL));
hwndOptSlider = GetDlgItem(hwndDlg, IDC_VOLUME);
SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN,SLIDER_MAX));
@@ -77,61 +103,95 @@ LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM SetWindowLong(grp, GWL_USERDATA, GetWindowLong(grp, GWL_WNDPROC));
SetWindowLong(grp, GWL_WNDPROC, (LONG)GroupWndProc);
-
+ SendDlgItemMessage(hwndDlg, IDC_BACKCOLOR, CPM_SETCOLOUR, 0, (LPARAM)DBGetContactSettingDword(NULL, SERVICENAME, "bgc", GetSysColor(COLOR_3DFACE)));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BACKCOLOR), DBGetContactSettingByte(NULL, SERVICENAME, "def_bg", 1) ? FALSE : TRUE);
+ CheckDlgButton(hwndDlg, IDC_DEFCOLOR, DBGetContactSettingByte(NULL, SERVICENAME, "def_bg", 1));
return TRUE;
}
case WM_HSCROLL:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ {
+ int value = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
+ if(hwndSlider)
+ SendMessage(hwndSlider, TBM_SETPOS, TRUE, value);
+ else
+ DBWriteContactSettingDword(NULL, SERVICENAME, "Volume", value);
+ playSnd::SetVolume(value);
+ if(IsDlgButtonChecked(hwndDlg, IDC_AUTO))
+ SkinPlaySound("AlertMsg");
+ SetRadioVolume(value);
break;
-
+ }
case WM_COMMAND:
- if(LOWORD(wParam) == IDC_TEST)
- {
- //playSnd::g_bInOption = TRUE;
+ if(LOWORD(wParam) == IDC_TEST) {
playSnd::SetVolume((DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0));
- SkinPlaySound("RecvMsg");
- //playSnd::g_bInOption = FALSE;
+ SkinPlaySound("AlertMsg");
return FALSE;
}
+ else if(LOWORD(wParam) == IDC_MRADIO) {
+ DBWriteContactSettingByte(NULL, SERVICENAME, "mRadioAdjust", IsDlgButtonChecked(hwndDlg, IDC_MRADIO) ? 1 : 0);
+ if(IsDlgButtonChecked(hwndDlg, IDC_MRADIO) && ServiceExists(MS_RADIO_SETVOL)) {
+ int value = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
+ CallService(MS_RADIO_SETVOL, (WPARAM)value, 0);
+ }
+ }
+ else if(LOWORD(wParam) == IDC_MUTERADIO) {
+ int useSound = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
+ int value;
+ DBWriteContactSettingByte(NULL, SERVICENAME, "mRadioMute", IsDlgButtonChecked(hwndDlg, IDC_MUTERADIO) ? 1 : 0);
+ if(ServiceExists(MS_RADIO_SETVOL)) {
+ if(IsDlgButtonChecked(hwndDlg, IDC_MUTERADIO))
+ g_mRadioMuted = !useSound;
+ value = g_mRadioMuted ? 0 : (int)SendMessage(hwndSlider, TBM_GETPOS, 0, 0);
+ CallService(MS_RADIO_SETVOL, (WPARAM)value, 0);
+ DBWriteContactSettingByte(NULL, "mRadio", "Volume", (BYTE)value);
+ SendMessage(hwndMRadio, BM_SETIMAGE,IMAGE_ICON,(LPARAM)(g_mRadioMuted ? hIconMRadio_off : hIconMRadio));
+ }
+ }
+ else if(LOWORD(wParam) == IDC_DEFCOLOR) {
+ DBWriteContactSettingByte(NULL, SERVICENAME, "def_bg", IsDlgButtonChecked(hwndDlg, IDC_DEFCOLOR) ? 1 : 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BACKCOLOR), DBGetContactSettingByte(NULL, SERVICENAME, "def_bg", 1) ? FALSE : TRUE);
+ LoadBackgroundSettings();
+ }
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0,0);
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->code)
- {
+ switch(((LPNMHDR)lParam)->code) {
case NM_RELEASEDCAPTURE:
- if(IsDlgButtonChecked(hwndDlg, IDC_AUTO) == BST_CHECKED)
- {
+ if(IsDlgButtonChecked(hwndDlg, IDC_AUTO) == BST_CHECKED) {
int value = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
- if(hwndSlider) SendMessage(hwndSlider, TBM_SETPOS, TRUE, value/SLIDER_DIV);
+ if(hwndSlider)
+ SendMessage(hwndSlider, TBM_SETPOS, TRUE, value);
- //playSnd::g_bInOption = TRUE;
playSnd::SetVolume(value);
- SkinPlaySound("RecvMsg");
- //playSnd::g_bInOption = FALSE;
+ SkinPlaySound("AlertMsg");
+ SetRadioVolume(value);
}
break;
case PSN_APPLY:
{
int value = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
- if(hwndSlider) SendMessage(hwndSlider, TBM_SETPOS, TRUE, value/SLIDER_DIV);
+ if(hwndSlider)
+ SendMessage(hwndSlider, TBM_SETPOS, TRUE, value);
playSnd::SetVolume(value);
+
DBWriteContactSettingDword(NULL, SERVICENAME, "Volume", value);
autoPreview = (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_AUTO) == BST_CHECKED);
DBWriteContactSettingByte(NULL, SERVICENAME, "AutoPreview", autoPreview);
value = (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_MUTE) == BST_CHECKED);
DBWriteContactSettingByte(NULL, SERVICENAME, "MuteBtn", value);
PostMessage(hwndFrame, WM_USER, value, 0);
-
+ DBWriteContactSettingDword(NULL, SERVICENAME, "bgc", (DWORD)SendDlgItemMessage(hwndDlg, IDC_BACKCOLOR, CPM_GETCOLOUR, 0, 0));
+ LoadBackgroundSettings();
return TRUE;
}
case PSN_RESET:
{
int value = DBGetContactSettingDword(NULL,SERVICENAME,"Volume",100);
SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETPOS, TRUE, value);
- if(hwndSlider) SendMessage(hwndSlider, TBM_SETPOS, TRUE, value/SLIDER_DIV);
+ if(hwndSlider)
+ SendMessage(hwndSlider, TBM_SETPOS, TRUE, value);
playSnd::SetVolume(value);
-
return TRUE;
}
}
@@ -141,6 +201,5 @@ LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM hwndOptSlider = NULL;
return FALSE;
}
-
return FALSE;
}
|