int QuotesEventFunc_OptInitialise(WPARAM wp, LPARAM/* lp*/) { const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders(); OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 910000000; odp.hInstance = g_hInstance; odp.ptszTitle = _T(QUOTES_PROTOCOL_NAME); odp.ptszGroup = LPGENT("Network"); odp.hIcon = Quotes_LoadIconEx(IDI_ICON_MAIN); odp.flags = ODPF_USERINFOTAB | ODPF_TCHAR; std::for_each(rapProviders.begin(), rapProviders.end(), boost::bind(&IQuotesProvider::ShowPropertyPage, _1, wp, boost::ref(odp))); return 0; }
int QuotesEventFunc_OnUserInfoInit(WPARAM wp, LPARAM lp) { MCONTACT hContact = MCONTACT(lp); if (NULL == hContact) return 0; if (false == IsMyContact(hContact)) return 0; g_hContact = hContact; OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = g_hInstance; odp.hIcon = Quotes_LoadIconEx(ICON_STR_MAIN); odp.pfnDlgProc = QuoteInfoDlgProc; odp.position = -2000000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_QUOTE_INFO); odp.pszTitle = LPGEN("Quote"); UserInfo_AddPage(wp, &odp); return 0; }
bool show_popup(const IQuotesProvider* pProvider, MCONTACT hContact, const CTendency& tendency, const tstring& rsFormat, const CPopupSettings& ps) { if (!ServiceExists(MS_POPUP_ADDPOPUPT)) return false; POPUPDATAT ppd; memset(&ppd, 0, sizeof(ppd)); ppd.lchContact = hContact; if (tendency.IsValid()) { CTendency::EResult nComparison = tendency.Compare(); if (CTendency::NotChanged == nComparison) ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_NOTCHANGED); else if (CTendency::Up == nComparison) ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_UP); else if (CTendency::Down == nComparison) ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_DOWN); } CQuotesProviderVisitorFormater visitor(hContact, _T('s'), 0); pProvider->Accept(visitor); const tstring& sTitle = visitor.GetResult(); mir_tstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME); { ptrT ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact)); tstring sText = format_rate(pProvider, hContact, tstring(ss)); mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE); } if (CPopupSettings::colourDefault == ps.GetColourMode()) { ppd.colorText = CPopupSettings::GetDefColourText(); ppd.colorBack = CPopupSettings::GetDefColourBk(); } else { ppd.colorText = ps.GetColourText(); ppd.colorBack = ps.GetColourBk(); } switch (ps.GetDelayMode()) { default: assert(!"Unknown popup delay mode"); case CPopupSettings::delayFromPopup: ppd.iSeconds = 0; break; case CPopupSettings::delayPermanent: ppd.iSeconds = -1; break; case CPopupSettings::delayCustom: ppd.iSeconds = ps.GetDelayTimeout(); break; } LPARAM lp = 0; if (false == ps.GetHistoryFlag()) lp |= 0x08; return (0 == CallService(MS_POPUP_ADDPOPUPT, reinterpret_cast<WPARAM>(&ppd), lp)); }