Пример #1
0
void BB_UpdateIcons(HWND hdlg, TWindowData *dat)
{
	HWND hwndBtn = NULL;

	for (int i = 0; i < LButtonsList.getCount(); i++) {
		CustomButtonData *cbd = LButtonsList[i];
		if (cbd) {
			if (!cbd->bSeparator)
				hwndBtn = GetDlgItem(hdlg, cbd->dwButtonCID);

			if (hwndBtn && cbd->hIcon)
				SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
		}
	}

	hwndBtn = NULL;
	for (int i = 0; i < RButtonsList.getCount(); i++) {
		CustomButtonData *cbd = RButtonsList[i];
		if (cbd) {
			if (!cbd->bSeparator)
				hwndBtn = GetDlgItem(hdlg, cbd->dwButtonCID);

			if (hwndBtn && cbd->hIcon)
				SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
		}
	}
}
Пример #2
0
int ReloadIcons(WPARAM wParam, LPARAM lParam)
{
	hIconRemove	= Skin_GetIconByHandle(iconList[0].hIcolib);
	hIconKeep	= Skin_GetIconByHandle(iconList[1].hIcolib);
	hIconClear	= Skin_GetIconByHandle(iconList[2].hIcolib);
	return 0;
}
Пример #3
0
/**
 * Popup classes initialization
 */
void FacebookProto::InitPopups()
{		
	POPUPCLASS ppc = { sizeof(ppc) };
	ppc.flags = PCF_TCHAR;		
	ppc.PluginWindowProc = PopupDlgProc;
	ppc.lParam = APF_RETURN_HWND;

	TCHAR desc[256];
	char name[256];

	// Client
	mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Client notifications"));
	mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Client");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("facebook"));
	ppc.colorBack = RGB(191, 0, 0); // red
	ppc.colorText = RGB(255, 255, 255); // white
	ppc.iSeconds = 0;
	popupClasses.push_back(Popup_RegisterClass(&ppc));

	// Newsfeeds
	mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("News feeds"));
	mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Newsfeed");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("newsfeed"));
	ppc.colorBack = RGB(255, 255, 255); // white
	ppc.colorText = RGB(0, 0, 0); // black
	ppc.iSeconds = 0;
	popupClasses.push_back(Popup_RegisterClass(&ppc));

	// Notifications
	mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Notifications"));
	mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Notification");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("notification"));
	ppc.colorBack = RGB(59, 89, 152); // Facebook's blue
	ppc.colorText = RGB(255, 255, 255); // white
	ppc.iSeconds = 0;
	popupClasses.push_back(Popup_RegisterClass(&ppc));

	// Others
	mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Other events"));
	mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Other");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("facebook"));
	ppc.colorBack = RGB(255, 255, 255); // white
	ppc.colorText = RGB(0, 0, 0); // black
	ppc.iSeconds = 0;
	popupClasses.push_back(Popup_RegisterClass(&ppc));
}
Пример #4
0
HICON CIconPool::GetIcon(const char *name, bool big)
{
	if (CPoolItem *item = FindItemByName(name))
		return Skin_GetIconByHandle(item->m_hIcolibItem, big);

	return NULL;
}
Пример #5
0
static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST il)
{
	TVINSERTSTRUCT tvis = { 0 };
	tvis.hInsertAfter = hItem;
	tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;

	int index;
	TCHAR* tmp;

	if (b->dwFlags & TTBBF_ISSEPARATOR) {
		tvis.item.pszText = _T("------------------");
		index = -1;
	}
	else {
		if (b->hIconHandleUp) {
			HICON hIcon = Skin_GetIconByHandle(b->hIconHandleUp);
			index = ImageList_AddIcon(il, hIcon);
			Skin_ReleaseIcon(hIcon);
		}
		else index = ImageList_AddIcon(il, b->hIconUp);

		tmp = mir_a2t( b->pszName );
		tvis.item.pszText = TranslateTS(tmp);
	}
	tvis.item.iImage = tvis.item.iSelectedImage = index;

	tvis.item.lParam = (LPARAM)b;
	HTREEITEM hti = TreeView_InsertItem(hTree, &tvis);

	if (!(b->dwFlags & TTBBF_ISSEPARATOR))
		mir_free(tmp);

	TreeView_SetCheckState(hTree, hti, b->isVisible());
	return hti;
}
Пример #6
0
HICON GetIcolibIcon(int iconId)
{
	HANDLE handle = GetIconHandle(iconId);
	if (handle != NULL)
		return Skin_GetIconByHandle(handle);

	return NULL;
}
Пример #7
0
//
//  wParam - Section name
//  lParam - Icon ID
//
int OnSkinIconsChanged(WPARAM wParam,LPARAM lParam)
{
	for(int indx = 0; indx < SIZEOF(hIcons); indx++)
		hIcons[indx] = Skin_GetIconByHandle( iconList[indx].hIcolib );

	WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0,0);

	return 0;
}
Пример #8
0
void ShowPopup(TCHAR* text, TCHAR* header)
{
	POPUPDATAT ppd = {0};

	lstrcpy(ppd.lptzText, text);
	lstrcpy(ppd.lptzContactName, header);
	ppd.lchIcon = Skin_GetIconByHandle(iconList[0].hIcolib);

	PUAddPopupT(&ppd);
}
Пример #9
0
HICON CJabberProto::LoadIconEx(const char* name, bool big)
{
	if (HICON result = g_LoadIconEx(name, big))
		return result;

	if (!strcmp(name, "main"))
		return Skin_GetIconByHandle(m_hProtoIcon, big);

	return NULL;
}
Пример #10
0
void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon)
{
	POPUPDATAT pd = {0};
	pd.lchIcon = Skin_GetIconByHandle(icon);
	_tcscpy(pd.lptzContactName, title);
	_tcscpy(pd.lptzText, message);
	pd.colorText = commonData.foreground;
	pd.colorBack = commonData.background;
	PUAddPopupT(&pd);
}
Пример #11
0
void CB_ChangeButton(HWND hwndDlg, TWindowData *dat, CustomButtonData *cbd)
{
	HWND hwndBtn = GetDlgItem(hwndDlg, cbd->dwButtonCID);
	if (hwndBtn) {
		if (cbd->hIcon)
			SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
		if (cbd->ptszTooltip)
			SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)cbd->ptszTooltip, BATF_TCHAR);
		SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
		SetWindowTextA(hwndBtn, cbd->pszModuleName);
	}
}
Пример #12
0
static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict) 
{
	TEXTMETRIC tm;
	RECT rc;

	GetTextMetrics(lpdis->hDC, &tm);

	int foreIndex, backIndex;
	if (lpdis->itemState & ODS_DISABLED) {
		foreIndex = COLOR_GRAYTEXT;
		backIndex = COLOR_BTNFACE;
	}
	else if (lpdis->itemState & ODS_SELECTED) {
		foreIndex = COLOR_HIGHLIGHTTEXT;
		backIndex = COLOR_HIGHLIGHT;
	}
	else {
		foreIndex = COLOR_WINDOWTEXT;
		backIndex = COLOR_WINDOW;
	}

	COLORREF clrfore = SetTextColor(lpdis->hDC,GetSysColor(foreIndex));
	COLORREF clrback = SetBkColor(lpdis->hDC,GetSysColor(backIndex));

	FillRect(lpdis->hDC, &lpdis->rcItem, GetSysColorBrush(backIndex));

	rc.left = lpdis->rcItem.left + 2;

	// Draw icon
	if (opts.use_flags) {
		HICON hFlag = Skin_GetIconByHandle(dict->hIcolib);

		rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - ICON_SIZE) / 2;
		DrawIconEx(lpdis->hDC, rc.left, rc.top, hFlag, 16, 16, 0, NULL, DI_NORMAL);

		rc.left += ICON_SIZE + 4;
		
		Skin_ReleaseIcon(hFlag);
	}

	// Draw text
	rc.right = lpdis->rcItem.right - 2;
	rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
	rc.bottom = rc.top + tm.tmHeight;
	DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);

	// Restore old colors
	SetTextColor(lpdis->hDC, clrfore);
	SetBkColor(lpdis->hDC, clrback);
}
Пример #13
0
int FacebookProto::OnToolbarInit(WPARAM, LPARAM)
{
	TTBButton ttb = { sizeof(ttb) };
	ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;

	char service[100];
	mir_snprintf(service, sizeof(service), "%s%s", m_szModuleName, "/Mind");

	ttb.pszService = service;
	ttb.pszTooltipUp = ttb.name = LPGEN("Share status...");
	ttb.hIconHandleUp = Skin_GetIconByHandle(GetIconHandle("mind"));
	TopToolbar_AddButton(&ttb);

	return 0;
}
Пример #14
0
/**
 * Sets statusbar text of hContact with last read time (from facy.readers map)
 */
