1 //////////////////////////////////////////////////////////////////////////////////////// 2 // 3 // Nestopia - NES/Famicom emulator written in C++ 4 // 5 // Copyright (C) 2003-2008 Martin Freij 6 // 7 // This file is part of Nestopia. 8 // 9 // Nestopia is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 13 // 14 // Nestopia is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with Nestopia; if not, write to the Free Software 21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 // 23 //////////////////////////////////////////////////////////////////////////////////////// 24 25 #ifndef NST_MANAGER_MOVIE_H 26 #define NST_MANAGER_MOVIE_H 27 28 #pragma once 29 30 #include "NstObjectHeap.hpp" 31 32 namespace Nestopia 33 { 34 namespace Window 35 { 36 class Movie; 37 } 38 39 namespace Io 40 { 41 namespace Stream 42 { 43 class InOut; 44 } 45 } 46 47 namespace Managers 48 { 49 class Paths; 50 51 class Movie : Manager 52 { 53 public: 54 55 Movie(Emulator&,Window::Menu&,const Paths&); 56 ~Movie(); 57 58 enum Alert 59 { 60 NOISY, 61 QUIET 62 }; 63 64 bool Load(const Path&,Alert); 65 66 private: 67 68 void OnMenu (const Window::Menu::PopupHandler::Param&); 69 void OnEmuEvent (Emulator::Event,Emulator::Data); 70 void OnCmdFile (uint); 71 void OnCmdRecord (uint); 72 void OnCmdPlay (uint); 73 void OnCmdStop (uint); 74 void OnCmdRewind (uint); 75 void OnCmdForward (uint); 76 void OnCmdExportAvi (uint); 77 78 class File 79 { 80 public: 81 82 explicit File(Emulator&); 83 ~File(); 84 85 enum Pos 86 { 87 POS_BEG, 88 POS_END 89 }; 90 91 enum Mode 92 { 93 MODE_PLAY, 94 MODE_RECORD 95 }; 96 97 bool Start(Mode); 98 void Stop(Pos=POS_BEG); 99 void Update(const Path&); 100 bool Rewind(); 101 bool Forward(); 102 103 bool CanPlay() const; 104 bool CanRecord() const; 105 bool CanStop() const; 106 bool CanRewind() const; 107 bool CanForward() const; 108 109 const Path& GetPath() const; 110 111 private: 112 113 bool IsReady() const; 114 bool CanSetPos() const; 115 116 Io::Stream::InOut* stream; 117 Pos pos; 118 Emulator& emulator; 119 Path path; 120 }; 121 122 File file; 123 Object::Heap<Window::Movie> dialog; 124 const Paths& paths; 125 }; 126 } 127 } 128 129 #endif 130