X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fsetformat.C;h=bf22103f2c0e6e7889bc5e3b63b5552af991ea3e;hb=9d8694b7d2e0f4202e025eaf78d096340184b4e6;hp=413fa950357b3f029b0c400452cf9f4ee5c41fe0;hpb=0b78779e9e75131eee81d2e4689b98df0e91c092;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/setformat.C b/cinelerra-5.1/cinelerra/setformat.C index 413fa950..bf22103f 100644 --- a/cinelerra-5.1/cinelerra/setformat.C +++ b/cinelerra-5.1/cinelerra/setformat.C @@ -151,14 +151,15 @@ void SetFormatThread::apply_changes() mwindow->undo->update_undo_before(); - memcpy(&mwindow->preferences->channel_positions[MAXCHANNELS * (new_channels - 1)], + memcpy(&mwindow->preferences->channel_positions[new_channels - 1], new_settings->session->achannel_positions, - sizeof(int) * MAXCHANNELS); + sizeof(mwindow->preferences->channel_positions[new_channels - 1])); mwindow->edl->copy_session(new_settings, 1); mwindow->edl->session->output_w = dimension[0]; mwindow->edl->session->output_h = dimension[1]; + mwindow->edl->retrack(); mwindow->edl->rechannel(); mwindow->edl->resample(old_samplerate, new_samplerate, TRACK_AUDIO); mwindow->edl->resample(old_framerate, new_framerate, TRACK_VIDEO); @@ -174,20 +175,6 @@ void SetFormatThread::update() window->channels->update((int64_t)new_settings->session->audio_channels); window->frame_rate->update((float)new_settings->session->frame_rate); - switch( new_settings->session->audio_channels ) { - case 6: - new_settings->session->achannel_positions[0] = 90; - new_settings->session->achannel_positions[1] = 150; - new_settings->session->achannel_positions[2] = 30; - new_settings->session->achannel_positions[3] = 210; - new_settings->session->achannel_positions[4] = 330; - new_settings->session->achannel_positions[5] = 270; - break; - case 2: - new_settings->session->achannel_positions[0] = 180; - new_settings->session->achannel_positions[1] = 0; - break; - } auto_aspect = 0; window->auto_aspect->update(0); @@ -292,22 +279,18 @@ void SetFormatThread::update_aspect() SetFormatWindow::SetFormatWindow(MWindow *mwindow, - SetFormatThread *thread, - int x, - int y) - : BC_Window(_(PROGRAM_NAME ": Set Format"), - x, - y, - mwindow->theme->setformat_w, - mwindow->theme->setformat_h, - -1, - -1, - 0, - 0, - 1) + SetFormatThread *thread, int x, int y) + : BC_Window(_(PROGRAM_NAME ": Set Format"), x, y, + mwindow->theme->setformat_w, mwindow->theme->setformat_h, + -1, -1, 0, 0, 1) { this->mwindow = mwindow; this->thread = thread; + presets = 0; +} +SetFormatWindow::~SetFormatWindow() +{ + delete presets; } void SetFormatWindow::create_objects() @@ -321,51 +304,38 @@ void SetFormatWindow::create_objects() - presets = new SetFormatPresets(mwindow, - this, - x, - y); + presets = new SetFormatPresets(mwindow, this, x, y); presets->create_objects(); - x = presets->x; - y = presets->y; - + x = presets->x; // y = presets->y; y = mwindow->theme->setformat_y2; - add_subwindow(new BC_Title(mwindow->theme->setformat_x1, - y, - _("Audio"), - LARGEFONT)); + add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y, + _("Audio"), LARGEFONT)); y = mwindow->theme->setformat_y3; - add_subwindow(new BC_Title(mwindow->theme->setformat_x1, - y, + add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y, _("Samplerate:"))); add_subwindow(sample_rate = new SetSampleRateTextBox(thread, mwindow->theme->setformat_x2, y)); - add_subwindow(new SampleRatePulldown(mwindow, - sample_rate, - mwindow->theme->setformat_x2 + sample_rate->get_w(), - y)); + add_subwindow(new SampleRatePulldown(mwindow, sample_rate, + mwindow->theme->setformat_x2 + sample_rate->get_w(), y)); y += mwindow->theme->setformat_margin; - add_subwindow(new BC_Title(mwindow->theme->setformat_x1, - y, + add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y, _("Channels:"))); add_subwindow(channels = new SetChannelsTextBox(thread, - mwindow->theme->setformat_x2, - y)); - add_subwindow(new BC_ITumbler(channels, - 1, - MAXCHANNELS, - mwindow->theme->setformat_x2 + channels->get_w(), - y)); + mwindow->theme->setformat_x2, y)); + add_subwindow(new BC_ITumbler(channels, 1, MAXCHANNELS, + mwindow->theme->setformat_x2 + channels->get_w(), y)); y += mwindow->theme->setformat_margin; - add_subwindow(new BC_Title(mwindow->theme->setformat_x1, - y, + add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y, _("Channel positions:"))); y += mwindow->theme->setformat_margin; + add_subwindow(new SetChannelsReset(thread, + mwindow->theme->setformat_x1, y, + _("Reset"))); add_subwindow(canvas = new SetChannelsCanvas(mwindow, thread, mwindow->theme->setformat_channels_x, @@ -376,12 +346,6 @@ void SetFormatWindow::create_objects() - - - - - - y = mwindow->theme->setformat_y2; add_subwindow(new BC_Title(mwindow->theme->setformat_x3, y, @@ -557,18 +521,6 @@ EDL* SetFormatPresets::get_edl() - - - - - - - - - - - - SetSampleRateTextBox::SetSampleRateTextBox(SetFormatThread *thread, int x, int y) : BC_TextBox(x, y, 100, 1, (int64_t)thread->new_settings->session->sample_rate) { @@ -595,8 +547,8 @@ int SetChannelsTextBox::handle_event() if(new_channels > 0) { memcpy(thread->new_settings->session->achannel_positions, - &thread->mwindow->preferences->channel_positions[MAXCHANNELS * (new_channels - 1)], - sizeof(int) * MAXCHANNELS); + &thread->mwindow->preferences->channel_positions[new_channels - 1], + sizeof(thread->new_settings->session->achannel_positions)); } @@ -604,28 +556,35 @@ int SetChannelsTextBox::handle_event() return 1; } +SetChannelsReset::SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text) + : BC_GenericButton(x, y, text) +{ + this->thread = thread; +} + +int SetChannelsReset::handle_event() +{ + int channels = thread->new_settings->session->audio_channels; + int *achannels = thread->new_settings->session->achannel_positions; + for( int i=0; iwindow->canvas->draw(); + return 1; +} SetChannelsCanvas::SetChannelsCanvas(MWindow *mwindow, - SetFormatThread *thread, - int x, - int y, - int w, - int h) - : BC_SubWindow(x, - y, - w, - h) + SetFormatThread *thread, int x, int y, int w, int h) + : BC_SubWindow(x, y, w, h) { this->thread = thread; this->mwindow = mwindow; active_channel = -1; box_r = mwindow->theme->channel_position_data->get_w() / 2; - temp_picon = new VFrame(0, - -1, + temp_picon = new VFrame( mwindow->theme->channel_position_data->get_w(), mwindow->theme->channel_position_data->get_h(), mwindow->theme->channel_position_data->get_color_model(), - -1); + 0); rotater = new RotateFrame(mwindow->preferences->processors, mwindow->theme->channel_position_data->get_w(), mwindow->theme->channel_position_data->get_h()); @@ -755,9 +714,9 @@ int SetChannelsCanvas::cursor_motion_event() { thread->new_settings->session->achannel_positions[active_channel] = new_d; int new_channels = thread->new_settings->session->audio_channels; - memcpy(&thread->mwindow->preferences->channel_positions[MAXCHANNELS * (new_channels - 1)], + memcpy(&thread->mwindow->preferences->channel_positions[new_channels - 1], thread->new_settings->session->achannel_positions, - sizeof(int) * MAXCHANNELS); + sizeof(thread->mwindow->preferences->channel_positions[new_channels - 1])); draw(thread->new_settings->session->achannel_positions[active_channel]); } return 1; @@ -766,13 +725,6 @@ int SetChannelsCanvas::cursor_motion_event() } - - - - - - - SetFrameRateTextBox::SetFrameRateTextBox(SetFormatThread *thread, int x, int y) : BC_TextBox(x, y, 100, 1, (float)thread->new_settings->session->frame_rate) { @@ -848,7 +800,6 @@ int ScaleRatioText::handle_event() } - ScaleAspectAuto::ScaleAspectAuto(int x, int y, SetFormatThread *thread) : BC_CheckBox(x, y, thread->auto_aspect, _("Auto")) { @@ -883,10 +834,6 @@ int ScaleAspectText::handle_event() } - - - - SetFormatApply::SetFormatApply(int x, int y, SetFormatThread *thread) : BC_GenericButton(x, y, _("Apply")) { @@ -900,17 +847,6 @@ int SetFormatApply::handle_event() } - - - - - - - - - - - FormatSwapExtents::FormatSwapExtents(MWindow *mwindow, SetFormatThread *thread, SetFormatWindow *gui, @@ -937,6 +873,3 @@ int FormatSwapExtents::handle_event() return 1; } - - -