vwindow replay, append tracks to proj, multi asset info, subtitle bug
authorGood Guy <good1.2guy@gmail.com>
Sat, 3 Feb 2018 23:30:23 +0000 (16:30 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sat, 3 Feb 2018 23:30:23 +0000 (16:30 -0700)
cinelerra-5.1/cinelerra/assetpopup.C
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/mainmenu.C
cinelerra-5.1/cinelerra/mainmenu.h
cinelerra-5.1/cinelerra/mwindow.inc
cinelerra-5.1/cinelerra/new.C
cinelerra-5.1/cinelerra/new.h
cinelerra-5.1/cinelerra/new.inc
cinelerra-5.1/cinelerra/vwindowgui.C

index 238a73c694addb15f8685ecf71a89ef4971ba8ce..b7aafa0dcec2445849db0afe14a6e9ced3162eb0 100644 (file)
@@ -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; i<n; ++i ) {
+                       AssetEdit *asset_edit = mwindow->awindow->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(
index 4c257cbe964164a274187b3ab11f8d6515048d9f..9eb0d9d8f885aedabd0c9aac3d745a6b9a97e64d 100644 (file)
@@ -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;
 }
 
 
index d85ef6bad0045d236d318b57b3316e32df202f86..67a7ee31ff393636878af52808e4bd3938f50455 100644 (file)
@@ -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")));
index 9baf2a3b01ddf875d15980b95e8b8ee6f85a080d..2796e15571c84bd0f60de3985fd32f9ed9fafb41 100644 (file)
@@ -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
index 9e872bc1d0519e3dec00b1585217038f1aa8ebd4..804842c30ea93b1f4397e0762b4cda3846e71fc5 100644 (file)
@@ -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")
index 58e6eca9d3a463d619a68f9294db76fe2e35525f..605be8684e3022ba5da3b42ca2120f49ec8e82a3 100644 (file)
@@ -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;
+       ArrayList<EDL *>new_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<BC_ListBoxItem*>*)&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<BC_ListBoxItem*>*)&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;
 }
 
index 1e6fc2a3eb6253fe7848f94b435d816811dcf198..c56dd4f6a5092731ff0b190316d58fe93285999b 100644 (file)
@@ -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
index 94e37d3b68c6762125cf3eb1c239ef8336932735..d87f00260f0ba2b340d746421583cbc807cf49b3 100644 (file)
@@ -25,6 +25,8 @@
 class ColormodelItem;
 class InterlacemodeItem;
 class New;
+class NewProject;
+class AppendTracks;
 class NewWindow;
 
 #endif
index 5ff595eeaec5801f23c60b0bb5006cbb486f3489..931b0d3e1a18c101b576b360ab4fd89ba594f790 100644 (file)
@@ -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())