LRESULT AnimeDialog::OnNotify(int idCtrl, LPNMHDR pnmh) { switch (idCtrl) { case IDC_LINK_NOWPLAYING: { switch (pnmh->code) { // Link click case NM_CLICK: { PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pnmh); wstring action = pNMLink->item.szUrl; if (IsEqual(pNMLink->item.szID, L"menu")) { action = UI.Menus.Show(m_hWindow, 0, 0, pNMLink->item.szUrl); } else if (IsEqual(pNMLink->item.szID, L"search")) { action = L"SearchAnime(" + CurrentEpisode.title + L")"; } else if (IsEqual(pNMLink->item.szUrl, L"score")) { action = L""; CurrentEpisode.anime_id = ToInt(pNMLink->item.szID); auto anime_item = AnimeDatabase.FindItem(CurrentEpisode.anime_id); if (anime_item) { anime_item->AddtoUserList(); auto synonyms = anime_item->GetUserSynonyms(); synonyms.push_back(CurrentEpisode.title); anime_item->SetUserSynonyms(synonyms); Meow.UpdateCleanTitles(anime_item->GetId()); Settings.Save(); anime_item->StartWatching(CurrentEpisode); MainDialog.ChangeStatus(); } } ExecuteAction(action, 0, GetCurrentId()); return TRUE; } // Custom draw case NM_CUSTOMDRAW: { return CDRF_DODEFAULT; } } break; } case IDC_TAB_ANIME: { switch (pnmh->code) { // Tab select case TCN_SELCHANGE: { SetCurrentPage(tab_.GetCurrentlySelected() + 1); break; } } break; } } return 0; }
void TorrentDialog::Search(std::wstring url, int anime_id) { auto anime_item = AnimeDatabase.FindItem(anime_id); if (!anime_item) return; std::wstring title = anime_item->GetTitle(); if (anime_item->GetUseAlternative() && anime_item->UserSynonymsAvailable()) title = anime_item->GetUserSynonyms().front(); Search(url, title); }