summaryrefslogtreecommitdiff
path: root/plugins/MsgPopup/src/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MsgPopup/src/options.cpp')
-rw-r--r--plugins/MsgPopup/src/options.cpp150
1 files changed, 67 insertions, 83 deletions
diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp
index 1921fce2f6..3fe5552085 100644
--- a/plugins/MsgPopup/src/options.cpp
+++ b/plugins/MsgPopup/src/options.cpp
@@ -22,15 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
int idOptionControls[4][3] = {
- IDC_ASTERISK_FG,IDC_ASTERISK_BG,IDC_TIMEOUT1,
- IDC_ERROR_FG,IDC_ERROR_BG,IDC_TIMEOUT2,
- IDC_EXCLAMATION_FG,IDC_EXCLAMATION_BG,IDC_TIMEOUT3,
- IDC_QUESTION_FG,IDC_QUESTION_BG,IDC_TIMEOUT4
+ IDC_ASTERISK_FG, IDC_ASTERISK_BG, IDC_TIMEOUT1,
+ IDC_ERROR_FG, IDC_ERROR_BG, IDC_TIMEOUT2,
+ IDC_EXCLAMATION_FG, IDC_EXCLAMATION_BG, IDC_TIMEOUT3,
+ IDC_QUESTION_FG, IDC_QUESTION_BG, IDC_TIMEOUT4
};
-static int __inline DBWriteContactSettingDwordDef(MCONTACT hContact,const char *szModule,const char *szSetting,DWORD val, DWORD defValue)
+static int __inline DBWriteContactSettingDwordDef(MCONTACT hContact, const char *szModule, const char *szSetting, DWORD val, DWORD defValue)
{
- if(val == db_get_dw(hContact, szModule, szSetting, defValue))
+ if (val == db_get_dw(hContact, szModule, szSetting, defValue))
return 0;
else
return db_set_dw(hContact, szModule, szSetting, val);
@@ -38,96 +38,80 @@ static int __inline DBWriteContactSettingDwordDef(MCONTACT hContact,const char *
INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch (message)
- {
- case WM_INITDIALOG:
- {
- int indx;
+ switch (message) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWnd);
+ for (int indx = 0; indx < 4; indx++) {
+ SendDlgItemMessage(hWnd, idOptionControls[indx][0], CPM_SETCOLOUR, 0, options.FG[indx]);
+ SendDlgItemMessage(hWnd, idOptionControls[indx][1], CPM_SETCOLOUR, 0, options.BG[indx]);
+ SetDlgItemInt(hWnd, idOptionControls[indx][2], options.Timeout[indx], TRUE);
+ }
+ CheckDlgButton(hWnd, IDC_MESSAGEBEEP, options.Sound ? BST_CHECKED : BST_UNCHECKED);
+ return TRUE;
- TranslateDialogDefault(hWnd);
- for(indx = 0; indx < 4; indx++)
- {
- SendDlgItemMessage(hWnd, idOptionControls[indx][0], CPM_SETCOLOUR, 0, options.FG[indx]);
- SendDlgItemMessage(hWnd, idOptionControls[indx][1], CPM_SETCOLOUR, 0, options.BG[indx]);
- SetDlgItemInt(hWnd, idOptionControls[indx][2], options.Timeout[indx], TRUE);
- }
- CheckDlgButton(hWnd, IDC_MESSAGEBEEP, options.Sound?BST_CHECKED:BST_UNCHECKED);
- return TRUE;
+ case WM_COMMAND:
+ int indx, value;
+ BOOL Translated;
+ if (LOWORD(wParam) == IDC_PREVIEW) {
+ MessageBox(0, TranslateT("Message with question"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONQUESTION);
+ MessageBox(0, TranslateT("Message with exclamation"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONEXCLAMATION);
+ MessageBox(0, TranslateT("Message with error"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONSTOP);
+ MessageBox(0, TranslateT("Message with asterisk"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONASTERISK);
+
+ return FALSE;
}
- case WM_COMMAND:
- {
- int indx, value;
- BOOL Translated;
- if(LOWORD(wParam) == IDC_PREVIEW)
- {
- MessageBox(0, TranslateT("Message with question"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONQUESTION);
- MessageBox(0, TranslateT("Message with exclamation"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONEXCLAMATION);
- MessageBox(0, TranslateT("Message with error"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONSTOP);
- MessageBox(0, TranslateT("Message with asterisk"), TranslateTS(_T(SERVICENAME) _T(" - demo")), MB_ICONASTERISK);
-
- return FALSE;
- }
- if(LOWORD(wParam) == IDC_MESSAGEBEEP)
- {
- options.Sound = IsDlgButtonChecked(hWnd, IDC_MESSAGEBEEP) == BST_CHECKED;
- }
- else
- for(indx = 0; indx < 4; indx++)
- {
- if(LOWORD(wParam) == idOptionControls[indx][0])
- {
- if(HIWORD(wParam) != CPN_COLOURCHANGED) return FALSE;
+
+ if (LOWORD(wParam) == IDC_MESSAGEBEEP)
+ options.Sound = IsDlgButtonChecked(hWnd, IDC_MESSAGEBEEP) == BST_CHECKED;
+ else {
+ for (indx = 0; indx < 4; indx++) {
+ if (LOWORD(wParam) == idOptionControls[indx][0]) {
+ if (HIWORD(wParam) != CPN_COLOURCHANGED) return FALSE;
options.FG[indx] = SendDlgItemMessage(hWnd, LOWORD(wParam), CPM_GETCOLOUR, 0, 0);
}
- else
- if(LOWORD(wParam) == idOptionControls[indx][1])
- {
- if(HIWORD(wParam) != CPN_COLOURCHANGED) return FALSE;
+ else if (LOWORD(wParam) == idOptionControls[indx][1]) {
+ if (HIWORD(wParam) != CPN_COLOURCHANGED) return FALSE;
options.BG[indx] = SendDlgItemMessage(hWnd, LOWORD(wParam), CPM_GETCOLOUR, 0, 0);
}
- else
- if(LOWORD(wParam) == idOptionControls[indx][2])
- {
- if(HIWORD(wParam) != EN_CHANGE) return FALSE;
- if((HWND)lParam != GetFocus()) return FALSE;
+ else if (LOWORD(wParam) == idOptionControls[indx][2]) {
+ if (HIWORD(wParam) != EN_CHANGE) return FALSE;
+ if ((HWND)lParam != GetFocus()) return FALSE;
value = (DWORD)GetDlgItemInt(hWnd, LOWORD(wParam), &Translated, TRUE);
- if(Translated) options.Timeout[indx] = value;
+ if (Translated)
+ options.Timeout[indx] = value;
}
}
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0,0);
- break;
}
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_RESET:
- LoadConfig();
- return FALSE;
-
- case PSN_APPLY:
- {
- char szNameFG[4];
- char szNameBG[4];
- char szNameTO[4];
- int indx;
-
- for(indx = 0; indx < 4; indx++)
- {
- mir_snprintf(szNameFG, SIZEOF(szNameFG), "FG%d", indx);
- mir_snprintf(szNameBG, SIZEOF(szNameBG), "BG%d", indx);
- mir_snprintf(szNameTO, SIZEOF(szNameTO), "TO%d", indx);
-
- DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]);
- DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]);
- DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameTO, options.Timeout[indx], (DWORD)optionsDefault.Timeout[indx]);
- }
- DBWriteContactSettingDwordDef(NULL,SERVICENAME,"Sound",options.Sound,optionsDefault.Sound);
-
- break;
- }
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadConfig();
+ return FALSE;
+
+ case PSN_APPLY:
+ char szNameFG[4];
+ char szNameBG[4];
+ char szNameTO[4];
+ int indx;
+
+ for (indx = 0; indx < 4; indx++) {
+ mir_snprintf(szNameFG, SIZEOF(szNameFG), "FG%d", indx);
+ mir_snprintf(szNameBG, SIZEOF(szNameBG), "BG%d", indx);
+ mir_snprintf(szNameTO, SIZEOF(szNameTO), "TO%d", indx);
+
+ DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameFG, options.FG[indx], optionsDefault.FG[indx]);
+ DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameBG, options.BG[indx], optionsDefault.BG[indx]);
+ DBWriteContactSettingDwordDef(NULL, SERVICENAME, szNameTO, options.Timeout[indx], (DWORD)optionsDefault.Timeout[indx]);
}
+ DBWriteContactSettingDwordDef(NULL, SERVICENAME, "Sound", options.Sound, optionsDefault.Sound);
+
break;
+ }
+ break;
}
return FALSE;
}