X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fplaybackprefs.C;h=d84913135a954c3c7305e6da3d962b3fbf88c015;hb=38cb4182e11e57fc426bede3825e825e9d61433b;hp=3ca0fbab8cd9185dec4706704c66b71e5db5332f;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/playbackprefs.C b/cinelerra-5.1/cinelerra/playbackprefs.C index 3ca0fbab..d8491313 100644 --- a/cinelerra-5.1/cinelerra/playbackprefs.C +++ b/cinelerra-5.1/cinelerra/playbackprefs.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2010 Adam Williams - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #include "adeviceprefs.h" @@ -68,30 +68,19 @@ void PlaybackPrefs::create_objects() x = mwindow->theme->preferencesoptions_x; y = mwindow->theme->preferencesoptions_y; - //int margin = mwindow->theme->widget_border; + int margin = mwindow->theme->widget_border; // Audio - add_subwindow(new BC_Title(x, - y, - _("Audio Out"), - LARGEFONT)); - - - y += get_text_height(LARGEFONT) + 5; - - BC_Title *title1, *title2; + add_subwindow(title1 = new BC_Title(x, y, _("Audio Out"), LARGEFONT)); + y += title1->get_h() + margin; add_subwindow(title2 = new BC_Title(x, y, _("Playback buffer samples:"), MEDIUMFONT)); - x2 = MAX(title2->get_w(), title2->get_w()) + 10; + x2 = title2->get_x() + title2->get_w() + margin; SET_TRACE sprintf(string, "%d", playback_config->aconfig->fragment_size); PlaybackModuleFragment *menu; - add_subwindow(menu = new PlaybackModuleFragment(x2, - y, - pwindow, - this, - string)); + add_subwindow(menu = new PlaybackModuleFragment(x2, y, pwindow, this, string)); menu->add_item(new BC_MenuItem("1024")); menu->add_item(new BC_MenuItem("2048")); menu->add_item(new BC_MenuItem("4096")); @@ -132,7 +121,7 @@ SET_TRACE play_gain->create_objects(); y += 40; add_subwindow(new BC_Title(x, y, _("Audio Driver:"))); - audio_device = new ADevicePrefs(x + 100, y, pwindow, + audio_device = new ADevicePrefs(x + 100, y, pwindow, this, playback_config->aconfig, 0, MODEPLAY); audio_device->initialize(0); @@ -141,26 +130,29 @@ SET_TRACE // Video - y += audio_device->get_h(); + y += audio_device->get_h(0) + margin; SET_TRACE - add_subwindow(new BC_Bar(5, y, get_w() - 10)); + add_subwindow(new BC_Bar(x, y, get_w() - x * 2)); y += 5; SET_TRACE - add_subwindow(new BC_Title(x, y, _("Video Out"), LARGEFONT)); - y += 30; + add_subwindow(title1 = new BC_Title(x, y, _("Video Out"), LARGEFONT)); + y += title1->get_h() + margin; SET_TRACE add_subwindow(window = new VideoEveryFrame(pwindow, this, x, y)); - - add_subwindow(new BC_Title(x + 200, y + 5, _("Framerate achieved:"))); - add_subwindow(framerate_title = new BC_Title(x + 350, y + 5, "--", MEDIUMFONT, RED)); + int x1 = x + window->get_w() + 30; + const char *txt = _("Framerate achieved:"); + int y1 = y + (window->get_h() - BC_Title::calculate_h(this, txt)) / 2; + add_subwindow(title1 = new BC_Title(x1, y1, txt)); + x1 += title1->get_w() + margin; + add_subwindow(framerate_title = new BC_Title(x1, y1, "--", MEDIUMFONT, RED)); draw_framerate(0); - y += window->get_h() + 5; + y += window->get_h() + 2*margin; - add_subwindow(asynchronous = new VideoAsynchronous(pwindow, x, y)); - y += asynchronous->get_h() + 10; +// add_subwindow(asynchronous = new VideoAsynchronous(pwindow, x, y)); +// y += asynchronous->get_h() + 10; SET_TRACE add_subwindow(title1 = new BC_Title(x, y, _("Scaling equation: Enlarge / Reduce "))); @@ -174,14 +166,13 @@ SET_TRACE add_subwindow(title1 = new BC_Title(x, y, _("DVD Subtitle to display:"))); PlaybackSubtitleNumber *subtitle_number; - subtitle_number = new PlaybackSubtitleNumber(x + title1->get_w() + 10, - y, - pwindow, - this); + x1 = x + title1->get_w() + margin; + subtitle_number = new PlaybackSubtitleNumber(x1, y, pwindow, this); subtitle_number->create_objects(); x2 = x + title1->get_w() + 10 + subtitle_number->get_w() + 30; PlaybackSubtitle *subtitle_toggle; + x1 += subtitle_number->get_w() + margin; add_subwindow(subtitle_toggle = new PlaybackSubtitle(x2, y, pwindow, this)); y += subtitle_toggle->get_h(); @@ -197,40 +188,19 @@ SET_TRACE add_subwindow(interpolate_raw = new PlaybackInterpolateRaw( x, y, pwindow, this)); - y += interpolate_raw->get_h(); + y += interpolate_raw->get_h() + margin; - add_subwindow(white_balance_raw = new PlaybackWhiteBalanceRaw( x, y, + add_subwindow(white_balance_raw = new PlaybackWhiteBalanceRaw(x, y, pwindow, this)); - y += white_balance_raw->get_h() + 10; - if(!pwindow->thread->edl->session->interpolate_raw) - white_balance_raw->disable(); - - -SET_TRACE -// y += 30; -// add_subwindow(new PlaybackDeblock(pwindow, 10, y)); - - x2 = x; - x += 370; - title1 = new BC_Title(x, y, _("Timecode offset:"), MEDIUMFONT); - add_subwindow(title1); x += title1->get_w(); - for( int i=3;;) { - sprintf(string, "%d", pwindow->thread->edl->session->timecode_offset[i]); - TimecodeOffset *tcofs = new TimecodeOffset(x, y, pwindow, this, string, i); - add_subwindow(tcofs); x += tcofs->get_w(); - if( --i < 0 ) break; - title1 = new BC_Title(x, y, ":", MEDIUMFONT); - add_subwindow(title1); x += title1->get_w(); - } + if(!pwindow->thread->edl->session->interpolate_raw) + white_balance_raw->disable(); + y += white_balance_raw->get_h() + margin; - x = x2; - y += white_balance_raw->get_h() + 5; add_subwindow(vdevice_title = new BC_Title(x, y, _("Video Driver:"))); - video_device = new VDevicePrefs(x + vdevice_title->get_w() + 10, y, - pwindow, this, playback_config->vconfig, 0, MODEPLAY); + y += vdevice_title->get_h() + margin; + video_device = new VDevicePrefs(x, y, pwindow, this, + playback_config->vconfig, 0, MODEPLAY); video_device->initialize(0); -SET_TRACE - } @@ -245,7 +215,7 @@ int PlaybackPrefs::draw_framerate(int flush) -PlaybackAudioOffset::PlaybackAudioOffset(PreferencesWindow *pwindow, +PlaybackAudioOffset::PlaybackAudioOffset(PreferencesWindow *pwindow, PlaybackPrefs *playback, int x, int y) : BC_TumbleTextBox(playback, playback->playback_config->aconfig->audio_offset, -10.0, 10.0, x, y, 100) @@ -265,56 +235,56 @@ int PlaybackAudioOffset::handle_event() -PlaybackModuleFragment::PlaybackModuleFragment(int x, int y, +PlaybackModuleFragment::PlaybackModuleFragment(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback, char *text) : BC_PopupMenu(x, y, 100, text, 1) -{ +{ this->pwindow = pwindow; this->playback = playback; } -int PlaybackModuleFragment::handle_event() +int PlaybackModuleFragment::handle_event() { - playback->playback_config->aconfig->fragment_size = atol(get_text()); + playback->playback_config->aconfig->fragment_size = atol(get_text()); return 1; } PlaybackViewFollows::PlaybackViewFollows(PreferencesWindow *pwindow, int value, int y) : BC_CheckBox(10, y, value, _("View follows playback")) -{ - this->pwindow = pwindow; +{ + this->pwindow = pwindow; } -int PlaybackViewFollows::handle_event() -{ - pwindow->thread->edl->session->view_follows_playback = get_value(); +int PlaybackViewFollows::handle_event() +{ + pwindow->thread->edl->session->view_follows_playback = get_value(); return 1; } PlaybackSoftwareTimer::PlaybackSoftwareTimer(PreferencesWindow *pwindow, int value, int y) : BC_CheckBox(10, y, value, _("Disable hardware synchronization")) -{ - this->pwindow = pwindow; +{ + this->pwindow = pwindow; } -int PlaybackSoftwareTimer::handle_event() -{ - pwindow->thread->edl->session->playback_software_position = get_value(); +int PlaybackSoftwareTimer::handle_event() +{ + pwindow->thread->edl->session->playback_software_position = get_value(); return 1; } PlaybackRealTime::PlaybackRealTime(PreferencesWindow *pwindow, int value, int y) : BC_CheckBox(10, y, value, _("Audio playback in real time priority (root only)")) -{ - this->pwindow = pwindow; +{ + this->pwindow = pwindow; } -int PlaybackRealTime::handle_event() -{ - pwindow->thread->edl->session->real_time_playback = get_value(); +int PlaybackRealTime::handle_event() +{ + pwindow->thread->edl->session->real_time_playback = get_value(); return 1; } @@ -324,21 +294,21 @@ PlaybackMap51_2::PlaybackMap51_2(PreferencesWindow *pwindow, : BC_CheckBox(10, y, value, _("Map 5.1->2")) { this->pwindow = pwindow; - this->playback_prefs = playback_prefs; + this->playback_prefs = playback_prefs; } -int PlaybackMap51_2::handle_event() +int PlaybackMap51_2::handle_event() { playback_prefs->playback_config->aconfig->map51_2 = get_value(); return 1; } -PlaybackInterpolateRaw::PlaybackInterpolateRaw( int x, int y, +PlaybackInterpolateRaw::PlaybackInterpolateRaw( int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) - : BC_CheckBox(x, - y, - pwindow->thread->edl->session->interpolate_raw, + : BC_CheckBox(x, + y, + pwindow->thread->edl->session->interpolate_raw, _("Interpolate CR2 images")) { this->pwindow = pwindow; @@ -348,7 +318,7 @@ PlaybackInterpolateRaw::PlaybackInterpolateRaw( int x, int y, int PlaybackInterpolateRaw::handle_event() { pwindow->thread->edl->session->interpolate_raw = get_value(); - if(!pwindow->thread->edl->session->interpolate_raw) { + if( !pwindow->thread->edl->session->interpolate_raw ) { playback->white_balance_raw->update(0, 0); playback->white_balance_raw->disable(); } @@ -359,13 +329,12 @@ int PlaybackInterpolateRaw::handle_event() return 1; } - -PlaybackWhiteBalanceRaw::PlaybackWhiteBalanceRaw( int x, int y, +PlaybackWhiteBalanceRaw::PlaybackWhiteBalanceRaw( int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) - : BC_CheckBox(x, - y, + : BC_CheckBox(x, + y, pwindow->thread->edl->session->interpolate_raw && - pwindow->thread->edl->session->white_balance_raw, + pwindow->thread->edl->session->white_balance_raw, _("White balance CR2 images")) { this->pwindow = pwindow; @@ -379,26 +348,25 @@ int PlaybackWhiteBalanceRaw::handle_event() return 1; } - -VideoAsynchronous::VideoAsynchronous(PreferencesWindow *pwindow, int x, int y) - : BC_CheckBox(x, y, - pwindow->thread->edl->session->video_every_frame && - pwindow->thread->edl->session->video_asynchronous, - _("Decode frames asynchronously")) -{ - this->pwindow = pwindow; - if(!pwindow->thread->edl->session->video_every_frame) - disable(); -} - -int VideoAsynchronous::handle_event() -{ - pwindow->thread->edl->session->video_asynchronous = get_value(); - return 1; -} - - -VideoEveryFrame::VideoEveryFrame(PreferencesWindow *pwindow, +// VideoAsynchronous::VideoAsynchronous(PreferencesWindow *pwindow, int x, int y) +// : BC_CheckBox(x, y, +// pwindow->thread->edl->session->video_every_frame && +// pwindow->thread->edl->session->video_asynchronous, +// _("Decode frames asynchronously")) +// { +// this->pwindow = pwindow; +// if(!pwindow->thread->edl->session->video_every_frame) +// disable(); +// } +// +// int VideoAsynchronous::handle_event() +// { +// pwindow->thread->edl->session->video_asynchronous = get_value(); +// return 1; +// } + + +VideoEveryFrame::VideoEveryFrame(PreferencesWindow *pwindow, PlaybackPrefs *playback_prefs, int x, int y) : BC_CheckBox(x, y, pwindow->thread->edl->session->video_every_frame, _("Play every frame")) { @@ -409,21 +377,21 @@ VideoEveryFrame::VideoEveryFrame(PreferencesWindow *pwindow, int VideoEveryFrame::handle_event() { pwindow->thread->edl->session->video_every_frame = get_value(); - if(!pwindow->thread->edl->session->video_every_frame) { - playback_prefs->asynchronous->update(0, 0); - playback_prefs->asynchronous->disable(); - } - else { - playback_prefs->asynchronous->update(pwindow->thread->edl->session->video_asynchronous, 0); - playback_prefs->asynchronous->enable(); - } +// if(!pwindow->thread->edl->session->video_every_frame) { +// playback_prefs->asynchronous->update(0, 0); +// playback_prefs->asynchronous->disable(); +// } +// else { +// playback_prefs->asynchronous->update(pwindow->thread->edl->session->video_asynchronous, 0); +// playback_prefs->asynchronous->enable(); +// } return 1; } -PlaybackSubtitle::PlaybackSubtitle(int x, int y, +PlaybackSubtitle::PlaybackSubtitle(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) - : BC_CheckBox(x, y, + : BC_CheckBox(x, y, pwindow->thread->edl->session->decode_subtitles, _("Enable subtitles/captioning")) { @@ -438,7 +406,7 @@ int PlaybackSubtitle::handle_event() } -PlaybackSubtitleNumber::PlaybackSubtitleNumber(int x, int y, +PlaybackSubtitleNumber::PlaybackSubtitleNumber(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) : BC_TumbleTextBox(playback, pwindow->thread->edl->session->subtitle_number, 0, 31, x, y, 50) @@ -454,9 +422,9 @@ int PlaybackSubtitleNumber::handle_event() } -PlaybackLabelCells::PlaybackLabelCells(int x, int y, +PlaybackLabelCells::PlaybackLabelCells(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) - : BC_CheckBox(x, y, + : BC_CheckBox(x, y, pwindow->thread->edl->session->label_cells, _("Label cells")) { @@ -471,7 +439,7 @@ int PlaybackLabelCells::handle_event() } -PlaybackProgramNumber::PlaybackProgramNumber(int x, int y, +PlaybackProgramNumber::PlaybackProgramNumber(int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) : BC_TumbleTextBox(playback, pwindow->thread->edl->session->program_no, @@ -493,7 +461,7 @@ PlaybackGain::PlaybackGain(int x, int y, pwindow->thread->edl->session->playback_config->aconfig->play_gain, 0.0001f, 10000.0f, x, y, 72) { - this->pwindow = pwindow; + this->pwindow = pwindow; this->set_increment(0.1); } @@ -504,18 +472,3 @@ int PlaybackGain::handle_event() return 1; } -TimecodeOffset::TimecodeOffset(int x, int y, PreferencesWindow *pwindow, - PlaybackPrefs *playback, char *text, int unit) - : BC_TextBox(x, y, 30, 1, text) -{ - this->pwindow = pwindow; - this->playback = playback; - this->unit = unit; -} - -int TimecodeOffset::handle_event() -{ - pwindow->thread->edl->session->timecode_offset[unit] = atol(get_text()); - return 1; -} -