Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: media/tools/player_wtl/mainfrm.h

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef MEDIA_TOOLS_PLAYER_WTL_MAINFRM_H_ 5 #ifndef MEDIA_TOOLS_PLAYER_WTL_MAINFRM_H_
6 #define MEDIA_TOOLS_PLAYER_WTL_MAINFRM_H_ 6 #define MEDIA_TOOLS_PLAYER_WTL_MAINFRM_H_
7 7
8 #include "media/tools/player_wtl/list.h" 8 #include "media/tools/player_wtl/list.h"
9 #include "media/tools/player_wtl/props.h" 9 #include "media/tools/player_wtl/props.h"
10 #include "media/tools/player_wtl/seek.h" 10 #include "media/tools/player_wtl/seek.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 virtual BOOL PreTranslateMessage(MSG* pMsg) { 55 virtual BOOL PreTranslateMessage(MSG* pMsg) {
56 if (CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg)) 56 if (CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg))
57 return TRUE; 57 return TRUE;
58 58
59 return m_view.PreTranslateMessage(pMsg); 59 return m_view.PreTranslateMessage(pMsg);
60 } 60 }
61 61
62 virtual BOOL OnIdle() { 62 virtual BOOL OnIdle() {
63 BOOL bEnable = !m_view.bmp_.IsNull(); 63 BOOL bEnable = !m_view.bmp_.IsNull();
64 BOOL bMovieOpen = media::Movie::get()->IsOpen() ? true : false; 64 BOOL bMovieOpen = media::Movie::GetInstance()->IsOpen() ? true : false;
65 65
66 float current_position = media::Movie::get()->GetPosition(); 66 float current_position = media::Movie::GetInstance()->GetPosition();
67 float duration = media::Movie::get()->GetDuration(); 67 float duration = media::Movie::GetInstance()->GetDuration();
68 if (enable_exit && bEnable && 68 if (enable_exit && bEnable &&
69 duration > 0.0f && current_position >= duration) { 69 duration > 0.0f && current_position >= duration) {
70 OnFileExit(0, 0, 0); 70 OnFileExit(0, 0, 0);
71 } 71 }
72 72
73 UIEnable(ID_FILE_PRINT, bEnable); 73 UIEnable(ID_FILE_PRINT, bEnable);
74 UIEnable(ID_FILE_PRINT_PREVIEW, bEnable); 74 UIEnable(ID_FILE_PRINT_PREVIEW, bEnable);
75 UISetCheck(ID_FILE_PRINT_PREVIEW, m_bPrintPreview); 75 UISetCheck(ID_FILE_PRINT_PREVIEW, m_bPrintPreview);
76 UIEnable(ID_EDIT_COPY, bEnable); 76 UIEnable(ID_EDIT_COPY, bEnable);
77 UIEnable(ID_EDIT_PASTE, ::IsClipboardFormatAvailable(CF_BITMAP)); 77 UIEnable(ID_EDIT_PASTE, ::IsClipboardFormatAvailable(CF_BITMAP));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 UISetCheck(ID_VIEW_HALFSIZE, (view_size == 1)); 297 UISetCheck(ID_VIEW_HALFSIZE, (view_size == 1));
298 UISetCheck(ID_VIEW_NORMALSIZE, (view_size == 2)); 298 UISetCheck(ID_VIEW_NORMALSIZE, (view_size == 2));
299 UISetCheck(ID_VIEW_DOUBLESIZE, (view_size == 3)); 299 UISetCheck(ID_VIEW_DOUBLESIZE, (view_size == 3));
300 UISetCheck(ID_VIEW_TRIPLESIZE, (view_size == 4)); 300 UISetCheck(ID_VIEW_TRIPLESIZE, (view_size == 4));
301 UISetCheck(ID_VIEW_QUADRUPLESIZE, (view_size == 5)); 301 UISetCheck(ID_VIEW_QUADRUPLESIZE, (view_size == 5));
302 UISetCheck(ID_VIEW_FITTOSCREEN, (view_size == 6)); 302 UISetCheck(ID_VIEW_FITTOSCREEN, (view_size == 6));
303 UISetCheck(ID_VIEW_FULLSCREEN, (view_size == 7)); 303 UISetCheck(ID_VIEW_FULLSCREEN, (view_size == 7));
304 } 304 }
305 305
306 void UpdateSpeedUICheck() { 306 void UpdateSpeedUICheck() {
307 if (media::Movie::get()) { 307 if (media::Movie::GetInstance()) {
308 float play_rate = media::Movie::get()->GetPlayRate(); 308 float play_rate = media::Movie::GetInstance()->GetPlayRate();
309 UISetCheck(ID_PLAY_HALFSPEED, (play_rate == 0.5f)); 309 UISetCheck(ID_PLAY_HALFSPEED, (play_rate == 0.5f));
310 UISetCheck(ID_PLAY_NORMALSPEED, (play_rate == 1.0f)); 310 UISetCheck(ID_PLAY_NORMALSPEED, (play_rate == 1.0f));
311 UISetCheck(ID_PLAY_DOUBLESPEED, (play_rate == 2.0f)); 311 UISetCheck(ID_PLAY_DOUBLESPEED, (play_rate == 2.0f));
312 UISetCheck(ID_PLAY_TRIPLESPEED, (play_rate == 3.0f)); 312 UISetCheck(ID_PLAY_TRIPLESPEED, (play_rate == 3.0f));
313 UISetCheck(ID_PLAY_QUADRUPLESPEED, (play_rate == 4.0f)); 313 UISetCheck(ID_PLAY_QUADRUPLESPEED, (play_rate == 4.0f));
314 UISetCheck(ID_PLAY_EIGHTSPEED, (play_rate == 8.0f)); 314 UISetCheck(ID_PLAY_EIGHTSPEED, (play_rate == 8.0f));
315 UISetCheck(ID_PLAY_SIXTEENSPEED, (play_rate == 16.0f)); 315 UISetCheck(ID_PLAY_SIXTEENSPEED, (play_rate == 16.0f));
316 } 316 }
317 } 317 }
318 318
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return true; 415 return true;
416 } 416 }
417 417
418 bool MovieOpenFile(const wchar_t* file_name) { 418 bool MovieOpenFile(const wchar_t* file_name) {
419 bool success = false; 419 bool success = false;
420 420
421 if (m_bPrintPreview) 421 if (m_bPrintPreview)
422 TogglePrintPreview(); 422 TogglePrintPreview();
423 423
424 // If a movie is open, close it. 424 // If a movie is open, close it.
425 media::Movie::get()->Close(); 425 media::Movie::GetInstance()->Close();
426 426
427 if (IsMovie(file_name)) { 427 if (IsMovie(file_name)) {
428 success = media::Movie::get()->Open(file_name, m_view.renderer_); 428 success = media::Movie::GetInstance()->Open(file_name, m_view.renderer_);
429 } else { 429 } else {
430 HBITMAP hbmp = NULL; 430 HBITMAP hbmp = NULL;
431 hbmp = (HBITMAP)::LoadImage(NULL, file_name, IMAGE_BITMAP, 0, 0, 431 hbmp = (HBITMAP)::LoadImage(NULL, file_name, IMAGE_BITMAP, 0, 0,
432 LR_CREATEDIBSECTION | LR_DEFAULTCOLOR | 432 LR_CREATEDIBSECTION | LR_DEFAULTCOLOR |
433 LR_LOADFROMFILE); 433 LR_LOADFROMFILE);
434 if (hbmp) { 434 if (hbmp) {
435 m_view.SetBitmap(hbmp); 435 m_view.SetBitmap(hbmp);
436 success = true; 436 success = true;
437 } 437 }
438 } 438 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } else { 583 } else {
584 MessageBox(L"Can't open clipboard to paste", 584 MessageBox(L"Can't open clipboard to paste",
585 g_lpcstrApp, MB_OK | MB_ICONERROR); 585 g_lpcstrApp, MB_OK | MB_ICONERROR);
586 } 586 }
587 } 587 }
588 588
589 void OnEditClear(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 589 void OnEditClear(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
590 if (m_bPrintPreview) 590 if (m_bPrintPreview)
591 TogglePrintPreview(); 591 TogglePrintPreview();
592 592
593 media::Movie::get()->Close(); 593 media::Movie::GetInstance()->Close();
594 m_view.Reset(); 594 m_view.Reset();
595 UpdateTitleBar(NULL); 595 UpdateTitleBar(NULL);
596 m_szFilePath[0] = 0; 596 m_szFilePath[0] = 0;
597 } 597 }
598 598
599 void OnViewSize(UINT /*uNotifyCode*/, int nID, CWindow /*wnd*/) { 599 void OnViewSize(UINT /*uNotifyCode*/, int nID, CWindow /*wnd*/) {
600 m_view.SetViewSize(nID - ID_VIEW_QUARTERSIZE); 600 m_view.SetViewSize(nID - ID_VIEW_QUARTERSIZE);
601 UpdateSizeUICheck(); 601 UpdateSizeUICheck();
602 UpdateLayout(); 602 UpdateLayout();
603 } 603 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 void OnViewProperties(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 636 void OnViewProperties(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
637 CBmpProperties prop; 637 CBmpProperties prop;
638 if (lstrlen(m_szFilePath) > 0) // we have a file name 638 if (lstrlen(m_szFilePath) > 0) // we have a file name
639 prop.SetFileInfo(m_szFilePath, NULL); 639 prop.SetFileInfo(m_szFilePath, NULL);
640 else // must be clipboard then 640 else // must be clipboard then
641 prop.SetFileInfo(NULL, m_view.bmp_.m_hBitmap); 641 prop.SetFileInfo(NULL, m_view.bmp_.m_hBitmap);
642 prop.DoModal(); 642 prop.DoModal();
643 } 643 }
644 644
645 void OnPlayPlayPause(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 645 void OnPlayPlayPause(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
646 bool paused = !media::Movie::get()->GetPause(); 646 bool paused = !media::Movie::GetInstance()->GetPause();
647 media::Movie::get()->SetPause(paused); 647 media::Movie::GetInstance()->SetPause(paused);
648 } 648 }
649 649
650 void OnPlayStepForward(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 650 void OnPlayStepForward(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
651 float current_position = media::Movie::get()->GetPosition(); 651 float current_position = media::Movie::GetInstance()->GetPosition();
652 media::Movie::get()->SetPosition(current_position + 10.0f); 652 media::Movie::GetInstance()->SetPosition(current_position + 10.0f);
653 } 653 }
654 654
655 void OnPlayStepBackward(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 655 void OnPlayStepBackward(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
656 float current_position = media::Movie::get()->GetPosition(); 656 float current_position = media::Movie::GetInstance()->GetPosition();
657 media::Movie::get()->SetPosition(current_position - 10.0f); 657 media::Movie::GetInstance()->SetPosition(current_position - 10.0f);
658 } 658 }
659 659
660 void OnPlayGotoStart(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 660 void OnPlayGotoStart(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
661 media::Movie::get()->SetPosition(0.0); 661 media::Movie::GetInstance()->SetPosition(0.0);
662 } 662 }
663 663
664 void OnPlayGotoEnd(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 664 void OnPlayGotoEnd(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
665 float current_position = media::Movie::get()->GetDuration(); 665 float current_position = media::Movie::GetInstance()->GetDuration();
666 media::Movie::get()->SetPosition(current_position - 30.0f); 666 media::Movie::GetInstance()->SetPosition(current_position - 30.0f);
667 } 667 }
668 668
669 void SetPlayRate(int play_speed) { 669 void SetPlayRate(int play_speed) {
670 if (play_speed == 0) { 670 if (play_speed == 0) {
671 media::Movie::get()->Play(0.5f); 671 media::Movie::GetInstance()->Play(0.5f);
672 } else if (play_speed == 2) { 672 } else if (play_speed == 2) {
673 media::Movie::get()->Play(2.0f); 673 media::Movie::GetInstance()->Play(2.0f);
674 } else if (play_speed == 3) { 674 } else if (play_speed == 3) {
675 media::Movie::get()->Play(3.0f); 675 media::Movie::GetInstance()->Play(3.0f);
676 } else if (play_speed == 4) { 676 } else if (play_speed == 4) {
677 media::Movie::get()->Play(4.0f); 677 media::Movie::GetInstance()->Play(4.0f);
678 } else if (play_speed == 5) { 678 } else if (play_speed == 5) {
679 media::Movie::get()->Play(8.0f); 679 media::Movie::GetInstance()->Play(8.0f);
680 } else if (play_speed == 6) { 680 } else if (play_speed == 6) {
681 media::Movie::get()->Play(16.0f); 681 media::Movie::GetInstance()->Play(16.0f);
682 } else { 682 } else {
683 media::Movie::get()->Play(1.0f); 683 media::Movie::GetInstance()->Play(1.0f);
684 } 684 }
685 } 685 }
686 686
687 void OnPlaySpeed(UINT /*uNotifyCode*/, int nID, CWindow /*wnd*/) { 687 void OnPlaySpeed(UINT /*uNotifyCode*/, int nID, CWindow /*wnd*/) {
688 int play_speed = nID - ID_PLAY_HALFSPEED; 688 int play_speed = nID - ID_PLAY_HALFSPEED;
689 SetPlayRate(play_speed); 689 SetPlayRate(play_speed);
690 UpdateSpeedUICheck(); 690 UpdateSpeedUICheck();
691 UpdateLayout(); 691 UpdateLayout();
692 } 692 }
693 693
694 void OnOptionsExit(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 694 void OnOptionsExit(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
695 // TODO(fbarchard): Implement when pipeline exposes properties. 695 // TODO(fbarchard): Implement when pipeline exposes properties.
696 enable_exit = !enable_exit; 696 enable_exit = !enable_exit;
697 UISetCheck(ID_OPTIONS_EXIT, enable_exit); 697 UISetCheck(ID_OPTIONS_EXIT, enable_exit);
698 UpdateLayout(); 698 UpdateLayout();
699 } 699 }
700 700
701 void OnOptionsDraw(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 701 void OnOptionsDraw(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
702 bool enable_draw = !media::Movie::get()->GetDrawEnable(); 702 bool enable_draw = !media::Movie::GetInstance()->GetDrawEnable();
703 media::Movie::get()->SetDrawEnable(enable_draw); 703 media::Movie::GetInstance()->SetDrawEnable(enable_draw);
704 UISetCheck(ID_OPTIONS_DRAW, enable_draw); 704 UISetCheck(ID_OPTIONS_DRAW, enable_draw);
705 UpdateLayout(); 705 UpdateLayout();
706 } 706 }
707 707
708 void OnOptionsAudio(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 708 void OnOptionsAudio(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
709 bool enable_audio = !media::Movie::get()->GetAudioEnable(); 709 bool enable_audio = !media::Movie::GetInstance()->GetAudioEnable();
710 media::Movie::get()->SetAudioEnable(enable_audio); 710 media::Movie::GetInstance()->SetAudioEnable(enable_audio);
711 UISetCheck(ID_OPTIONS_AUDIO, enable_audio); 711 UISetCheck(ID_OPTIONS_AUDIO, enable_audio);
712 UpdateLayout(); 712 UpdateLayout();
713 } 713 }
714 714
715 void OnOptionsDumpYUVFile(UINT /*uNotify*/, int /*nID*/, CWindow /*wnd*/) { 715 void OnOptionsDumpYUVFile(UINT /*uNotify*/, int /*nID*/, CWindow /*wnd*/) {
716 bool enable_dump_yuv_file = !media::Movie::get()->GetDumpYuvFileEnable(); 716 bool enable_dump_yuv_file =
717 media::Movie::get()->SetDumpYuvFileEnable(enable_dump_yuv_file); 717 !media::Movie::GetInstance()->GetDumpYuvFileEnable();
718 media::Movie::GetInstance()->SetDumpYuvFileEnable(enable_dump_yuv_file);
718 UISetCheck(ID_OPTIONS_DUMPYUVFILE, enable_dump_yuv_file); 719 UISetCheck(ID_OPTIONS_DUMPYUVFILE, enable_dump_yuv_file);
719 UpdateLayout(); 720 UpdateLayout();
720 } 721 }
721 722
722 void OnAppAbout(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 723 void OnAppAbout(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
723 CSimpleDialog<IDD_ABOUTBOX> dlg; 724 CSimpleDialog<IDD_ABOUTBOX> dlg;
724 dlg.DoModal(); 725 dlg.DoModal();
725 } 726 }
726 727
727 728
728 void OnPlayGotoFrame(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { 729 void OnPlayGotoFrame(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) {
729 CSeek seek; 730 CSeek seek;
730 seek.DoModal(); 731 seek.DoModal();
731 } 732 }
732 }; 733 };
733 734
734 #endif // MEDIA_TOOLS_PLAYER_WTL_MAINFRM_H_ 735 #endif // MEDIA_TOOLS_PLAYER_WTL_MAINFRM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698