rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.git] / cinelerra-5.1 / cinelerra / formattools.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 FORMATTOOLS_H
23 #define FORMATTOOLS_H
24
25 #include "asset.inc"
26 #include "guicast.h"
27 #include "bitspopup.h"
28 #include "browsebutton.h"
29 #include "compresspopup.h"
30 #include "file.inc"
31 #include "ffmpeg.h"
32 #include "formatpopup.h"
33 #include "mwindow.inc"
34
35 class FormatAParams;
36 class FormatVParams;
37 class FormatAThread;
38 class FormatVThread;
39 class FormatChannels;
40 class FormatPathButton;
41 class FormatPathText;
42 class FormatFormat;
43 class FormatFFMPEG;
44 class FFMpegType;
45 class FormatAudio;
46 class FormatVideo;
47 class FormatMultiple;
48
49 class FormatTools
50 {
51 public:
52         FormatTools(MWindow *mwindow,
53                                 BC_WindowBase *window,
54                                 Asset *asset);
55         virtual ~FormatTools();
56
57         void create_objects(int &init_x,
58                                                 int &init_y,
59                                                 int do_audio,    // Include tools for audio
60                                                 int do_video,   // Include tools for video
61                                                 int prompt_audio,  // Include checkbox for audio
62                                                 int prompt_video,  // Include checkbox for video
63                                                 int prompt_audio_channels,
64                                                 int prompt_video_compression,
65                                                 const char *locked_compressor,  // Select compressors to be offered
66                                                 int recording, // Change captions for recording
67                                                 int *strategy,  // If nonzero, prompt for insertion strategy
68                                                 int brender,   // Supply file formats for background rendering
69                                                 int horizontal_layout = 0);
70 // In recording preferences, aspects of the format are locked
71 // depending on the driver used.
72         void update_driver(int driver);
73         void update_format();
74
75
76         void reposition_window(int &init_x, int &init_y);
77 // Put new asset's parameters in and change asset.
78         void update(Asset *asset, int *strategy);
79 // Update filename extension when format is changed.
80         void update_extension();
81         void close_format_windows();
82         Asset* get_asset();
83
84 // Handle change in path text.  Used in BatchRender.
85         virtual int handle_event();
86
87         int set_audio_options();
88         int set_video_options();
89         void set_w(int w);
90         int get_w();
91
92         BC_WindowBase *window;
93         Asset *asset;
94
95         FormatAParams *aparams_button;
96         FormatVParams *vparams_button;
97         FormatAThread *aparams_thread;
98         FormatVThread *vparams_thread;
99         BrowseButton *path_button;
100         FormatPathText *path_textbox;
101         BC_RecentList *path_recent;
102         BC_Title *format_title;
103         FormatFormat *format_button;
104         BC_TextBox *format_text;
105         FormatFFMPEG *format_ffmpeg;
106         FFMpegType *ffmpeg_type;
107         BC_ITumbler *channels_tumbler;
108
109         BC_Title *audio_title;
110         BC_Title *channels_title;
111         FormatChannels *channels_button;
112         FormatAudio *audio_switch;
113
114         BC_Title *video_title;
115         FormatVideo *video_switch;
116
117         FormatMultiple *multiple_files;
118
119 // Suggestions for the textbox
120         ArrayList<BC_ListBoxItem*> *file_entries;
121         ArrayList<PluginServer*> *plugindb;
122         MWindow *mwindow;
123         const char *locked_compressor;
124         int recording;
125         int use_brender;
126         int do_audio;
127         int do_video;
128         int prompt_audio;
129         int prompt_audio_channels;
130         int prompt_video;
131         int prompt_video_compression;
132         int *strategy;
133         int w;
134 // Determines what the configuration buttons do.
135         int video_driver;
136 };
137
138
139
140 class FormatPathText : public BC_TextBox
141 {
142 public:
143         FormatPathText(int x, int y, FormatTools *format);
144         ~FormatPathText();
145         int handle_event();
146
147         FormatTools *format;
148 };
149
150
151
152 class FormatFormat : public FormatPopup
153 {
154 public:
155         FormatFormat(int x, int y, FormatTools *format);
156         ~FormatFormat();
157
158         int handle_event();
159         FormatTools *format;
160 };
161
162 class FormatFFMPEG : public FFMPEGPopup
163 {
164 public:
165         FormatFFMPEG(int x, int y, FormatTools *format);
166         ~FormatFFMPEG();
167
168         int handle_event();
169         FormatTools *format;
170
171 // squash show/hide window
172         int show_window(int flush=1) { return 0; }
173         int hide_window(int flush=1) { return 0; }
174         int show(int flush=1) { return BC_SubWindow::show_window(flush); }
175         int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
176 };
177
178 class FFMpegType : public BC_TextBox
179 {
180 public:
181         FFMpegType(int x, int y, int w, int h, const char *text)
182          : BC_TextBox(x, y, w, h, text) {}
183         ~FFMpegType() {}
184 // squash show/hide window
185         int show_window(int flush=1) { return 0; }
186         int hide_window(int flush=1) { return 0; }
187         int show(int flush=1) { return BC_SubWindow::show_window(flush); }
188         int hide(int flush=1) { return BC_SubWindow::hide_window(flush); }
189 };
190
191 class FormatAParams : public BC_Button
192 {
193 public:
194         FormatAParams(MWindow *mwindow, FormatTools *format, int x, int y);
195         ~FormatAParams();
196         int handle_event();
197         FormatTools *format;
198 };
199
200 class FormatVParams : public BC_Button
201 {
202 public:
203         FormatVParams(MWindow *mwindow, FormatTools *format, int x, int y);
204         ~FormatVParams();
205         int handle_event();
206         FormatTools *format;
207 };
208
209
210 class FormatAThread : public Thread
211 {
212 public:
213         FormatAThread(FormatTools *format);
214         ~FormatAThread();
215
216         void run();
217         void start();
218         void join() { if( !joined ) { joined = 1; Thread::join(); } }
219
220         FormatTools *format;
221         File *file;
222         int joined;
223 };
224
225 class FormatVThread : public Thread
226 {
227 public:
228         FormatVThread(FormatTools *format);
229         ~FormatVThread();
230
231         void run();
232         void start();
233         void join() { if( !joined ) { joined = 1; Thread::join(); } }
234
235         FormatTools *format;
236         File *file;
237         int joined;
238 };
239
240 class FormatAudio : public BC_CheckBox
241 {
242 public:
243         FormatAudio(int x, int y, FormatTools *format, int default_);
244         ~FormatAudio();
245         int handle_event();
246         FormatTools *format;
247 };
248
249 class FormatVideo : public BC_CheckBox
250 {
251 public:
252         FormatVideo(int x, int y, FormatTools *format, int default_);
253         ~FormatVideo();
254         int handle_event();
255         FormatTools *format;
256 };
257
258
259 class FormatChannels : public BC_TextBox
260 {
261 public:
262         FormatChannels(int x, int y, FormatTools *format);
263         ~FormatChannels();
264         int handle_event();
265         FormatTools *format;
266 };
267
268 class FormatToTracks : public BC_CheckBox
269 {
270 public:
271         FormatToTracks(int x, int y, int *output);
272         ~FormatToTracks();
273         int handle_event();
274         int *output;
275 };
276
277 class FormatMultiple : public BC_CheckBox
278 {
279 public:
280         FormatMultiple(MWindow *mwindow, int x, int y, int *output);
281         ~FormatMultiple();
282         int handle_event();
283         void update(int *output);
284         int *output;
285         MWindow *mwindow;
286 };
287
288
289 #endif