1 #include "deleteallindexes.h"
3 #include "edlsession.h"
6 #include "preferences.h"
7 #include "preferencesthread.h"
8 #include "interfaceprefs.h"
11 N_("Drag all following edits")
12 N_("Drag only one edit")
13 N_("Drag source only")
17 #define MOVE_ALL_EDITS_TITLE "Drag all following edits"
18 #define MOVE_ONE_EDIT_TITLE "Drag only one edit"
19 #define MOVE_NO_EDITS_TITLE "Drag source only"
20 #define MOVE_EDITS_DISABLED_TITLE "No effect"
22 InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
23 : PreferencesDialog(mwindow, pwindow)
27 int InterfacePrefs::create_objects()
29 int y = 5, x = 5, value;
31 // add_border(get_resources()->get_bg_shadow1(),
32 // get_resources()->get_bg_shadow2(),
33 // get_resources()->get_bg_color(),
34 // get_resources()->get_bg_light2(),
35 // get_resources()->get_bg_light1());
36 add_subwindow(new BC_Title(x, y, _("Interface"), LARGEFONT, BLACK));
40 add_subwindow(hms = new TimeFormatHMS(pwindow,
42 pwindow->thread->edl->session->time_format == TIME_HMS,
46 add_subwindow(hmsf = new TimeFormatHMSF(pwindow,
48 pwindow->thread->edl->session->time_format == TIME_HMSF,
52 add_subwindow(samples = new TimeFormatSamples(pwindow,
54 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
58 add_subwindow(hex = new TimeFormatHex(pwindow,
60 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
64 add_subwindow(frames = new TimeFormatFrames(pwindow,
66 pwindow->thread->edl->session->time_format == TIME_FRAMES,
70 add_subwindow(feet = new TimeFormatFeet(pwindow,
72 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
75 add_subwindow(new BC_Title(260, y, _("frames per foot")));
76 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
77 add_subwindow(new TimeFormatFeetSetting(pwindow,
82 add_subwindow(seconds = new TimeFormatSeconds(pwindow,
84 pwindow->thread->edl->session->time_format == TIME_SECONDS,
91 add_subwindow(new BC_Title(x, y, _("Index files"), LARGEFONT, BLACK));
95 add_subwindow(new BC_Title(x,
97 _("Index files go here:"), MEDIUMFONT, BLACK));
98 add_subwindow(ipathtext = new IndexPathText(x + 230,
101 pwindow->thread->preferences->index_directory));
102 add_subwindow(ipath = new BrowseButton(mwindow,
105 x + 230 + ipathtext->get_w(),
107 pwindow->thread->preferences->index_directory,
109 _("Select the directory for index files"),
113 add_subwindow(new BC_Title(x,
115 _("Size of index file:"),
118 sprintf(string, "%ld", pwindow->thread->preferences->index_size);
119 add_subwindow(isize = new IndexSize(x + 230, y, pwindow, string));
121 add_subwindow(new BC_Title(x, y + 5, _("Number of index files to keep:"), MEDIUMFONT, BLACK));
122 sprintf(string, "%ld", pwindow->thread->preferences->index_count);
123 add_subwindow(icount = new IndexCount(x + 230, y, pwindow, string));
124 add_subwindow(deleteall = new DeleteAllIndexes(mwindow, pwindow, 350, y));
132 add_subwindow(new BC_Title(x, y, _("Editing"), LARGEFONT, BLACK));
136 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
139 add_subwindow(new BC_Title(x, y, _("Clicking on in/out points does what:")));
141 add_subwindow(new BC_Title(x, y, _("Button 1:")));
143 ViewBehaviourText *text;
144 add_subwindow(text = new ViewBehaviourText(80,
146 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]),
148 &(pwindow->thread->edl->session->edit_handle_mode[0])));
149 text->create_objects();
151 add_subwindow(new BC_Title(x, y, _("Button 2:")));
152 add_subwindow(text = new ViewBehaviourText(80,
154 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[1]),
156 &(pwindow->thread->edl->session->edit_handle_mode[1])));
157 text->create_objects();
159 add_subwindow(new BC_Title(x, y, _("Button 3:")));
160 add_subwindow(text = new ViewBehaviourText(80,
162 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[2]),
164 &(pwindow->thread->edl->session->edit_handle_mode[2])));
165 text->create_objects();
170 add_subwindow(title = new BC_Title(x, y + 5, _("Min DB for meter:")));
171 x += title->get_w() + 10;
172 sprintf(string, "%d", pwindow->thread->edl->session->min_meter_db);
173 add_subwindow(min_db = new MeterMinDB(pwindow, string, x, y));
175 x += min_db->get_w() + 10;
176 add_subwindow(title = new BC_Title(x, y + 5, _("Max DB:")));
177 x += title->get_w() + 10;
178 sprintf(string, "%d", pwindow->thread->edl->session->max_meter_db);
179 add_subwindow(max_db = new MeterMaxDB(pwindow, string, x, y));
184 add_subwindow(new BC_Title(x, y, _("Theme:")));
186 add_subwindow(theme = new ViewTheme(x, y, pwindow));
187 theme->create_objects();
191 char* InterfacePrefs::behavior_to_text(int mode)
196 return _(MOVE_ALL_EDITS_TITLE);
199 return _(MOVE_ONE_EDIT_TITLE);
202 return _(MOVE_NO_EDITS_TITLE);
204 case MOVE_EDITS_DISABLED:
205 return _(MOVE_EDITS_DISABLED_TITLE);
213 int InterfacePrefs::update(int new_value)
215 pwindow->thread->redraw_times = 1;
216 pwindow->thread->edl->session->time_format = new_value;
217 hms->update(new_value == TIME_HMS);
218 hmsf->update(new_value == TIME_HMSF);
219 samples->update(new_value == TIME_SAMPLES);
220 hex->update(new_value == TIME_SAMPLES_HEX);
221 frames->update(new_value == TIME_FRAMES);
222 feet->update(new_value == TIME_FEET_FRAMES);
223 seconds->update(new_value == TIME_SECONDS);
226 InterfacePrefs::~InterfacePrefs()
256 IndexPathText::IndexPathText(int x,
258 PreferencesWindow *pwindow,
260 : BC_TextBox(x, y, 240, 1, text)
262 this->pwindow = pwindow;
265 IndexPathText::~IndexPathText() {}
267 int IndexPathText::handle_event()
269 strcpy(pwindow->thread->preferences->index_directory, get_text());
275 IndexSize::IndexSize(int x,
277 PreferencesWindow *pwindow,
279 : BC_TextBox(x, y, 100, 1, text)
281 this->pwindow = pwindow;
284 int IndexSize::handle_event()
288 result = atol(get_text());
289 if(result < 64000) result = 64000;
290 //if(result < 500000) result = 500000;
291 pwindow->thread->preferences->index_size = result;
297 IndexCount::IndexCount(int x,
299 PreferencesWindow *pwindow,
301 : BC_TextBox(x, y, 100, 1, text)
303 this->pwindow = pwindow;
306 int IndexCount::handle_event()
310 result = atol(get_text());
311 if(result < 1) result = 1;
312 pwindow->thread->preferences->index_count = result;
330 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
331 : BC_Radial(x, y, value, _("Use Hours:Minutes:Seconds.xxx"))
332 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
334 int TimeFormatHMS::handle_event()
336 tfwindow->update(TIME_HMS);
340 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
341 : BC_Radial(x, y, value, _("Use Hours:Minutes:Seconds:Frames"))
342 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
344 int TimeFormatHMSF::handle_event()
346 tfwindow->update(TIME_HMSF);
349 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
350 : BC_Radial(x, y, value, _("Use Samples"))
351 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
353 int TimeFormatSamples::handle_event()
355 tfwindow->update(TIME_SAMPLES);
358 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
359 : BC_Radial(x, y, value, _("Use Frames"))
360 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
362 int TimeFormatFrames::handle_event()
364 tfwindow->update(TIME_FRAMES);
367 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
368 : BC_Radial(x, y, value, _("Use Hex Samples"))
369 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
371 int TimeFormatHex::handle_event()
373 tfwindow->update(TIME_SAMPLES_HEX);
376 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
377 : BC_Radial(x, y, value, _("Use Seconds"))
379 this->pwindow = pwindow;
380 this->tfwindow = tfwindow;
383 int TimeFormatSeconds::handle_event()
385 tfwindow->update(TIME_SECONDS);
388 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
389 : BC_Radial(x, y, value, _("Use Feet-frames"))
390 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
392 int TimeFormatFeet::handle_event()
394 tfwindow->update(TIME_FEET_FRAMES);
397 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
398 : BC_TextBox(x, y, 90, 1, string)
399 { this->pwindow = pwindow; }
401 int TimeFormatFeetSetting::handle_event()
403 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
404 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
411 ViewBehaviourText::ViewBehaviourText(int x,
414 PreferencesWindow *pwindow,
416 : BC_PopupMenu(x, y, 200, text)
418 this->output = output;
421 ViewBehaviourText::~ViewBehaviourText()
425 int ViewBehaviourText::handle_event()
429 int ViewBehaviourText::create_objects()
431 // Video4linux versions are automatically detected
432 add_item(new ViewBehaviourItem(this, _(MOVE_ALL_EDITS_TITLE), MOVE_ALL_EDITS));
433 add_item(new ViewBehaviourItem(this, _(MOVE_ONE_EDIT_TITLE), MOVE_ONE_EDIT));
434 add_item(new ViewBehaviourItem(this, _(MOVE_NO_EDITS_TITLE), MOVE_NO_EDITS));
435 add_item(new ViewBehaviourItem(this, _(MOVE_EDITS_DISABLED_TITLE), MOVE_EDITS_DISABLED));
440 ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour)
444 this->behaviour = behaviour;
447 ViewBehaviourItem::~ViewBehaviourItem()
451 int ViewBehaviourItem::handle_event()
453 popup->set_text(get_text());
454 *(popup->output) = behaviour;
460 MeterMinDB::MeterMinDB(PreferencesWindow *pwindow, char *text, int x, int y)
461 : BC_TextBox(x, y, 50, 1, text)
463 this->pwindow = pwindow;
466 int MeterMinDB::handle_event()
468 pwindow->thread->redraw_meters = 1;
469 pwindow->thread->edl->session->min_meter_db = atol(get_text());
476 MeterMaxDB::MeterMaxDB(PreferencesWindow *pwindow, char *text, int x, int y)
477 : BC_TextBox(x, y, 50, 1, text)
479 this->pwindow = pwindow;
482 int MeterMaxDB::handle_event()
484 pwindow->thread->redraw_meters = 1;
485 pwindow->thread->edl->session->max_meter_db = atol(get_text());
493 MeterVUDB::MeterVUDB(PreferencesWindow *pwindow, char *text, int y)
494 : BC_Radial(145, y, pwindow->thread->edl->session->meter_format == METER_DB, text)
496 this->pwindow = pwindow;
499 int MeterVUDB::handle_event()
501 pwindow->thread->redraw_meters = 1;
502 // vu_int->update(0);
503 pwindow->thread->edl->session->meter_format = METER_DB;
507 MeterVUInt::MeterVUInt(PreferencesWindow *pwindow, char *text, int y)
508 : BC_Radial(205, y, pwindow->thread->edl->session->meter_format == METER_INT, text)
510 this->pwindow = pwindow;
513 int MeterVUInt::handle_event()
515 pwindow->thread->redraw_meters = 1;
517 pwindow->thread->edl->session->meter_format = METER_INT;
524 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
525 : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->theme, 1)
527 this->pwindow = pwindow;
529 ViewTheme::~ViewTheme()
533 void ViewTheme::create_objects()
535 ArrayList<PluginServer*> themes;
536 pwindow->mwindow->create_plugindb(0,
543 for(int i = 0; i < themes.total; i++)
545 add_item(new ViewThemeItem(this, themes.values[i]->title));
549 int ViewTheme::handle_event()
558 ViewThemeItem::ViewThemeItem(ViewTheme *popup, char *text)
564 int ViewThemeItem::handle_event()
566 popup->set_text(get_text());
567 strcpy(popup->pwindow->thread->preferences->theme, get_text());
568 popup->handle_event();
572 ViewThumbnails::ViewThumbnails(int x,
574 PreferencesWindow *pwindow)
577 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
579 this->pwindow = pwindow;
582 int ViewThumbnails::handle_event()
584 pwindow->thread->preferences->use_thumbnails = get_value();