From: Good Guy Date: Sat, 3 Feb 2018 23:30:23 +0000 (-0700) Subject: vwindow replay, append tracks to proj, multi asset info, subtitle bug X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=8ab335aafbd648cad728f18e01153715a4e59eef;p=goodguy%2Fhistory.git vwindow replay, append tracks to proj, multi asset info, subtitle bug --- diff --git a/cinelerra-5.1/cinelerra/assetpopup.C b/cinelerra-5.1/cinelerra/assetpopup.C index 238a73c6..b7aafa0d 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.C +++ b/cinelerra-5.1/cinelerra/assetpopup.C @@ -160,10 +160,13 @@ int AssetPopupInfo::handle_event() { int cur_x, cur_y; popup->gui->get_abs_cursor(cur_x, cur_y); - if( mwindow->session->drag_assets->size() ) { - AssetEdit *asset_edit = mwindow->awindow->get_asset_editor(); - asset_edit->edit_asset( - mwindow->session->drag_assets->values[0], cur_x, cur_y); + int n = mwindow->session->drag_assets->size(); + if( n > 0 ) { + for( int i=0; iawindow->get_asset_editor(); + asset_edit->edit_asset( + mwindow->session->drag_assets->values[i], cur_x-30*i, cur_y-30*i); + } } else if( mwindow->session->drag_clips->size() ) { popup->gui->awindow->clip_edit->edit_clip( diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index 4c257cbe..9eb0d9d8 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -33,6 +33,7 @@ #include "plugin.h" #include "mainsession.h" #include "nestededls.h" +#include "strack.h" #include "trackcanvas.h" #include "tracks.h" #include "transition.h" @@ -233,7 +234,9 @@ void Edit::detach_transition() int Edit::silence() { - return asset || nested_edl ? 0 : 1; + return (track->data_type != TRACK_SUBTITLE ? + asset || nested_edl : + *((SEdit *)this)->get_text()) ? 0 : 1; } diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C index d85ef6ba..67a7ee31 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.C +++ b/cinelerra-5.1/cinelerra/mainmenu.C @@ -98,7 +98,7 @@ void MainMenu::create_objects() total_loads = 0; add_menu(filemenu = new BC_Menu(_("File"))); - filemenu->add_item(new_project = new New(mwindow)); + filemenu->add_item(new_project = new NewProject(mwindow)); new_project->create_objects(); // file loaders @@ -198,6 +198,9 @@ void MainMenu::create_objects() trackmenu->add_item(new DeleteTracks(mwindow)); trackmenu->add_item(new DeleteTrack(mwindow)); trackmenu->add_item(new ConcatenateTracks(mwindow)); + AppendTracks *append_tracks; + trackmenu->add_item(append_tracks = new AppendTracks(mwindow)); + append_tracks->create_objects(); trackmenu->add_item(new AddSubttlTrack(mwindow)); add_menu(settingsmenu = new BC_Menu(_("Settings"))); diff --git a/cinelerra-5.1/cinelerra/mainmenu.h b/cinelerra-5.1/cinelerra/mainmenu.h index 9baf2a3b..2796e155 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.h +++ b/cinelerra-5.1/cinelerra/mainmenu.h @@ -106,7 +106,7 @@ public: RecordMenuItem *record_menu_item; RenderItem *render; - New *new_project; + NewProject *new_project; MenuAEffectItem *aeffect[TOTAL_EFFECTS]; MenuVEffectItem *veffect[TOTAL_EFFECTS]; Quit *quit_program; // affected by save diff --git a/cinelerra-5.1/cinelerra/mwindow.inc b/cinelerra-5.1/cinelerra/mwindow.inc index 9e872bc1..804842c3 100644 --- a/cinelerra-5.1/cinelerra/mwindow.inc +++ b/cinelerra-5.1/cinelerra/mwindow.inc @@ -100,6 +100,7 @@ N_("Cinelerra: Mask") N_("Cinelerra: Mixer") N_("Cinelerra: New folder") N_("Cinelerra: New Project") +N_("Cinelerra: Append to Project") N_("Cinelerra: Normalize") N_("Cinelerra: Options") N_("Cinelerra: Overlays") diff --git a/cinelerra-5.1/cinelerra/new.C b/cinelerra-5.1/cinelerra/new.C index 58e6eca9..605be868 100644 --- a/cinelerra-5.1/cinelerra/new.C +++ b/cinelerra-5.1/cinelerra/new.C @@ -53,7 +53,6 @@ #define HEIGHT 425 New::New(MWindow *mwindow) - : BC_MenuItem(_("New Project..."), "n", 'n') { this->mwindow = mwindow; script = 0; @@ -66,11 +65,6 @@ New::~New() delete thread; } -void New::create_objects() -{ - thread = new NewThread(mwindow, this); -} - int New::handle_event() { mwindow->gui->unlock_window(); @@ -92,7 +86,7 @@ void New::create_new_edl() } -int New::create_new_project() +int New::create_new_project(int load_mode) { mwindow->stop_playback(0); mwindow->gui->lock_window(); @@ -106,26 +100,59 @@ int New::create_new_project() mwindow->undo->update_undo_before(); mwindow->set_filename(""); - - mwindow->hide_plugins(); - mwindow->edl->Garbage::remove_user(); - mwindow->edl = new_edl; + ArrayListnew_edls; + new_edls.append(new_edl); + mwindow->paste_edls(&new_edls, load_mode, 0,0,0,0,0,0); + new_edl->remove_user(); new_edl = 0; - mwindow->save_defaults(); // Load file sequence - mwindow->update_project(LOADMODE_REPLACE); + mwindow->update_project(load_mode); mwindow->session->changes_made = 0; - mwindow->undo->update_undo_after(_("New Project"), LOAD_ALL); + mwindow->undo->update_undo_after(load_mode == LOADMODE_REPLACE ? + _("New Project") : _("Append Project"), LOAD_ALL); mwindow->gui->unlock_window(); return 0; } -NewThread::NewThread(MWindow *mwindow, New *new_project) +NewProject::NewProject(MWindow *mwindow) + : BC_MenuItem(_("New Project..."), "n", 'n'), New(mwindow) +{ +} +NewProject::~NewProject() +{ +} + +void NewProject::create_objects() +{ + thread = new NewThread(mwindow, this, + _(PROGRAM_NAME ": New Project"), LOADMODE_REPLACE); +} + +AppendTracks::AppendTracks(MWindow *mwindow) + : BC_MenuItem(_("Append to Project..."), "N", 'N'), New(mwindow) +{ + set_shift(1); +} +AppendTracks::~AppendTracks() +{ +} + +void AppendTracks::create_objects() +{ + thread = new NewThread(mwindow, this, + _(PROGRAM_NAME ": Append to Project"), LOADMODE_NEW_TRACKS); +} + + +NewThread::NewThread(MWindow *mwindow, New *new_project, + const char *title, int load_mode) : BC_DialogThread() { this->mwindow = mwindow; this->new_project = new_project; + this->title = title; + this->load_mode = load_mode; nwindow = 0; } @@ -162,7 +189,7 @@ void NewThread::handle_close_event(int result) new_project->new_edl = 0; } else { - new_project->create_new_project(); + new_project->create_new_project(load_mode); } } @@ -187,28 +214,40 @@ int NewThread::update_aspect() new_project->new_edl->session->output_w, new_project->new_edl->session->output_h); sprintf(string, "%.02f", new_project->new_edl->session->aspect_w); - nwindow->aspect_w_text->update(string); + if( nwindow->aspect_w_text ) nwindow->aspect_w_text->update(string); sprintf(string, "%.02f", new_project->new_edl->session->aspect_h); - nwindow->aspect_h_text->update(string); + if( nwindow->aspect_h_text )nwindow->aspect_h_text->update(string); } return 0; } NewWindow::NewWindow(MWindow *mwindow, NewThread *new_thread, int x, int y) - : BC_Window(_(PROGRAM_NAME ": New Project"), x, y, WIDTH, HEIGHT, + : BC_Window(new_thread->title, x, y, + WIDTH, new_thread->load_mode == LOADMODE_REPLACE ? HEIGHT : HEIGHT-180, -1, -1, 0, 0, 1) { this->mwindow = mwindow; this->new_thread = new_thread; this->new_edl = new_thread->new_project->new_edl; format_presets = 0; + atracks = 0; + achannels = 0; + sample_rate = 0; + vtracks = 0; + frame_rate = 0; + output_w_text = 0; + output_h_text = 0; + aspect_w_text = 0; + aspect_h_text = 0; + interlace_pulldown = 0; + color_model = 0; } NewWindow::~NewWindow() { lock_window("NewWindow::~NewWindow"); - if( format_presets ) delete format_presets; + delete format_presets; unlock_window(); } @@ -244,20 +283,22 @@ void NewWindow::create_objects() add_subwindow(new NewATracksTumbler(this, x1, y)); y += atracks->get_h() + 5; - x1 = x; - add_subwindow(new BC_Title(x1, y, _("Channels:"))); - x1 += 100; - add_subwindow(achannels = new NewAChannels(this, "", x1, y)); - x1 += achannels->get_w(); - add_subwindow(new NewAChannelsTumbler(this, x1, y)); - y += achannels->get_h() + 5; - - x1 = x; - add_subwindow(new BC_Title(x1, y, _("Samplerate:"))); - x1 += 100; - add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y)); - x1 += sample_rate->get_w(); - add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y)); + if( new_thread->load_mode == LOADMODE_REPLACE ) { + x1 = x; + add_subwindow(new BC_Title(x1, y, _("Channels:"))); + x1 += 100; + add_subwindow(achannels = new NewAChannels(this, "", x1, y)); + x1 += achannels->get_w(); + add_subwindow(new NewAChannelsTumbler(this, x1, y)); + y += achannels->get_h() + 5; + + x1 = x; + add_subwindow(new BC_Title(x1, y, _("Samplerate:"))); + x1 += 100; + add_subwindow(sample_rate = new NewSampleRate(this, "", x1, y)); + x1 += sample_rate->get_w(); + add_subwindow(new SampleRatePulldown(mwindow, sample_rate, x1, y)); + } x += 250; y = y1; @@ -271,21 +312,22 @@ void NewWindow::create_objects() add_subwindow(new NewVTracksTumbler(this, x1, y)); y += vtracks->get_h() + 5; -// x1 = x; -// add_subwindow(new BC_Title(x1, y, _("Channels:"))); -// x1 += 100; -// add_subwindow(vchannels = new NewVChannels(this, "", x1, y)); -// x1 += vchannels->get_w(); -// add_subwindow(new NewVChannelsTumbler(this, x1, y)); -// y += vchannels->get_h() + 5; - x1 = x; - add_subwindow(new BC_Title(x1, y, _("Framerate:"))); - x1 += 115; - add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y)); - x1 += frame_rate->get_w(); - add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y)); - y += frame_rate->get_h() + 5; - + if( new_thread->load_mode == LOADMODE_REPLACE ) { +// x1 = x; +// add_subwindow(new BC_Title(x1, y, _("Channels:"))); +// x1 += 100; +// add_subwindow(vchannels = new NewVChannels(this, "", x1, y)); +// x1 += vchannels->get_w(); +// add_subwindow(new NewVChannelsTumbler(this, x1, y)); +// y += vchannels->get_h() + 5; + x1 = x; + add_subwindow(new BC_Title(x1, y, _("Framerate:"))); + x1 += 115; + add_subwindow(frame_rate = new NewFrameRate(this, "", x1, y)); + x1 += frame_rate->get_w(); + add_subwindow(new FrameRatePulldown(mwindow, frame_rate, x1, y)); + y += frame_rate->get_h() + 5; + } // x1 = x; // add_subwindow(new BC_Title(x1, y, _("Canvas size:"))); // x1 += 100; @@ -323,39 +365,41 @@ void NewWindow::create_objects() add_subwindow(new NewSwapExtents(mwindow, this, x1, y)); y += output_h_text->get_h() + 5; - x1 = x; - add_subwindow(new BC_Title(x1, y, _("Aspect ratio:"))); - x1 += 115; - add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y)); - x1 += aspect_w_text->get_w() + 2; - add_subwindow(new BC_Title(x1, y, ":")); - x1 += 10; - add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y)); - x1 += aspect_h_text->get_w(); - add_subwindow(new AspectPulldown(mwindow, - aspect_w_text, aspect_h_text, x1, y)); - - x1 = aspect_w_text->get_x(); - y += aspect_w_text->get_h() + 5; - add_subwindow(new NewAspectAuto(this, x1, y)); - y += 40; - BC_Title *title; - add_subwindow(title = new BC_Title(x, y, _("Color model:"))); - x1 = x + title->get_w(); - y1 = y; y += title->get_h() + 10; - add_subwindow(title = new BC_Title(x, y, _("Interlace mode:"))); - int x2 = x + title->get_w(); - int y2 = y; y += title->get_h() + 10; - if( x1 < x2 ) x1 = x2; - x1 += 20; - add_subwindow(textbox = new BC_TextBox(x1, y1, 150, 1, "")); - add_subwindow(color_model = new ColormodelPulldown(mwindow, - textbox, &new_edl->session->color_model, x1+textbox->get_w(), y1)); - add_subwindow(textbox = new BC_TextBox(x1, y2, 150, 1, "")); - add_subwindow(interlace_pulldown = new InterlacemodePulldown(mwindow, - textbox, &new_edl->session->interlace_mode, - (ArrayList*)&mwindow->interlace_project_modes, - x1+textbox->get_w(), y2)); + if( new_thread->load_mode == LOADMODE_REPLACE ) { + x1 = x; + add_subwindow(new BC_Title(x1, y, _("Aspect ratio:"))); + x1 += 115; + add_subwindow(aspect_w_text = new NewAspectW(this, "", x1, y)); + x1 += aspect_w_text->get_w() + 2; + add_subwindow(new BC_Title(x1, y, ":")); + x1 += 10; + add_subwindow(aspect_h_text = new NewAspectH(this, "", x1, y)); + x1 += aspect_h_text->get_w(); + add_subwindow(new AspectPulldown(mwindow, + aspect_w_text, aspect_h_text, x1, y)); + + x1 = aspect_w_text->get_x(); + y += aspect_w_text->get_h() + 5; + add_subwindow(new NewAspectAuto(this, x1, y)); + y += 40; + BC_Title *title; + add_subwindow(title = new BC_Title(x, y, _("Color model:"))); + x1 = x + title->get_w(); + y1 = y; y += title->get_h() + 10; + add_subwindow(title = new BC_Title(x, y, _("Interlace mode:"))); + int x2 = x + title->get_w(); + int y2 = y; y += title->get_h() + 10; + if( x1 < x2 ) x1 = x2; + x1 += 20; + add_subwindow(textbox = new BC_TextBox(x1, y1, 150, 1, "")); + add_subwindow(color_model = new ColormodelPulldown(mwindow, + textbox, &new_edl->session->color_model, x1+textbox->get_w(), y1)); + add_subwindow(textbox = new BC_TextBox(x1, y2, 150, 1, "")); + add_subwindow(interlace_pulldown = new InterlacemodePulldown(mwindow, + textbox, &new_edl->session->interlace_mode, + (ArrayList*)&mwindow->interlace_project_modes, + x1+textbox->get_w(), y2)); + } add_subwindow(new BC_OKButton(this, mwindow->theme->get_image_set("new_ok_images"))); @@ -369,17 +413,17 @@ void NewWindow::create_objects() int NewWindow::update() { - atracks->update((int64_t)new_edl->session->audio_tracks); - achannels->update((int64_t)new_edl->session->audio_channels); - sample_rate->update((int64_t)new_edl->session->sample_rate); - vtracks->update((int64_t)new_edl->session->video_tracks); - frame_rate->update((float)new_edl->session->frame_rate); - output_w_text->update((int64_t)new_edl->session->output_w); - output_h_text->update((int64_t)new_edl->session->output_h); - aspect_w_text->update((float)new_edl->session->aspect_w); - aspect_h_text->update((float)new_edl->session->aspect_h); - interlace_pulldown->update(new_edl->session->interlace_mode); - color_model->update_value(new_edl->session->color_model); + if( atracks ) atracks->update((int64_t)new_edl->session->audio_tracks); + if( achannels ) achannels->update((int64_t)new_edl->session->audio_channels); + if( sample_rate ) sample_rate->update((int64_t)new_edl->session->sample_rate); + if( vtracks ) vtracks->update((int64_t)new_edl->session->video_tracks); + if( frame_rate ) frame_rate->update((float)new_edl->session->frame_rate); + if( output_w_text ) output_w_text->update((int64_t)new_edl->session->output_w); + if( output_h_text ) output_h_text->update((int64_t)new_edl->session->output_h); + if( aspect_w_text ) aspect_w_text->update((float)new_edl->session->aspect_w); + if( aspect_h_text ) aspect_h_text->update((float)new_edl->session->aspect_h); + if( interlace_pulldown ) interlace_pulldown->update(new_edl->session->interlace_mode); + if( color_model ) color_model->update_value(new_edl->session->color_model); return 0; } diff --git a/cinelerra-5.1/cinelerra/new.h b/cinelerra-5.1/cinelerra/new.h index 1e6fc2a3..c56dd4f6 100644 --- a/cinelerra-5.1/cinelerra/new.h +++ b/cinelerra-5.1/cinelerra/new.h @@ -38,16 +38,16 @@ class NewPresets; class InterlacemodePulldown; class ColormodelPulldown; -class New : public BC_MenuItem +class New { public: New(MWindow *mwindow); ~New(); - void create_objects(); + virtual void create_objects() = 0; int handle_event(); int run_script(FileXML *script); - int create_new_project(); + int create_new_project(int load_mode); void create_new_edl(); MWindow *mwindow; @@ -58,10 +58,30 @@ private: FileXML *script; }; +class NewProject : public BC_MenuItem, public New +{ +public: + NewProject(MWindow *mwindow); + ~NewProject(); + + void create_objects(); + int handle_event() { return New::handle_event(); } +}; + +class AppendTracks : public BC_MenuItem, public New +{ +public: + AppendTracks(MWindow *mwindow); + ~AppendTracks(); + + void create_objects(); + int handle_event() { return New::handle_event(); } +}; + class NewThread : public BC_DialogThread { public: - NewThread(MWindow *mwindow, New *new_project); + NewThread(MWindow *mwindow, New *new_project, const char *title, int load_mode); ~NewThread(); BC_Window* new_gui(); @@ -75,6 +95,8 @@ public: NewWindow *nwindow; MWindow *mwindow; New *new_project; + const char *title; + int load_mode; }; class NewWindow : public BC_Window diff --git a/cinelerra-5.1/cinelerra/new.inc b/cinelerra-5.1/cinelerra/new.inc index 94e37d3b..d87f0026 100644 --- a/cinelerra-5.1/cinelerra/new.inc +++ b/cinelerra-5.1/cinelerra/new.inc @@ -25,6 +25,8 @@ class ColormodelItem; class InterlacemodeItem; class New; +class NewProject; +class AppendTracks; class NewWindow; #endif diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 5ff595ee..931b0d3e 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -356,15 +356,17 @@ int VWindowGUI::button_press_event() { if( get_buttonpress() == LEFT_BUTTON && canvas->get_canvas() && canvas->get_canvas()->get_cursor_over_window() ) { + int command = STOP; PlaybackEngine *playback_engine = vwindow->playback_engine; - unlock_window(); - if( playback_engine->is_playing_back ) { - transport->handle_transport(STOP, 1); - } - else { - transport->handle_transport(NORMAL_FWD, 1); + if( !playback_engine->is_playing_back && vwindow->get_edl() != 0 ) { + double length = vwindow->get_edl()->tracks->total_playable_length(); + double position = playback_engine->get_tracking_position(); + if( position >= length ) transport->goto_start(); + command = NORMAL_FWD; } - vwindow->gui->lock_window("VWindowEditing::prev_label"); + unlock_window(); + transport->handle_transport(command, 1); + lock_window("VWindowGUI::button_press_event"); return 1; } if(canvas->get_canvas())