vwindow replay, append tracks to proj, multi asset info, subtitle bug
[goodguy/history.git] / cinelerra-5.1 / cinelerra / mainmenu.C
index 06a12becdb551f45533a07bd5d9217eb8637570c..67a7ee31ff393636878af52808e4bd3938f50455 100644 (file)
@@ -60,6 +60,7 @@
 #include "patchbay.h"
 #include "playbackengine.h"
 #include "preferences.h"
+#include "proxy.h"
 #include "preferencesthread.h"
 #include "quit.h"
 #include "record.h"
@@ -97,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
@@ -197,12 +198,18 @@ 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")));
 
        settingsmenu->add_item(new SetFormat(mwindow));
        settingsmenu->add_item(preferences = new PreferencesMenuitem(mwindow));
+       ProxyMenuItem *proxy;
+       settingsmenu->add_item(proxy = new ProxyMenuItem(mwindow));
+       proxy->create_objects();
        mwindow->preferences_thread = preferences->thread;
        settingsmenu->add_item(labels_follow_edits = new LabelsFollowEdits(mwindow));
        settingsmenu->add_item(plugins_follow_edits = new PluginsFollowEdits(mwindow));
@@ -212,7 +219,7 @@ void MainMenu::create_objects()
        settingsmenu->add_item(new BC_MenuItem("-"));
        settingsmenu->add_item(new SaveSettingsNow(mwindow));
        settingsmenu->add_item(loop_playback = new LoopPlayback(mwindow));
-       settingsmenu->add_item(new SetBRenderRange(mwindow));
+       settingsmenu->add_item(brender_active = new SetBRenderActive(mwindow));
 // set scrubbing speed
 //     ScrubSpeed *scrub_speed;
 //     settingsmenu->add_item(scrub_speed = new ScrubSpeed(mwindow));
@@ -252,6 +259,8 @@ void MainMenu::create_objects()
        windowmenu->add_item(new BC_MenuItem("-"));
        windowmenu->add_item(split_x = new SplitX(mwindow));
        windowmenu->add_item(split_y = new SplitY(mwindow));
+       windowmenu->add_item(mixer_viewer = new MixerViewer(mwindow));
+       windowmenu->add_item(new TileMixers(mwindow));
        windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p'));
        windowmenu->add_item(new TileWindows(mwindow,_("Tile left"),0));
        windowmenu->add_item(new TileWindows(mwindow,_("Tile right"),1));
@@ -616,7 +625,8 @@ Undo::Undo(MWindow *mwindow) : BC_MenuItem(_("Undo"), "z", 'z')
 }
 int Undo::handle_event()
 {
-       mwindow->undo_entry(mwindow->gui);
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->undo_entry(mwindow->gui);
        return 1;
 }
 int Undo::update_caption(const char *new_caption)
@@ -636,8 +646,8 @@ Redo::Redo(MWindow *mwindow) : BC_MenuItem(_("Redo"), _("Shift-Z"), 'Z')
 
 int Redo::handle_event()
 {
-       mwindow->redo_entry(mwindow->gui);
-
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->redo_entry(mwindow->gui);
        return 1;
 }
 int Redo::update_caption(const char *new_caption)
@@ -657,7 +667,8 @@ CutKeyframes::CutKeyframes(MWindow *mwindow)
 
 int CutKeyframes::handle_event()
 {
-       mwindow->cut_automation();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->cut_automation();
        return 1;
 }
 
@@ -670,7 +681,8 @@ CopyKeyframes::CopyKeyframes(MWindow *mwindow)
 
 int CopyKeyframes::handle_event()
 {
-       mwindow->copy_automation();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->copy_automation();
        return 1;
 }
 
@@ -683,7 +695,8 @@ PasteKeyframes::PasteKeyframes(MWindow *mwindow)
 
 int PasteKeyframes::handle_event()
 {
-       mwindow->paste_automation();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->paste_automation();
        return 1;
 }
 
@@ -696,7 +709,8 @@ ClearKeyframes::ClearKeyframes(MWindow *mwindow)
 
 int ClearKeyframes::handle_event()
 {
-       mwindow->clear_automation();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->clear_automation();
        return 1;
 }
 
