r136: This commit was manufactured by cvs2svn to create tag 'hv_1_1_8'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / recordprefs.C
blobd11289c280c125284dd523da3c88b9597ac13aa6
1 #include "adeviceprefs.h"
2 #include "audioconfig.h"
3 #include "clip.h"
4 #include "edl.h"
5 #include "edlsession.h"
6 #include "new.h"
7 #include "preferences.h"
8 #include "recordconfig.h"
9 #include "recordprefs.h"
10 #include "vdeviceprefs.h"
13 #include <libintl.h>
14 #define _(String) gettext(String)
15 #define gettext_noop(String) String
16 #define N_(String) gettext_noop (String)
19 RecordPrefs::RecordPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
20  : PreferencesDialog(mwindow, pwindow)
22         this->mwindow = mwindow;
25 RecordPrefs::~RecordPrefs()
27         delete in_device;
28 //      delete duplex_device;
31 int RecordPrefs::create_objects()
33         int x = 5, y = 5, x2;
34         char string[BCTEXTLEN];
36         add_subwindow(new BC_Title(x, y, _("Audio In"), LARGEFONT, BLACK));
37         y += 25;
40         add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
41         in_device = new ADevicePrefs(x + 110, 
42                 y, 
43                 pwindow, 
44                 this, 
45                 0,
46                 pwindow->thread->edl->session->aconfig_in, 
47                 MODERECORD);
48         in_device->initialize();
50         y += ADevicePrefs::get_h();
53         BC_TextBox *textbox;
54         BC_Title *title1, *title2;
55         add_subwindow(title1 = new BC_Title(x, y, _("Samples to write to disk at a time:")));
56         add_subwindow(title2 = new BC_Title(x, y + 30, _("Sample rate for recording:")));
57         x2 = MAX(title1->get_w(), title2->get_w()) + 10;
59         sprintf(string, "%ld", pwindow->thread->edl->session->record_write_length);
60         add_subwindow(textbox = new RecordWriteLength(mwindow, 
61                 pwindow, 
62                 x2, 
63                 y, 
64                 string));
65         add_subwindow(textbox = new RecordSampleRate(pwindow, x2, y + 30));
66         add_subwindow(new SampleRatePulldown(mwindow, textbox, x2 + textbox->get_w(), y + 30));
68         y += 60;
71         add_subwindow(new RecordRealTime(mwindow, 
72                 pwindow, 
73                 x, 
74                 y, 
75                 pwindow->thread->edl->session->real_time_record));
76         y += 45;
77         x = 5;
80         add_subwindow(new BC_Title(x, y, _("Video In"), LARGEFONT, BLACK));
81         y += 25;
83         add_subwindow(new BC_Title(x, y, _("Record Driver:"), MEDIUMFONT, BLACK));
84         video_in_device = new VDevicePrefs(x + 110, 
85                 y, 
86                 pwindow, 
87                 this, 
88                 0, 
89                 pwindow->thread->edl->session->vconfig_in, 
90                 MODERECORD);
91         video_in_device->initialize();
93         y += 55;
94         sprintf(string, "%d", pwindow->thread->edl->session->video_write_length);
95         add_subwindow(textbox = new VideoWriteLength(pwindow, string, y));
96         add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
97         add_subwindow(new BC_Title(x, y, _("Frames to record to disk at a time:")));
98         y += 27;
99         sprintf(string, "%d", pwindow->thread->edl->session->vconfig_in->capture_length);
100         add_subwindow(textbox = new VideoCaptureLength(pwindow, string, y));
101         add_subwindow(new CaptureLengthTumbler(pwindow, textbox, textbox->get_x() + textbox->get_w(), y));
102         add_subwindow(new BC_Title(x, y, _("Frames to buffer in device:")));
103         y += 27;
105         add_subwindow(new RecordSoftwareTimer(pwindow, 
106                 pwindow->thread->edl->session->record_software_position, 
107                 x, 
108                 y));
109         y += 27;
110         add_subwindow(new RecordSyncDrives(pwindow, 
111                 pwindow->thread->edl->session->record_sync_drives, 
112                 x, 
113                 y));
114         y += 35;
116         BC_TextBox *w_text, *h_text;
117         add_subwindow(new BC_Title(x, y, _("Size of captured frame:")));
118         x += 170;
119         add_subwindow(w_text = new RecordW(pwindow, x, y));
120         x += w_text->get_w() + 2;
121         add_subwindow(new BC_Title(x, y, "x"));
122         x += 10;
123         add_subwindow(h_text = new RecordH(pwindow, x, y));
124         x += h_text->get_w();
125         add_subwindow(new FrameSizePulldown(mwindow, 
126                 w_text, 
127                 h_text, 
128                 x, 
129                 y));
131         y += 30;
132         x = 5;
133         add_subwindow(new BC_Title(x, y, _("Frame rate for recording:")));
134         x += 180;
135         add_subwindow(textbox = new RecordFrameRate(pwindow, x, y));
136         x += 75;
137         add_subwindow(new FrameRatePulldown(mwindow, textbox, x, y));
138         y += 30;
140         return 0;
144 RecordWriteLength::RecordWriteLength(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, char *text)
145  : BC_TextBox(x, y, 100, 1, text)
147         this->pwindow = pwindow; 
150 int RecordWriteLength::handle_event()
152         pwindow->thread->edl->session->record_write_length = atol(get_text());
153         return 1; 
158 RecordRealTime::RecordRealTime(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
159  : BC_CheckBox(x, y, value, _("Record in realtime priority (root only)"))
161         this->pwindow = pwindow; 
164 int RecordRealTime::handle_event()
166         pwindow->thread->edl->session->real_time_record = get_value();
170 RecordSampleRate::RecordSampleRate(PreferencesWindow *pwindow, int x, int y)
171  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->aconfig_in->in_samplerate)
173         this->pwindow = pwindow;
175 int RecordSampleRate::handle_event()
177         pwindow->thread->edl->session->aconfig_in->in_samplerate = atol(get_text());
178         return 1;
182 // DuplexEnable::DuplexEnable(MWindow *mwindow, PreferencesWindow *pwindow, int x, int y, int value)
183 //  : BC_CheckBox(x, y, value, _("Enable full duplex"))
184 // { this->pwindow = pwindow; }
185 // 
186 // int DuplexEnable::handle_event()
187 // {
188 //      pwindow->thread->edl->session->enable_duplex = get_value();
189 // }
190 // 
193 RecordW::RecordW(PreferencesWindow *pwindow, int x, int y)
194  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->w)
196         this->pwindow = pwindow;
198 int RecordW::handle_event()
200         pwindow->thread->edl->session->vconfig_in->w = atol(get_text());
201         return 1;
204 RecordH::RecordH(PreferencesWindow *pwindow, int x, int y)
205  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->h)
207         this->pwindow = pwindow;
209 int RecordH::handle_event()
211         pwindow->thread->edl->session->vconfig_in->h = atol(get_text());
212         return 1;
215 RecordFrameRate::RecordFrameRate(PreferencesWindow *pwindow, int x, int y)
216  : BC_TextBox(x, y, 70, 1, pwindow->thread->edl->session->vconfig_in->in_framerate)
218         this->pwindow = pwindow;
220 int RecordFrameRate::handle_event()
222         pwindow->thread->edl->session->vconfig_in->in_framerate = atof(get_text());
223         return 1;
227 VideoWriteLength::VideoWriteLength(PreferencesWindow *pwindow, char *text, int y)
228  : BC_TextBox(260, y, 100, 1, text)
230         this->pwindow = pwindow; 
233 int VideoWriteLength::handle_event()
235         pwindow->thread->edl->session->video_write_length = atol(get_text()); 
236         return 1;
240 VideoCaptureLength::VideoCaptureLength(PreferencesWindow *pwindow, char *text, int y)
241  : BC_TextBox(260, y, 100, 1, text)
243         this->pwindow = pwindow;
246 int VideoCaptureLength::handle_event()
248         pwindow->thread->edl->session->vconfig_in->capture_length = atol(get_text()); 
249         return 1; 
252 CaptureLengthTumbler::CaptureLengthTumbler(PreferencesWindow *pwindow, BC_TextBox *text, int x, int y)
253  : BC_Tumbler(x, y)
255         this->pwindow;
256         this->text = text;
259 int CaptureLengthTumbler::handle_up_event()
261         int value = atol(text->get_text());
262         value++;
263         char string[BCTEXTLEN];
264         sprintf(string, "%d", value);
265         text->update(string);
266         text->handle_event();
267         return 1;
270 int CaptureLengthTumbler::handle_down_event()
272         int value = atol(text->get_text());
273         value--;
274         value = MAX(1, value);
275         char string[BCTEXTLEN];
276         sprintf(string, "%d", value);
277         text->update(string);
278         text->handle_event();
279         return 1;
284 RecordSoftwareTimer::RecordSoftwareTimer(PreferencesWindow *pwindow, int value, int x, int y)
285  : BC_CheckBox(x, y, value, _("Use software for positioning information"))
287         this->pwindow = pwindow; 
290 int RecordSoftwareTimer::handle_event() 
292         pwindow->thread->edl->session->record_software_position = get_value(); 
293         return 1;
298 RecordSyncDrives::RecordSyncDrives(PreferencesWindow *pwindow, int value, int x, int y)
299  : BC_CheckBox(x, y, value, _("Sync drives automatically"))
301         this->pwindow = pwindow; 
304 int RecordSyncDrives::handle_event() 
306         pwindow->thread->edl->session->record_sync_drives = get_value(); 
307         return 1;