map media vicon popup
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / playtransport.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef PLAYTRANSPORT_H
23 #define PLAYTRANSPORT_H
24
25 #include "edl.inc"
26 #include "guicast.h"
27 #include "mwindow.inc"
28 #include "playbackengine.inc"
29 #include "playtransport.inc"
30
31 #define PLAY_MODE 0
32 #define PAUSE_MODE 1
33 #define PAUSEDOWN_MODE 2
34
35 class PlayTransport
36 {
37 public:
38         PlayTransport(MWindow *mwindow, BC_WindowBase *subwindow, int x, int y);
39         virtual ~PlayTransport();
40
41         void create_objects();
42         void reposition_buttons(int x, int y);
43
44         virtual void goto_start();
45         virtual void goto_end();
46
47 // Set the playback engine to control
48         void set_engine(PlaybackEngine *engine);
49         static int get_transport_width(MWindow *mwindow);
50         int flip_vertical(int vertical, int &x, int &y);
51         int keypress_event();
52         int do_keypress(int key);
53 // Abstract TransportQue::send_command.
54 // wait_tracking - causes stop to wail until the final tracking position
55 // is updated before returning
56 // use_inout - causes the in/out points to determine the beginning and end
57 // of playback
58 // update_refresh - causes a frame advance to be issued after STOP to update
59 // the refresh frame.
60 // toggle_audio - reverses audio playback enable in RenderEngine::get_duty
61 // loop_play - sets play_loop and plays btwn start/end position (in a loop)
62         void handle_transport(int command, int wait_tracking=0,
63                 int use_inout=0, int update_refresh=1, int toggle_audio=0,
64                 int loop_play=0);
65         int pause_transport();
66         int reset_transport();
67         int get_w();
68         int is_stopped();
69 // Get the EDL to play back with default to mwindow->edl
70         virtual EDL* get_edl();
71         void change_position(double position);
72         virtual int is_vwindow() { return 0; }
73
74 // playback parameters
75         int reverse;
76         float speed;
77
78         PTransportButton *active_button;
79         PlayButton *forward_play;
80         FramePlayButton *frame_forward_play;
81         ReverseButton *reverse_play;
82         FrameReverseButton *frame_reverse_play;
83         FastReverseButton *fast_reverse;
84         FastPlayButton *fast_play;
85         RewindButton *rewind_button;
86         StopButton *stop_button;
87         EndButton *end_button;
88         MWindow *mwindow;
89         BC_WindowBase *subwindow;
90
91         PlaybackEngine *engine;
92         int using_inout, status;
93         int x, y;
94 };
95
96 // Should be toggle
97
98 class PTransportButton : public BC_Button
99 {
100 public:
101         PTransportButton(MWindow *mwindow, PlayTransport *transport, int x, int y, VFrame **data);
102         virtual ~PTransportButton();
103         virtual int set_mode(int mode);
104         int play_command(const char *lock_msg, int command);
105
106         int mode;
107         MWindow *mwindow;
108         PlayTransport *transport;
109 };
110
111 class RewindButton : public PTransportButton
112 {
113 public:
114         RewindButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
115         int handle_event();
116 };
117
118 class FastReverseButton : public PTransportButton
119 {
120 public:
121         FastReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
122         int handle_event();
123 };
124
125 class ReverseButton : public PTransportButton
126 {
127 public:
128         ReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
129         int handle_event();
130 };
131
132 class FrameReverseButton : public PTransportButton
133 {
134 public:
135         FrameReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
136         int handle_event();
137 };
138
139 class PlayButton : public PTransportButton
140 {
141 public:
142         PlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
143         int handle_event();
144 };
145
146 class FramePlayButton : public PTransportButton
147 {
148 public:
149         FramePlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
150         int handle_event();
151 };
152
153 class FastPlayButton : public PTransportButton
154 {
155 public:
156         FastPlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
157         int handle_event();
158 };
159
160
161
162 class EndButton : public PTransportButton
163 {
164 public:
165         EndButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
166         int handle_event();
167 };
168
169 class StopButton : public PTransportButton
170 {
171 public:
172         StopButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
173         int handle_event();
174 };
175
176 #endif