@@ -799,7 +813,8 @@ CutDefaultKeyframe::CutDefaultKeyframe(MWindow *mwindow)
 
 int CutDefaultKeyframe::handle_event()
 {
-       mwindow->cut_default_keyframe();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->cut_default_keyframe();
        return 1;
 }
 
@@ -812,7 +827,8 @@ CopyDefaultKeyframe::CopyDefaultKeyframe(MWindow *mwindow)
 
 int CopyDefaultKeyframe::handle_event()
 {
-       mwindow->copy_default_keyframe();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->copy_default_keyframe();
        return 1;
 }
 
@@ -825,7 +841,8 @@ PasteDefaultKeyframe::PasteDefaultKeyframe(MWindow *mwindow)
 
 int PasteDefaultKeyframe::handle_event()
 {
-       mwindow->paste_default_keyframe();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->paste_default_keyframe();
        return 1;
 }
 
@@ -838,7 +855,8 @@ ClearDefaultKeyframe::ClearDefaultKeyframe(MWindow *mwindow)
 
 int ClearDefaultKeyframe::handle_event()
 {
-       mwindow->clear_default_keyframe();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->clear_default_keyframe();
        return 1;
 }
 
@@ -850,7 +868,8 @@ Cut::Cut(MWindow *mwindow)
 
 int Cut::handle_event()
 {
-       mwindow->cut();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->cut();
        return 1;
 }
 
@@ -862,7 +881,8 @@ Copy::Copy(MWindow *mwindow)
 
 int Copy::handle_event()
 {
-       mwindow->copy();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->copy();
        return 1;
 }
 
@@ -874,7 +894,8 @@ Paste::Paste(MWindow *mwindow)
 
 int Paste::handle_event()
 {
-       mwindow->paste();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->paste();
        return 1;
 }
 
@@ -886,9 +907,11 @@ Clear::Clear(MWindow *mwindow)
 
 int Clear::handle_event()
 {
-       mwindow->cwindow->gui->lock_window("Clear::handle_event");
-       mwindow->clear_entry();
-       mwindow->cwindow->gui->unlock_window();
+       if( mwindow->session->current_operation == NO_OPERATION ) {
+               mwindow->cwindow->gui->lock_window("Clear::handle_event");
+               mwindow->clear_entry();
+               mwindow->cwindow->gui->unlock_window();
+       }
        return 1;
 }
 
@@ -901,7 +924,8 @@ PasteSilence::PasteSilence(MWindow *mwindow)
 
 int PasteSilence::handle_event()
 {
-       mwindow->paste_silence();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->paste_silence();
        return 1;
 }
 
@@ -913,7 +937,8 @@ SelectAll::SelectAll(MWindow *mwindow)
 
 int SelectAll::handle_event()
 {
-       mwindow->select_all();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->select_all();
        return 1;
 }
 
@@ -959,7 +984,8 @@ MuteSelection::MuteSelection(MWindow *mwindow)
 
 int MuteSelection::handle_event()
 {
-       mwindow->mute_selection();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->mute_selection();
        return 1;
 }
 
@@ -997,7 +1023,8 @@ AddAudioTrack::AddAudioTrack(MWindow *mwindow)
 
 int AddAudioTrack::handle_event()
 {
-       mwindow->add_audio_track_entry(0, 0);
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->add_audio_track_entry(0, 0);
        return 1;
 }
 
@@ -1020,7 +1047,8 @@ DefaultATransition::DefaultATransition(MWindow *mwindow)
 
 int DefaultATransition::handle_event()
 {
-       mwindow->paste_audio_transition();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->paste_audio_transition();
        return 1;
 }
 
@@ -1064,7 +1092,8 @@ AddVideoTrack::AddVideoTrack(MWindow *mwindow)
 
 int AddVideoTrack::handle_event()
 {
-       mwindow->add_video_track_entry();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->add_video_track_entry();
        return 1;
 }
 
@@ -1104,7 +1133,8 @@ DefaultVTransition::DefaultVTransition(MWindow *mwindow)
 
 int DefaultVTransition::handle_event()
 {
-       mwindow->paste_video_transition();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->paste_video_transition();
        return 1;
 }
 
@@ -1143,7 +1173,8 @@ DeleteTrack::DeleteTrack(MWindow *mwindow)
 
 int DeleteTrack::handle_event()
 {
-       mwindow->delete_track();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->delete_track();
        return 1;
 }
 
