From: Good Guy Date: Sat, 4 Jul 2020 03:55:56 +0000 (-0600) Subject: pluginclient cr=apply in option value textbox, add loop_mode for vwdw X-Git-Tag: 2020-07~10 X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=commitdiff_plain;h=f5725c7e12def18fec49a295dad688652edaa4b3;ds=sidebyside pluginclient cr=apply in option value textbox, add loop_mode for vwdw playback, add swap track up/dn, change reset_cache to use ref counts, change gang_media,gang_chans pngs, add shift switch gang mode btn, tweak mask_engine for high cpu count, change patchbay btn layout, fix track redraw interrupted by index builder, fix scollable textbox resize positioning, wsiwyg gang_master tweak. --- diff --git a/cinelerra-5.1/cinelerra/assetpopup.C b/cinelerra-5.1/cinelerra/assetpopup.C index 56832ca9..bc428164 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.C +++ b/cinelerra-5.1/cinelerra/assetpopup.C @@ -951,8 +951,8 @@ int SnapshotMenuItem::handle_event() command.realtime = 0; RenderEngine render_engine(0, preferences, 0, 0); - CICache video_cache(preferences); - render_engine.set_vcache(&video_cache); + CICache *video_cache = new CICache(preferences); + render_engine.set_vcache(video_cache); render_engine.arm_command(&command); double position = edl->local_session->get_selectionstart(1); @@ -962,6 +962,7 @@ int SnapshotMenuItem::handle_event() if( !ret ) ret = file.write_video_buffer(1); file.close_file(); + video_cache->remove_user(); } if( !ret ) { asset->folder_no = AW_MEDIA_FOLDER; diff --git a/cinelerra-5.1/cinelerra/cache.C b/cinelerra-5.1/cinelerra/cache.C index 3a0d118e..80bf347b 100644 --- a/cinelerra-5.1/cinelerra/cache.C +++ b/cinelerra-5.1/cinelerra/cache.C @@ -37,7 +37,7 @@ // edl came from a command which won't exist anymore CICache::CICache(Preferences *preferences) - : List() + : Garbage("CICache"), List() { this->preferences = preferences; edl = 0; @@ -69,11 +69,11 @@ File* CICache::check_out(Asset *asset, EDL *edl, int block) CICacheItem *current = 0; long tid = (long)Thread::get_self(); if( !tid ) tid = 1; + total_lock->lock("CICache::check_out"); + add_user(); - while(1) - { + while( users > 1 ) { File *file = 0; - total_lock->lock("CICache::check_out"); // Scan directory for item current = first; while(current && strcmp(current->asset->path, asset->path) != 0) @@ -108,12 +108,21 @@ File* CICache::check_out(Asset *asset, EDL *edl, int block) else current = 0; } - total_lock->unlock(); if( current || !file || !block ) break; // Try again after blocking + total_lock->unlock(); check_out_lock->lock("CICache::check_out"); + total_lock->lock("CICache::check_out"); + } + +// cache deleted during checkout, destroy this + if( users == 1 ) { + remove_user(); + return 0; } + remove_user(); + total_lock->unlock(); //printf("check out %p %lx %s\n", current, tid, asset->path); return current ? current->file : 0; } diff --git a/cinelerra-5.1/cinelerra/cache.h b/cinelerra-5.1/cinelerra/cache.h index 8ab4457f..15329e69 100644 --- a/cinelerra-5.1/cinelerra/cache.h +++ b/cinelerra-5.1/cinelerra/cache.h @@ -61,7 +61,7 @@ private: CICache *cache; }; -class CICache : public List +class CICache : public Garbage, public List { public: CICache(Preferences *preferences); diff --git a/cinelerra-5.1/cinelerra/editpanel.C b/cinelerra-5.1/cinelerra/editpanel.C index ddc7595a..41394277 100644 --- a/cinelerra-5.1/cinelerra/editpanel.C +++ b/cinelerra-5.1/cinelerra/editpanel.C @@ -1355,10 +1355,11 @@ void EditPanelGangTracks::update(int gang) int EditPanelGangTracks::handle_event() { int gang = mwindow->edl->session->gang_tracks; - switch( gang ) { - case GANG_NONE: gang = GANG_CHANNELS; break; - case GANG_CHANNELS: gang = GANG_MEDIA; break; - case GANG_MEDIA: gang = GANG_NONE; break; + if( !shift_down() ) { + if( ++gang > GANG_MEDIA ) gang = GANG_NONE; + } + else { + if( --gang < GANG_NONE ) gang = GANG_MEDIA; } update(gang); panel->panel_set_gang_tracks(gang); diff --git a/cinelerra-5.1/cinelerra/fileref.C b/cinelerra-5.1/cinelerra/fileref.C index ab8ecd7f..ade91c48 100644 --- a/cinelerra-5.1/cinelerra/fileref.C +++ b/cinelerra-5.1/cinelerra/fileref.C @@ -101,8 +101,8 @@ int FileREF::close_file() ref = 0; delete render_engine; render_engine = 0; delete command; command = 0; - delete acache; acache = 0; - delete vcache; vcache = 0; + if( acache ) { acache->remove_user(); acache = 0; } + if( vcache ) { vcache->remove_user(); vcache = 0; } delete temp; temp = 0; for( int i=0; iremove_user(); + cache = 0; + } } int64_t IndexFile::get_required_scale() diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C index de902545..64e90885 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.C +++ b/cinelerra-5.1/cinelerra/mainmenu.C @@ -209,6 +209,8 @@ void MainMenu::create_objects() trackmenu->add_item(new DeleteFirstTrack(mwindow)); trackmenu->add_item(new DeleteLastTrack(mwindow)); trackmenu->add_item(new ConcatenateTracks(mwindow)); + trackmenu->add_item(new SwapTracksUp(mwindow)); + trackmenu->add_item(new SwapTracksDown(mwindow)); AppendTracks *append_tracks; trackmenu->add_item(append_tracks = new AppendTracks(mwindow)); append_tracks->create_objects(); @@ -1290,6 +1292,34 @@ int MoveTracksDown::handle_event() } +SwapTracksUp::SwapTracksUp(MWindow *mwindow) + : BC_MenuItem(_("Swap tracks up"), 0, UP) +{ + this->mwindow = mwindow; + set_shift(); +} + +int SwapTracksUp::handle_event() +{ + if( mwindow->session->current_operation == NO_OPERATION ) + mwindow->swap_tracks_up(); + return 1; +} + +SwapTracksDown::SwapTracksDown(MWindow *mwindow) + : BC_MenuItem(_("Swap tracks down"), 0, DOWN) +{ + set_shift(); this->mwindow = mwindow; +} + +int SwapTracksDown::handle_event() +{ + if( mwindow->session->current_operation == NO_OPERATION ) + mwindow->swap_tracks_down(); + return 1; +} + + ConcatenateTracks::ConcatenateTracks(MWindow *mwindow) diff --git a/cinelerra-5.1/cinelerra/mainmenu.h b/cinelerra-5.1/cinelerra/mainmenu.h index 681ba384..bf14888f 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.h +++ b/cinelerra-5.1/cinelerra/mainmenu.h @@ -655,6 +655,22 @@ public: MWindow *mwindow; }; +class SwapTracksUp : public BC_MenuItem +{ +public: + SwapTracksUp(MWindow *mwindow); + int handle_event(); + MWindow *mwindow; +}; + +class SwapTracksDown : public BC_MenuItem +{ +public: + SwapTracksDown(MWindow *mwindow); + int handle_event(); + MWindow *mwindow; +}; + class DeleteTracks : public BC_MenuItem { public: diff --git a/cinelerra-5.1/cinelerra/maskengine.C b/cinelerra-5.1/cinelerra/maskengine.C index 564d1fe8..efe37ccc 100644 --- a/cinelerra-5.1/cinelerra/maskengine.C +++ b/cinelerra-5.1/cinelerra/maskengine.C @@ -301,7 +301,6 @@ void MaskUnit::process_package(LoadPackage *package) pkg = (MaskPackage*)package; start_x = pkg->start_x; end_x = pkg->end_x; start_y = pkg->start_y; end_y = pkg->end_y; - if( start_y >= end_y ) return; MaskEdge *edge = engine->edge; float r = engine->r, v = engine->v; VFrame *in = engine->in; diff --git a/cinelerra-5.1/cinelerra/module.C b/cinelerra-5.1/cinelerra/module.C index 01f3095f..c6990275 100644 --- a/cinelerra-5.1/cinelerra/module.C +++ b/cinelerra-5.1/cinelerra/module.C @@ -59,7 +59,6 @@ Module::Module(RenderEngine *renderengine, nested_edl = 0; nested_renderengine = 0; nested_command = 0; - private_cache = 0; cache = 0; } @@ -86,7 +85,6 @@ Module::~Module() delete nested_renderengine; delete nested_command; - if(private_cache) delete cache; } void Module::create_objects() diff --git a/cinelerra-5.1/cinelerra/module.h b/cinelerra-5.1/cinelerra/module.h index 85b50677..1203f3b6 100644 --- a/cinelerra-5.1/cinelerra/module.h +++ b/cinelerra-5.1/cinelerra/module.h @@ -82,8 +82,6 @@ public: // CICache used during effect & nested EDL CICache *cache; -// If the cache was allocated by the module - int private_cache; // Parent EDL of this module when used for effect rendering. // Used by APluginArray. EDL *edl; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 702bd8a7..1466b445 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -349,8 +349,9 @@ MWindow::~MWindow() delete gui; gui = 0; delete mainindexes; mainindexes = 0; delete mainprogress; mainprogress = 0; - delete audio_cache; audio_cache = 0; // delete the cache after the assets - delete video_cache; video_cache = 0; // delete the cache after the assets + // delete the caches after the assets + if( audio_cache ) { audio_cache->remove_user(); audio_cache = 0; } + if( video_cache ) { video_cache->remove_user(); video_cache = 0; } delete frame_cache; frame_cache = 0; delete wave_cache; wave_cache = 0; delete plugin_guis; plugin_guis = 0; diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 049694ed..8f80280f 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -500,6 +500,10 @@ public: void move_tracks_down(); void move_track_up(Track *track); void move_tracks_up(); + void swap_track_down(Track *track); + void swap_tracks_down(); + void swap_track_up(Track *track); + void swap_tracks_up(); void mute_selection(); void new_folder(const char *new_folder, int is_clips); void delete_folder(char *folder); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 5e4b797b..6242b788 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -1205,6 +1205,56 @@ void MWindow::move_tracks_up() } +void MWindow::swap_track_down(Track *track) +{ + undo_before(); + edl->tracks->swap_track_down(track); + save_backup(); + undo_after(_("swap track down"), LOAD_ALL); + + restart_brender(); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); + sync_parameters(CHANGE_EDL); + save_backup(); +} + +void MWindow::swap_tracks_down() +{ + undo_before(); + edl->tracks->swap_tracks_down(); + save_backup(); + undo_after(_("swap tracks down"), LOAD_ALL); + + restart_brender(); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); + sync_parameters(CHANGE_EDL); + save_backup(); +} + +void MWindow::swap_track_up(Track *track) +{ + undo_before(); + edl->tracks->swap_track_up(track); + save_backup(); + undo_after(_("swap track up"), LOAD_ALL); + restart_brender(); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); + sync_parameters(CHANGE_EDL); + save_backup(); +} + +void MWindow::swap_tracks_up() +{ + undo_before(); + edl->tracks->swap_tracks_up(); + save_backup(); + undo_after(_("swap tracks up"), LOAD_ALL); + restart_brender(); + gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); + sync_parameters(CHANGE_EDL); +} + + void MWindow::mute_selection() { double start = edl->local_session->get_selectionstart(); diff --git a/cinelerra-5.1/cinelerra/packagerenderer.C b/cinelerra-5.1/cinelerra/packagerenderer.C index d60a5be0..a76d736a 100644 --- a/cinelerra-5.1/cinelerra/packagerenderer.C +++ b/cinelerra-5.1/cinelerra/packagerenderer.C @@ -101,8 +101,10 @@ PackageRenderer::PackageRenderer() PackageRenderer::~PackageRenderer() { delete command; - delete audio_cache; - delete video_cache; + if( audio_cache ) + audio_cache->remove_user(); + if( video_cache ) + video_cache->remove_user(); delete vconfig; delete aconfig; delete timer; diff --git a/cinelerra-5.1/cinelerra/patchgui.C b/cinelerra-5.1/cinelerra/patchgui.C index dc518b5c..f99601c1 100644 --- a/cinelerra-5.1/cinelerra/patchgui.C +++ b/cinelerra-5.1/cinelerra/patchgui.C @@ -60,11 +60,11 @@ PatchGUI::PatchGUI(MWindow *mwindow, record = 0; play = 0; // automate = 0; - gang = 0; draw = 0; mute = 0; - zoom = 0; + gang = 0; master = 0; + zoom = 0; expand = 0; nudge = 0; mix = 0; @@ -79,11 +79,11 @@ PatchGUI::~PatchGUI() delete record; delete play; // delete automate; - delete gang; delete draw; delete mute; - delete zoom; + delete gang; delete master; + delete zoom; delete expand; delete nudge; delete mix; @@ -117,15 +117,16 @@ int PatchGUI::reposition(int x, int y) x1 += record->get_w(); // automate->reposition_window(x1, y1 + y); // x1 += automate->get_w(); - gang->reposition_window(gang->get_x(), y1 + y); - x1 += gang->get_w(); draw->reposition_window(draw->get_x(), y1 + y); x1 += draw->get_w(); mute->reposition_window(mute->get_x(), y1 + y); x1 += mute->get_w(); - zoom->reposition_window(zoom->get_x(), y1 + y); - x1 += zoom->get_w(); + gang->reposition_window(gang->get_x(), y1 + y); + x1 += gang->get_w(); master->reposition_window(master->get_x(), y1 + y); + x1 += master->get_w(); + zoom->reposition_window(zoom->get_x(), y1 + y); +// x1 += zoom->get_w(); } y1 += mwindow->theme->play_h; } @@ -177,18 +178,19 @@ int PatchGUI::update(int x, int y) if( h < y2 ) { delete play; play = 0; delete record; record = 0; - delete gang; gang = 0; delete draw; draw = 0; delete mute; mute = 0; - delete zoom; zoom = 0; + delete gang; gang = 0; delete master; master = 0; + delete zoom; zoom = 0; } else { play->update(track->play); record->update(track->armed); - gang->update(track->ganged); draw->update(track->draw); mute->update(mwindow->get_int_auto(this, AUTOMATION_MUTE)->value); + gang->update(track->ganged); + master->update(track->master); } } else if( h >= y2 ) { @@ -197,15 +199,16 @@ int PatchGUI::update(int x, int y) x1 += play->get_w(); patchbay->add_subwindow(record = new RecordPatch(mwindow, this, x1 + x, y1 + y)); x1 += record->get_w(); - patchbay->add_subwindow(gang = new GangPatch(mwindow, this, x1 + x, y1 + y)); - x1 += gang->get_w(); patchbay->add_subwindow(draw = new DrawPatch(mwindow, this, x1 + x, y1 + y)); x1 += draw->get_w(); patchbay->add_subwindow(mute = new MutePatch(mwindow, this, x1 + x, y1 + y)); x1 += mute->get_w(); - patchbay->add_subwindow(zoom = new ZoomPatch(mwindow, this, x1 + x, y1 + y)); - x1 += zoom->get_w(); + patchbay->add_subwindow(gang = new GangPatch(mwindow, this, x1 + x, y1 + y)); + x1 += gang->get_w(); patchbay->add_subwindow(master = new MasterPatch(mwindow, this, x1 + x, y1 + y)); + x1 += master->get_w(); + patchbay->add_subwindow(zoom = new ZoomPatch(mwindow, this, x1 + x, y1 + y)); +// x1 += zoom->get_w(); } if( play ) y1 = y2; diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index 8ce98234..82bd7bb6 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -85,8 +85,10 @@ PlaybackEngine::~PlaybackEngine() Thread::join(); delete preferences; delete_render_engine(); - delete audio_cache; - delete video_cache; + if( audio_cache ) + audio_cache->remove_user(); + if( video_cache ) + video_cache->remove_user(); delete tracking_lock; delete tracking_done; delete pause_lock; @@ -162,10 +164,12 @@ void PlaybackEngine::wait_render_engine() void PlaybackEngine::create_cache() { - if(audio_cache) { delete audio_cache; audio_cache = 0; } - if(video_cache) { delete video_cache; video_cache = 0; } - if(!audio_cache) audio_cache = new CICache(preferences); - if(!video_cache) video_cache = new CICache(preferences); + if( audio_cache ) + audio_cache->remove_user(); + if( video_cache ) + video_cache->remove_user(); + audio_cache = new CICache(preferences); + video_cache = new CICache(preferences); } diff --git a/cinelerra-5.1/cinelerra/playtransport.C b/cinelerra-5.1/cinelerra/playtransport.C index d9d9a48a..8caf4678 100644 --- a/cinelerra-5.1/cinelerra/playtransport.C +++ b/cinelerra-5.1/cinelerra/playtransport.C @@ -30,6 +30,7 @@ #include "preferences.h" #include "shuttle.h" #include "theme.h" +#include "tracks.h" #include "transportque.h" #include "vframe.h" @@ -329,21 +330,14 @@ EDL* PlayTransport::get_edl() return mwindow->edl; } -int PlayTransport::pause_transport() +int PlayTransport::set_transport(int mode) { - if(active_button) active_button->set_mode(PLAY_MODE); - return 0; -} - - -int PlayTransport::reset_transport() -{ - fast_reverse->set_mode(PLAY_MODE); - reverse_play->set_mode(PLAY_MODE); - forward_play->set_mode(PLAY_MODE); - frame_reverse_play->set_mode(PLAY_MODE); - frame_forward_play->set_mode(PLAY_MODE); - fast_play->set_mode(PLAY_MODE); + fast_reverse->set_mode(mode); + reverse_play->set_mode(mode); + forward_play->set_mode(mode); + frame_reverse_play->set_mode(mode); + frame_forward_play->set_mode(mode); + fast_play->set_mode(mode); return 0; } @@ -358,10 +352,29 @@ PTransportButton::~PTransportButton() { } -int PTransportButton::set_mode(int mode) +void PTransportButton::set_mode(int mode) { this->mode = mode; - return 0; +} + +void PTransportButton::loop_mode(int dir) +{ + if( mode != LOOP_MODE ) return; + EDL *edl = transport->get_edl(); + if( !edl ) return; + PlaybackEngine *engine = transport->engine; + if( !engine || engine->is_playing_back ) return; + double position = engine->get_tracking_position(); + switch( dir ) { + case PLAY_FORWARD: + if( position >= edl->tracks->total_playable_length() ) + transport->goto_start(); + break; + case PLAY_REVERSE: + if( position <= 0 ) + transport->goto_end(); + break; + } } int PTransportButton::play_command(const char *lock_msg, int command) @@ -398,6 +411,7 @@ FastReverseButton::FastReverseButton(MWindow *mwindow, PlayTransport *transport, } int FastReverseButton::handle_event() { + loop_mode(PLAY_REVERSE); return play_command("FastReverseButton::handle_event", FAST_REWIND); } @@ -410,6 +424,7 @@ ReverseButton::ReverseButton(MWindow *mwindow, PlayTransport *transport, int x, } int ReverseButton::handle_event() { + loop_mode(PLAY_REVERSE); return play_command("ReverseButton::handle_event", NORMAL_REWIND); } @@ -437,6 +452,7 @@ PlayButton::PlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y) } int PlayButton::handle_event() { + loop_mode(PLAY_FORWARD); return play_command("PlayButton::handle_event", NORMAL_FWD); } @@ -466,6 +482,7 @@ FastPlayButton::FastPlayButton(MWindow *mwindow, PlayTransport *transport, int x } int FastPlayButton::handle_event() { + loop_mode(PLAY_FORWARD); return play_command("FastPlayButton::handle_event", FAST_FWD); } diff --git a/cinelerra-5.1/cinelerra/playtransport.h b/cinelerra-5.1/cinelerra/playtransport.h index 20d98999..791a801f 100644 --- a/cinelerra-5.1/cinelerra/playtransport.h +++ b/cinelerra-5.1/cinelerra/playtransport.h @@ -29,8 +29,7 @@ #include "playtransport.inc" #define PLAY_MODE 0 -#define PAUSE_MODE 1 -#define PAUSEDOWN_MODE 2 +#define LOOP_MODE 1 class PlayTransport { @@ -62,8 +61,7 @@ public: // speed - play speed for SLOW/FAST playback, zero defaults to slow=.5,fast=2. void handle_transport(int command, int wait_tracking=0, int use_inout=0, int toggle_audio=0, int loop_play=0, float speed=0); - int pause_transport(); - int reset_transport(); + int set_transport(int mode); int get_w(); int is_stopped(); // Get the EDL to play back with default to mwindow->edl @@ -100,7 +98,8 @@ class PTransportButton : public BC_Button public: PTransportButton(MWindow *mwindow, PlayTransport *transport, int x, int y, VFrame **data); virtual ~PTransportButton(); - virtual int set_mode(int mode); + void set_mode(int mode); + void loop_mode(int dir); int play_command(const char *lock_msg, int command); int mode; diff --git a/cinelerra-5.1/cinelerra/pluginarray.C b/cinelerra-5.1/cinelerra/pluginarray.C index a04e9858..7d971a69 100644 --- a/cinelerra-5.1/cinelerra/pluginarray.C +++ b/cinelerra-5.1/cinelerra/pluginarray.C @@ -266,8 +266,10 @@ int PluginArray::stop_plugins() values[i]->close_plugin(); } } - - delete cache; + if( cache ) { + cache->remove_user(); + cache = 0; + } return 0; } diff --git a/cinelerra-5.1/cinelerra/pluginfclient.C b/cinelerra-5.1/cinelerra/pluginfclient.C index 2cc12d62..486d7319 100644 --- a/cinelerra-5.1/cinelerra/pluginfclient.C +++ b/cinelerra-5.1/cinelerra/pluginfclient.C @@ -8,6 +8,7 @@ #include "bcwindowbase.h" #include "bctitle.h" #include "cstrdup.h" +#include "keys.h" #include "language.h" #include "mwindow.h" #include "pluginfclient.h" @@ -186,6 +187,10 @@ PluginFClientText:: int PluginFClientText::handle_event() { + if( get_keypress() == RETURN ) { + fwin->update(); + activate(); + } return 0; } diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index 34f833fb..fff64f37 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -657,7 +657,8 @@ ProxyClient::ProxyClient(MWindow *mwindow, ProxyClient::~ProxyClient() { delete render_engine; - delete video_cache; + if( video_cache ) + video_cache->remove_user(); delete src_file; } diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index 746b4187..741d6ff3 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -882,8 +882,8 @@ printf("Render::render_single: Session finished.\n"); mwindow->restart_brender(); if( farm_server ) delete farm_server; delete command; - delete audio_cache; - delete video_cache; + audio_cache->remove_user(); + video_cache->remove_user(); // Must delete packages after server delete render->packages; diff --git a/cinelerra-5.1/cinelerra/resourcethread.C b/cinelerra-5.1/cinelerra/resourcethread.C index 308e902d..4c28c032 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.C +++ b/cinelerra-5.1/cinelerra/resourcethread.C @@ -670,10 +670,11 @@ void ResourceThread::stop() video_thread->stop(); } -void ResourceThread::reset(int pane_number) +void ResourceThread::reset(int pane_number, int indexes_only) { audio_thread->reset(pane_number); - video_thread->reset(pane_number); + if( !indexes_only ) + video_thread->reset(pane_number); } void ResourceThread::close_indexable(Indexable *idxbl) diff --git a/cinelerra-5.1/cinelerra/resourcethread.h b/cinelerra-5.1/cinelerra/resourcethread.h index 1f8fada5..8434553d 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.h +++ b/cinelerra-5.1/cinelerra/resourcethread.h @@ -205,7 +205,7 @@ public: void run(); void stop(); - void reset(int pane_number); + void reset(int pane_number, int indexes_only); void close_indexable(Indexable*); MWindow *mwindow; diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index 264bd95f..9e86481c 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -1793,10 +1793,25 @@ void Track::set_camera(float x, float y, float z) Track *Track::gang_master() { - if( edl->session->gang_tracks == GANG_NONE ) return this; Track *track = this; - while( track && !track->master ) track = track->previous; - return !track ? tracks->first : track; + switch( edl->session->gang_tracks ) { + case GANG_NONE: + return track; + case GANG_CHANNELS: { + Track *current = track; + int data_type = track->data_type; + while( current && !track->master ) { + if( !(current = current->previous) ) break; + if( current->data_type == data_type ) track = current; + if( track->master ) break; + } + break; } + case GANG_MEDIA: { + while( track && !track->master ) track = track->previous; + break; } + } + if( !track ) track = tracks->first; + return track; } int Track::is_hidden() @@ -1815,6 +1830,7 @@ int Track::is_armed() { return gang_master()->armed; } + int Track::is_ganged() { return gang_master()->ganged; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index dda88761..c0f8f995 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -781,7 +781,7 @@ void TrackCanvas::draw_resources(int mode, if(debug) PRINT_TRACE if(mode != IGNORE_THREAD) - gui->resource_thread->reset(pane->number); + gui->resource_thread->reset(pane->number, indexes_only); // Search every edit for(Track *current = mwindow->edl->tracks->first; @@ -3902,7 +3902,7 @@ int TrackCanvas::render_handle_frame(EDL *edl, int64_t pos, int mode) !vrender->process_buffer(&vlt, left, 0) && !vrender->process_buffer(&vrt, pos , 0) ? 0 : 1; delete render_engine; - delete video_cache; + video_cache->remove_user(); mwindow->cwindow->gui->lock_window("TrackCanvas::render_handle_frame 0"); Canvas *canvas = mwindow->cwindow->gui->canvas; float ox1, oy1, ox2, oy2, cx1, cy1, cx2, cy2; diff --git a/cinelerra-5.1/cinelerra/trackpopup.C b/cinelerra-5.1/cinelerra/trackpopup.C index 077fa9cb..6dd1512e 100644 --- a/cinelerra-5.1/cinelerra/trackpopup.C +++ b/cinelerra-5.1/cinelerra/trackpopup.C @@ -72,6 +72,8 @@ void TrackPopup::create_objects() add_item(new TrackPopupShow(mwindow, this)); add_item(new TrackPopupUserTitle(mwindow, this)); add_item(new TrackPopupTitleColor(mwindow, this)); + add_item(new TrackSwapUp(mwindow, this)); + add_item(new TrackSwapDown(mwindow, this)); resize_option = 0; matchsize_option = 0; } @@ -135,8 +137,6 @@ int TrackMoveUp::handle_event() return 1; } - - TrackMoveDown::TrackMoveDown(MWindow *mwindow, TrackPopup *popup) : BC_MenuItem(_("Move down")) { @@ -153,6 +153,37 @@ int TrackMoveDown::handle_event() } +TrackSwapUp::TrackSwapUp(MWindow *mwindow, TrackPopup *popup) + : BC_MenuItem(_("Swap up")) +{ + this->mwindow = mwindow; + this->popup = popup; +} +TrackSwapUp::~TrackSwapUp() +{ +} +int TrackSwapUp::handle_event() +{ + mwindow->swap_track_up(popup->track); + return 1; +} + +TrackSwapDown::TrackSwapDown(MWindow *mwindow, TrackPopup *popup) + : BC_MenuItem(_("Swap down")) +{ + this->mwindow = mwindow; + this->popup = popup; +} +TrackSwapDown::~TrackSwapDown() +{ +} +int TrackSwapDown::handle_event() +{ + mwindow->swap_track_down(popup->track); + return 1; +} + + TrackPopupResize::TrackPopupResize(MWindow *mwindow, TrackPopup *popup) : BC_MenuItem(_("Resize track...")) { diff --git a/cinelerra-5.1/cinelerra/trackpopup.h b/cinelerra-5.1/cinelerra/trackpopup.h index b8042f34..b44a62d5 100644 --- a/cinelerra-5.1/cinelerra/trackpopup.h +++ b/cinelerra-5.1/cinelerra/trackpopup.h @@ -130,6 +130,30 @@ public: TrackPopup *popup; }; +class TrackSwapUp : public BC_MenuItem +{ +public: + TrackSwapUp(MWindow *mwindow, TrackPopup *popup); + ~TrackSwapUp(); + + int handle_event(); + + MWindow *mwindow; + TrackPopup *popup; +}; + +class TrackSwapDown : public BC_MenuItem +{ +public: + TrackSwapDown(MWindow *mwindow, TrackPopup *popup); + ~TrackSwapDown(); + + int handle_event(); + + MWindow *mwindow; + TrackPopup *popup; +}; + class TrackPopupFindAsset : public BC_MenuItem { public: diff --git a/cinelerra-5.1/cinelerra/tracks.h b/cinelerra-5.1/cinelerra/tracks.h index 3d676713..dd1a92f6 100644 --- a/cinelerra-5.1/cinelerra/tracks.h +++ b/cinelerra-5.1/cinelerra/tracks.h @@ -73,10 +73,14 @@ public: void equivalent_output(Tracks *tracks, double *result); void move_tracks(Track *src, Track *dst, int n); - int move_track_up(Track *track); // move recordable tracks up - int move_track_down(Track *track); // move recordable tracks down - int move_tracks_up(); // move recordable tracks up - int move_tracks_down(); // move recordable tracks down + int move_track_up(Track *track); + int move_track_down(Track *track); + int move_tracks_up(); + int move_tracks_down(); + int swap_track_up(Track *track); + int swap_track_down(Track *track); + int swap_tracks_up(); + int swap_tracks_down(); void paste_audio_transition(PluginServer *server); void paste_video_transition(PluginServer *server, int first_track = 0); diff --git a/cinelerra-5.1/cinelerra/tracksedit.C b/cinelerra-5.1/cinelerra/tracksedit.C index f1684204..29584b23 100644 --- a/cinelerra-5.1/cinelerra/tracksedit.C +++ b/cinelerra-5.1/cinelerra/tracksedit.C @@ -922,6 +922,61 @@ int Tracks::move_tracks_down() } +int Tracks::swap_track_up(Track *track) +{ + Track *next_track = track->previous; + if(!next_track) next_track = last; + + change_modules(number_of(track), number_of(next_track), 1); + swap(track, next_track); + return 0; +} + +int Tracks::swap_track_down(Track *track) +{ + Track *next_track = track->next; + if(!next_track) next_track = first; + + change_modules(number_of(track), number_of(next_track), 1); + swap(track, next_track); + return 0; +} + + +int Tracks::swap_tracks_up() +{ + int result = 0; + Track *next = first; + while( next ) { + Track *track = next; next = track->next; + if( !track->armed ) continue; + if( track->previous ) { + change_modules(number_of(track->previous), number_of(track), 1); + swap(track->previous, track); + result = 1; + } + } + + return result; +} + +int Tracks::swap_tracks_down() +{ + int result = 0; + Track *prev = last; + while( prev ) { + Track *track = prev; prev = track->previous; + if( !track->armed ) continue; + if( track->next ) { + change_modules(number_of(track), number_of(track->next), 1); + swap(track, track->next); + result = 1; + } + } + + return result; +} + void Tracks::paste_audio_transition(PluginServer *server) { for(Track *current = first; current; current = NEXT) diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 1217633f..09d3e6f5 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -129,7 +129,7 @@ void VWindowGUI::draw_wave() for( int i=channels; --i>=0; ) delete samples[i]; delete render_engine; - delete cache; + cache->remove_user(); delete canvas->refresh_frame; canvas->refresh_frame = vframe; canvas->refresh(1); @@ -227,6 +227,7 @@ void VWindowGUI::create_objects() mwindow->theme->vtransport_x, mwindow->theme->vtransport_y); transport->create_objects(); + transport->set_transport(LOOP_MODE); //printf("VWindowGUI::create_objects 1\n"); // add_subwindow(fps_title = new BC_Title(mwindow->theme->vedit_x, y, "")); diff --git a/cinelerra-5.1/guicast/bctextbox.C b/cinelerra-5.1/guicast/bctextbox.C index f300e66c..b81da1fb 100644 --- a/cinelerra-5.1/guicast/bctextbox.C +++ b/cinelerra-5.1/guicast/bctextbox.C @@ -2377,7 +2377,8 @@ void BC_ScrollTextBox::update_scrollbars() delete yscroll; yscroll = 0; } - if( view_rows != text->get_rows() || view_w != text->get_w() ) { + if( view_rows != text->get_rows() || view_w != text->get_w() || + x != text->get_x() || y != text->get_y() ) { text->reposition_window(x, y, view_w, view_rows); } if( need_xscroll && !xscroll ) { diff --git a/cinelerra-5.1/plugins/theme_blond/data/gang1.png b/cinelerra-5.1/plugins/theme_blond/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_blond/data/gang1.png and b/cinelerra-5.1/plugins/theme_blond/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_blond/data/gang2.png b/cinelerra-5.1/plugins/theme_blond/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_blond/data/gang2.png and b/cinelerra-5.1/plugins/theme_blond/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_blond_cv/data/gang1.png b/cinelerra-5.1/plugins/theme_blond_cv/data/gang1.png index e3bbd85b..3537b41b 100644 Binary files a/cinelerra-5.1/plugins/theme_blond_cv/data/gang1.png and b/cinelerra-5.1/plugins/theme_blond_cv/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_blond_cv/data/gang2.png b/cinelerra-5.1/plugins/theme_blond_cv/data/gang2.png index 4d99ae1a..e1f564c5 100644 Binary files a/cinelerra-5.1/plugins/theme_blond_cv/data/gang2.png and b/cinelerra-5.1/plugins/theme_blond_cv/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_blue/data/gang1.png b/cinelerra-5.1/plugins/theme_blue/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_blue/data/gang1.png and b/cinelerra-5.1/plugins/theme_blue/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_blue/data/gang2.png b/cinelerra-5.1/plugins/theme_blue/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_blue/data/gang2.png and b/cinelerra-5.1/plugins/theme_blue/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/gang1.png b/cinelerra-5.1/plugins/theme_blue_dot/data/gang1.png index 8bfbdf44..f95d5635 100644 Binary files a/cinelerra-5.1/plugins/theme_blue_dot/data/gang1.png and b/cinelerra-5.1/plugins/theme_blue_dot/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/gang2.png b/cinelerra-5.1/plugins/theme_blue_dot/data/gang2.png index a2346a16..2ad644ee 100644 Binary files a/cinelerra-5.1/plugins/theme_blue_dot/data/gang2.png and b/cinelerra-5.1/plugins/theme_blue_dot/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_bright/data/gang1.png b/cinelerra-5.1/plugins/theme_bright/data/gang1.png index 70c3bdbb..f5a95e55 100644 Binary files a/cinelerra-5.1/plugins/theme_bright/data/gang1.png and b/cinelerra-5.1/plugins/theme_bright/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_bright/data/gang2.png b/cinelerra-5.1/plugins/theme_bright/data/gang2.png index cdcc5c15..4d989dd7 100644 Binary files a/cinelerra-5.1/plugins/theme_bright/data/gang2.png and b/cinelerra-5.1/plugins/theme_bright/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_cakewalk/data/gang1.png b/cinelerra-5.1/plugins/theme_cakewalk/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_cakewalk/data/gang1.png and b/cinelerra-5.1/plugins/theme_cakewalk/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_cakewalk/data/gang2.png b/cinelerra-5.1/plugins/theme_cakewalk/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_cakewalk/data/gang2.png and b/cinelerra-5.1/plugins/theme_cakewalk/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_hulk/data/gang1.png b/cinelerra-5.1/plugins/theme_hulk/data/gang1.png index a99c6263..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_hulk/data/gang1.png and b/cinelerra-5.1/plugins/theme_hulk/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_hulk/data/gang2.png b/cinelerra-5.1/plugins/theme_hulk/data/gang2.png index f6738f0c..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_hulk/data/gang2.png and b/cinelerra-5.1/plugins/theme_hulk/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_neophyte/data/gang1.png b/cinelerra-5.1/plugins/theme_neophyte/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_neophyte/data/gang1.png and b/cinelerra-5.1/plugins/theme_neophyte/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_neophyte/data/gang2.png b/cinelerra-5.1/plugins/theme_neophyte/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_neophyte/data/gang2.png and b/cinelerra-5.1/plugins/theme_neophyte/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_pinklady/data/gang1.png b/cinelerra-5.1/plugins/theme_pinklady/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_pinklady/data/gang1.png and b/cinelerra-5.1/plugins/theme_pinklady/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_pinklady/data/gang2.png b/cinelerra-5.1/plugins/theme_pinklady/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_pinklady/data/gang2.png and b/cinelerra-5.1/plugins/theme_pinklady/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_suv/data/gang1.png b/cinelerra-5.1/plugins/theme_suv/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_suv/data/gang1.png and b/cinelerra-5.1/plugins/theme_suv/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_suv/data/gang2.png b/cinelerra-5.1/plugins/theme_suv/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_suv/data/gang2.png and b/cinelerra-5.1/plugins/theme_suv/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/theme_unflat/data/gang1.png b/cinelerra-5.1/plugins/theme_unflat/data/gang1.png index ac658091..0d9ffe84 100644 Binary files a/cinelerra-5.1/plugins/theme_unflat/data/gang1.png and b/cinelerra-5.1/plugins/theme_unflat/data/gang1.png differ diff --git a/cinelerra-5.1/plugins/theme_unflat/data/gang2.png b/cinelerra-5.1/plugins/theme_unflat/data/gang2.png index 483afee9..b845849e 100644 Binary files a/cinelerra-5.1/plugins/theme_unflat/data/gang2.png and b/cinelerra-5.1/plugins/theme_unflat/data/gang2.png differ diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C index 11e454ec..6722704d 100644 --- a/cinelerra-5.1/plugins/titler/titler.C +++ b/cinelerra-5.1/plugins/titler/titler.C @@ -944,7 +944,8 @@ TitleMain::~TitleMain() background = 0; } delete render_engine; - delete video_cache; + if( video_cache ) + video_cache->remove_user(); delete overlay_frame; delete bg_file; delete bg_frame; @@ -1186,7 +1187,7 @@ int TitleMain::load_font(BC_FontEntry *font) Indexable *TitleMain::open_background(const char *filename) { delete render_engine; render_engine = 0; - delete video_cache; video_cache = 0; + if( video_cache ) { video_cache->remove_user(); video_cache = 0; } delete bg_file; bg_file = new File; Asset *asset = new Asset(filename);