1 #include "deleteallindexes.h"
3 #include "edlsession.h"
5 #include "preferences.h"
6 #include "preferencesthread.h"
7 #include "interfaceprefs.h"
10 #define _(String) gettext(String)
11 #define gettext_noop(String) String
12 #define N_(String) gettext_noop (String)
15 N_("Drag all following edits")
16 N_("Drag only one edit")
17 N_("Drag source only")
21 #define MOVE_ALL_EDITS_TITLE "Drag all following edits"
22 #define MOVE_ONE_EDIT_TITLE "Drag only one edit"
23 #define MOVE_NO_EDITS_TITLE "Drag source only"
24 #define MOVE_EDITS_DISABLED_TITLE "No effect"
26 InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
27 : PreferencesDialog(mwindow, pwindow)
31 int InterfacePrefs::create_objects()
33 int y = 5, x = 5, value;
35 // add_border(get_resources()->get_bg_shadow1(),
36 // get_resources()->get_bg_shadow2(),
37 // get_resources()->get_bg_color(),
38 // get_resources()->get_bg_light2(),
39 // get_resources()->get_bg_light1());
40 add_subwindow(new BC_Title(x, y, _("Interface"), LARGEFONT, BLACK));
44 add_subwindow(hms = new TimeFormatHMS(pwindow,
46 pwindow->thread->edl->session->time_format == 0,
50 add_subwindow(hmsf = new TimeFormatHMSF(pwindow,
52 pwindow->thread->edl->session->time_format == 1,
56 add_subwindow(samples = new TimeFormatSamples(pwindow,
58 pwindow->thread->edl->session->time_format == 2,
62 add_subwindow(hex = new TimeFormatHex(pwindow,
64 pwindow->thread->edl->session->time_format == 3,
68 add_subwindow(frames = new TimeFormatFrames(pwindow,
70 pwindow->thread->edl->session->time_format == 4,
74 add_subwindow(feet = new TimeFormatFeet(pwindow,
76 pwindow->thread->edl->session->time_format == 5,
79 add_subwindow(new BC_Title(260, y, _("frames per foot")));
80 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
81 add_subwindow(new TimeFormatFeetSetting(pwindow,
89 add_subwindow(new BC_Title(x, y, _("Index files"), LARGEFONT, BLACK));
93 add_subwindow(new BC_Title(x,
95 _("Index files go here:"), MEDIUMFONT, BLACK));
96 add_subwindow(ipathtext = new IndexPathText(x + 230,
99 pwindow->thread->preferences->index_directory));
100 add_subwindow(ipath = new BrowseButton(mwindow,
103 x + 230 + ipathtext->get_w(),
105 pwindow->thread->preferences->index_directory,
107 _("Select the directory for index files"),
111 add_subwindow(new BC_Title(x,
113 _("Size of index file:"),
116 sprintf(string, "%ld", pwindow->thread->preferences->index_size);
117 add_subwindow(isize = new IndexSize(x + 230, y, pwindow, string));
119 add_subwindow(new BC_Title(x, y + 5, _("Number of index files to keep:"), MEDIUMFONT, BLACK));
120 sprintf(string, "%ld", pwindow->thread->preferences->index_count);
121 add_subwindow(icount = new IndexCount(x + 230, y, pwindow, string));
122 add_subwindow(deleteall = new DeleteAllIndexes(mwindow, pwindow, 350, y));
130 add_subwindow(new BC_Title(x, y, _("Editing"), LARGEFONT, BLACK));
134 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
137 add_subwindow(new BC_Title(x, y, _("Clicking on in/out points does what:")));
139 add_subwindow(new BC_Title(x, y, _("Button 1:")));
141 ViewBehaviourText *text;
142 add_subwindow(text = new ViewBehaviourText(80,
144 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]),
146 &(pwindow->thread->edl->session->edit_handle_mode[0])));
147 text->create_objects();
149 add_subwindow(new BC_Title(x, y, _("Button 2:")));
150 add_subwindow(text = new ViewBehaviourText(80,
152 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[1]),
154 &(pwindow->thread->edl->session->edit_handle_mode[1])));
155 text->create_objects();
157 add_subwindow(new BC_Title(x, y, _("Button 3:")));
158 add_subwindow(text = new ViewBehaviourText(80,
160 behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[2]),
162 &(pwindow->thread->edl->session->edit_handle_mode[2])));
163 text->create_objects();
166 add_subwindow(new BC_Title(x, y, _("Min DB for meter:")));
167 sprintf(string, "%.0f", pwindow->thread->edl->session->min_meter_db);
168 add_subwindow(min_db = new MeterMinDB(pwindow, string, y));
170 add_subwindow(new BC_Title(x, y, _("Format for meter:")));
171 add_subwindow(vu_db = new MeterVUDB(pwindow, _("DB"), y));
172 // add_subwindow(vu_int = new MeterVUInt(pwindow, _("Percent of maximum"), y));
173 // vu_db->vu_int = vu_int;
174 // vu_int->vu_db = vu_db;
178 add_subwindow(new BC_Title(x, y, _("Theme:")));
180 add_subwindow(theme = new ViewTheme(x, y, pwindow));
181 theme->create_objects();
185 char* InterfacePrefs::behavior_to_text(int mode)
190 return _(MOVE_ALL_EDITS_TITLE);
193 return _(MOVE_ONE_EDIT_TITLE);
196 return _(MOVE_NO_EDITS_TITLE);
198 case MOVE_EDITS_DISABLED:
199 return _(MOVE_EDITS_DISABLED_TITLE);
207 int InterfacePrefs::update(int new_value)
209 pwindow->thread->redraw_times = 1;
210 pwindow->thread->edl->session->time_format = new_value;
211 hms->update(new_value == 0);
212 hmsf->update(new_value == 1);
213 samples->update(new_value == 2);
214 hex->update(new_value == 3);
215 frames->update(new_value == 4);
216 feet->update(new_value == 5);
219 InterfacePrefs::~InterfacePrefs()
248 IndexPathText::IndexPathText(int x,
250 PreferencesWindow *pwindow,
252 : BC_TextBox(x, y, 240, 1, text)
254 this->pwindow = pwindow;
257 IndexPathText::~IndexPathText() {}
259 int IndexPathText::handle_event()
261 strcpy(pwindow->thread->preferences->index_directory, get_text());
267 IndexSize::IndexSize(int x,
269 PreferencesWindow *pwindow,
271 : BC_TextBox(x, y, 100, 1, text)
273 this->pwindow = pwindow;
276 int IndexSize::handle_event()
280 result = atol(get_text());
281 if(result < 64000) result = 64000;
282 //if(result < 500000) result = 500000;
283 pwindow->thread->preferences->index_size = result;
289 IndexCount::IndexCount(int x,
291 PreferencesWindow *pwindow,
293 : BC_TextBox(x, y, 100, 1, text)
295 this->pwindow = pwindow;
298 int IndexCount::handle_event()
302 result = atol(get_text());
303 if(result < 1) result = 1;
304 pwindow->thread->preferences->index_count = result;
322 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
323 : BC_Radial(x, y, value, _("Use Hours:Minutes:Seconds.xxx"))
324 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
326 int TimeFormatHMS::handle_event()
332 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
333 : BC_Radial(x, y, value, _("Use Hours:Minutes:Seconds:Frames"))
334 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
336 int TimeFormatHMSF::handle_event()
341 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
342 : BC_Radial(x, y, value, _("Use Samples"))
343 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
345 int TimeFormatSamples::handle_event()
350 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
351 : BC_Radial(x, y, value, _("Use Frames"))
352 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
354 int TimeFormatFrames::handle_event()
359 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
360 : BC_Radial(x, y, value, _("Use Hex Samples"))
361 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
363 int TimeFormatHex::handle_event()
368 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, InterfacePrefs *tfwindow, int value, int x, int y)
369 : BC_Radial(x, y, value, _("Use Feet-frames"))
370 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
372 int TimeFormatFeet::handle_event()
377 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
378 : BC_TextBox(x, y, 90, 1, string)
379 { this->pwindow = pwindow; }
381 int TimeFormatFeetSetting::handle_event()
383 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
384 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
391 ViewBehaviourText::ViewBehaviourText(int x,
394 PreferencesWindow *pwindow,
396 : BC_PopupMenu(x, y, 200, text)
398 this->output = output;
401 ViewBehaviourText::~ViewBehaviourText()
405 int ViewBehaviourText::handle_event()
409 int ViewBehaviourText::create_objects()
411 // Video4linux versions are automatically detected
412 add_item(new ViewBehaviourItem(this, _(MOVE_ALL_EDITS_TITLE), MOVE_ALL_EDITS));
413 add_item(new ViewBehaviourItem(this, _(MOVE_ONE_EDIT_TITLE), MOVE_ONE_EDIT));
414 add_item(new ViewBehaviourItem(this, _(MOVE_NO_EDITS_TITLE), MOVE_NO_EDITS));
415 add_item(new ViewBehaviourItem(this, _(MOVE_EDITS_DISABLED_TITLE), MOVE_EDITS_DISABLED));
420 ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour)
424 this->behaviour = behaviour;
427 ViewBehaviourItem::~ViewBehaviourItem()
431 int ViewBehaviourItem::handle_event()
433 popup->set_text(get_text());
434 *(popup->output) = behaviour;
440 MeterMinDB::MeterMinDB(PreferencesWindow *pwindow, char *text, int y)
441 : BC_TextBox(145, y, 50, 1, text)
442 { this->pwindow = pwindow; }
444 int MeterMinDB::handle_event()
446 pwindow->thread->redraw_meters = 1;
447 pwindow->thread->edl->session->min_meter_db = atol(get_text());
456 MeterVUDB::MeterVUDB(PreferencesWindow *pwindow, char *text, int y)
457 : BC_Radial(145, y, pwindow->thread->edl->session->meter_format == METER_DB, text)
459 this->pwindow = pwindow;
462 int MeterVUDB::handle_event()
464 pwindow->thread->redraw_meters = 1;
465 // vu_int->update(0);
466 pwindow->thread->edl->session->meter_format = METER_DB;
470 MeterVUInt::MeterVUInt(PreferencesWindow *pwindow, char *text, int y)
471 : BC_Radial(205, y, pwindow->thread->edl->session->meter_format == METER_INT, text)
473 this->pwindow = pwindow;
476 int MeterVUInt::handle_event()
478 pwindow->thread->redraw_meters = 1;
480 pwindow->thread->edl->session->meter_format = METER_INT;
487 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
488 : BC_PopupMenu(x, y, 200, pwindow->thread->preferences->theme, 1)
490 this->pwindow = pwindow;
492 ViewTheme::~ViewTheme()
496 void ViewTheme::create_objects()
498 ArrayList<PluginServer*> themes;
499 pwindow->mwindow->create_plugindb(0,
506 for(int i = 0; i < themes.total; i++)
508 add_item(new ViewThemeItem(this, themes.values[i]->title));
512 int ViewTheme::handle_event()
521 ViewThemeItem::ViewThemeItem(ViewTheme *popup, char *text)
527 int ViewThemeItem::handle_event()
529 popup->set_text(get_text());
530 strcpy(popup->pwindow->thread->preferences->theme, get_text());
531 popup->handle_event();
535 ViewThumbnails::ViewThumbnails(int x,
537 PreferencesWindow *pwindow)
540 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
542 this->pwindow = pwindow;
545 int ViewThumbnails::handle_event()
547 pwindow->thread->preferences->use_thumbnails = get_value();