void FacebookProto::MessageRead(MCONTACT hContact)
{
	std::map<MCONTACT, time_t>::iterator it = facy.readers.find(hContact);
	if (it == facy.readers.end())
		return;
	
	TCHAR ttime[64];
	_tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&it->second));

	StatusTextData st = { 0 };
	st.cbSize = sizeof(st);
	st.hIcon = Skin_GetIconByHandle(GetIconHandle("read"));
	mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime);
	
	CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
Пример #15
0
void InitIcons(void)
{
	HINSTANCE hNewIconInst = NULL;

	if (g_hFolders) {
		TCHAR pathname[MAX_PATH];
		FoldersGetCustomPathExT(g_hFolders, pathname, MAX_PATH, "icons\\");
		if (hNewIconInst == NULL)
			hNewIconInst = LoadIconsPack(pathname);
	}

	if (hNewIconInst == NULL)
		hNewIconInst = LoadIconsPack("icons\\secureim_icons.dll");

	if (hNewIconInst == NULL)
		hNewIconInst = LoadIconsPack("plugins\\secureim_icons.dll");

	if (hNewIconInst == NULL)
		g_hIconInst = g_hInst;
	else
		g_hIconInst = hNewIconInst;

	TCHAR tszPath[MAX_PATH];
	GetModuleFileName(g_hIconInst, tszPath, SIZEOF(tszPath));

	SKINICONDESC sid = { sizeof(sid) };
	sid.pszSection = "SecureIM";
	sid.ptszDefaultFile = tszPath;

	for (int i = 0; i < SIZEOF(icons); i++) {
		sid.pszSection = icons[i].section;
		sid.pszName = icons[i].name;
		sid.pszDescription = icons[i].text;
		sid.iDefaultIndex = -icons[i].key;
		HANDLE hIcolib = Skin_AddIcon(&sid);

		HICON hIcon = Skin_GetIconByHandle(hIcolib);
		if (icons[i].tbl == TBL_IEC)
			g_hIEC[icons[i].idx] = hIcon;
		else if (icons[i].tbl == TBL_ICO)
			g_hICO[icons[i].idx] = hIcon;
		else if (icons[i].tbl == TBL_POP)
			g_hPOP[icons[i].idx] = hIcon;
	}

	HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
Пример #16
0
//=======================================================
//BPLoadIcon
//=======================================================
INT_PTR LoadLCIcon(WPARAM wParam,LPARAM lParam)
{
	if (LOWORD(wParam) == PLI_PROTOCOL) {
		if (wParam & PLIF_ICOLIBHANDLE)
			return (INT_PTR)icoList[0].hIcolib;

		HICON hIcon = Skin_GetIconByHandle(icoList[0].hIcolib, (wParam & PLIF_SMALL) == 0);
		if (wParam & PLIF_ICOLIB)
			return (INT_PTR)hIcon;

		HICON hIcon2 = CopyIcon(hIcon);
		Skin_ReleaseIcon(hIcon);
		return (INT_PTR)hIcon2;
	}

	return NULL;	
}
Пример #17
0
static int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
{
	for(int indx = 0; indx < SIZEOF(hIcons); indx++)
		hIcons[indx] = Skin_GetIconByHandle( iconList[indx].hIcolib );

	hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);

	CLISTMENUITEM mi = { sizeof(mi) };
	mi.position = 200011;
	mi.hIcon = hIcons[ICON_MAIN];
	mi.pszName = LPGEN("File As Message...");
	mi.pszService = SERVICE_NAME "/FESendFile";
	mi.pszContactOwner = NULL;
	mi.flags = CMIF_NOTOFFLINE;
	Menu_AddContactMenuItem(&mi);
	return 0;
}
Пример #18
0
static INT_PTR CB_SetButtonState(WPARAM wParam, LPARAM lParam)
{
	if (wParam == 0 || lParam == 0)
		return 1;

	bool realbutton = false;
	DWORD tempCID = 0;
	BBButton *bbdi = (BBButton *)lParam;
	for (int i = 0; i < LButtonsList.getCount(); i++) {
		CustomButtonData *cbd = LButtonsList[i];
		if (!strcmp(cbd->pszModuleName, bbdi->pszModuleName) && (cbd->dwButtonOrigID == bbdi->dwButtonID)) {
			realbutton = true;
			tempCID = cbd->dwButtonCID;
		}
	}
	if (!realbutton)
		for (int i = 0; i < RButtonsList.getCount(); i++) {
			CustomButtonData* cbd = RButtonsList[i];
			if (!strcmp(cbd->pszModuleName, bbdi->pszModuleName) && (cbd->dwButtonOrigID == bbdi->dwButtonID)) {
				realbutton = true;
				tempCID = cbd->dwButtonCID;
			}
		}

	if (!realbutton)
		return 1;

	HWND hwndDlg = M.FindWindow(wParam);
	if (!hwndDlg)
		return 1;

	SetDlgItemTextA(hwndDlg, tempCID, bbdi->pszModuleName);
	if (bbdi->hIcon)
		SendDlgItemMessage(hwndDlg, tempCID, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(bbdi->hIcon));
	if (bbdi->pszTooltip)
		SendDlgItemMessage(hwndDlg, tempCID, BUTTONADDTOOLTIP, (WPARAM)bbdi->ptszTooltip, (bbdi->bbbFlags & BBBF_ANSITOOLTIP) ? 0 : BATF_TCHAR);
	if (bbdi->bbbFlags) {
		Utils::showDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_HIDDEN) ? SW_HIDE : SW_SHOW);
		Utils::enableDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_DISABLED) ? 0 : 1);
		CheckDlgButton(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_PUSHED) ? 1 : 0);
		CheckDlgButton(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_RELEASED) ? 0 : 1);
	}
	return 0;
}
Пример #19
0
static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam)
{
	DBEVENTINFO* dbei = (DBEVENTINFO*)lParam;
	HICON icon = NULL;
	DBEVENTTYPEDESCR* et = (DBEVENTTYPEDESCR*)DbEventTypeGet((WPARAM)dbei->szModule, (LPARAM)dbei->eventType);

	if (et && ServiceExists(et->iconService)) {
		icon = (HICON)CallService(et->iconService, wParam, lParam);
		if (icon)
			return (INT_PTR)icon;
	}
	if (et && et->eventIcon)
		icon = Skin_GetIconByHandle(et->eventIcon);
	if (!icon) {
		char szName[100];
		mir_snprintf(szName, sizeof(szName), "eventicon_%s%d", dbei->szModule, dbei->eventType);
		icon = Skin_GetIcon(szName);
	}

	if (!icon) {
		switch(dbei->eventType) {
		case EVENTTYPE_URL:
			icon = LoadSkinIcon(SKINICON_EVENT_URL);
			break;

		case EVENTTYPE_FILE:
			icon = LoadSkinIcon(SKINICON_EVENT_FILE);
			break;

		default: // EVENTTYPE_MESSAGE and unknown types
			icon = LoadSkinIcon(SKINICON_EVENT_MESSAGE);
			break;
		}
	}

	return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon));
}
Пример #20
0
int CIcqProto::ShowPopupMsg(HANDLE hContact, const char *szTitle, const char *szMsg, BYTE bType)
{
	if (bPopupService && getByte("PopupsEnabled", DEFAULT_POPUPS_ENABLED))
	{
		POPUPDATAT ppd = { 0 };
		LPCTSTR rsIcon;
		char szPrefix[32], szSetting[32];
		strcpy(szPrefix, "Popups");

		switch(bType) {
		case LOG_NOTE:
			rsIcon = MAKEINTRESOURCE(IDI_INFORMATION);
			ppd.colorBack = DEFAULT_LOG0_BACK_COLORS;
			ppd.colorText = DEFAULT_LOG0_TEXT_COLORS;
			strcat(szPrefix, "0");
			break;

		case LOG_WARNING:
			rsIcon = MAKEINTRESOURCE(IDI_WARNING);
			ppd.colorBack = DEFAULT_LOG1_BACK_COLORS;
			ppd.colorText = DEFAULT_LOG1_TEXT_COLORS;
			strcat(szPrefix, "1");
			break;

		case LOG_ERROR:
			rsIcon = MAKEINTRESOURCE(IDI_ERROR);
			ppd.colorBack = DEFAULT_LOG2_BACK_COLORS;
			ppd.colorText = DEFAULT_LOG2_TEXT_COLORS;
			strcat(szPrefix, "2");
			break;

		case LOG_FATAL:
			rsIcon = MAKEINTRESOURCE(IDI_ERROR);
			ppd.colorBack = DEFAULT_LOG3_BACK_COLORS;
			ppd.colorText = DEFAULT_LOG3_TEXT_COLORS;
			strcat(szPrefix, "3");
			break;

		case POPTYPE_SPAM:
			rsIcon = MAKEINTRESOURCE(IDI_WARNING);
			ppd.colorBack = DEFAULT_SPAM_BACK_COLORS;
			ppd.colorText = DEFAULT_SPAM_TEXT_COLORS;
			strcat(szPrefix, "Spam");
			break;
		default:
			return -1;
		}
		if (!getByte("PopupsSysIcons", DEFAULT_POPUPS_SYS_ICONS))
			ppd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon);
		else
			ppd.lchIcon = (HICON)LoadImage( NULL, rsIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
		
		if (getByte("PopupsWinColors", DEFAULT_POPUPS_WIN_COLORS)) {
			ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
			ppd.colorBack = GetSysColor(COLOR_WINDOW);
		}
		else {
			if (getByte("PopupsDefColors", DEFAULT_POPUPS_DEF_COLORS)) {
				ppd.colorText = NULL;
				ppd.colorBack = NULL;
			}
			else {
				strcpy(szSetting, szPrefix);
				strcat(szSetting, "TextColor");
				ppd.colorText = getDword(szSetting, ppd.colorText);
				strcpy(szSetting, szPrefix);
				strcat(szSetting, "BackColor");
				ppd.colorBack = getDword(szSetting, ppd.colorBack);
			}
		}
		strcpy(szSetting, szPrefix);
		strcat(szSetting, "Timeout");
		ppd.iSeconds = getDword(szSetting, ppd.iSeconds);

		char str[4096];
		make_unicode_string_static( ICQTranslateUtfStatic(szTitle, str, sizeof(str)), ppd.lpwzContactName, MAX_CONTACTNAME);
		make_unicode_string_static( ICQTranslateUtfStatic(szMsg, str, sizeof(str)), ppd.lpwzText, MAX_SECONDLINE);
		ppd.lchContact = hContact;
		ppd.lchIcon = ppd.lchIcon;
		ppd.colorBack = ppd.colorBack;
		ppd.colorText = ppd.colorText;
		ppd.PluginWindowProc = NULL;
		ppd.PluginData = NULL;
		ppd.iSeconds = ppd.iSeconds;
		return PUAddPopupT(&ppd);
	}
	return -1; // Failure
}
Пример #21
0
void WhatsAppProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, TCHAR* szUrl)
{
    int ret;
    int timeout;
    COLORREF colorBack = 0;
    COLORREF colorText = 0;

    switch ( flags )
    {
    case WHATSAPP_EVENT_CLIENT:
        if ( !getByte( WHATSAPP_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE ))
            goto exit;
        if ( !getByte( WHATSAPP_KEY_EVENT_CLIENT_DEFAULT, 0 ))
        {
            colorBack = getDword( WHATSAPP_KEY_EVENT_CLIENT_COLBACK, DEFAULT_EVENT_COLBACK );
            colorText = getDword( WHATSAPP_KEY_EVENT_CLIENT_COLTEXT, DEFAULT_EVENT_COLTEXT );
        }
        timeout = getDword( WHATSAPP_KEY_EVENT_CLIENT_TIMEOUT, 0 );
        flags |= NIIF_WARNING;
        break;

    case WHATSAPP_EVENT_OTHER:
        if ( !getByte( WHATSAPP_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE ))
            goto exit;
        if ( !getByte( WHATSAPP_KEY_EVENT_OTHER_DEFAULT, 0 ))
        {
            colorBack = getDword( WHATSAPP_KEY_EVENT_OTHER_COLBACK, DEFAULT_EVENT_COLBACK );
            colorText = getDword( WHATSAPP_KEY_EVENT_OTHER_COLTEXT, DEFAULT_EVENT_COLTEXT );
        }
        timeout = getDword( WHATSAPP_KEY_EVENT_OTHER_TIMEOUT, -1 );
        SkinPlaySound( "OtherEvent" );
        flags |= NIIF_INFO;
        break;
    }

    if ( !getByte(WHATSAPP_KEY_SYSTRAY_NOTIFY,DEFAULT_SYSTRAY_NOTIFY))
    {
        if (ServiceExists(MS_POPUP_ADDPOPUP))
        {
            POPUPDATAT pd;
            pd.colorBack = colorBack;
            pd.colorText = colorText;
            pd.iSeconds = timeout;
            pd.lchContact = contact;
            pd.lchIcon = Skin_GetIconByHandle(m_hProtoIcon); // TODO: Icon test
            pd.PluginData = szUrl;
            pd.PluginWindowProc = (WNDPROC)PopupDlgProc;
            lstrcpy(pd.lptzContactName, title);
            lstrcpy(pd.lptzText, info);
            ret = PUAddPopupT(&pd);

            if (ret == 0)
                return;
        }
    } else {
        if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY))
        {
            MIRANDASYSTRAYNOTIFY err;
            int niif_flags = flags;
            REMOVE_FLAG( niif_flags, WHATSAPP_EVENT_CLIENT |
                         WHATSAPP_EVENT_NOTIFICATION |
                         WHATSAPP_EVENT_OTHER );
            err.szProto = m_szModuleName;
            err.cbSize = sizeof(err);
            err.dwInfoFlags = NIIF_INTERN_TCHAR | niif_flags;
            err.tszInfoTitle = title;
            err.tszInfo = info;
            err.uTimeout = 1000 * timeout;
            ret = CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) & err);

            if (ret == 0)
                goto exit;
        }
    }

    if (FLAG_CONTAINS(flags, WHATSAPP_EVENT_CLIENT))
        MessageBox(NULL, info, title, MB_OK | MB_ICONINFORMATION);

