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 == 0,
46 add_subwindow(hmsf = new TimeFormatHMSF(pwindow,
48 pwindow->thread->edl->session->time_format == 1,
52 add_subwindow(samples = new TimeFormatSamples(pwindow,
54 pwindow->thread->edl->session->time_format == 2,
58 add_subwindow(hex = new TimeFormatHex(pwindow,
60 pwindow->thread->edl->session->time_format == 3,
64 add_subwindow(frames = new TimeFormatFrames(pwindow,
66 pwindow->thread->edl->session->time_format == 4,
70 add_subwindow(feet = new TimeFormatFeet(pwindow,
72 pwindow->thread->edl->session->time_format == 5,
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,
85 add_subwindow(new BC_Title(x, y, _("Index files"), LARGEFONT, BLACK));
89 add_subwindow(new BC_Title(x,
91 _("Index files go here:"), MEDIUMFONT, BLACK));
92 add_subwindow(ipathtext = new IndexPathText(x + 230,
95 pwindow->thread->preferences->index_directory));
96 add_subwindow(ipath = new BrowseButton(mwindow,
99 x + 230 + ipathtext->get_w(),
101 pwindow->thread->preferences->index_directory,
103 _("Select the directory for index files"),
107 add_subwindow(new BC_Title(x,
109 _("Size of index file:"),
112 sprintf(string, "%ld", pwindow->thread->preferences->index_size);
113 add_subwindow(isize = new IndexSize(x + 230, y, pwindow, string));
115 add_subwindow(new BC_Title(x, y + 5, _("Number of index files to keep:"), MEDIUMFONT, BLACK));
116 sprintf(string, "%ld", pwindow->thread->preferences->index_count);
117 add_subwindow(icount = new IndexCount(x + 230, y, pwindow, string));
118 add_subwindow(deleteall = new DeleteAllIndexes(mwindow, pwindow, 350, y));
126 add_subwindow(new BC_Title(x, y, _("Editing"), LARGEFONT, BLACK));
130 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
133 add_subwindow(new BC_Title(x, y, _("Clicking on in/out points does what:")));
135 add_subwindow(new BC_Title(x, y, _("Button 1:")));
137 ViewBehaviourText *text;
138 add_subwindow(text = new ViewBehaviourText(80,
140 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]),
142 &(pwindow->thread->edl->session->edit_handle_mode[0])));
143 text->create_objects();
145 add_subwindow(new BC_Title(x, y, _("Button 2:")));
146 add_subwindow(text = new ViewBehaviourText(80,
148 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[1]),
150 &(pwindow->thread->edl->session->edit_handle_mode[1])));
151 text->create_objects();
153 add_subwindow(new BC_Title(x, y, _("Button 3:")));
154 add_subwindow(text = new ViewBehaviourText(80,
156 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[2]),
158 &(pwindow->thread->edl->session->edit_handle_mode[2])));
159 text->create_objects();
164 add_subwindow(title = new BC_Title(x, y + 5, _("Min DB for meter:")));
165 x += title->get_w() + 10;
166 sprintf(string, "%d", pwindow->thread->edl->session->min_meter_db);
167 add_subwindow(min_db = new MeterMinDB(pwindow, string, x, y));
169 x += min_db->get_w() + 10;
170 add_subwindow(title = new BC_Title(x, y + 5, _("Max DB:")));
171 x += title->get_w() + 10;
172 sprintf(string, "%d", pwindow->thread->edl->session->max_meter_db);
173 add_subwindow(max_db = new MeterMaxDB(pwindow, string, x, y));
177 // add_subwindow(new BC_Title(x, y, _("Format for meter:")));
178 // add_subwindow(vu_db = new MeterVUDB(pwindow, _("DB"), y));
179 // add_subwindow(vu_int = new MeterVUInt(pwindow, _("Percent of maximum"), y));
180 // vu_db->vu_int = vu_int;
181 // vu_int->vu_db = vu_db;
185 add_subwindow(new BC_Title(x, y, _("Theme:")));
187 add_subwindow(theme = new ViewTheme(x, y, pwindow));
188 theme->create_objects();
192 char* InterfacePrefs::behavior_to_text(int mode)
197 return _(MOVE_ALL_EDITS_TITLE);
200 return _(MOVE_ONE_EDIT_TITLE);
203 return _(MOVE_NO_EDITS_TITLE);
205 case MOVE_EDITS_DISABLED:
206 return _(MOVE_EDITS_DISABLED_TITLE);
214 int InterfacePrefs::update(int new_value)
216 pwindow->thread->redraw_times = 1;
217 pwindow->thread->edl->session->time_format = new_value;
218 hms->update(new_value == 0);
219 hmsf->update(new_value == 1);
220 samples->update(new_value == 2);
221 hex->update(new_value == 3);
222 frames->update(new_value == 4);
223 feet->update(new_value == 5);
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()
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()
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()
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()
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()
376 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
377 : BC_Radial(x, y, value, _("Use Feet-frames"))
378 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
380 int TimeFormatFeet::handle_event()
385 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
386 : BC_TextBox(x, y, 90, 1, string)
387 { this->pwindow = pwindow; }
389 int TimeFormatFeetSetting::handle_event()
391 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
392 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
399 ViewBehaviourText::ViewBehaviourText(int x,
402 PreferencesWindow *pwindow,
404 : BC_PopupMenu(x, y, 200, text)
406 this->output = output;
409 ViewBehaviourText::~ViewBehaviourText()
413 int ViewBehaviourText::handle_event()
417 int ViewBehaviourText::create_objects()
419 // Video4linux versions are automatically detected
420 add_item(new ViewBehaviourItem(this, _(MOVE_ALL_EDITS_TITLE), MOVE_ALL_EDITS));
421 add_item(new ViewBehaviourItem(this, _(MOVE_ONE_EDIT_TITLE), MOVE_ONE_EDIT));
422 add_item(new ViewBehaviourItem(this, _(MOVE_NO_EDITS_TITLE), MOVE_NO_EDITS));
423 add_item(new ViewBehaviourItem(this, _(MOVE_EDITS_DISABLED_TITLE), MOVE_EDITS_DISABLED));
428 ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour)
432 this->behaviour = behaviour;
435 ViewBehaviourItem::~ViewBehaviourItem()
439 int ViewBehaviourItem::handle_event()
441 popup->set_text(get_text());
442 *(popup->output) = behaviour;
448 MeterMinDB::MeterMinDB(PreferencesWindow *pwindow, char *text, int x, int y)
449 : BC_TextBox(x, y, 50, 1, text)
451 this->pwindow = pwindow;
454 int MeterMinDB::handle_event()
456 pwindow->thread->redraw_meters = 1;
457 pwindow->thread->edl->session->min_meter_db = atol(get_text());
464 MeterMaxDB::MeterMaxDB(PreferencesWindow *pwindow, char *text, int x, int y)
465 : BC_TextBox(x, y, 50, 1, text)
467 this->pwindow = pwindow;
470 int MeterMaxDB::handle_event()
472 pwindow->thread->redraw_meters = 1;
473 pwindow->thread->edl->session->max_meter_db = atol(get_text());
481 MeterVUDB::MeterVUDB(PreferencesWindow *pwindow, char *text, int y)
482 : BC_Radial(145, y, pwindow->thread->edl->session->meter_format == METER_DB, text)
484 this->pwindow = pwindow;
487 int MeterVUDB::handle_event()
489 pwindow->thread->redraw_meters = 1;
490 // vu_int->update(0);
491 pwindow->thread->edl->session->meter_format = METER_DB;
495 MeterVUInt::MeterVUInt(PreferencesWindow *pwindow, char *text, int y)
496 : BC_Radial(205, y, pwindow->thread->edl->session->meter_format == METER_INT, text)
498 this->pwindow = pwindow;
501 int MeterVUInt::handle_event()
503 pwindow->thread->redraw_meters = 1;
505 pwindow->thread->edl->session->meter_format = METER_INT;
512 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
513 : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->theme, 1)
515 this->pwindow = pwindow;
517 ViewTheme::~ViewTheme()
521 void ViewTheme::create_objects()
523 ArrayList<PluginServer*> themes;
524 pwindow->mwindow->create_plugindb(0,
531 for(int i = 0; i < themes.total; i++)
533 add_item(new ViewThemeItem(this, themes.values[i]->title));
537 int ViewTheme::handle_event()
546 ViewThemeItem::ViewThemeItem(ViewTheme *popup, char *text)
552 int ViewThemeItem::handle_event()
554 popup->set_text(get_text());
555 strcpy(popup->pwindow->thread->preferences->theme, get_text());
556 popup->handle_event();
560 ViewThumbnails::ViewThumbnails(int x,
562 PreferencesWindow *pwindow)
565 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
567 this->pwindow = pwindow;
570 int ViewThumbnails::handle_event()
572 pwindow->thread->preferences->use_thumbnails = get_value();