4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "appearanceprefs.h"
23 #include "deleteallindexes.h"
25 #include "edlsession.h"
27 #include "filesystem.h"
30 #include "preferences.h"
31 #include "preferencesthread.h"
32 #include "shbtnprefs.h"
36 AppearancePrefs::AppearancePrefs(MWindow *mwindow, PreferencesWindow *pwindow)
37 : PreferencesDialog(mwindow, pwindow)
50 // *** CONTEXT_HELP ***
51 context_help_set_keyword("Appearance");
54 AppearancePrefs::~AppearancePrefs()
65 delete thumbnail_size;
70 void AppearancePrefs::create_objects()
72 int xs5 = xS(5), xs10 = xS(10), xs30 = xS(30);
73 int ys5 = yS(5), ys10 = yS(10), ys15 = yS(15);
74 int ys20 = yS(20), ys35 = yS(35);
75 BC_Resources *resources = BC_WindowBase::get_resources();
76 int margin = mwindow->theme->widget_border;
77 char string[BCTEXTLEN];
78 int x0 = mwindow->theme->preferencesoptions_x;
79 int y0 = mwindow->theme->preferencesoptions_y;
80 int x = x0, y = y0, x1 = x + xS(100);
83 add_subwindow(title = new BC_Title(x, y, _("Layout:"), LARGEFONT,
84 resources->text_default));
85 title->context_help_set_keyword("Layout section");
86 y += title->get_h() + ys10;
90 add_subwindow(title = new BC_Title(x, y, _("Theme:")));
91 title->context_help_set_keyword("Layout section");
92 add_subwindow(theme = new ViewTheme(x1, y, pwindow));
93 theme->create_objects();
94 theme->context_help_set_keyword("Layout section");
95 y += theme->get_h() + ys5;
98 ViewPluginIcons *plugin_icons;
99 add_subwindow(title = new BC_Title(x, y, _("Plugin Icons:")));
100 title->context_help_set_keyword("Updatable Icon Image Support");
101 add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow));
102 plugin_icons->create_objects();
103 plugin_icons->context_help_set_keyword("Updatable Icon Image Support");
104 y += plugin_icons->get_h() + ys10;
105 add_subwindow(title = new BC_Title(x, y, _("Language:")));
106 title->context_help_set_keyword("Layout section");
107 LayoutLocale *layout_locale;
108 add_subwindow(layout_locale = new LayoutLocale(x1, y, pwindow));
109 layout_locale->create_objects();
110 layout_locale->context_help_set_keyword("Layout section");
111 y += layout_locale->get_h() + ys15;
114 int x2 = x1 + xS(160), y2 = y;
117 add_subwindow(title = new BC_Title(x1, y, _("Layout Scale:")));
118 title->context_help_set_keyword("Layout section");
119 layout_scale = new ViewLayoutScale(pwindow, this, x2, y);
120 layout_scale->create_objects();
121 y += layout_scale->get_h() + ys5;
122 add_subwindow(title = new BC_Title(x1, y, _("View thumbnail size:")));
123 title->context_help_set_keyword("Layout section");
124 thumbnail_size = new ViewThumbnailSize(pwindow, this, x2, y);
125 thumbnail_size->create_objects();
126 y += thumbnail_size->get_h() + ys5;
127 add_subwindow(title = new BC_Title(x1, y, _("Vicon quality:")));
128 title->context_help_set_keyword("Layout section");
129 vicon_size = new ViewViconSize(pwindow, this, x2, y);
130 vicon_size->create_objects();
131 y += vicon_size->get_h() + ys5;
132 add_subwindow(title = new BC_Title(x1, y, _("Vicon color mode:")));
133 title->context_help_set_keyword("Layout section");
134 add_subwindow(vicon_color_mode = new ViewViconColorMode(pwindow, x2, y));
135 vicon_color_mode->create_objects();
136 vicon_color_mode->context_help_set_keyword("Layout section");
137 y += vicon_color_mode->get_h() + ys5;
140 add_subwindow(new BC_Bar(xs5, y, get_w() - xs10));
144 add_subwindow(title = new BC_Title(x, y, _("Time Format:"), LARGEFONT,
145 resources->text_default));
146 title->context_help_set_keyword("Time Format section");
147 y += title->get_h() + ys10;
148 add_subwindow(hms = new TimeFormatHMS(pwindow, this,
149 pwindow->thread->edl->session->time_format == TIME_HMS,
151 hms->context_help_set_keyword("Time Format section");
153 add_subwindow(hmsf = new TimeFormatHMSF(pwindow, this,
154 pwindow->thread->edl->session->time_format == TIME_HMSF,
156 hmsf->context_help_set_keyword("Time Format section");
158 add_subwindow(timecode = new TimeFormatTimecode(pwindow, this,
159 pwindow->thread->edl->session->time_format == TIME_TIMECODE,
161 timecode->context_help_set_keyword("Time Format section");
163 add_subwindow(samples = new TimeFormatSamples(pwindow, this,
164 pwindow->thread->edl->session->time_format == TIME_SAMPLES,
166 samples->context_help_set_keyword("Time Format section");
168 add_subwindow(hex = new TimeFormatHex(pwindow, this,
169 pwindow->thread->edl->session->time_format == TIME_SAMPLES_HEX,
171 hex->context_help_set_keyword("Time Format section");
173 add_subwindow(frames = new TimeFormatFrames(pwindow, this,
174 pwindow->thread->edl->session->time_format == TIME_FRAMES,
176 frames->context_help_set_keyword("Time Format section");
178 add_subwindow(feet = new TimeFormatFeet(pwindow, this,
179 pwindow->thread->edl->session->time_format == TIME_FEET_FRAMES,
181 feet->context_help_set_keyword("Time Format section");
182 x += feet->get_w() + xS(15);
183 add_subwindow(title = new BC_Title(x, y, _("Frames per foot:")));
184 title->context_help_set_keyword("Time Format section");
185 x += title->get_w() + margin;
186 sprintf(string, "%0.2f", pwindow->thread->edl->session->frames_per_foot);
187 add_subwindow(new TimeFormatFeetSetting(pwindow,
188 x, y - ys5, string));
191 add_subwindow(seconds = new TimeFormatSeconds(pwindow, this,
192 pwindow->thread->edl->session->time_format == TIME_SECONDS,
194 seconds->context_help_set_keyword("Time Format section");
199 add_subwindow(title = new BC_Title(x, y, _("Color:"), LARGEFONT,
200 resources->text_default));
201 title->context_help_set_keyword("Color section");
203 add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:")));
204 title->context_help_set_keyword("Color section");
205 x += title->get_w() + margin;
206 char hex_color[BCSTRLEN];
207 sprintf(hex_color, "%06x", preferences->highlight_inverse);
208 add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color));
211 add_subwindow(title = new BC_Title(x, y, _("Composer BG Color:")));
212 title->context_help_set_keyword("Color section");
213 int clr_color = pwindow->thread->edl->session->cwindow_clear_color;
214 add_subwindow(cwdw_bg_color = new Composer_BG_Color(pwindow,
215 x2, y, xS(80), yS(24), clr_color));
216 draw_3d_border(x2-2,y-2, xS(80)+4,xS(24)+4, 1);
217 cwdw_bg_color->create_objects();
218 cwdw_bg_color->context_help_set_keyword("Color section");
219 x2 += cwdw_bg_color->get_w();
222 add_subwindow(title = new BC_Title(x1, y, _("YUV color space:")));
223 title->context_help_set_keyword("Color Space and Color Range");
225 add_subwindow(yuv_color_space = new YuvColorSpace(x, y, pwindow));
226 yuv_color_space->create_objects();
227 yuv_color_space->context_help_set_keyword("Color Space and Color Range");
228 y += yuv_color_space->get_h() + ys5;
230 add_subwindow(title = new BC_Title(x1, y, _("YUV color range:")));
231 title->context_help_set_keyword("Color Space and Color Range");
233 add_subwindow(yuv_color_range = new YuvColorRange(x, y, pwindow));
234 yuv_color_range->create_objects();
235 yuv_color_range->context_help_set_keyword("Color Space and Color Range");
236 y += yuv_color_range->get_h() + ys35;
239 add_subwindow(new BC_Bar(x0, y2, get_w()-x0 - xs30));
243 add_subwindow(title = new BC_Title(x, y, _("Warnings:"), LARGEFONT,
244 resources->text_default));
245 title->context_help_set_keyword("Warnings section");
246 y += title->get_h() + ys10;
247 UseWarnIndecies *idx_warn = new UseWarnIndecies(pwindow, x, y);
248 add_subwindow(idx_warn);
249 idx_warn->context_help_set_keyword("Warnings section");
250 y += idx_warn->get_h() + ys5;
251 BD_WarnRoot *bdwr_warn = new BD_WarnRoot(pwindow, x, y);
252 add_subwindow(bdwr_warn);
253 bdwr_warn->context_help_set_keyword("Blu-ray Workaround for Mount");
254 y += bdwr_warn->get_h() + ys5;
255 UseWarnFileRef *warn_ref = new UseWarnFileRef(pwindow, x, y);
256 add_subwindow(warn_ref);
257 warn_ref->context_help_set_keyword("File by Reference");
258 y += warn_ref->get_h() + ys5;
260 add_subwindow(new BC_Bar(x0, y, warn_ref->get_w()-x0 - xs30));
263 add_subwindow(title = new BC_Title(x, y, _("Dangerous:"), LARGEFONT,
264 resources->text_default));
265 title->context_help_set_keyword("Dangerous section");
266 y += title->get_h() + ys10;
269 UseUnsafeGUI *unsafe_gui = new UseUnsafeGUI(pwindow, x, y);
270 add_subwindow(unsafe_gui);
271 unsafe_gui->context_help_set_keyword("Advanced features");
272 y += unsafe_gui->get_h() + ys5;
273 OngoingBackups *ongoing_backups = new OngoingBackups(pwindow, x, y);
274 add_subwindow(ongoing_backups);
275 ongoing_backups->context_help_set_keyword("Backup and Perpetual Session");
276 y += ongoing_backups->get_h() + ys5;
278 x = get_w() / 3 + xs30;
280 add_subwindow(title = new BC_Title(x, y, _("Flags:"), LARGEFONT,
281 resources->text_default));
282 title->context_help_set_keyword("Flags section");
283 y += title->get_h() + ys10;
285 AutocolorAssets *autocolor_assets = new AutocolorAssets(pwindow, x, y);
286 add_subwindow(autocolor_assets);
287 autocolor_assets->context_help_set_keyword("Color Title Bars and Assets");
288 y += autocolor_assets->get_h() + ys5;
289 PerpetualSession *perpetual = new PerpetualSession(x, y, pwindow);
290 add_subwindow(perpetual);
291 perpetual->context_help_set_keyword("Backup and Perpetual Session");
292 y += perpetual->get_h() + ys5;
293 RectifyAudioToggle *rect_toggle = new RectifyAudioToggle(x, y, pwindow);
294 add_subwindow(rect_toggle);
295 rect_toggle->context_help_set_keyword("Flags section");
296 y += rect_toggle->get_h() + ys5;
297 CtrlToggle *ctrl_toggle = new CtrlToggle(x, y, pwindow);
298 add_subwindow(ctrl_toggle);
299 ctrl_toggle->context_help_set_keyword("Selection Methods");
300 y += ctrl_toggle->get_h() + ys5;
301 ForwardRenderDisplacement *displacement = new ForwardRenderDisplacement(pwindow, x, y);
302 add_subwindow(displacement);
303 displacement->context_help_set_keyword("Always Show Next Frame");
304 y += displacement->get_h() + ys5;
305 UseTipWindow *tip_win = new UseTipWindow(pwindow, x, y);
306 add_subwindow(tip_win);
307 tip_win->context_help_set_keyword("Flags section");
308 y += tip_win->get_h() + ys5;
310 x = 2*get_w() / 3 - xs30;
312 add_subwindow(thumbnails = new ViewThumbnails(x, y, pwindow));
313 thumbnails->context_help_set_keyword("Video Icons \\/ Audio Icons");
314 y += thumbnails->get_h() + ys5;
315 PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x, y);
316 add_subwindow(pop_win);
317 pop_win->context_help_set_keyword("Flags section");
318 y += pop_win->get_h() + ys5;
319 GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x, y);
320 add_subwindow(grab_input_focus);
321 grab_input_focus->context_help_set_keyword("Flags section");
322 y += grab_input_focus->get_h() + ys5;
323 ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x, y);
324 add_subwindow(focus_activate);
325 focus_activate->context_help_set_keyword("Flags section");
326 y += focus_activate->get_h() + ys5;
327 DeactivateFocusPolicy *focus_deactivate = new DeactivateFocusPolicy(pwindow, x, y);
328 add_subwindow(focus_deactivate);
329 focus_deactivate->context_help_set_keyword("Flags section");
330 y += focus_deactivate->get_h() + ys5;
331 AutoRotate *auto_rotate = new AutoRotate(pwindow, x, y);
332 add_subwindow(auto_rotate);
333 auto_rotate->context_help_set_keyword("Flags section");
334 y += auto_rotate->get_h() + ys5;
337 int AppearancePrefs::update(int new_value)
339 pwindow->thread->redraw_times = 1;
340 pwindow->thread->edl->session->time_format = new_value;
341 hms->update(new_value == TIME_HMS);
342 hmsf->update(new_value == TIME_HMSF);
343 timecode->update(new_value == TIME_TIMECODE);
344 samples->update(new_value == TIME_SAMPLES);
345 hex->update(new_value == TIME_SAMPLES_HEX);
346 frames->update(new_value == TIME_FRAMES);
347 feet->update(new_value == TIME_FEET_FRAMES);
348 seconds->update(new_value == TIME_SECONDS);
353 TimeFormatHMS::TimeFormatHMS(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
354 : BC_Radial(x, y, value, TIME_HMS_TEXT)
355 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
357 int TimeFormatHMS::handle_event()
359 tfwindow->update(TIME_HMS);
363 TimeFormatHMSF::TimeFormatHMSF(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
364 : BC_Radial(x, y, value, TIME_HMSF_TEXT)
365 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
367 int TimeFormatHMSF::handle_event()
369 tfwindow->update(TIME_HMSF);
373 TimeFormatTimecode::TimeFormatTimecode(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
374 : BC_Radial(x, y, value, TIME_TIMECODE_TEXT)
375 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
377 int TimeFormatTimecode::handle_event()
379 tfwindow->update(TIME_TIMECODE);
383 TimeFormatSamples::TimeFormatSamples(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
384 : BC_Radial(x, y, value, TIME_SAMPLES_TEXT)
385 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
387 int TimeFormatSamples::handle_event()
389 tfwindow->update(TIME_SAMPLES);
393 TimeFormatFrames::TimeFormatFrames(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
394 : BC_Radial(x, y, value, TIME_FRAMES_TEXT)
395 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
397 int TimeFormatFrames::handle_event()
399 tfwindow->update(TIME_FRAMES);
403 TimeFormatHex::TimeFormatHex(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
404 : BC_Radial(x, y, value, TIME_SAMPLES_HEX_TEXT)
405 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
407 int TimeFormatHex::handle_event()
409 tfwindow->update(TIME_SAMPLES_HEX);
413 TimeFormatSeconds::TimeFormatSeconds(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
414 : BC_Radial(x, y, value, TIME_SECONDS_TEXT)
416 this->pwindow = pwindow;
417 this->tfwindow = tfwindow;
420 int TimeFormatSeconds::handle_event()
422 tfwindow->update(TIME_SECONDS);
426 TimeFormatFeet::TimeFormatFeet(PreferencesWindow *pwindow, AppearancePrefs *tfwindow, int value, int x, int y)
427 : BC_Radial(x, y, value, TIME_FEET_FRAMES_TEXT)
428 { this->pwindow = pwindow; this->tfwindow = tfwindow; }
430 int TimeFormatFeet::handle_event()
432 tfwindow->update(TIME_FEET_FRAMES);
436 TimeFormatFeetSetting::TimeFormatFeetSetting(PreferencesWindow *pwindow, int x, int y, char *string)
437 : BC_TextBox(x, y, xS(90), 1, string)
438 { this->pwindow = pwindow; }
440 int TimeFormatFeetSetting::handle_event()
442 pwindow->thread->edl->session->frames_per_foot = atof(get_text());
443 if(pwindow->thread->edl->session->frames_per_foot < 1) pwindow->thread->edl->session->frames_per_foot = 1;
448 ViewTheme::ViewTheme(int x, int y, PreferencesWindow *pwindow)
449 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->theme, 1)
451 this->pwindow = pwindow;
453 ViewTheme::~ViewTheme()
457 void ViewTheme::create_objects()
459 ArrayList<PluginServer*> themes;
460 MWindow::search_plugindb(0, 0, 0, 0, 1, themes);
462 for(int i = 0; i < themes.total; i++) {
463 add_item(new ViewThemeItem(this, themes.values[i]->title));
467 int ViewTheme::handle_event()
472 ViewThemeItem::ViewThemeItem(ViewTheme *popup, const char *text)
478 int ViewThemeItem::handle_event()
480 popup->set_text(get_text());
481 strcpy(popup->pwindow->thread->preferences->theme, get_text());
482 popup->handle_event();
487 ViewPluginIcons::ViewPluginIcons(int x, int y, PreferencesWindow *pwindow)
488 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->plugin_icons, 1)
490 this->pwindow = pwindow;
492 ViewPluginIcons::~ViewPluginIcons()
496 void ViewPluginIcons::create_objects()
498 add_item(new ViewPluginIconItem(this, DEFAULT_PICON));
500 const char *plugin_path = File::get_plugin_path();
501 char picon_path[BCTEXTLEN];
502 snprintf(picon_path,sizeof(picon_path)-1,"%s/picon", plugin_path);
503 if( fs.update(picon_path) ) return;
504 for( int i=0; i<fs.dir_list.total; ++i ) {
505 char *fs_path = fs.dir_list[i]->path;
506 if( !fs.is_dir(fs_path) ) continue;
507 char *cp = strrchr(fs_path,'/');
508 cp = !cp ? fs_path : cp+1;
509 if( !strcmp(cp,DEFAULT_PICON) ) continue;
510 add_item(new ViewPluginIconItem(this, cp));
514 int ViewPluginIcons::handle_event()
519 ViewPluginIconItem::ViewPluginIconItem(ViewPluginIcons *popup, const char *text)
525 int ViewPluginIconItem::handle_event()
527 popup->set_text(get_text());
528 strcpy(popup->pwindow->thread->preferences->plugin_icons, get_text());
529 popup->handle_event();
533 LayoutLocale::LayoutLocale(int x, int y, PreferencesWindow *pwindow)
534 : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->locale, 1)
536 this->pwindow = pwindow;
538 LayoutLocale::~LayoutLocale()
542 const char *LayoutLocale::locale_list[] = { LOCALE_LIST, 0 };
544 void LayoutLocale::create_objects()
546 for( const char *tp, **lp=locale_list; (tp=*lp)!=0; ++lp )
547 add_item(new LayoutLocaleItem(this, tp));
550 int LayoutLocale::handle_event()
555 LayoutLocaleItem::LayoutLocaleItem(LayoutLocale *popup, const char *text)
561 int LayoutLocaleItem::handle_event()
563 popup->set_text(get_text());
564 strcpy(popup->pwindow->thread->preferences->locale, get_text());
565 popup->handle_event();
569 ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow,
570 AppearancePrefs *aprefs, int x, int y)
571 : BC_TumbleTextBox(aprefs,
572 pwindow->thread->preferences->layout_scale,
573 0.f, 10.f, x, y, xS(80), 2)
575 this->pwindow = pwindow;
576 this->aprefs = aprefs;
580 int ViewLayoutScale::handle_event()
582 float v = atof(get_text());
583 pwindow->thread->preferences->layout_scale = v;
588 ViewThumbnails::ViewThumbnails(int x,
590 PreferencesWindow *pwindow)
593 pwindow->thread->preferences->use_thumbnails, _("Use thumbnails in resource window"))
595 this->pwindow = pwindow;
598 int ViewThumbnails::handle_event()
600 pwindow->thread->preferences->use_thumbnails = get_value();
605 ViewThumbnailSize::ViewThumbnailSize(PreferencesWindow *pwindow,
606 AppearancePrefs *aprefs, int x, int y)
607 : BC_TumbleTextBox(aprefs,
608 pwindow->thread->preferences->awindow_picon_h,
609 16, 512, x, y, xS(80))
612 this->pwindow = pwindow;
613 this->aprefs = aprefs;
616 int ViewThumbnailSize::handle_event()
618 int v = atoi(get_text());
620 pwindow->thread->preferences->awindow_picon_h = v;
624 ViewViconSize::ViewViconSize(PreferencesWindow *pwindow,
625 AppearancePrefs *aprefs, int x, int y)
626 : BC_TumbleTextBox(aprefs,
627 pwindow->thread->preferences->vicon_size,
628 16, 512, x, y, xS(80))
631 this->pwindow = pwindow;
632 this->aprefs = aprefs;
635 int ViewViconSize::handle_event()
637 int v = atoi(get_text());
639 pwindow->thread->preferences->vicon_size = v;
643 ViewViconColorMode::ViewViconColorMode(PreferencesWindow *pwindow, int x, int y)
644 : BC_PopupMenu(x, y, xS(100),
645 _(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]), 1)
647 this->pwindow = pwindow;
649 ViewViconColorMode::~ViewViconColorMode()
653 const char *ViewViconColorMode::vicon_color_modes[] = {
659 void ViewViconColorMode::create_objects()
661 for( int id=0,nid=sizeof(vicon_color_modes)/sizeof(vicon_color_modes[0]); id<nid; ++id )
662 add_item(new ViewViconColorModeItem(this, _(vicon_color_modes[id]), id));
666 int ViewViconColorMode::handle_event()
668 set_text(_(vicon_color_modes[pwindow->thread->preferences->vicon_color_mode]));
672 ViewViconColorModeItem::ViewViconColorModeItem(ViewViconColorMode *popup, const char *text, int id)
679 int ViewViconColorModeItem::handle_event()
681 popup->set_text(get_text());
682 popup->pwindow->thread->preferences->vicon_color_mode = id;
683 return popup->handle_event();
687 UseTipWindow::UseTipWindow(PreferencesWindow *pwindow, int x, int y)
690 pwindow->thread->preferences->use_tipwindow,
691 _("Show tip of the day"))
693 this->pwindow = pwindow;
695 int UseTipWindow::handle_event()
697 pwindow->thread->preferences->use_tipwindow = get_value();
702 UseWarnIndecies::UseWarnIndecies(PreferencesWindow *pwindow, int x, int y)
703 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_indexes,
704 _("ffmpeg probe warns rebuild indexes"))
706 this->pwindow = pwindow;
709 int UseWarnIndecies::handle_event()
711 pwindow->thread->preferences->warn_indexes = get_value();
715 UseUnsafeGUI::UseUnsafeGUI(PreferencesWindow *pwindow, int x, int y)
716 : BC_CheckBox(x, y, pwindow->thread->preferences->unsafe_gui,
717 _("Unsafe GUI in batchrender"))
719 this->pwindow = pwindow;
720 set_tooltip(_("Save to EDL path option becomes available and will overwrite EDL on disk. \n Warn if jobs/session mismatch option is available but can be unchecked."));
723 int UseUnsafeGUI::handle_event()
725 pwindow->thread->preferences->unsafe_gui = get_value();
729 OngoingBackups::OngoingBackups(PreferencesWindow *pwindow, int x, int y)
730 : BC_CheckBox(x, y, pwindow->thread->preferences->ongoing_backups,
731 _("Autosave continuous backups"))
733 this->pwindow = pwindow;
734 set_tooltip(_("When you stop Cinelerra, all but the newest 50 will be deleted but you risk \n running out of disk space if you do a lot of work without restarting."));
737 int OngoingBackups::handle_event()
739 pwindow->thread->preferences->ongoing_backups = get_value();
743 BD_WarnRoot::BD_WarnRoot(PreferencesWindow *pwindow, int x, int y)
744 : BC_CheckBox(x, y, pwindow->thread->preferences->bd_warn_root,
745 _("Create Bluray warns if not root"))
747 this->pwindow = pwindow;
750 int BD_WarnRoot::handle_event()
752 pwindow->thread->preferences->bd_warn_root = get_value();
756 UseWarnFileRef::UseWarnFileRef(PreferencesWindow *pwindow, int x, int y)
757 : BC_CheckBox(x, y, pwindow->thread->preferences->warn_fileref,
758 _("Warn on creating file references"))
760 this->pwindow = pwindow;
763 int UseWarnFileRef::handle_event()
765 pwindow->thread->preferences->warn_fileref = get_value();
770 PopupMenuBtnup::PopupMenuBtnup(PreferencesWindow *pwindow, int x, int y)
771 : BC_CheckBox(x, y, pwindow->thread->preferences->popupmenu_btnup,
772 _("Popups activate on button up"))
774 this->pwindow = pwindow;
777 int PopupMenuBtnup::handle_event()
779 pwindow->thread->preferences->popupmenu_btnup = get_value();
783 GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y)
784 : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0,
785 _("Set Input Focus when window entered"))
787 this->pwindow = pwindow;
790 int GrabFocusPolicy::handle_event()
792 pwindow->thread->preferences->grab_input_focus = get_value();
796 ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
797 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0,
798 _("Click to activate text focus"))
800 this->pwindow = pwindow;
803 int ActivateFocusPolicy::handle_event()
806 pwindow->thread->preferences->textbox_focus_policy |= CLICK_ACTIVATE;
808 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_ACTIVATE;
812 DeactivateFocusPolicy::DeactivateFocusPolicy(PreferencesWindow *pwindow, int x, int y)
813 : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_DEACTIVATE) != 0,
814 _("Click to deactivate text focus"))
816 this->pwindow = pwindow;
819 int DeactivateFocusPolicy::handle_event()
822 pwindow->thread->preferences->textbox_focus_policy |= CLICK_DEACTIVATE;
824 pwindow->thread->preferences->textbox_focus_policy &= ~CLICK_DEACTIVATE;
828 AutoRotate::AutoRotate(PreferencesWindow *pwindow, int x, int y)
829 : BC_CheckBox(x, y, pwindow->thread->preferences->auto_rotate != 0,
830 _("Auto rotate ffmpeg media"))
832 this->pwindow = pwindow;
833 set_tooltip(_("Automatically rotates media if legal rotation metadata in file."));
836 int AutoRotate::handle_event()
838 pwindow->thread->preferences->auto_rotate = get_value();
842 ForwardRenderDisplacement::ForwardRenderDisplacement(PreferencesWindow *pwindow, int x, int y)
843 : BC_CheckBox(x, y, pwindow->thread->preferences->forward_render_displacement,
844 _("Always show next frame"))
846 this->pwindow = pwindow;
849 int ForwardRenderDisplacement::handle_event()
851 pwindow->thread->preferences->forward_render_displacement = get_value();
855 AutocolorAssets::AutocolorAssets(PreferencesWindow *pwindow, int x, int y)
856 : BC_CheckBox(x, y, pwindow->thread->preferences->autocolor_assets,
857 _("Autocolor assets"))
859 this->pwindow = pwindow;
860 set_tooltip(_("Displays automatically generated color overlay for the \n edits on the timeline that belong to the same media file."));
863 int AutocolorAssets::handle_event()
865 pwindow->thread->preferences->autocolor_assets = get_value();
869 HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex)
870 : BC_TextBox(x, y, xS(80), 1, hex)
872 this->pwindow = pwindow;
875 int HighlightInverseColor::handle_event()
877 int inverse_color = strtoul(get_text(),0,16);
878 if( (inverse_color &= 0xffffff) == 0 ) {
879 inverse_color = 0xffffff;
880 char string[BCSTRLEN];
881 sprintf(string,"%06x", inverse_color);
884 pwindow->thread->preferences->highlight_inverse = inverse_color;
889 const char *YuvColorSpace::color_space[] = {
890 N_("BT601"), // COLOR_SPACE_BT601
891 N_("BT709"), // COLOR_SPACE_BT709
892 N_("BT2020"), // COLOR_SPACE_BT2020
895 YuvColorSpace::YuvColorSpace(int x, int y, PreferencesWindow *pwindow)
896 : BC_PopupMenu(x, y, xS(120),
897 _(color_space[pwindow->thread->preferences->yuv_color_space]), 1)
899 this->pwindow = pwindow;
901 YuvColorSpace::~YuvColorSpace()
905 void YuvColorSpace::create_objects()
907 for( int id=0,nid=sizeof(color_space)/sizeof(color_space[0]); id<nid; ++id )
908 add_item(new YuvColorSpaceItem(this, _(color_space[id]), id));
912 int YuvColorSpace::handle_event()
914 set_text(_(color_space[pwindow->thread->preferences->yuv_color_space]));
918 YuvColorSpaceItem::YuvColorSpaceItem(YuvColorSpace *popup, const char *text, int id)
925 int YuvColorSpaceItem::handle_event()
927 popup->set_text(get_text());
928 popup->pwindow->thread->preferences->yuv_color_space = id;
929 return popup->handle_event();
933 const char *YuvColorRange::color_range[] = {
934 N_("JPEG"), // COLOR_RANGE_JPEG
935 N_("MPEG"), // COLOR_RANGE_MPEG
938 YuvColorRange::YuvColorRange(int x, int y, PreferencesWindow *pwindow)
939 : BC_PopupMenu(x, y, xS(100),
940 _(color_range[pwindow->thread->preferences->yuv_color_range]), 1)
942 this->pwindow = pwindow;
944 YuvColorRange::~YuvColorRange()
948 void YuvColorRange::create_objects()
950 for( int id=0,nid=sizeof(color_range)/sizeof(color_range[0]); id<nid; ++id )
951 add_item(new YuvColorRangeItem(this, _(color_range[id]), id));
955 int YuvColorRange::handle_event()
957 set_text(color_range[pwindow->thread->preferences->yuv_color_range]);
961 YuvColorRangeItem::YuvColorRangeItem(YuvColorRange *popup, const char *text, int id)
968 int YuvColorRangeItem::handle_event()
970 popup->set_text(get_text());
971 popup->pwindow->thread->preferences->yuv_color_range = id;
972 return popup->handle_event();
975 PerpetualSession::PerpetualSession(int x, int y, PreferencesWindow *pwindow)
977 pwindow->thread->preferences->perpetual_session, _("Perpetual session"))
979 this->pwindow = pwindow;
980 set_tooltip(_("Resume previous session on startup with undo/redo stack saved between sessions. \n On startup, previous project is loaded as if there was no stoppage."));
983 int PerpetualSession::handle_event()
985 pwindow->thread->preferences->perpetual_session = get_value();
989 CtrlToggle::CtrlToggle(int x, int y, PreferencesWindow *pwindow)
991 pwindow->thread->preferences->ctrl_toggle, _("Clears before toggle"))
993 this->pwindow = pwindow;
994 set_tooltip(_("Drag and Drop editing - when using LMB on edit,\n clears all selected edits except this one."));
997 int CtrlToggle::handle_event()
999 pwindow->thread->preferences->ctrl_toggle = get_value();
1003 RectifyAudioToggle::RectifyAudioToggle(int x, int y, PreferencesWindow *pwindow)
1005 pwindow->thread->preferences->rectify_audio, _("Timeline Rectify Audio"))
1007 this->pwindow = pwindow;
1008 set_tooltip(_("Displays rectified audio showing only positive half of the waveform \n resulting in waveform stretched more over the height of the track."));
1011 int RectifyAudioToggle::handle_event()
1013 pwindow->thread->preferences->rectify_audio = get_value();
1017 Composer_BG_Color::Composer_BG_Color(PreferencesWindow *pwindow,
1018 int x, int y, int w, int h, int color)
1019 : ColorBoxButton(_("Composer BG color"), x, y, w, h, color, -1, 1)
1021 this->pwindow = pwindow;
1024 Composer_BG_Color::~Composer_BG_Color()
1028 void Composer_BG_Color::handle_done_event(int result)
1031 pwindow->lock_window("Composer_BG_Color::handle_done_event");
1032 update_gui(orig_color, orig_alpha);
1033 pwindow->unlock_window();
1034 handle_new_color(orig_color, orig_alpha);
1038 int Composer_BG_Color::handle_new_color(int color, int alpha)
1040 pwindow->thread->edl->session->cwindow_clear_color = color;