STDMETHODIMP CFHtmlEventDispatcher::ShowContextMenu(VARIANT wParam, VARIANT lParam, VARIANT* ppRes) { ppRes->vt = VT_I4; ppRes->lVal = 0; switch(wParam.ulVal) { case 1: //status right click { FArray<FString> aVideoIDs; VariantToUINTArray(lParam, aVideoIDs); if (aVideoIDs.GetCount() > 0) ppRes->lVal = (LONG)g_MainFrame->m_Container->m_pStatus->ShowContextMenu(aVideoIDs); } break; case 2: //channelguide right click { g_MainFrame->m_Container->m_pBrowser->ShowContextMenu(); } break; case 10: //toolbar right click ppRes->lVal = g_MainFrame->ShowMenu(); break; } return S_OK; }
void FBSplineSurface::samplePoints(std::vector< std::vector< double > > &points, double tResolution, double uResolution) { double currentT = knots1[0]; double currentU = knots2[0]; double deltaT = tResolution; double deltaU = uResolution; int stepsT = numSamplePointsT = (int)((knots1[knots1.size() - 1] - knots1[0]) / deltaT + 1); int stepT = 0; int stepsU = numSamplePointsU = (int)((knots2[knots2.size() - 1] - knots2[0]) / deltaU + 1); int stepU = 0; for( stepU = 0; stepU < stepsU; stepU++) { currentU = knots2[0] + stepU * deltaU; for( stepT = 0; stepT < stepsT; stepT++) { std::vector< double > dmy; currentT = knots1[0] + stepT * deltaT; FArray samplePoint = this->f(currentT, currentU); samplePoint.getCoordinates(dmy); points.push_back(dmy); } } return; }
size_t VariantToUINTArray(VARIANT vtVar, FArray<FString>& aVids) { USES_CONVERSION; if (vtVar.vt == VT_BSTR) { const tchar* psz = OLE2T(vtVar.bstrVal); if (psz != NULL) { if (NULL != strchr(psz, ',')) { SplitStringToArray(psz, aVids); } else { aVids.Add(psz); } } } else { FString StrVid; StrVid.Format("%u", VariantToUINT(vtVar)); aVids.Add(StrVid); } return aVids.GetCount(); }
size_t BuildDownloadArray(FArray<FDownload> &DownArray, const FArray<FString>& aVids) { for (size_t k = 0; k < aVids.GetCount(); k++) { vidtype videoID = strtoul(aVids[k], NULL, 10); FDownload pVideo = g_Objects._DownloadManager.GetDownloadInfo(videoID); if (pVideo.IsValid()) { DownArray.Add(pVideo); } } return DownArray.GetCount(); }
void FBSpline::samplePoints(std::vector< std::vector< double > > &points, double resolution) { double deltaT = resolution; double currentT = knots[0]; int steps = (int)((knots[knots.size() - 1] - knots[0]) / deltaT + 1); for( int step = 0; step < steps; step++) { std::vector< double > dmy; currentT = knots[0] + step * deltaT; FArray samplePoint = f(currentT); samplePoint.getCoordinates(dmy); points.push_back(dmy); } }
// Action_VelocityAutoCorr::ParallelPreloadFrames() int Action_VelocityAutoCorr::ParallelPreloadFrames(FArray const& preload_frames) { if (!useVelInfo_) { unsigned int idx = preload_frames.size() - 1; previousFrame_ = preload_frames[idx]; } return 0; }
void FLabels::ParseLabelStr(const tchar* pszLabelString, BOOL bAddToList) { if (!bAddToList) { m_Labels.RemoveAll(); m_LabelStr = ""; } FArray<FString> aArray; SplitStringToArray(pszLabelString, aArray, ","); for (size_t k = 0; k < aArray.GetCount(); k++) { AddLabel(aArray[k]); } BuildLabelStr(); }
FArray FBSplineSurface::f(double _t, double _u) { /* numDeBoorPoints1 -> t-parameter (knots1) n 0,0 _____________x_____________ u | | | | | | | | | | m |_____________x____________| D | | | | | | | | | | e |_____________x____________| first all splines with t-param B | | | | | | | | | | then final spline with u-param o |_____________x____________| o | | | | | | | | | | r |____________[x]___________| f(t, u) P | | | | | | | | | | 2 |_____________x____________| -> | | | | | | | | | | u |_____________x____________| - | | | | | | | | | | param|_____________x____________| (knots2)| | | | | | | | | | |_____________x____________| */ std::vector< std::vector< double > > uSplineDeBoorPoints; for(int row = 0; row < numDeBoorPoints2; row++) { std::vector< std::vector< double > > tSplineDeBoorPoints; for(int col = 0; col < numDeBoorPoints1; col++) tSplineDeBoorPoints.push_back(this->deBoorPoints[row * numDeBoorPoints1 + col]); FBSpline tSpline(order1, tSplineDeBoorPoints); FArray dmyArray = tSpline.f(_t); std::vector< double > dmyVector; dmyArray.getCoordinates(dmyVector); uSplineDeBoorPoints.push_back(dmyVector); } FBSpline uSpline(order2, uSplineDeBoorPoints); return uSpline.f(_u); }
void BuildLabelsUnion(FArray<FDownload>& DownArray, FLabels& AllLabels, FLabels& CommonLabels) { for (size_t k = 0; k < DownArray.GetCount(); k++) { CopyLabels(AllLabels, DownArray[k].m_Detail.m_Labels); } size_t j = 0; for (size_t k = 0; k < AllLabels.GetItemCount(); k++) { const FString& StrLabel = AllLabels.GetLabelAt(k); for ( j = 0; j < DownArray.GetCount(); j++) { if (!DownArray[j].m_Detail.m_Labels.HasLabel(StrLabel)) break; } if (j == DownArray.GetCount()) { CommonLabels.AddLabel(StrLabel); } } }
int Action_AtomicCorr::ParallelPreloadFrames(FArray const& preload_frames) { unsigned int idx = preload_frames.size() - 1; previousFrame_ = preload_frames[idx]; return 0; }
int FCollectionMenu::ShowContextMenu(HWND hWndParent, const FArray<FString> &aVids) { FArray<FDownload> aVideos; size_t videoCount = BuildDownloadArray(aVideos, aVids); if (videoCount == 0) return 0; vidtype videoID = aVideos[0].m_Detail.m_VideoID; FDownload &pVideo = aVideos[0]; HMENU hmenu = CreatePopupMenu(); int i = 0; if (videoCount == 1 ) { if (pVideo.m_dwFlags & FLAG_DOWNLOAD_FINISHED) _InsertMenuItem(hmenu, i++, miPlay, "Play"); if (!pVideo.IsDownloadFinished()) { if (pVideo.m_dwFlags & FLAG_DOWNLOAD_QUEUED ) _InsertMenuItem(hmenu, i++, miStart, "Start Download"); else _InsertMenuItem(hmenu, i++, miSuspend, pVideo.IsPaused() ? "Resume Download" : "Suspend Download"); } else { if (pVideo.IsDownloadableStream()) _InsertMenuItem(hmenu, i++, miStart, "Download Video"); } _InsertMenuItem(hmenu, i++, miInfo, "Info..."); _InsertMenuItem(hmenu, i++, miRename, "Rename"); } _InsertMenuItem(hmenu, i++, miDelete, "Delete"); _InsertMenuSeparator(hmenu, i++); FLabels aAllLabels; FLabels aCommonLabels; BuildLabelsUnion(aVideos, aAllLabels, aCommonLabels); HMENU hSub = CreateLabelsSubmenu(aCommonLabels, 100); _InsertSubMenu(hmenu, i++, "Label", hSub); if (videoCount == 1) _InsertMenuItem(hmenu, i++, miRevealFiles, "Reveal Files"); BOOL bShowReveal = g_AppSettings.m_LogEnabled; #ifdef _DEBUG bShowReveal = TRUE; #endif if (bShowReveal) _InsertMenuItem(hmenu, i++, miRevealMTTI, "Reveal MTTI"); POINT pt; GetCursorPos(&pt); int nCmd = TrackPopupMenu(hmenu, TPM_RETURNCMD, pt.x, pt.y, 0, hWndParent, NULL); if (nCmd < 100) { switch(nCmd) { case miPlay: g_MainFrame->PlayMediaFile(videoID); break; case miRename: { FString StrNewName = ShowRenameDlg(hWndParent, pVideo.m_Detail.m_VideoName); if (StrNewName != "") { pVideo.m_Detail.m_VideoName = StrNewName; g_Objects._DownloadManager.SaveVideoDetails(pVideo.GetVideoID(), pVideo.m_Detail); } } break; case miSuspend: for (size_t k = 0; k < aVideos.GetCount(); k++) { FDownload& pVideo = aVideos[k]; if (!pVideo.IsPaused()) g_Objects._DownloadManager.PauseDownload(videoID); else g_Objects._DownloadManager.ResumeDownload(videoID); } break; case miDelete: for (size_t k = 0; k < aVideos.GetCount(); k++) { g_MainFrame->RemoveVideo(aVideos[k].m_Detail.m_VideoID); //g_Objects._DownloadManager.RemoveDownload(aVideos[k].m_Detail.m_VideoID); } break; case miRevealFiles: { FString StrExec; if (pVideo.m_Clips.GetCount() > 0) StrExec = pVideo.m_Clips[0]->m_DataPath; ShellExecute(NULL, "open", StrExec, "", "", SW_SHOW); } break; case miRevealMTTI: { FString MTTFileName = g_Objects._DownloadManager.GetDownloadMTTI(videoID); ShellExecute(NULL, "open", "notepad", MTTFileName, "", SW_SHOW); } break; case miStart: { IVideoPlayer* pPlayer = g_MainFrame->GetPlayer(); if (pPlayer) { if (pPlayer->GetVideoID() == videoID) pPlayer->Stop(); } g_Objects._DownloadManager.StartQueuedDownload(videoID); } break; case miInfo: { //Navigate to details if episodeID exists. //If it's a RSS Feed, GoToChannelById() //If it's neither, open the folder g_MainFrame->EpisodeDetails(videoID); } break; } } if (nCmd >= 100) { int idStr = nCmd - 100; if (idStr == 0) { FString StrLabel = ShowAddLabelDlg(hWndParent, ""); if (StrLabel.GetLength() > 0) { g_Objects._LabelManager.AddLabel(StrLabel); for (size_t k = 0; k < aVideos.GetCount(); k++) { g_Objects._DownloadManager.AddLabel(aVideos[k].m_Detail.m_VideoID, StrLabel); } } nCmd = 0; } else if (idStr > 0 && idStr <= (int)m_zeLabels.GetCount()) { FString SelectedLabel = m_zeLabels[idStr - 1]; UINT uState = GetMenuState(hSub, idStr + 100, MF_BYCOMMAND); if (uState != (UINT)-1) { for (size_t k = 0; k < aVideos.GetCount(); k++) { if (uState == MF_CHECKED) g_Objects._DownloadManager.RemoveLabel(aVideos[k].m_Detail.m_VideoID, SelectedLabel); else g_Objects._DownloadManager.AddLabel(aVideos[k].m_Detail.m_VideoID, SelectedLabel); } } } } DestroyMenu(hSub); DestroyMenu(hmenu); return nCmd; }