diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 18:43:53 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 18:43:53 +0000 |
commit | 6e7c24ee5cd7ce88266ceae158c31c62d7498d3f (patch) | |
tree | 7fe0d691192959f1a31095aa35dc5efb147f88c8 /media/tools/player_wtl/seek.h | |
parent | a999b0e58e1ca80435c7322df5cb229b64be113f (diff) | |
download | chromium_src-6e7c24ee5cd7ce88266ceae158c31c62d7498d3f.zip chromium_src-6e7c24ee5cd7ce88266ceae158c31c62d7498d3f.tar.gz chromium_src-6e7c24ee5cd7ce88266ceae158c31c62d7498d3f.tar.bz2 |
Re-organizing all tools under /src/media to be consistent with the rest of the repository.
TEST=n/a
BUG=n/a
Review URL: http://codereview.chromium.org/431046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/tools/player_wtl/seek.h')
-rw-r--r-- | media/tools/player_wtl/seek.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/media/tools/player_wtl/seek.h b/media/tools/player_wtl/seek.h new file mode 100644 index 0000000..84f3c95 --- /dev/null +++ b/media/tools/player_wtl/seek.h @@ -0,0 +1,97 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// source code is governed by a BSD-style license that can be found in the +// LICENSE file. + +#ifndef MEDIA_TOOLS_PLAYER_WTL_SEEK_H_ +#define MEDIA_TOOLS_PLAYER_WTL_SEEK_H_ + +#include "media/tools/player_wtl/player_wtl.h" + +// Movie seek dialog. +// TODO(fbachard): Frame properties only work for images, so +// this tab is removed until movie frame properties can be added. +class CSeek : public CSimpleDialog<IDD_SEEK>, + public CMessageFilter, + public CIdleHandler { + public: + CSeek() { + } + + virtual BOOL PreTranslateMessage(MSG* pMsg) { + return FALSE; + } + + BEGIN_MSG_MAP(CSeek) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + CHAIN_MSG_MAP(CSimpleDialog<IDD_SEEK>) + END_MSG_MAP() + + LRESULT OnPaint(UINT /*uMsg*/, + WPARAM /*wParam*/, + LPARAM /*lParam*/, + BOOL& bHandled) { + static float previous_position = -1.0f; + + float position = media::Movie::get()->GetPosition(); + if (static_cast<int>(position * 10) != + static_cast<int>(previous_position * 10)) { + previous_position = position; + wchar_t szBuff[200]; + float duration = media::Movie::get()->GetDuration(); + float fps = 29.97f; + wsprintf(szBuff, L"%i.%i / %i.%i, %i / %i", + static_cast<int>(position), + static_cast<int>(position * 10) % 10, + static_cast<int>(duration), + static_cast<int>(duration * 10) % 10, + static_cast<int>(position * fps), + static_cast<int>(duration * fps)); + SetDlgItemText(IDC_SEEKLOCATION, szBuff); + bHandled = TRUE; + return FALSE; + } + bHandled = FALSE; + return FALSE; + } + + virtual BOOL OnIdle() { + wchar_t szBuff[200]; + float position = media::Movie::get()->GetPosition(); + float duration = media::Movie::get()->GetDuration(); + // TODO(fbarchard): Use frame rate property when it exists. + float fps = 29.97f; + wsprintf(szBuff, L"%i.%i / %i.%i, %i / %i", + static_cast<int>(position), + static_cast<int>(position * 10) % 10, + static_cast<int>(duration), + static_cast<int>(duration * 10) % 10, + static_cast<int>(position * fps), + static_cast<int>(duration * fps)); + SetDlgItemText(IDC_SEEKLOCATION, szBuff); + return FALSE; + } + + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, + BOOL& /*bHandled*/) { + CMessageLoop* pLoop = g_module.GetMessageLoop(); + ATLASSERT(pLoop != NULL); + pLoop->AddMessageFilter(this); + pLoop->AddIdleHandler(this); + return TRUE; + } + + LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, + BOOL& bHandled) { + // unregister message filtering and idle updates + CMessageLoop* pLoop = g_module.GetMessageLoop(); + ATLASSERT(pLoop != NULL); + pLoop->RemoveMessageFilter(this); + pLoop->RemoveIdleHandler(this); + bHandled = FALSE; + return 1; + } +}; + +#endif // MEDIA_TOOLS_PLAYER_WTL_SEEK_H_ |