@@ -1155,7 +1186,8 @@ MoveTracksUp::MoveTracksUp(MWindow *mwindow)
 
 int MoveTracksUp::handle_event()
 {
-       mwindow->move_tracks_up();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->move_tracks_up();
        return 1;
 }
 
@@ -1167,7 +1199,8 @@ MoveTracksDown::MoveTracksDown(MWindow *mwindow)
 
 int MoveTracksDown::handle_event()
 {
-       mwindow->move_tracks_down();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->move_tracks_down();
        return 1;
 }
 
@@ -1201,8 +1234,10 @@ LoopPlayback::LoopPlayback(MWindow *mwindow)
 
 int LoopPlayback::handle_event()
 {
-       mwindow->toggle_loop_playback();
-       set_checked(mwindow->edl->local_session->loop_playback);
+       if( mwindow->session->current_operation == NO_OPERATION ) {
+               mwindow->toggle_loop_playback();
+               set_checked(mwindow->edl->local_session->loop_playback);
+       }
        return 1;
 }
 
@@ -1220,7 +1255,8 @@ AddSubttlTrack::AddSubttlTrack(MWindow *mwindow)
 
 int AddSubttlTrack::handle_event()
 {
-       mwindow->add_subttl_track_entry();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->add_subttl_track_entry();
        return 1;
 }
 
@@ -1232,33 +1268,30 @@ PasteSubttl::PasteSubttl(MWindow *mwindow)
 
 int PasteSubttl::handle_event()
 {
-       mwindow->gui->swindow->paste_subttl();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->gui->swindow->paste_subttl();
        return 1;
 }
 
 
-
-
-
-
-SetBRenderRange::SetBRenderRange(MWindow *mwindow)
- : BC_MenuItem(_("Set background rendering"))
+SetBRenderActive::SetBRenderActive(MWindow *mwindow)
+ : BC_MenuItem(_("Toggle background rendering"),_("Shift-G"),'G')
 {
        this->mwindow = mwindow;
+       set_shift(1);
 }
 
-int SetBRenderRange::handle_event()
+int SetBRenderActive::handle_event()
 {
-       mwindow->set_brender_range();
+       if( mwindow->session->current_operation == NO_OPERATION ) {
+               int v = mwindow->brender_active ? 0 : 1;
+               set_checked(v);
+               mwindow->set_brender_active(v);
+       }
        return 1;
 }
 
 
