1 #include "deleteallindexes.h"
3 #include "edlsession.h"
6 #include "preferences.h"
7 #include "preferencesthread.h"
8 #include "interfaceprefs.h"
12 N_("Drag all following edits")
13 N_("Drag only one edit")
14 N_("Drag source only")
18 #define MOVE_ALL_EDITS_TITLE "Drag all following edits"
19 #define MOVE_ONE_EDIT_TITLE "Drag only one edit"
20 #define MOVE_NO_EDITS_TITLE "Drag source only"
21 #define MOVE_EDITS_DISABLED_TITLE "No effect"
23 InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
24 : PreferencesDialog(mwindow, pwindow)
28 int InterfacePrefs::create_objects()
31 BC_Resources *resources = BC_WindowBase::get_resources();
33 x = mwindow->theme->preferencesoptions_x;
34 y = mwindow->theme->preferencesoptions_y;
36 add_subwindow(new BC_Title(x,
40 resources->text_default));
42 y += get_text_height(LARGEFONT) + 5;
45 add_subwindow(hms = new TimeFormatHMS(pwindow,
47 pwindow->thread->edl->session->time_format == TIME_HMS,
51 add_subwindow(hmsf = new TimeFormatHMSF(pwindow,
53 pwindow->thread->edl->session->time_format == TIME_HMSF,
57 add_subwindow(samples = new TimeFormatSamples(pwindow,
59 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
63 add_subwindow(hex = new TimeFormatHex(pwindow,
65 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
69 add_subwindow(frames = new TimeFormatFrames(pwindow,
71 pwindow->thread->edl->session->time_format == TIME_FRAMES,
75 add_subwindow(feet = new TimeFormatFeet(pwindow,
77 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
80 add_subwindow(new BC_Title(260, y, _("frames per foot")));
81 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
82 add_subwindow(new TimeFormatFeetSetting(pwindow,
87 add_subwindow(seconds = new TimeFormatSeconds(pwindow,
89 pwindow->thread->edl->session->time_format == TIME_SECONDS,
95 add_subwindow(new UseTipWindow(pwindow, x, y));
98 add_subwindow(new BC_Bar(5, y, get_w() - 10));
101 add_subwindow(new BC_Title(x, y, _("Index files"), LARGEFONT, resources->text_default));
105 add_subwindow(new BC_Title(x,
107 _("Index files go here:"), MEDIUMFONT, resources->text_default));
108 add_subwindow(ipathtext = new IndexPathText(x + 230,
111 pwindow->thread->preferences->index_directory));
112 add_subwindow(ipath = new BrowseButton(mwindow,
115 x + 230 + ipathtext->get_w(),
117 pwindow->thread->preferences->index_directory,
119 _("Select the directory for index files"),
123 add_subwindow(new BC_Title(x,
125 _("Size of index file:"),
127 resources->text_default));
128 sprintf(string, "%ld", pwindow->thread->preferences->index_size);
129 add_subwindow(isize = new IndexSize(x + 230, y, pwindow, string));
131 add_subwindow(new BC_Title(x, y + 5, _("Number of index files to keep:"), MEDIUMFONT, resources->text_default));
132 sprintf(string, "%ld", pwindow->thread->preferences->index_count);
133 add_subwindow(icount = new IndexCount(x + 230, y, pwindow, string));
134 add_subwindow(deleteall = new DeleteAllIndexes(mwindow, pwindow, 350, y));
141 add_subwindow(new BC_Bar(5, y, get_w() - 10));
144 add_subwindow(new BC_Title(x, y, _("Editing"), LARGEFONT, resources->text_default));
148 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
151 add_subwindow(new BC_Title(x, y, _("Clicking on in/out points does what:")));
153 add_subwindow(new BC_Title(x, y, _("Button 1:")));
155 ViewBehaviourText *text;
156 add_subwindow(text = new ViewBehaviourText(80,
158 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]),
160 &(pwindow->thread->edl->session->edit_handle_mode[0])));
161 text->create_objects();
163 add_subwindow(new BC_Title(x, y, _("Button 2:")));
164 add_subwindow(text = new ViewBehaviourText(80,
166 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[1]),
168 &(pwindow->thread->edl->session->edit_handle_mode[1])));
169 text->create_objects();
171 add_subwindow(new BC_Title(x, y, _("Button 3:")));
172 add_subwindow(text = new ViewBehaviourText(80,
174 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[2]),
176 &(pwindow->thread->edl->session->edit_handle_mode[2])));
177 text->create_objects();
182 add_subwindow(title = new BC_Title(x, y + 5, _("Min DB for meter:")));
183 x += title->get_w() + 10;
184 sprintf(string, "%d", pwindow->thread->edl->session->min_meter_db);
185 add_subwindow(min_db = new MeterMinDB(pwindow, string, x, y));
187 x += min_db->get_w() + 10;
188 add_subwindow(title = new BC_Title(x, y + 5, _("Max DB:")));
189 x += title->get_w() + 10;
190 sprintf(string, "%d", pwindow->thread->edl->session->max_meter_db);
191 add_subwindow(max_db = new MeterMaxDB(pwindow, string, x, y));
196 add_subwindow(new BC_Title(x, y, _("Theme:")));
198 add_subwindow(theme = new ViewTheme(x, y, pwindow));
199 theme->create_objects();
204 char* InterfacePrefs::behavior_to_text(int mode)
209 return _(MOVE_ALL_EDITS_TITLE);
212 return _(MOVE_ONE_EDIT_TITLE);
215 return _(MOVE_NO_EDITS_TITLE);
217 case MOVE_EDITS_DISABLED:
218 return _(MOVE_EDITS_DISABLED_TITLE);
226 int InterfacePrefs::update(int new_value)
228 pwindow->thread->redraw_times = 1;
229 pwindow->thread->edl->session->time_format = new_value;
230 hms->update(new_value == TIME_HMS);
231 hmsf->update(new_value == TIME_HMSF);
232 samples->update(new_value == TIME_SAMPLES);
233 hex->update(new_value == TIME_SAMPLES_HEX);
234 frames->update(new_value == TIME_FRAMES);
235 feet->update(new_value == TIME_FEET_FRAMES);
236 seconds->update(new_value == TIME_SECONDS);
239 InterfacePrefs::~InterfacePrefs()
269 IndexPathText::IndexPathText(int x,
271 PreferencesWindow *pwindow,
273 : BC_TextBox(x, y, 240, 1, text)
275 this->pwindow = pwindow;
278 IndexPathText::~IndexPathText() {}
280 int IndexPathText::handle_event()
282 strcpy(pwindow->thread->preferences->index_directory, get_text());
288 IndexSize::IndexSize(int x,
290 PreferencesWindow *pwindow,
292 : BC_TextBox(x, y, 100, 1, text)
294 this->pwindow = pwindow;
297 int IndexSize::handle_event()
301 result = atol(get_text());
302 if(result < 64000) result = 64000;
303 //if(result < 500000) result = 500000;
304 pwindow->thread->preferences->index_size = result;
310 IndexCount::IndexCount(int x,
312 PreferencesWindow *pwindow,
314 : BC_TextBox(x, y, 100, 1, text)
316 this->pwindow = pwindow;
319 int IndexCount::handle_event()
323 result = atol(get_text());
324 if(result < 1) result = 1;
325 pwindow->thread->preferences->index_count = result;
343 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
344 : BC_Radial(x, y, value, _("Use Hours:Minutes:Seconds.xxx"))
345 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
347 int TimeFormatHMS::handle_event()
349 tfwindow->update(TIME_HMS);
353 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
354 : BC_Radial(x, y, value, _("Use Hours:Minutes:Seconds:Frames"))
355 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
357 int TimeFormatHMSF::handle_event()
359 tfwindow->update(TIME_HMSF);
362 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
363 : BC_Radial(x, y, value, _("Use Samples"))
364 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
366 int TimeFormatSamples::handle_event()
368 tfwindow->update(TIME_SAMPLES);
371 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
372 : BC_Radial(x, y, value, _("Use Frames"))
373 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
375 int TimeFormatFrames::handle_event()
377 tfwindow->update(TIME_FRAMES);
380 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
381 : BC_Radial(x, y, value, _("Use Hex Samples"))
382 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
384 int TimeFormatHex::handle_event()
386 tfwindow->update(TIME_SAMPLES_HEX);
389 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
390 : BC_Radial(x, y, value, _("Use Seconds"))
392 this->pwindow = pwindow;
393 this->tfwindow = tfwindow;
396 int TimeFormatSeconds::handle_event()
398 tfwindow->update(TIME_SECONDS);
401 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
402 : BC_Radial(x, y, value, _("Use Feet-frames"))
403 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
405 int TimeFormatFeet::handle_event()
407 tfwindow->update(TIME_FEET_FRAMES);
410 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
411 : BC_TextBox(x, y, 90, 1, string)
412 { this->pwindow = pwindow; }
414 int TimeFormatFeetSetting::handle_event()
416 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
417 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
424 ViewBehaviourText::ViewBehaviourText(int x,
427 PreferencesWindow *pwindow,
429 : BC_PopupMenu(x, y, 200, text)
431 this->output = output;
434 ViewBehaviourText::~ViewBehaviourText()
438 int ViewBehaviourText::handle_event()
442 int ViewBehaviourText::create_objects()
444 // Video4linux versions are automatically detected
445 add_item(new ViewBehaviourItem(this, _(MOVE_ALL_EDITS_TITLE), MOVE_ALL_EDITS));
446 add_item(new ViewBehaviourItem(this, _(MOVE_ONE_EDIT_TITLE), MOVE_ONE_EDIT));
447 add_item(new ViewBehaviourItem(this, _(MOVE_NO_EDITS_TITLE), MOVE_NO_EDITS));
448 add_item(new ViewBehaviourItem(this, _(MOVE_EDITS_DISABLED_TITLE), MOVE_EDITS_DISABLED));
453 ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour)
457 this->behaviour = behaviour;
460 ViewBehaviourItem::~ViewBehaviourItem()
464 int ViewBehaviourItem::handle_event()
466 popup->set_text(get_text());
467 *(popup->output) = behaviour;
473 MeterMinDB::MeterMinDB(PreferencesWindow *pwindow, char *text, int x, int y)
474 : BC_TextBox(x, y, 50, 1, text)
476 this->pwindow = pwindow;
479 int MeterMinDB::handle_event()
481 pwindow->thread->redraw_meters = 1;
482 pwindow->thread->edl->session->min_meter_db = atol(get_text());
489 MeterMaxDB::MeterMaxDB(PreferencesWindow *pwindow, char *text, int x, int y)
490 : BC_TextBox(x, y, 50, 1, text)
492 this->pwindow = pwindow;
495 int MeterMaxDB::handle_event()
497 pwindow->thread->redraw_meters = 1;
498 pwindow->thread->edl->session->max_meter_db = atol(get_text());
506 MeterVUDB::MeterVUDB(PreferencesWindow *pwindow, char *text, int y)
507 : BC_Radial(145, y, pwindow->thread->edl->session->meter_format == METER_DB, text)
509 this->pwindow = pwindow;
512 int MeterVUDB::handle_event()
514 pwindow->thread->redraw_meters = 1;
515 // vu_int->update(0);
516 pwindow->thread->edl->session->meter_format = METER_DB;
520 MeterVUInt::MeterVUInt(PreferencesWindow *pwindow, char *text, int y)
521 : BC_Radial(205, y, pwindow->thread->edl->session->meter_format == METER_INT, text)
523 this->pwindow = pwindow;
526 int MeterVUInt::handle_event()
528 pwindow->thread->redraw_meters = 1;
530 pwindow->thread->edl->session->meter_format = METER_INT;
537 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
538 : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->theme, 1)
540 this->pwindow = pwindow;
542 ViewTheme::~ViewTheme()
546 void ViewTheme::create_objects()
548 ArrayList<PluginServer*> themes;
549 pwindow->mwindow->create_plugindb(0,
556 for(int i = 0; i < themes.total; i++)
558 add_item(new ViewThemeItem(this, themes.values[i]->title));
562 int ViewTheme::handle_event()
571 ViewThemeItem::ViewThemeItem(ViewTheme *popup, char *text)
577 int ViewThemeItem::handle_event()
579 popup->set_text(get_text());
580 strcpy(popup->pwindow->thread->preferences->theme, get_text());
581 popup->handle_event();
585 ViewThumbnails::ViewThumbnails(int x,
587 PreferencesWindow *pwindow)
590 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
592 this->pwindow = pwindow;
595 int ViewThumbnails::handle_event()
597 pwindow->thread->preferences->use_thumbnails = get_value();
603 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
606 pwindow->thread->preferences->use_tipwindow,
607 _("Show tip of the day"))
609 this->pwindow = pwindow;
611 int UseTipWindow::handle_event()
613 pwindow->thread->preferences->use_tipwindow = get_value();