diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2014-07-31 14:34:46 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2014-07-31 14:34:46 +0000 |
commit | 35586e08f45e41070186cd32038da1af98adc9d2 (patch) | |
tree | 48be4432293f835f91a77d00c42f890ce866a215 /plugins/NewXstatusNotify/src/indsnd.cpp | |
parent | 3bdff57b5868e9d333f61297021f7943ed160500 (diff) |
options refactoring (thx slotwin)
git-svn-id: http://svn.miranda-ng.org/main/trunk@10003 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewXstatusNotify/src/indsnd.cpp')
-rw-r--r-- | plugins/NewXstatusNotify/src/indsnd.cpp | 297 |
1 files changed, 153 insertions, 144 deletions
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index b1776c9898..1d00167947 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -33,15 +33,13 @@ void PreviewSound(HWND hList) int hlpStatus = lvi.lParam;
ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff));
- if (_tcscmp(buff, TranslateT(DEFAULT_SOUND)) == 0)
- {
- if (hlpStatus == ID_STATUS_FROMOFFLINE)
- SkinPlaySound("UserFromOffline");
- else
+ if (_tcscmp(buff, TranslateT(DEFAULT_SOUND)) == 0) {
+ if (hlpStatus < ID_STATUS_MIN)
+ SkinPlaySound(StatusListEx[hlpStatus].lpzSkinSoundName);
+ else
SkinPlaySound(StatusList[Index(hlpStatus)].lpzSkinSoundName);
}
- else
- {
+ else {
PathToAbsoluteT(buff, stzSoundPath);
SkinPlaySoundFile(stzSoundPath);
}
@@ -50,8 +48,7 @@ void PreviewSound(HWND hList) BOOL RemoveSoundFromList(HWND hList)
{
int iSel = ListView_GetSelectionMark(hList);
- if (iSel != -1)
- {
+ if (iSel != -1) {
iSel = -1;
while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1)
ListView_SetItemText(hList, iSel, 1, TranslateT(DEFAULT_SOUND));
@@ -61,12 +58,14 @@ BOOL RemoveSoundFromList(HWND hList) return FALSE;
}
-TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff)
+TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff)
{
OPENFILENAME ofn = {0};
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
- ListView_GetItemText(hList, ListView_GetNextItem(hList,- 1, LVNI_SELECTED), 1, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, ListView_GetNextItem(hList, -1, LVNI_SELECTED), 1, buff, SIZEOF(buff));
+ if (_tcscmp(buff, TranslateT(DEFAULT_SOUND)) == 0)
+ buff = NULL;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = GetParent(hwndDlg);
@@ -88,16 +87,14 @@ TCHAR *SelectSound(HWND hwndDlg, TCHAR *buff) return NULL;
}
-HIMAGELIST GetStatusIconsImgList(char *szProto)
+HIMAGELIST GetStatusIconsImgList(char *szProto)
{
HIMAGELIST hList = NULL;
- if (szProto)
- {
- hList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, STATUS_COUNT, 0);
- if (hList != NULL)
- {
+ if (szProto) {
+ hList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, STATUS_COUNT - 1, 0);
+ if (hList != NULL) {
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
- ImageList_AddIcon(hList, LoadSkinnedProtoIcon(szProto, StatusList[Index(i)].ID));
+ ImageList_AddIcon(hList, LoadSkinnedProtoIcon(szProto, i));
ImageList_AddIcon(hList, LoadSkinnedIcon(SKINICON_OTHER_USERONLINE));
}
}
@@ -105,7 +102,7 @@ HIMAGELIST GetStatusIconsImgList(char *szProto) return hList;
}
-INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static MCONTACT hContact = NULL;
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
@@ -120,17 +117,17 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ListView_SetImageList(hList, GetStatusIconsImgList(szProto), LVSIL_SMALL);
ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
- RECT rc = { 0 };
+ RECT rc = {0};
GetClientRect(hList, &rc);
- LV_COLUMN lvc = { 0 };
+ LV_COLUMN lvc = {0};
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.cx = STATUS_COLUMN;
lvc.pszText = TranslateT("Status");
ListView_InsertColumn(hList, 0, &lvc);
lvc.cx = rc.right - STATUS_COLUMN - GetSystemMetrics(SM_CXVSCROLL);
- lvc.pszText = TranslateT("Sound for the status");
+ lvc.pszText = TranslateT("Sound file");
ListView_InsertColumn(hList, 1, &lvc);
if (szProto) {
@@ -143,13 +140,13 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA flags = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE;
if ((flags & Proto_Status2Flag(i)) || i == ID_STATUS_OFFLINE) {
- LV_ITEM lvi = { 0 };
+ LV_ITEM lvi = {0};
lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
lvi.iItem = 0;
lvi.iSubItem = 0;
lvi.iImage = Index(i);
lvi.lParam = (LPARAM)i;
- lvi.pszText = TranslateTS(StatusList[Index(i)].lpzStandardText);
+ lvi.pszText = StatusList[Index(i)].lpzSkinSoundDesc;
lvi.iItem = ListView_InsertItem(hList, &lvi);
if (!db_get_ts(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv)) {
@@ -163,22 +160,25 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
}
- LV_ITEM lvi = { 0 };
- lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
- lvi.iItem = 0;
- lvi.iSubItem = 0;
- lvi.iImage = Index(ID_STATUS_MAX) + 1; // additional icon
- lvi.lParam = (LPARAM)ID_STATUS_FROMOFFLINE;
- lvi.pszText = TranslateT("From offline");
- lvi.iItem = ListView_InsertItem(hList, &lvi);
-
- if (!db_get_ts(hContact, MODULE, "UserFromOffline", &dbv)) {
- _tcscpy(buff, dbv.ptszVal);
- db_free(&dbv);
- }
- else _tcscpy(buff, TranslateT(DEFAULT_SOUND));
+ for (int i = 0; i <= ID_STATUSEX_MAX; i++) {
+ LV_ITEM lvi = {0};
+ lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
+ lvi.iItem = 0;
+ lvi.iSubItem = 0;
+ lvi.iImage = Index(ID_STATUS_MAX) + 1; // additional icon
+ lvi.lParam = (LPARAM)i;
+ lvi.pszText = StatusListEx[i].lpzSkinSoundDesc;
+ lvi.iItem = ListView_InsertItem(hList, &lvi);
+
+ if (!db_get_ts(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) {
+ _tcscpy(buff, dbv.ptszVal);
+ db_free(&dbv);
+ }
+ else
+ _tcscpy(buff, TranslateT(DEFAULT_SOUND));
- ListView_SetItemText(hList, lvi.iItem, 1, buff);
+ ListView_SetItemText(hList, lvi.iItem, 1, buff);
+ }
}
CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYSOUNDS, db_get_b(hContact, MODULE, "EnableSounds", 1));
@@ -198,7 +198,6 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (ListView_GetSelectionMark(hList) != -1)
PreviewSound(hList);
break;
-
case IDC_CHANGE:
{
int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED);
@@ -219,11 +218,9 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (RemoveSoundFromList(GetDlgItem(hwndDlg, IDC_INDSNDLIST)))
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
-
case IDC_CHECK_NOTIFYSOUNDS:
db_set_b(hContact, MODULE, "EnableSounds", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYSOUNDS) ? 1 : 0);
break;
-
case IDC_CHECK_NOTIFYPOPUPS:
db_set_b(hContact, MODULE, "EnablePopups", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYPOPUPS) ? 1 : 0);
break;
@@ -235,7 +232,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR buff[MAX_PATH];
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
- LVITEM lvi = { 0 };
+ LVITEM lvi = {0};
lvi.mask = LVIF_PARAM;
//Cycle through the list reading the text associated to each status.
for (lvi.iItem = ListView_GetItemCount(hList) - 1; lvi.iItem >= 0; lvi.iItem--) {
@@ -243,16 +240,16 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff));
if (!_tcscmp(buff, TranslateT(DEFAULT_SOUND))) {
- if (lvi.lParam == ID_STATUS_FROMOFFLINE)
- db_unset(hContact, MODULE, "UserFromOffline");
+ if (lvi.lParam < ID_STATUS_MIN)
+ db_unset(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName);
else
db_unset(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName);
}
else {
- TCHAR stzSoundPath[MAX_PATH] = { 0 };
+ TCHAR stzSoundPath[MAX_PATH] = {0};
PathToRelativeT(buff, stzSoundPath);
- if (lvi.lParam == ID_STATUS_FROMOFFLINE)
- db_set_ws(hContact, MODULE, "UserFromOffline", stzSoundPath);
+ if (lvi.lParam < ID_STATUS_MIN)
+ db_set_ws(hContact, MODULE, StatusListEx[lvi.lParam].lpzSkinSoundName, stzSoundPath);
else
db_set_ws(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName, stzSoundPath);
}
@@ -289,23 +286,9 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return FALSE;
}
-int UserInfoInitialise(WPARAM wParam, LPARAM lParam)
-{
- if (lParam) {
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.position = 100000000;
- odp.hInstance = hInst;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS);
- odp.pszTitle = LPGEN("Status Notify");
- odp.pfnDlgProc = DlgProcSoundUIPage;
- UserInfo_AddPage(wParam, &odp);
- }
- return 0;
-}
-
-void ResetListOptions(HWND hwndList)
+void ResetListOptions(HWND hwndList)
{
- SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList,GWL_STYLE) | CLS_SHOWHIDDEN);
+ SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList, GWL_STYLE) | CLS_SHOWHIDDEN);
}
__inline int GetExtraImage(HWND hwndList, HANDLE hItem, int column)
@@ -320,7 +303,7 @@ __inline void SetExtraImage(HWND hwndList, HANDLE hItem, int column, int imageID void SetAllContactsIcons(HWND hwndList)
{
- BYTE EnableSounds, EnablePopups, EnableXStatus, EnableLogging;
+ BYTE EnableSounds, EnablePopups, EnableXStatus, EnableXLogging, EnableStatusMsg, EnableSMsgLogging;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
@@ -330,14 +313,19 @@ void SetAllContactsIcons(HWND hwndList) EnableSounds = db_get_b(hContact, MODULE, "EnableSounds", 1);
EnablePopups = db_get_b(hContact, MODULE, "EnablePopups", 1);
EnableXStatus = db_get_b(hContact, MODULE, "EnableXStatusNotify", 1);
- EnableLogging = db_get_b(hContact, MODULE, "EnableLogging", 1);
+ EnableXLogging = db_get_b(hContact, MODULE, "EnableXLogging", 1);
+ EnableStatusMsg = db_get_b(hContact, MODULE, "EnableSMsgNotify", 1);
+ EnableSMsgLogging = db_get_b(hContact, MODULE, "EnableSMsgLogging", 1);
}
- else EnableSounds = EnablePopups = EnableXStatus = EnableLogging = 0;
+ else
+ EnableSounds = EnablePopups = EnableXStatus = EnableXLogging = EnableStatusMsg = EnableSMsgLogging = 0;
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_SOUND, EnableSounds ? EXTRA_IMAGE_SOUND : EXTRA_IMAGE_DOT);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_POPUP, EnablePopups? EXTRA_IMAGE_POPUP : EXTRA_IMAGE_DOT);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_XSTATUS, EnableXStatus ? EXTRA_IMAGE_XSTATUS : EXTRA_IMAGE_DOT);
- SetExtraImage(hwndList, hItem, EXTRA_IMAGE_LOGGING, EnableLogging ? EXTRA_IMAGE_LOGGING : EXTRA_IMAGE_DOT);
+ SetExtraImage(hwndList, hItem, EXTRA_IMAGE_XLOGGING, EnableXLogging ? EXTRA_IMAGE_XLOGGING : EXTRA_IMAGE_DOT);
+ SetExtraImage(hwndList, hItem, EXTRA_IMAGE_STATUSMSG, EnableStatusMsg ? EXTRA_IMAGE_STATUSMSG : EXTRA_IMAGE_DOT);
+ SetExtraImage(hwndList, hItem, EXTRA_IMAGE_SMSGLOGGING, EnableSMsgLogging ? EXTRA_IMAGE_SMSGLOGGING : EXTRA_IMAGE_DOT);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_DISABLEALL, EXTRA_IMAGE_DISABLEALL);
SetExtraImage(hwndList, hItem, EXTRA_IMAGE_ENABLEALL, EXTRA_IMAGE_ENABLEALL);
}
@@ -346,25 +334,23 @@ void SetAllContactsIcons(HWND hwndList) void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
{
- int iconOn[6] = {1,1,1,1,1,1};
- int childCount[6] = {0};
+ int iconOn[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
+ int childCount[8] = {0};
HANDLE hItem;
int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- if (typeOfFirst == CLCIT_GROUP)
+ if (typeOfFirst == CLCIT_GROUP)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem)
- {
+ while (hItem) {
HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem)
+ if (hChildItem)
SetGroupsIcons(hwndList, hChildItem, hItem, childCount);
- for (int i = 0; i < SIZEOF(iconOn); i++)
- {
- if (iconOn[i] && GetExtraImage(hwndList, hItem, i) == EXTRA_IMAGE_DOT)
+ for (int i = 0; i < SIZEOF(iconOn); i++) {
+ if (iconOn[i] && GetExtraImage(hwndList, hItem, i) == EXTRA_IMAGE_DOT)
iconOn[i] = 0;
}
@@ -372,20 +358,18 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g }
//check contacts
- if (typeOfFirst == CLCIT_CONTACT)
+ if (typeOfFirst == CLCIT_CONTACT)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while(hItem)
- {
- for (int i = 0; i < SIZEOF(iconOn); i++)
- {
+ while (hItem) {
+ for (int i = 0; i < SIZEOF(iconOn); i++) {
int image = GetExtraImage(hwndList, hItem, i);
- if (iconOn[i] && image == EXTRA_IMAGE_DOT)
+ if (iconOn[i] && image == EXTRA_IMAGE_DOT)
iconOn[i] = 0;
- if (image != EMPTY_EXTRA_ICON)
+ if (image != EMPTY_EXTRA_ICON)
childCount[i]++;
}
@@ -393,10 +377,9 @@ void SetGroupsIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *g }
//set icons
- for(int i = 0; i < SIZEOF(iconOn); i++)
- {
+ for (int i = 0; i < SIZEOF(iconOn); i++) {
SetExtraImage(hwndList, hParentItem, i, childCount[i] ? (iconOn[i] ? i : EXTRA_IMAGE_DOT) : EMPTY_EXTRA_ICON);
- if (groupChildCount)
+ if (groupChildCount)
groupChildCount[i] += childCount[i];
}
}
@@ -406,62 +389,64 @@ void SetAllChildrenIcons(HWND hwndList, HANDLE hFirstItem, int column, int image HANDLE hItem, hChildItem;
int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
- if (typeOfFirst == CLCIT_GROUP)
+ if (typeOfFirst == CLCIT_GROUP)
hItem = hFirstItem;
- else
+ 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)
+ while (hItem) {
+ hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ if (hChildItem)
SetAllChildrenIcons(hwndList, hChildItem, column, image);
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
- if (typeOfFirst == CLCIT_CONTACT)
+ if (typeOfFirst == CLCIT_CONTACT)
hItem = hFirstItem;
- else
+ else
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while(hItem)
- {
+ while (hItem) {
int oldIcon = GetExtraImage(hwndList, hItem, column);
- if (oldIcon != EMPTY_EXTRA_ICON && oldIcon != image)
+ if (oldIcon != EMPTY_EXTRA_ICON && oldIcon != image)
SetExtraImage(hwndList, hItem, column, image);
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
}
-INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HANDLE hItemAll;
switch (msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3, 3);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_SOUND)));
- SendDlgItemMessage(hwndDlg,IDC_SOUNDICON,STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SOUND, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_SOUND)));
+ SendDlgItemMessage(hwndDlg, IDC_SOUNDICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SOUND, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP)));
SendDlgItemMessage(hwndDlg, IDC_POPUPICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_POPUP, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_XSTATUS)));
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_XSTATUS)));
SendDlgItemMessage(hwndDlg, IDC_XSTATUSICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_XSTATUS, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_LOGGING)));
- SendDlgItemMessage(hwndDlg, IDC_LOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_LOGGING, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_DISABLEALL)));
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_LOGGING_XSTATUS)));
+ SendDlgItemMessage(hwndDlg, IDC_XLOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_XLOGGING, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_STATUS_MESSAGE)));
+ SendDlgItemMessage(hwndDlg, IDC_SMSGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_STATUSMSG, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_LOGGING_SMSG)));
+ SendDlgItemMessage(hwndDlg, IDC_SMSGLOGGINGICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_SMSGLOGGING, ILD_NORMAL), 0);
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_DISABLEALL)));
SendDlgItemMessage(hwndDlg, IDC_DISABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_DISABLEALL, ILD_NORMAL), 0);
- ImageList_AddIcon(hImageList, LoadIcon(hInst,MAKEINTRESOURCE(IDI_ENABLEALL)));
+ ImageList_AddIcon(hImageList, LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLEALL)));
SendDlgItemMessage(hwndDlg, IDC_ENABLEALLICON, STM_SETICON, (WPARAM)ImageList_GetIcon(hImageList, EXTRA_IMAGE_ENABLEALL, ILD_NORMAL), 0);
ImageList_AddIcon(hImageList, LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hImageList);
- SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRACOLUMNS, 6, 0);
+ SendDlgItemMessage(hwndDlg, IDC_INDSNDLIST, CLM_SETEXTRACOLUMNS, 8, 0);
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
ResetListOptions(hList);
@@ -481,7 +466,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_NOTIFY:
{
HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST);
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_INDSNDLIST:
switch (((LPNMHDR)lParam)->code) {
case CLN_NEWCONTACT:
@@ -494,59 +479,59 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case CLN_OPTIONSCHANGED:
ResetListOptions(hList);
break;
- case NM_CLICK:
+ case NM_CLICK:
{
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
+ NMCLISTCONTROL *nm = (NMCLISTCONTROL *)lParam;
DWORD hitFlags;
// Make sure we have an extra column
- if (nm->iColumn == -1) break;
+ if (nm->iColumn == -1)
+ break;
// Find clicked item
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == NULL) break;
- if (!(hitFlags & CLCHT_ONITEMEXTRA)) break;
+ if (hItem == NULL)
+ break;
+ if (!(hitFlags & CLCHT_ONITEMEXTRA))
+ break;
int itemType = SendMessage(hList, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
// Get image in clicked column
int image = GetExtraImage(hList, hItem, nm->iColumn);
- if (image == EXTRA_IMAGE_DOT)
+ if (image == EXTRA_IMAGE_DOT)
image = nm->iColumn;
- else if (image >= EXTRA_IMAGE_SOUND && image <= EXTRA_IMAGE_LOGGING)
+ else if (image >= EXTRA_IMAGE_SOUND && image <= EXTRA_IMAGE_SMSGLOGGING)
image = EXTRA_IMAGE_DOT;
// Get item type (contact, group, etc...)
- if (itemType == CLCIT_CONTACT)
- {
- if (image == EXTRA_IMAGE_DISABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ if (itemType == CLCIT_CONTACT) {
+ if (image == EXTRA_IMAGE_DISABLEALL) {
+ for (int i = 0; i < 6; i++)
SetExtraImage(hList, hItem, i, EXTRA_IMAGE_DOT);
}
- else if (image == EXTRA_IMAGE_ENABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ else if (image == EXTRA_IMAGE_ENABLEALL) {
+ for (int i = 0; i < 6; i++)
SetExtraImage(hList, hItem, i, i);
}
- else SetExtraImage(hList, hItem, nm->iColumn, image);
+ else
+ SetExtraImage(hList, hItem, nm->iColumn, image);
}
else if (itemType == CLCIT_INFO || itemType == CLCIT_GROUP) {
if (itemType == CLCIT_GROUP)
hItem = (HANDLE)SendMessage(hList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hItem) {
- if (image == EXTRA_IMAGE_DISABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ if (image == EXTRA_IMAGE_DISABLEALL) {
+ for (int i = 0; i < 6; i++)
SetAllChildrenIcons(hList, hItem, i, EXTRA_IMAGE_DOT);
}
- else if (image == EXTRA_IMAGE_ENABLEALL)
- {
- for (int i = 0; i < 4; i++)
+ else if (image == EXTRA_IMAGE_ENABLEALL) {
+ for (int i = 0; i < 6; i++)
SetAllChildrenIcons(hList, hItem, i, i);
}
- else SetAllChildrenIcons(hList, hItem, nm->iColumn, image);
+ else
+ SetAllChildrenIcons(hList, hItem, nm->iColumn, image);
}
}
@@ -560,29 +545,39 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case 0:
switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
+ case PSN_APPLY:
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SOUND) == EXTRA_IMAGE_SOUND)
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SOUND) == EXTRA_IMAGE_SOUND)
db_unset(hContact, MODULE, "EnableSounds");
- else
+ else
db_set_b(hContact, MODULE, "EnableSounds", 0);
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_POPUP) == EXTRA_IMAGE_POPUP)
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_POPUP) == EXTRA_IMAGE_POPUP)
db_unset(hContact, MODULE, "EnablePopups");
- else
+ else
db_set_b(hContact, MODULE, "EnablePopups", 0);
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XSTATUS) == EXTRA_IMAGE_XSTATUS)
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XSTATUS) == EXTRA_IMAGE_XSTATUS)
db_unset(hContact, MODULE, "EnableXStatusNotify");
else
db_set_b(hContact, MODULE, "EnableXStatusNotify", 0);
- if (GetExtraImage(hList, hItem, EXTRA_IMAGE_LOGGING) == EXTRA_IMAGE_LOGGING)
- db_unset(hContact, MODULE, "EnableLogging");
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_XLOGGING) == EXTRA_IMAGE_XLOGGING)
+ db_unset(hContact, MODULE, "EnableXLogging");
+ else
+ db_set_b(hContact, MODULE, "EnableXLogging", 0);
+
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_STATUSMSG) == EXTRA_IMAGE_STATUSMSG)
+ db_unset(hContact, MODULE, "EnableSMsgNotify");
else
- db_set_b(hContact, MODULE, "EnableLogging", 0);
+ db_set_b(hContact, MODULE, "EnableSMsgNotify", 0);
+
+ if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SMSGLOGGING) == EXTRA_IMAGE_SMSGLOGGING)
+ db_unset(hContact, MODULE, "EnableSMsgLogging");
+ else
+ db_set_b(hContact, MODULE, "EnableSMsgLogging", 0);
}
}
return TRUE;
@@ -591,7 +586,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
break;
- case WM_DESTROY:
+ case WM_DESTROY:
HIMAGELIST hImageList = (HIMAGELIST)SendMessage(GetDlgItem(hwndDlg, IDC_INDSNDLIST), CLM_GETEXTRAIMAGELIST, 0, 0);
for (int i = 0; i < ImageList_GetImageCount(hImageList); i++)
DestroyIcon(ImageList_GetIcon(hImageList, i, ILD_NORMAL));
@@ -600,3 +595,17 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
return FALSE;
}
+
+int UserInfoInitialise(WPARAM wParam, LPARAM lParam)
+{
+ if (lParam) {
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.position = 100000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS);
+ odp.pszTitle = LPGEN("Status Notify");
+ odp.pfnDlgProc = DlgProcSoundUIPage;
+ UserInfo_AddPage(wParam, &odp);
+ }
+ return 0;
+}
|