-
-
-
-
-
 LabelsFollowEdits::LabelsFollowEdits(MWindow *mwindow)
  : BC_MenuItem(_("Edit labels"))
 {
@@ -1277,16 +1310,16 @@ int LabelsFollowEdits::handle_event()
 
 
 PluginsFollowEdits::PluginsFollowEdits(MWindow *mwindow)
- : BC_MenuItem(_("Edit effects")) 
-{ 
-       this->mwindow = mwindow; 
+ : BC_MenuItem(_("Edit effects"))
+{
+       this->mwindow = mwindow;
        set_checked(mwindow->edl->session->plugins_follow_edits);
 }
 
 int PluginsFollowEdits::handle_event()
 {
        set_checked(get_checked() ^ 1);
-       mwindow->edl->session->plugins_follow_edits = get_checked(); 
+       mwindow->edl->session->plugins_follow_edits = get_checked();
        return 1;
 }
 
@@ -1294,45 +1327,45 @@ int PluginsFollowEdits::handle_event()
 
 
 KeyframesFollowEdits::KeyframesFollowEdits(MWindow *mwindow)
- : BC_MenuItem(_("Keyframes follow edits")) 
-{ 
-       this->mwindow = mwindow; 
+ : BC_MenuItem(_("Keyframes follow edits"))
+{
+       this->mwindow = mwindow;
        set_checked(mwindow->edl->session->autos_follow_edits);
 }
 
 int KeyframesFollowEdits::handle_event()
-{ 
-       mwindow->edl->session->autos_follow_edits ^= 1; 
+{
+       mwindow->edl->session->autos_follow_edits ^= 1;
        set_checked(!get_checked());
        return 1;
 }
 
 
 CursorOnFrames::CursorOnFrames(MWindow *mwindow)
- : BC_MenuItem(_("Align cursor on frames")) 
-{ 
-       this->mwindow = mwindow; 
+ : BC_MenuItem(_("Align cursor on frames"))
+{
+       this->mwindow = mwindow;
        set_checked(mwindow->edl->session->cursor_on_frames);
 }
 
 int CursorOnFrames::handle_event()
 {
-       mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames; 
+       mwindow->edl->session->cursor_on_frames = !mwindow->edl->session->cursor_on_frames;
        set_checked(mwindow->edl->session->cursor_on_frames);
        return 1;
 }
 
 
 TypelessKeyframes::TypelessKeyframes(MWindow *mwindow)
- : BC_MenuItem(_("Typeless keyframes")) 
-{ 
-       this->mwindow = mwindow; 
+ : BC_MenuItem(_("Typeless keyframes"))
+{
+       this->mwindow = mwindow;
        set_checked(mwindow->edl->session->typeless_keyframes);
 }
 
 int TypelessKeyframes::handle_event()
 {
-       mwindow->edl->session->typeless_keyframes = !mwindow->edl->session->typeless_keyframes; 
+       mwindow->edl->session->typeless_keyframes = !mwindow->edl->session->typeless_keyframes;
        set_checked(mwindow->edl->session->typeless_keyframes);
        return 1;
 }
@@ -1358,9 +1391,9 @@ int ScrubSpeed::handle_event()
        return 1;
 }
 
-SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now")) 
-{ 
-       this->mwindow = mwindow; 
+SaveSettingsNow::SaveSettingsNow(MWindow *mwindow) : BC_MenuItem(_("Save settings now"))
+{
+       this->mwindow = mwindow;
 }
 
 int SaveSettingsNow::handle_event()
@@ -1425,11 +1458,13 @@ ShowGWindow::ShowGWindow(MWindow *mwindow)
 }
 int ShowGWindow::handle_event()
 {
-       if( !mwindow->session->show_gwindow )
-               mwindow->show_gwindow();
-       else
-               mwindow->hide_gwindow();
-       set_checked(mwindow->session->show_gwindow);
+       if( mwindow->session->current_operation == NO_OPERATION ) {
+               if( !mwindow->session->show_gwindow )
+                       mwindow->show_gwindow();
+               else
+                       mwindow->hide_gwindow();
+               set_checked(mwindow->session->show_gwindow);
+       }
        return 1;
 }
 
@@ -1456,11 +1491,13 @@ TileWindows::TileWindows(MWindow *mwindow, const char *item_title, int config,
 }
 int TileWindows::handle_event()
 {
-       int window_config = config >= 0 ? config :
-               mwindow->session->window_config;
-       if( mwindow->tile_windows(window_config) ) {
-               mwindow->restart_status = 1;
-               mwindow->gui->set_done(0);
+       if( mwindow->session->current_operation == NO_OPERATION ) {
+               int window_config = config >= 0 ? config :
+                       mwindow->session->window_config;
+               if( mwindow->tile_windows(window_config) ) {
+                       mwindow->restart_status = 1;
+                       mwindow->gui->set_done(0);
+               }
        }
        return 1;
 }
@@ -1474,7 +1511,8 @@ SplitX::SplitX(MWindow *mwindow)
 }
 int SplitX::handle_event()
 {
-       mwindow->split_x();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->split_x();
        return 1;
 }
 
@@ -1487,8 +1525,35 @@ SplitY::SplitY(MWindow *mwindow)
 }
 int SplitY::handle_event()
 {
-       mwindow->split_y();
+       if( mwindow->session->current_operation == NO_OPERATION )
+               mwindow->split_y();
+       return 1;
+}
+
+
+MixerViewer::MixerViewer(MWindow *mwindow)
+ : BC_MenuItem(_("Mixer Viewer"), _("Shift-M"), 'M')
+{
+       this->mwindow = mwindow;
+       set_shift(1);
+}
+
+int MixerViewer::handle_event()
+{
+       mwindow->start_mixer();
        return 1;
 }
 
+TileMixers::TileMixers(MWindow *mwindow)
+ : BC_MenuItem(_("Tile mixers"), "Alt-t", 't')
+{
+       this->mwindow = mwindow;
+       set_alt();
+}
+
+int TileMixers::handle_event()
+{
+       mwindow->tile_mixers();
+       return 1;
+}