exit:
    if (szUrl != NULL)
        mir_free(szUrl);
}
Пример #22
0
INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
	post_status_data *data;

	switch (message)
	{

	case WM_INITDIALOG:
	{
		TranslateDialogDefault(hwnd);

		SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(GetIconHandle("mind")));

		data = reinterpret_cast<post_status_data*>(lparam);

		SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
		SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0);
		SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0);

		ptrT place(data->proto->getTStringA(FACEBOOK_KEY_PLACE));
		SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : _T("Miranda NG"));

		bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0;
		ResizeHorizontal(hwnd, bShowContacts);

		HWND hwndClist = GetDlgItem(hwnd, IDC_CCLIST);
		SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE);

		for (std::vector<wall_data*>::size_type i = 0; i < data->walls.size(); i++)
			SendDlgItemMessage(hwnd, IDC_WALL, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(data->walls[i]->title));
		SendDlgItemMessage(hwnd, IDC_WALL, CB_SETCURSEL, 0, 0);
		SendDlgItemMessage(hwnd, IDC_WALL, CB_SETCURSEL, data->proto->getByte(FACEBOOK_KEY_LAST_WALL, 0), 0);
		RefreshPrivacy(hwnd, data);

		ptrA firstname(data->proto->getStringA(FACEBOOK_KEY_FIRST_NAME));
		if (firstname != NULL) {
			char title[100];
			mir_snprintf(title, SIZEOF(title), Translate("What's on your mind, %s?"), firstname);
			SetWindowTextA(hwnd, title);
		}
	}

	EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
	return TRUE;

	case WM_NOTIFY:
	{
		NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lparam;
		if (nmc->hdr.idFrom == IDC_CCLIST) {
			switch (nmc->hdr.code) {
			case CLN_LISTREBUILT:
				data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
				ClistPrepare(data->proto, NULL, nmc->hdr.hwndFrom);
				break;
			}
		}
	}
	break;

	case WM_COMMAND:
		switch (LOWORD(wparam))
		{
		case IDC_WALL:
			if (HIWORD(wparam) == CBN_SELCHANGE) {
				data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
				RefreshPrivacy(hwnd, data);
			}
			break;

		case IDC_MINDMSG:
		case IDC_URL:
			if (HIWORD(wparam) == EN_CHANGE) {
				bool ok = SendDlgItemMessage(hwnd, IDC_MINDMSG, WM_GETTEXTLENGTH, 0, 0) > 0;
				if (!ok && SendDlgItemMessage(hwnd, IDC_URL, WM_GETTEXTLENGTH, 0, 0) > 0)
					ok = true;

				EnableWindow(GetDlgItem(hwnd, IDOK), ok);
				return TRUE;
			}
			break;

		case IDC_EXPAND:
			bShowContacts = !bShowContacts;
			ResizeHorizontal(hwnd, bShowContacts);
			break;

		case IDOK:
		{
			data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));

			TCHAR mindMessageT[FACEBOOK_MIND_LIMIT + 1];
			TCHAR urlT[1024];
			TCHAR placeT[100];

			GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, SIZEOF(mindMessageT));
			GetDlgItemText(hwnd, IDC_PLACE, placeT, SIZEOF(placeT));
			GetDlgItemText(hwnd, IDC_URL, urlT, SIZEOF(urlT));
			ShowWindow(hwnd, SW_HIDE);

			int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0);
			int privacy_id = SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_GETCURSEL, 0, 0);

			data->proto->setTString(FACEBOOK_KEY_PLACE, placeT);
			data->proto->setByte("PostStatusExpand", bShowContacts);

			// remember last wall, only when there are more options
			if (SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCOUNT, 0, 0) > 1)
				data->proto->setByte(FACEBOOK_KEY_LAST_WALL, wall_id);

			// remember last privacy, only when there are more options
			if (SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_GETCOUNT, 0, 0) > 1)
				data->proto->setByte(FACEBOOK_KEY_PRIVACY_TYPE, privacy_id);

			status_data *status = new status_data();
			status->user_id = data->walls[wall_id]->user_id;
			status->isPage = data->walls[wall_id]->isPage;
			status->privacy = privacy_types[privacy_id].id;
			status->place = ptrA(mir_utf8encodeT(placeT));
			status->url = _T2A(urlT);

			HWND hwndList = GetDlgItem(hwnd, IDC_CCLIST);
			GetSelectedContacts(data->proto, NULL, hwndList, &status->users);

			ptrA narrow(mir_utf8encodeT(mindMessageT));
			status->text = narrow;

			if (status->user_id == data->proto->facy.self_.user_id && data->proto->last_status_msg_ != (char *)narrow)
				data->proto->last_status_msg_ = narrow;

			data->proto->ForkThread(&FacebookProto::SetAwayMsgWorker, status);

			EndDialog(hwnd, wparam);
			return TRUE;
		}

		case IDCANCEL:
			EndDialog(hwnd, wparam);
			return TRUE;

		} break;
	case WM_DESTROY:
		data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));

		for (std::vector<wall_data*>::size_type i = 0; i < data->walls.size(); i++) {
			mir_free(data->walls[i]->title);
			delete data->walls[i];
		}

		delete data;
	}

	return FALSE;
}
Пример #23
0
static HICON LoadIconEx(IconIndex i)
{
	return Skin_GetIconByHandle(iconList[(int)i].hIcolib);
}
Пример #24
0
void TSAPI BB_InitDlgButtons(TWindowData *dat)
{
	RECT rect;
	int i;
	int lwidth = 0, rwidth = 0;
	RECT rcSplitter;
	POINT ptSplitter;
	int splitterY;
	BYTE gap = DPISCALEX_S(PluginConfig.g_iButtonsBarGap);
	BOOL isThemed = TRUE;
	int cx = 0, cy = 0;
	int lcount = LButtonsList.getCount();
	int rcount = RButtonsList.getCount();
	HWND hdlg = dat->hwnd;

	if (dat == 0 || hdlg == 0) { return; }
	if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED &&
		 !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED) {
		isThemed = FALSE;
	}

	GetWindowRect(GetDlgItem(hdlg, (dat->bType == SESSIONTYPE_IM) ? IDC_SPLITTER : IDC_SPLITTERY), &rcSplitter);
	ptSplitter.x = 0;
	ptSplitter.y = rcSplitter.top;
	ScreenToClient(hdlg, &ptSplitter);

	GetClientRect(hdlg, &rect);
	splitterY = ptSplitter.y - DPISCALEY_S(1);

	HWND hwndBtn = NULL;

	for (i = 0; i < RButtonsList.getCount(); i++) {
		CustomButtonData *cbd = RButtonsList[i];
		if (((dat->bType == SESSIONTYPE_IM && cbd->bIMButton) || (dat->bType == SESSIONTYPE_CHAT && cbd->bChatButton))) {
			if (!cbd->bHidden)
				rwidth += cbd->iButtonWidth + gap;
			if (!cbd->bHidden && !cbd->bCanBeHidden)
				dat->iButtonBarReallyNeeds += cbd->iButtonWidth + gap;
			if (!cbd->bSeparator && !GetDlgItem(hdlg, cbd->dwButtonCID)) {
				hwndBtn = CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, rect.right - rwidth + gap, splitterY, cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU)cbd->dwButtonCID, g_hInst, NULL);
				CustomizeButton(hwndBtn);
			}
			if (!cbd->bSeparator && hwndBtn) {
				SendMessage(hwndBtn, BUTTONSETASFLATBTN, TRUE, 0);
				SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, isThemed != 0, 0);
				if (cbd->hIcon)
					SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
				if (cbd->ptszTooltip)
					SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), BATF_TCHAR);
				SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
				SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0);

				if (hwndBtn && cbd->dwArrowCID)
					SendMessage(hwndBtn, BUTTONSETARROW, cbd->dwArrowCID, 0);
				if (hwndBtn && cbd->bPushButton)
					SendMessage(hwndBtn, BUTTONSETASPUSHBTN, TRUE, 0);
			}
		}
		else if (GetDlgItem(hdlg, cbd->dwButtonCID))
			DestroyWindow(GetDlgItem(hdlg, cbd->dwButtonCID));

		if (cbd->bDisabled)
			EnableWindow(hwndBtn, 0);
		if (cbd->bHidden)
			ShowWindow(hwndBtn, SW_HIDE);

	}

	hwndBtn = NULL;

	for (i = 0; i < LButtonsList.getCount(); i++) {
		CustomButtonData *cbd = LButtonsList[i];
		if (((dat->bType == SESSIONTYPE_IM && cbd->bIMButton) || (dat->bType == SESSIONTYPE_CHAT && cbd->bChatButton))) {
			if (!cbd->bSeparator && !GetDlgItem(hdlg, cbd->dwButtonCID)) {
				hwndBtn = CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 2 + lwidth, splitterY,
												 cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU)cbd->dwButtonCID, g_hInst, NULL);
				CustomizeButton(hwndBtn);
			}
			if (!cbd->bHidden)
				lwidth += cbd->iButtonWidth + gap;
			if (!cbd->bHidden && !cbd->bCanBeHidden)
				dat->iButtonBarReallyNeeds += cbd->iButtonWidth + gap;
			if (!cbd->bSeparator && hwndBtn) {
				SendMessage(hwndBtn, BUTTONSETASFLATBTN, TRUE, 0);
				SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, isThemed != 0, 0);
				if (cbd->hIcon)
					SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
				if (cbd->ptszTooltip)
					SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), BATF_TCHAR);
				SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
				SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0);

				if (hwndBtn && cbd->dwArrowCID)
					SendMessage(hwndBtn, BUTTONSETARROW, cbd->dwArrowCID, 0);
				if (hwndBtn && cbd->bPushButton)
					SendMessage(hwndBtn, BUTTONSETASPUSHBTN, TRUE, 0);
			}
		}
		else if (GetDlgItem(hdlg, cbd->dwButtonCID))
			DestroyWindow(GetDlgItem(hdlg, cbd->dwButtonCID));

		if (cbd->bDisabled)
			EnableWindow(hwndBtn, 0);
		if (cbd->bHidden)
			ShowWindow(hwndBtn, SW_HIDE);
	}

	dat->bbLSideWidth = lwidth;
	dat->bbRSideWidth = rwidth;
}
Пример #25
0
INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (uMsg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);

		ppro = (CVkProto*)lParam;
		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);

		SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
		SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
		{
			ptrT tszLogin(ppro->getTStringA("Login"));
			if (tszLogin != NULL)
				SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);

			ptrT tszPassw(ppro->GetUserStoredPassword());
			if (tszPassw != NULL)
				SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);

			SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
		}
		CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery);
		CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats);
		CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getByte("AutoClean", 0));
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_URL:
			CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
			break;

		case IDC_LOGIN:
		case IDC_PASSWORD:
		case IDC_GROUPNAME:
			if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;

		case IDC_DELIVERY:
		case IDC_HIDECHATS:
		case IDC_AUTOCLEAN:
			if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->code == PSN_APPLY) {
			TCHAR str[128];
			GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
			ppro->setTString("Login", str);

			GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, SIZEOF(str));
			if (_tcscmp(ppro->getGroup(), str)) {
				ppro->setGroup(str);
				ppro->setTString("ProtoGroup", str);
			}

			GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
			ptrA szRawPasswd(mir_utf8encodeT(str));
			if (szRawPasswd != NULL)
				ppro->setString("Password", szRawPasswd);

			ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
			ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);

			ppro->m_bHideChats = IsDlgButtonChecked(hwndDlg, IDC_HIDECHATS) == BST_CHECKED;
			ppro->setByte("HideChats", ppro->m_bHideChats);

			ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
		}
		break;

	case WM_CLOSE:
		EndDialog(hwndDlg, 0);
		break;

	case WM_DESTROY:
		Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
		Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
		break;
	}

	return FALSE;
}
Пример #26
0
static int BuildMenuObjectsTree(HWND hToolBarTree)
{
	HTREEITEM hti;
	int iImage = 0;

	TVINSERTSTRUCT tvis;
	tvis.hParent = NULL;
	tvis.hInsertAfter = TVI_LAST;
	tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_SELECTEDIMAGE | TVIF_IMAGE;

	TreeView_DeleteAllItems(hToolBarTree);

	himgl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2);
	ImageList_AddIcon(himgl, LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT));
	ImageList_Destroy(TreeView_GetImageList(hToolBarTree, TVSIL_NORMAL));
	TreeView_SetImageList(hToolBarTree, himgl, TVSIL_NORMAL);

	if ((RButtonsList.getCount() + LButtonsList.getCount()) == 0)
		return FALSE;

	mir_cslock lck(ToolBarCS);

	for (int i = 0; i < LButtonsList.getCount(); i++) {
		CustomButtonData *cbd = LButtonsList[i];
		tvis.item.lParam = (LPARAM)cbd;

		if (cbd->bSeparator) {
			tvis.item.pszText = TranslateT("<Separator>");
			tvis.item.iImage = tvis.item.iSelectedImage = 0;
		}
		else {
			tvis.item.pszText = TranslateTS(cbd->ptszTooltip);
			iImage = ImageList_AddIcon(himgl, Skin_GetIconByHandle(cbd->hIcon));
			tvis.item.iImage = tvis.item.iSelectedImage = iImage;
		}
		cbd->opFlags = 0;
		hti = TreeView_InsertItem(hToolBarTree, &tvis);

		TreeView_SetCheckState(hToolBarTree, hti, (cbd->bIMButton || cbd->bChatButton));
	}

	tvis.item.lParam = 0;
	tvis.item.mask |= TVIF_STATE;
	tvis.item.pszText = MIDDLE_SEPARATOR;
	tvis.item.stateMask = TVIS_BOLD;
	tvis.item.state = TVIS_BOLD;
	tvis.item.iImage = tvis.item.iSelectedImage = -1;
	hti = TreeView_InsertItem(hToolBarTree, &tvis);
	TreeView_SetCheckState(hToolBarTree, hti, 1);

	for (int i = RButtonsList.getCount()-1; i >= 0; i--) {
		CustomButtonData *cbd = RButtonsList[i];
		tvis.item.lParam = (LPARAM)cbd;

		if (cbd->bSeparator) {
			tvis.item.pszText = TranslateT("<Separator>");
			tvis.item.iImage = tvis.item.iSelectedImage = -1;
		}
		else {
			tvis.item.pszText = TranslateTS(cbd->ptszTooltip);
			iImage = ImageList_AddIcon(himgl, Skin_GetIconByHandle(cbd->hIcon));
			tvis.item.iImage = tvis.item.iSelectedImage = iImage;
		}
		tvis.item.state = 0;
		cbd->opFlags = 0;
		hti = TreeView_InsertItem(hToolBarTree, &tvis);
		TreeView_SetCheckState(hToolBarTree, hti, (cbd->bIMButton || cbd->bChatButton));
	}

	return 1;
}
Пример #27
0
INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{	
	switch(msg) {
	case WM_INITDIALOG:
		{
			int startupmode,exitmode;
			COMBOBOXINFO cbi={0};
			cbi.cbSize = sizeof(cbi);

			opses_count=0;
			g_opHdlg=hdlg;
			bOptionsInit=TRUE;
			TranslateDialogDefault(hdlg);
			hMarked = Skin_GetIconByHandle(iconList[1].hIcolib);
			hNotMarked = Skin_GetIconByHandle(iconList[2].hIcolib);

			hIcon=(bChecked=IsMarkedUserDefSession(opses_count))?hMarked:hNotMarked;

			SetDlgItemInt(hdlg, IDC_TRACK,ses_limit=db_get_b(0, MODNAME, "TrackCount", 10), FALSE);
			SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
			SendDlgItemMessage(hdlg, IDC_SPIN1, UDM_SETPOS, 0, GetDlgItemInt(hdlg, IDC_TRACK, NULL, FALSE));

			SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
			SetDlgItemInt(hdlg, IDC_STARTDELAY, db_get_w(NULL, MODNAME, "StartupModeDelay", 1500), FALSE);
			startupmode = db_get_b(NULL, MODNAME, "StartupMode", 3);
			exitmode = db_get_b(NULL, MODNAME, "ShutdownMode", 2);

			g_bExclHidden = db_get_b(NULL, MODNAME, "ExclHidden", 0);
			g_bWarnOnHidden = db_get_b(NULL, MODNAME, "WarnOnHidden", 0);
			g_bOtherWarnings = db_get_b(NULL, MODNAME, "OtherWarnings", 1);
			g_bCrashRecovery = db_get_b(NULL, MODNAME, "CrashRecovery", 0);

			CheckDlgButton(hdlg,IDC_EXCLHIDDEN,g_bExclHidden?BST_CHECKED:BST_UNCHECKED);
			CheckDlgButton(hdlg,IDC_LASTHIDDENWARN,g_bWarnOnHidden?BST_CHECKED:BST_UNCHECKED);
			CheckDlgButton(hdlg,IDC_WARNINGS,g_bOtherWarnings?BST_CHECKED:BST_UNCHECKED);
			CheckDlgButton(hdlg,IDC_CRASHRECOVERY,g_bCrashRecovery?BST_CHECKED:BST_UNCHECKED);


			if (startupmode == 1)
				CheckDlgButton(hdlg,IDC_STARTDIALOG,BST_CHECKED);
			else if (startupmode == 3) {
				CheckDlgButton(hdlg,IDC_STARTDIALOG,BST_CHECKED);
				CheckDlgButton(hdlg,IDC_CHECKLAST,BST_CHECKED);
			}
			else if (startupmode == 2) {
				CheckDlgButton(hdlg,IDC_RLOADLAST,BST_CHECKED);
				EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
			}
			else if (startupmode == 0)	{
				CheckDlgButton(hdlg,IDC_RNOTHING,BST_CHECKED);
				EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), FALSE);
				EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), FALSE);
				EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), FALSE);
				EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
			}

			if (exitmode == 0) {
				CheckDlgButton(hdlg,IDC_REXDSAVE,BST_CHECKED);
				EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_TRACK),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),FALSE);
			}
			else if (exitmode == 1)
				CheckDlgButton(hdlg,IDC_REXASK,BST_CHECKED);
			else if (exitmode == 2)
				CheckDlgButton(hdlg,IDC_REXSAVE,BST_CHECKED);

			LoadSessionToCombobox (hdlg,1,255,"UserSessionDsc",0);
			if (SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0)) {
				EnableWindow(GetDlgItem(hdlg,IDC_EDIT),TRUE);
				SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
				if (!OpLoadSessionContacts(0,opses_count))
					EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
			}

			GetComboBoxInfo(GetDlgItem(hdlg,IDC_LIST),&cbi);
			mir_subclassWindow(cbi.hwndItem, ComboBoxSubclassProc);

			hComboBoxEdit=cbi.hwndItem;
			hComboBox=cbi.hwndCombo;

			SetWindowPos( hComboBoxEdit, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED );

			bOptionsInit=FALSE;
		}
		break;

	case WM_CTLCOLORLISTBOX:
		switch(GetDlgCtrlID((HWND) lparam)) {
		case IDC_OPCLIST:
			SetBkMode((HDC) wparam, TRANSPARENT);
			return (BOOL) CreateSolidBrush(GetSysColor(COLOR_3DFACE));
		}
		break;

	case WM_NOTIFY:
		switch(((LPNMHDR)lparam)->code) {
		case PSN_APPLY:
			{
				int iDelay=GetDlgItemInt(hdlg, IDC_STARTDELAY,NULL, FALSE);
				db_set_w(0, MODNAME, "StartupModeDelay", (WORD)iDelay);
				db_set_b(0, MODNAME, "TrackCount", (BYTE)(ses_limit=GetDlgItemInt(hdlg, IDC_TRACK,NULL, FALSE)));
				if (IsDlgButtonChecked(hdlg, IDC_REXSAVE))
					db_set_b(NULL, MODNAME, "ShutdownMode", 2);
				else if (IsDlgButtonChecked(hdlg, IDC_REXDSAVE))
					db_set_b(NULL, MODNAME, "ShutdownMode", 0);
				else if (IsDlgButtonChecked(hdlg, IDC_REXASK))
					db_set_b(NULL, MODNAME, "ShutdownMode", 1);

				if (IsDlgButtonChecked(hdlg, IDC_STARTDIALOG)) {
					if (!IsDlgButtonChecked(hdlg, IDC_CHECKLAST))
						db_set_b(NULL, MODNAME, "StartupMode", 1);
					else
						db_set_b(NULL, MODNAME, "StartupMode", 3);
				}
				else if (IsDlgButtonChecked(hdlg, IDC_RLOADLAST))
					db_set_b(NULL, MODNAME, "StartupMode", 2);
				else if (IsDlgButtonChecked(hdlg, IDC_RNOTHING))
					db_set_b(NULL, MODNAME, "StartupMode", 0);

				db_set_b(NULL, MODNAME, "ExclHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_EXCLHIDDEN) ? (g_bExclHidden = 1) : (g_bExclHidden = 0)));
				db_set_b(NULL, MODNAME, "WarnOnHidden", (BYTE)(IsDlgButtonChecked(hdlg, IDC_LASTHIDDENWARN) ? (g_bWarnOnHidden = 1) : (g_bWarnOnHidden = 0)));
				db_set_b(NULL, MODNAME, "OtherWarnings", (BYTE)(IsDlgButtonChecked(hdlg, IDC_WARNINGS) ? (g_bOtherWarnings = 1) : (g_bOtherWarnings = 0)));
				db_set_b(NULL, MODNAME, "CrashRecovery", (BYTE)(IsDlgButtonChecked(hdlg, IDC_CRASHRECOVERY) ? (g_bCrashRecovery = 1) : (g_bCrashRecovery = 0)));
			}
			return 1;

		case CLN_CHECKCHANGED:
			if (((LPNMHDR)lparam)->idFrom  == IDC_EMCLIST)
			{
				int iSelection = (int)((NMCLISTCONTROL *)lparam)->hItem;
				HANDLE hContact = db_find_first();
				for ( ; hContact; hContact = db_find_next(hContact))
					if (SendDlgItemMessage(hdlg, IDC_EMCLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection)
						break;
				if (hContact)
					EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
				else
					EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
			}
		}
		break;

	case WM_COMMAND:
		switch(LOWORD(wparam)) {
		case IDC_LIST:
			switch(HIWORD(wparam)) {
			case CBN_EDITCHANGE:
				EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
				bSesssionNameChanged=TRUE;
				break;

			case CBN_SELCHANGE:
				{
					HWND hCombo = GetDlgItem(hdlg, IDC_LIST);
					int index = SendMessage(hCombo, CB_GETCURSEL, 0, 0);
					if (index != CB_ERR) {
						opses_count = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
						SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
						if (IsMarkedUserDefSession(opses_count)) {
							hIcon=hMarked;
							bChecked=TRUE;
							RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
						}
						else {
							hIcon=hNotMarked;
							bChecked=FALSE;
							RedrawWindow(hComboBoxEdit, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
						}
						OpLoadSessionContacts(0,opses_count);
						if (!hOpClistControl)
							EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE);
						else {
							for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
								SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,0);

							for (int i=0 ; session_list_t[i] > 0; i++) {
								HANDLE hContact = (HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0);
								SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact, 1);
							}
							EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
						}
					}
				}break;
			}break;

		case IDC_EDIT:
			if (!hOpClistControl) {
				ShowWindow(GetDlgItem(hdlg,IDC_OPCLIST),SW_HIDE);
				EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
				//EnableWindow(GetDlgItem(hdlg,IDC_SAVE),TRUE);
				SetWindowText(GetDlgItem(hdlg,IDC_EDIT),TranslateT("View"));
				hOpClistControl = CreateWindowEx(WS_EX_STATICEDGE, _T(CLISTCONTROL_CLASS), _T(""),
					WS_TABSTOP |WS_VISIBLE | WS_CHILD , 
					14,198,161,163,hdlg, (HMENU)IDC_EMCLIST, hinstance, 0);

				SetWindowLongPtr(hOpClistControl, GWL_STYLE,
					GetWindowLongPtr(hOpClistControl, GWL_STYLE)|CLS_CHECKBOXES|CLS_HIDEEMPTYGROUPS|CLS_USEGROUPS|CLS_GREYALTERNATE|CLS_GROUPCHECKBOXES);
				SendMessage(hOpClistControl, CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP|CLS_EX_TRACKSELECT, 0);

				SendMessage(hOpClistControl,WM_TIMER,TIMERID_REBUILDAFTER,0);

				for (int i=0 ; session_list_t[i] > 0; i++) {
					HANDLE hItem=(HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0);
					SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hItem,1);
				}
			}
			else {
				ShowWindow(GetDlgItem(hdlg,IDC_OPCLIST),SW_SHOWNA);
				EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE);
				EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
				SetWindowText(GetDlgItem(hdlg,IDC_EDIT),TranslateT("Edit"));
				DestroyWindow(hOpClistControl);
				hOpClistControl=NULL;
			}
			break;

		case IDC_SAVE:
			{
				int i=0;
				for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
					BYTE res =(BYTE)SendMessage(GetDlgItem(hdlg,IDC_EMCLIST), CLM_GETCHECKMARK,
						SendMessage(GetDlgItem(hdlg,IDC_EMCLIST), CLM_FINDCONTACT, (WPARAM)hContact, 0), 0);
					if (res) {
						SetSessionMark(hContact,1,'1',opses_count);
						SetInSessionOrder(hContact,1,opses_count,i);
						i++;
					}
					else {
						SetSessionMark(hContact,1,'0',opses_count);
						SetInSessionOrder(hContact,1,opses_count,0);
					}
				}
				if (bSesssionNameChanged) {
					if (GetWindowTextLength(hComboBoxEdit)) {
						TCHAR szUserSessionName[MAX_PATH]={'\0'};
						GetWindowText(hComboBoxEdit, szUserSessionName, SIZEOF(szUserSessionName));
						RenameUserDefSession(opses_count,szUserSessionName);
						SendDlgItemMessage(hdlg, IDC_LIST, CB_RESETCONTENT ,0,0);
						LoadSessionToCombobox (hdlg,1,255,"UserSessionDsc",0);
					}
					bSesssionNameChanged=FALSE;
				}
				EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE);
			}
			break;

		case IDC_DEL:
			DelUserDefSession(opses_count);

			SendDlgItemMessage(hdlg, IDC_OPCLIST, LB_RESETCONTENT, 0, 0);
			SendDlgItemMessage(hdlg, IDC_LIST, CB_RESETCONTENT, 0, 0);

			LoadSessionToCombobox (hdlg,1,255,"UserSessionDsc",0);

			opses_count=0;

			if (SendDlgItemMessage(hdlg, IDC_LIST, CB_GETCOUNT, 0, 0)) {
				EnableWindow(GetDlgItem(hdlg,IDC_EDIT),TRUE);
				SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, 0, 0);
				if (!OpLoadSessionContacts(0,opses_count))
					EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
			}
			else {
				EnableWindow(GetDlgItem(hdlg,IDC_EDIT),FALSE);
				EnableWindow(GetDlgItem(hdlg,IDC_DEL),FALSE);
			}
			break;

		case IDC_STARTDIALOG:
			EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), TRUE);
			EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), TRUE);
			EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), TRUE);
			EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), TRUE);
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
			break;

		case IDC_RLOADLAST:
			EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), TRUE);
			EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), TRUE);
			EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), TRUE);
			EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
			break;

		case IDC_RNOTHING:
			EnableWindow(GetDlgItem(hdlg, IDC_STARTDELAY), FALSE);
			EnableWindow(GetDlgItem(hdlg, IDC_STATICOP), FALSE);
			EnableWindow(GetDlgItem(hdlg, IDC_STATICMS), FALSE);
			EnableWindow(GetDlgItem(hdlg, IDC_CHECKLAST), FALSE);
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
			break;

		case IDC_REXSAVE:
			EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),TRUE);
			EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),TRUE);
			EnableWindow(GetDlgItem(hdlg,IDC_TRACK),TRUE);
			EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),TRUE);
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
			break;

		case IDC_REXDSAVE:
			EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),FALSE);
			EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),FALSE);
			EnableWindow(GetDlgItem(hdlg,IDC_TRACK),FALSE);
			EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),FALSE);
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
			break;

		case IDC_REXASK:
			EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC1),TRUE);
			EnableWindow(GetDlgItem(hdlg,IDC_EXSTATIC2),TRUE);
			EnableWindow(GetDlgItem(hdlg,IDC_TRACK),TRUE);
			EnableWindow(GetDlgItem(hdlg,IDC_SPIN1),TRUE);
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);
			break;
		}

		if (HIWORD(wparam) == CBN_DROPDOWN&&!hOpClistControl) {
			SendMessage(hComboBoxEdit,EM_SETSEL ,0,0);
			SendMessage(hComboBoxEdit,EM_SCROLLCARET ,0,0);
			SendMessage(hComboBoxEdit,WM_KILLFOCUS ,0,0);
			HideCaret(hComboBoxEdit);
		}

		if ((HIWORD(wparam)!=CBN_DROPDOWN)&&(LOWORD(wparam) == IDC_LIST)&&!hOpClistControl) {
			SendMessage(hComboBoxEdit,EM_SCROLLCARET ,0,0);
			HideCaret(hComboBoxEdit);
		}

		if ((LOWORD(wparam) == IDC_STARTDELAY) && (HIWORD(wparam)!=EN_CHANGE || (HWND)lparam != GetFocus()))
			return 0;

		if (lparam&&!bOptionsInit&&(HIWORD(wparam) == BN_CLICKED)&& (GetFocus() == (HWND)lparam)
			&&((LOWORD(wparam) == IDC_CHECKLAST)||((LOWORD(wparam)>=IDC_EXCLHIDDEN)&&(LOWORD(wparam)<=IDC_CRASHRECOVERY))))
			SendMessage(GetParent(hdlg),PSM_CHANGED,0,0);

		return 0;

	case WM_CLOSE:
		EndDialog(hdlg,0);
		return 0;
	}
	return 0;
}
Пример #28
0
INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (uMsg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);

		ppro = (CVkProto*)lParam;
		SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );

		SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
		SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
		{
			ptrT tszLogin(ppro->getTStringA("Login"));
			if (tszLogin != NULL)
				SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);

			ptrT tszPassw(ppro->GetUserStoredPassword());
			if (tszPassw != NULL)
				SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_URL:
			CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
			break;

		case IDC_LOGIN:
		case IDC_PASSWORD:
			if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
				break;
			}
		}
		break;

	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code) {
		case PSN_APPLY:
			TCHAR str[128];
			GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
			ppro->setTString("Login", str);
			
			GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
			ptrA szRawPasswd( mir_utf8encodeT(str));
			if (szRawPasswd != NULL)
				ppro->setString("Password", szRawPasswd);
		}
		break;

	case WM_CLOSE:
		EndDialog(hwndDlg, 0);
		break;

	case WM_DESTROY:
		Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
		Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
		break;
	}

	return FALSE;
}