diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-03 17:32:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-03 17:32:37 +0000 |
commit | 31b191bc8ddb639e488ab8306f71ac1dbabf16f0 (patch) | |
tree | aa661023372aa18381e46c7f6fcecf67856ac8ae /plugins/IgnoreState/src/options.cpp | |
parent | 6ba829af4e0c008865675b67b868f33d8e7641df (diff) |
removing built-in Clist Modern extra icons part I
git-svn-id: http://svn.miranda-ng.org/main/trunk@2167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IgnoreState/src/options.cpp')
-rw-r--r-- | plugins/IgnoreState/src/options.cpp | 253 |
1 files changed, 51 insertions, 202 deletions
diff --git a/plugins/IgnoreState/src/options.cpp b/plugins/IgnoreState/src/options.cpp index ba1f01488e..cdd27fb3be 100644 --- a/plugins/IgnoreState/src/options.cpp +++ b/plugins/IgnoreState/src/options.cpp @@ -20,244 +20,93 @@ #include "commonheaders.h"
-//extern byte bUseAuthIcon, bUseGrantIcon, bContactMenuItem, bIconsForRecentContacts;
-
-//#define EXTRA_ICON_RES0 0 // only used by nicer
-//#define EXTRA_ICON_EMAIL 1
-//#define EXTRA_ICON_WEB 2
-//#define EXTRA_ICON_SMS 3
-//#define EXTRA_ICON_ADV1 4
-//#define EXTRA_ICON_ADV2 5
-//#define EXTRA_ICON_ADV3 6
-//#define EXTRA_ICON_CLIENT 7
-//#define EXTRA_ICON_ADV4 8
-//#define EXTRA_ICON_RES1 9 // only used by nicer
-//#define EXTRA_ICON_PROTO 9 // used by mwclist and modern
-//#define EXTRA_ICON_RES2 10 // only used by nicer
-//#define EXTRA_ICON_VISMODE 10 // only used by modern
-
#define MS_SKINENG_DRAWICONEXFIX "SkinEngine/DrawIconEx_Fix"
-enum {
- clist_none,
- clist_modern,
- clist_nicer
-};
-
-TCHAR* szAdvancedIconsModern[] = {
- _T("E-mail"),
- _T("Web page"),
- _T("Phone/SMS"),
- _T("Advanced #1"),
- _T("Advanced #2"),
- _T("Advanced #3"),
- _T("Client"),
- _T("Advanced #4"),
- _T("Protocol"),
- _T("Visibility/Chat activity")
-};
-//const int cAdvancedIconsModern = sizeof(szAdvancedIconsModern) / sizeof(szAdvancedIconsModern[0]);
-
-TCHAR* szAdvancedIconsNicer[] = {
- _T("Reserved"),
- _T("E-mail"),
- _T("Homepage"),
- _T("Telephone"),
- _T("Advanced #1"),
- _T("Advanced #2"),
- _T("Client"),
- _T("Advanced #3"),
- _T("Advanced #4"),
- _T("Reserved #1"),
- _T("Reserved #2")
- };
-//const int cAdvancedIconsNicer = sizeof(szAdvancedIconsNicer) / sizeof(szAdvancedIconsNicer[0]);
+static bool bInitializing;
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- HIMAGELIST himlButtonIcons=NULL;
- INT bInitializing = 0;
- INT usedClist = clist_none;
- INT cAdvancedIcons;
- isExtraiconsUsed = ServiceExists(MS_EXTRAICON_REGISTER);
-// const char **szAdvancedIcons;
HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
- switch (msg)
- {
- case WM_INITDIALOG:
+ switch (msg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
- bInitializing = 1;
+ bInitializing = true;
fill_filter();
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- if (hExtraIcon == NULL)
- {
- if (ServiceExists(MS_SKINENG_DRAWICONEXFIX))
- { // modern?
- cAdvancedIcons = SIZEOF(szAdvancedIconsModern);
- usedClist = clist_modern;
- }
- else
- {
- if (ServiceExists("CLN/About"))
- {
- usedClist = clist_nicer;
- cAdvancedIcons = SIZEOF(szAdvancedIconsNicer);
- }
- else
- {
- usedClist = clist_modern;
- cAdvancedIcons = SIZEOF(szAdvancedIconsModern) - 1; // mw doesn`t have last modern extraicon
- }
- }
- }
- else
- {
- SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Extraicons plugin is used, use Contact list > Extraicons for customize."));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
- }
- }
- else
- {
- cAdvancedIcons = 0;
-// SendDlgItemMessage(hwndDlg,IDC_USED_CLIST, WM_SETTEXT,0,(LPARAM)_T("Your clist: classic"));
- SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Warning: classic contact list plugin doesn`t have ability to use extraicons"));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
- }
- if (usedClist != clist_none) {
- for (int i = 0; i < cAdvancedIcons; i++)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) TranslateTS( usedClist==clist_modern ? szAdvancedIconsModern[i] : szAdvancedIconsNicer[i]));
- }
- if (usedClist == clist_modern )
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon-1, 0);
- else
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon, 0);
- }
+ SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Extraicons plugin is used, use Contact list > Extraicons for customize."));
+ ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
SetWindowLongPtr(hTree,GWL_STYLE,GetWindowLongPtr(hTree,GWL_STYLE)|TVS_NOHSCROLL);
- {
- himlButtonIcons=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,2,2);
- TreeView_SetImageList(hTree,himlButtonIcons,TVSIL_NORMAL);
- }
+
+ HIMAGELIST himlButtonIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,2,2);
+ TreeView_SetImageList(hTree,himlButtonIcons,TVSIL_NORMAL);
TreeView_DeleteAllItems(hTree);
- int i;
- int cii = SIZEOF(ii);
- for (i=2; i<cii; i++) // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
- {
+ for (int i=2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
TVINSERTSTRUCT tvis={0};
- HTREEITEM hti;
- int index=ImageList_AddIcon(himlButtonIcons, LoadSkinnedIcon(ii[i].icon));
+ int index = ImageList_AddIcon(himlButtonIcons, LoadSkinnedIcon(ii[i].icon));
tvis.hParent=NULL;
tvis.hInsertAfter=TVI_LAST;
tvis.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_STATE;
tvis.item.lParam=(LPARAM)(ii[i].type);
tvis.item.pszText=TranslateTS(ii[i].name);
tvis.item.iImage=tvis.item.iSelectedImage=index;
- hti=TreeView_InsertItem(hTree,&tvis);
+ HTREEITEM hti = TreeView_InsertItem(hTree,&tvis);
TreeView_SetCheckState(hTree, hti, checkState(ii[i].type));
-// TreeView_SetCheckState(hTree, hti, (bool)(ii[i].filtered || ii[0].filtered));
}
CheckDlgButton(hwndDlg, IDC_IGNORE_IGNOREALL, bUseMirandaSettings );
EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !bUseMirandaSettings);
- bInitializing = 0;
- return TRUE;
+ bInitializing = false;
}
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_ADVICON:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
- case IDC_IGNORE_IGNOREALL:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL));
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ADVICON:
+ if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- }
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- if (usedClist==clist_none && hExtraIcon == NULL )
- return TRUE;
-///////////
- DWORD flags=0;
- TVITEM tvi;
- tvi.mask=TVIF_HANDLE|TBIF_LPARAM;
- HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
- tvi.hItem=TreeView_GetRoot(hTree); //check ignore all
- while(tvi.hItem)
- {
- TreeView_GetItem(hTree,&tvi);
- if(TreeView_GetCheckState(hTree,tvi.hItem)) flags|=1<<(tvi.lParam-1);
- tvi.hItem=TreeView_GetNextSibling(hTree,tvi.hItem);
- }
- DBWriteContactSettingDword(NULL, MODULENAME, "Filter", flags);
- bUseMirandaSettings = IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL) ? 1 : 0;
- DBWriteContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
+ case IDC_IGNORE_IGNOREALL:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
- fill_filter();
-//////////
- if (hExtraIcon == NULL)
- {
- clistIcon = SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
- if (usedClist == clist_modern )
- clistIcon++;
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
+ DWORD flags=0;
+ TVITEM tvi;
+ tvi.mask=TVIF_HANDLE|TBIF_LPARAM;
+ HWND hTree=GetDlgItem(hwndDlg,IDC_FILTER);
+ tvi.hItem=TreeView_GetRoot(hTree); //check ignore all
+ while(tvi.hItem) {
+ TreeView_GetItem(hTree,&tvi);
+ if(TreeView_GetCheckState(hTree,tvi.hItem)) flags|=1<<(tvi.lParam-1);
+ tvi.hItem=TreeView_GetNextSibling(hTree,tvi.hItem);
+ }
+ DBWriteContactSettingDword(NULL, MODULENAME, "Filter", flags);
- //Store options values to DB
- DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
+ bUseMirandaSettings = IsDlgButtonChecked(hwndDlg,IDC_IGNORE_IGNOREALL) ? 1 : 0;
+ DBWriteContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);
- HANDLE hContact = db_find_first();
- while (hContact)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = db_find_next(hContact);
- }
- g_IECClear.ColumnType = clistIcon;
- if (hExtraIcon == NULL)
- onExtraImageListRebuild(0,0);
- hContact = db_find_first();
- while (hContact)
- {
- onExtraImageApplying((WPARAM)hContact,0);
- hContact = db_find_next(hContact);
- }
- }
- }
- }
- }
- case IDC_FILTER:
- if (((LPNMHDR)lParam)->code == NM_CLICK)
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ fill_filter();
}
}
- }
- case WM_DESTROY:
+ case IDC_FILTER:
+ if (((LPNMHDR)lParam)->code == NM_CLICK)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
+ }
}
return FALSE;
}
|