예제 #1
0
파일: main.cpp 프로젝트: Seldom/miranda-ng
int onModulesLoaded(WPARAM, LPARAM)
{
	HookEvent(ME_OPT_INITIALISE, onOptInitialise);

	fill_filter();

	// Set initial value for all contacts
	for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
		applyExtraImage(hContact);

	return 0;
}
예제 #2
0
파일: main.cpp 프로젝트: Seldom/miranda-ng
int onContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
	DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;

	if (!strcmp(cws->szModule, "Ignore") && !strcmp(cws->szSetting, "Mask1"))
		applyExtraImage(hContact);
	else if (hContact == 0) {
		if ((!strcmp(cws->szModule, MODULENAME) && !strcmp(cws->szSetting, "Filter")) ||
			(bUseMirandaSettings && !strcmp(cws->szModule, "Ignore") && !strcmp(cws->szSetting, "Default1")))
		{
			fill_filter();
		}
	}

	return 0;
}
예제 #3
0
int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	HookEvent(ME_OPT_INITIALISE, onOptInitialise);

	//IcoLib support
	Icon_Register(g_hInst, LPGEN("Ignore State"), iconList, SIZEOF(iconList));

	fill_filter();

	hExtraIcon = ExtraIcon_Register("ignore", LPGEN("Ignore State"), "ignore_full");

	// Set initial value for all contacts
	for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
		applyExtraImage(hContact);

	return 0;
}
예제 #4
0
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	HWND hTree = GetDlgItem(hwndDlg, IDC_FILTER);

	switch (msg) {
	case WM_INITDIALOG:
	{
		TranslateDialogDefault(hwndDlg);
		bInitializing = true;
		fill_filter();

		SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree, GWL_STYLE) | TVS_NOHSCROLL);

		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);

		for (int i = 2; i < nII; i++) { // we don`t need it IGNORE_ALL and IGNORE_MESSAGE
			TVINSERTSTRUCT tvis = { 0 };
			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;
			HTREEITEM hti = TreeView_InsertItem(hTree, &tvis);
			TreeView_SetCheckState(hTree, hti, checkState(ii[i].type));
		}

		CheckDlgButton(hwndDlg, IDC_IGNORE_IGNOREALL, bUseMirandaSettings ? BST_CHECKED : BST_UNCHECKED);
		EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), !bUseMirandaSettings);
		bInitializing = false;
	}
	return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_IGNORE_IGNOREALL:
			EnableWindow(GetDlgItem(hwndDlg, IDC_FILTER), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL));
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;
		}
		break;

	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);
				}
				db_set_dw(NULL, MODULENAME, "Filter", flags);

				bUseMirandaSettings = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_IGNOREALL) ? 1 : 0;
				db_set_b(NULL, MODULENAME, "UseMirandaSettings", bUseMirandaSettings);

				fill_filter();
			}
			}
		case IDC_FILTER:
			if (((LPNMHDR)lParam)->code == NM_CLICK)
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;
		}
	}
	return FALSE;
}