From e41864cf7931bfb86f68c5d35d4578dfe161d386 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 26 Nov 2018 17:22:53 -0700 Subject: [PATCH] add window layout feature, resource wdw select used, blue_dot/blond_cv theme fix, vframe ppm, docs update, increased retries on ffmpeg encode_frame for flush --- cinelerra-5.1/cinelerra/assetpopup.C | 5 + cinelerra-5.1/cinelerra/assetpopup.h | 1 + cinelerra-5.1/cinelerra/awindowgui.C | 44 ++++ cinelerra-5.1/cinelerra/awindowgui.h | 22 ++ cinelerra-5.1/cinelerra/awindowgui.inc | 2 + cinelerra-5.1/cinelerra/cwindowgui.C | 218 ++++++++++-------- cinelerra-5.1/cinelerra/edits.C | 10 +- cinelerra-5.1/cinelerra/edl.C | 19 ++ cinelerra-5.1/cinelerra/edl.h | 1 + cinelerra-5.1/cinelerra/ffmpeg.C | 2 +- cinelerra-5.1/cinelerra/gwindowgui.C | 4 +- cinelerra-5.1/cinelerra/mainmenu.C | 64 ++++- cinelerra-5.1/cinelerra/mainmenu.h | 28 +++ cinelerra-5.1/cinelerra/mainsession.C | 28 +++ cinelerra-5.1/cinelerra/mainsession.h | 2 + cinelerra-5.1/cinelerra/mwindow.C | 33 +++ cinelerra-5.1/cinelerra/mwindow.h | 1 + cinelerra-5.1/cinelerra/preferences.inc | 1 + cinelerra-5.1/doc/shortcuts.html | 24 ++ cinelerra-5.1/ffmpeg/plugin.opts | 170 +++++++------- cinelerra-5.1/guicast/bcmenuitem.C | 19 +- cinelerra-5.1/guicast/vframe.C | 22 ++ cinelerra-5.1/guicast/vframe.h | 5 +- .../plugins/theme_blond_cv/blondcvtheme.C | 4 + .../plugins/theme_blue_dot/bluedottheme.C | 5 + 25 files changed, 533 insertions(+), 201 deletions(-) diff --git a/cinelerra-5.1/cinelerra/assetpopup.C b/cinelerra-5.1/cinelerra/assetpopup.C index c9bac6fd..244e472f 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.C +++ b/cinelerra-5.1/cinelerra/assetpopup.C @@ -404,6 +404,11 @@ void AssetListMenu::create_objects() { add_item(load_file = new AssetPopupLoadFile(mwindow, gui)); add_item(format = new AWindowListFormat(mwindow, gui)); + add_item(select_used = new AssetSelectUsed(mwindow, gui)); + BC_SubMenu *submenu; + select_used->add_submenu(submenu = new BC_SubMenu()); + submenu->add_submenuitem(new AssetSelectUsedItem(select_used, _("Used"), SELECT_USED)); + submenu->add_submenuitem(new AssetSelectUsedItem(select_used, _("Unused"), SELECT_UNUSED)); add_item(new AWindowListSort(mwindow, gui)); add_item(new AssetListCopy(mwindow, gui)); add_item(new AssetListPaste(mwindow, gui)); diff --git a/cinelerra-5.1/cinelerra/assetpopup.h b/cinelerra-5.1/cinelerra/assetpopup.h index 129cd335..c30c155c 100644 --- a/cinelerra-5.1/cinelerra/assetpopup.h +++ b/cinelerra-5.1/cinelerra/assetpopup.h @@ -217,6 +217,7 @@ public: AWindowListFormat *format; AssetSnapshot *asset_snapshot; AssetGrabshot *asset_grabshot; + AssetSelectUsed *select_used; int shots_displayed; }; diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 2ef63796..56347110 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -2937,3 +2937,47 @@ int AWindowListSort::handle_event() return 1; } +AssetSelectUsedItem::AssetSelectUsedItem(AssetSelectUsed *select_used, const char *text, int action) + : BC_MenuItem(text) +{ + this->select_used = select_used; + this->action = action; +} + +int AssetSelectUsedItem::handle_event() +{ + MWindow *mwindow = select_used->mwindow; + AWindowGUI *gui = select_used->gui; + AWindowAssets *asset_list = gui->asset_list; + ArrayList *data = gui->displayed_assets; + asset_list->set_all_selected(data, 0); + + for( int i = 0; i < data->total; i++ ) { + AssetPicon *picon = (AssetPicon*)data->values[i]; + Indexable *idxbl = picon->indexable ? picon->indexable : + picon->edl ? picon->edl->get_proxy_asset() : 0; + int used = idxbl && mwindow->edl->in_use(idxbl) ? 1 : 0; + int selected = 0; + switch( action ) { + case SELECT_USED: selected = used; break; + case SELECT_UNUSED: selected = !used; break; + } + asset_list->set_selected(data, i, selected); + } + + int asset_xposition = asset_list->get_xposition(); + int asset_yposition = asset_list->get_yposition(); + asset_list->update(gui->displayed_assets, gui->asset_titles, + mwindow->edl->session->asset_columns, ASSET_COLUMNS, + asset_xposition, asset_yposition, -1, 0); + asset_list->center_selection(); + return 1; +} + +AssetSelectUsed::AssetSelectUsed(MWindow *mwindow, AWindowGUI *gui) + : BC_MenuItem(_("Select used")) +{ + this->mwindow = mwindow; + this->gui = gui; +} + diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index 436965c9..41dd0491 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -49,6 +49,9 @@ #include "samples.inc" #include "vicon.h" +#define SELECT_USED 0 +#define SELECT_UNUSED 1 + class AWindowFolderItem : public BC_ListBoxItem { public: @@ -548,4 +551,23 @@ public: AWindowGUI *gui; }; +class AssetSelectUsedItem : public BC_MenuItem +{ +public: + AssetSelectUsedItem(AssetSelectUsed *select_used, const char *text, int action); + int handle_event(); + + int action; + AssetSelectUsed *select_used; +}; + +class AssetSelectUsed : public BC_MenuItem +{ +public: + AssetSelectUsed(MWindow *mwindow, AWindowGUI *gui); + + MWindow *mwindow; + AWindowGUI *gui; +}; + #endif diff --git a/cinelerra-5.1/cinelerra/awindowgui.inc b/cinelerra-5.1/cinelerra/awindowgui.inc index fdb7525c..b67da703 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.inc +++ b/cinelerra-5.1/cinelerra/awindowgui.inc @@ -49,5 +49,7 @@ class AddPluginItem; class AVIconDrawing; class AWindowListFormat; class AWindowListSort; +class AssetSelectUsedItem; +class AssetSelectUsed; #endif diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 19ff101e..86c7e424 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -463,113 +463,133 @@ int CWindowGUI::keypress_event() int result = 0; int cwindow_operation = CWINDOW_NONE; - switch(get_keypress()) - { - case 'w': - case 'W': - close_event(); - result = 1; - break; - case '+': - case '=': - keyboard_zoomin(); - result = 1; - break; - case '-': - keyboard_zoomout(); - result = 1; - break; - case 'f': + switch( get_keypress() ) { + case 'w': + case 'W': + close_event(); + result = 1; + break; + case '+': + case '=': + keyboard_zoomin(); + result = 1; + break; + case '-': + keyboard_zoomout(); + result = 1; + break; + case 'f': + unlock_window(); + if(mwindow->session->cwindow_fullscreen) + canvas->stop_fullscreen(); + else + canvas->start_fullscreen(); + lock_window("CWindowGUI::keypress_event 1"); + result = 1; + break; + case 'x': + if( ctrl_down() || shift_down() || alt_down() ) break; + unlock_window(); + mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); + mwindow->cut(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 2"); + result = 1; + break; + case DELETE: + unlock_window(); + mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); + mwindow->clear_entry(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 3"); + result = 1; + break; + case ESC: + unlock_window(); + if(mwindow->session->cwindow_fullscreen) + canvas->stop_fullscreen(); + lock_window("CWindowGUI::keypress_event 4"); + result = 1; + break; + case LEFT: + if( !ctrl_down() ) { + int alt_down = this->alt_down(); + int shift_down = this->shift_down(); unlock_window(); - if(mwindow->session->cwindow_fullscreen) - canvas->stop_fullscreen(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 5"); + if( alt_down ) + mwindow->prev_edit_handle(shift_down); else - canvas->start_fullscreen(); - lock_window("CWindowGUI::keypress_event 1"); - break; - case 'x': - if( ctrl_down() || shift_down() || alt_down() ) break; - unlock_window(); - mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); - mwindow->cut(); + mwindow->move_left(); mwindow->gui->unlock_window(); - lock_window("CWindowGUI::keypress_event 2"); - break; - case DELETE: + lock_window("CWindowGUI::keypress_event 6"); + result = 1; + } + break; + + case ',': + if( !ctrl_down() && !alt_down() ) { unlock_window(); - mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); - mwindow->clear_entry(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 7"); + mwindow->move_left(); mwindow->gui->unlock_window(); - lock_window("CWindowGUI::keypress_event 3"); - break; - case ESC: + lock_window("CWindowGUI::keypress_event 8"); + result = 1; + } + break; + + case RIGHT: + if( !ctrl_down() ) { + int alt_down = this->alt_down(); + int shift_down = this->shift_down(); unlock_window(); - if(mwindow->session->cwindow_fullscreen) - canvas->stop_fullscreen(); - lock_window("CWindowGUI::keypress_event 4"); - break; - case LEFT: - if( !ctrl_down() ) { - int alt_down = this->alt_down(); - int shift_down = this->shift_down(); - unlock_window(); - stop_transport(0); - mwindow->gui->lock_window("CWindowGUI::keypress_event 5"); - if( alt_down ) - mwindow->prev_edit_handle(shift_down); - else - mwindow->move_left(); - mwindow->gui->unlock_window(); - lock_window("CWindowGUI::keypress_event 6"); - result = 1; - } - break; + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 8"); + if( alt_down ) + mwindow->next_edit_handle(shift_down); + else + mwindow->move_right(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 9"); + result = 1; + } + break; - case ',': - if( !ctrl_down() && !alt_down() ) { - unlock_window(); - stop_transport(0); - mwindow->gui->lock_window("CWindowGUI::keypress_event 7"); - mwindow->move_left(); - mwindow->gui->unlock_window(); - lock_window("CWindowGUI::keypress_event 8"); - result = 1; - } - break; + case '.': + if( !ctrl_down() && !alt_down() ) { + unlock_window(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 10"); + mwindow->move_right(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 11"); + result = 1; + } + break; + } - case RIGHT: - if( !ctrl_down() ) { - int alt_down = this->alt_down(); - int shift_down = this->shift_down(); - unlock_window(); - stop_transport(0); - mwindow->gui->lock_window("CWindowGUI::keypress_event 8"); - if( alt_down ) - mwindow->next_edit_handle(shift_down); - else - mwindow->move_right(); - mwindow->gui->unlock_window(); - lock_window("CWindowGUI::keypress_event 9"); - result = 1; + if( !result && !ctrl_down() ) { + switch( get_keypress() ) { + case KEY_F1: + if( shift_down() ) { + mwindow->toggle_camera_xyz(); result = 1; } + else + cwindow_operation = CWINDOW_PROTECT; break; - - case '.': - if( !ctrl_down() && !alt_down() ) { - unlock_window(); - stop_transport(0); - mwindow->gui->lock_window("CWindowGUI::keypress_event 10"); - mwindow->move_right(); - mwindow->gui->unlock_window(); - lock_window("CWindowGUI::keypress_event 11"); - result = 1; + case KEY_F2: + if( shift_down() ) { + mwindow->toggle_projector_xyz(); result = 1; } + else + cwindow_operation = CWINDOW_ZOOM; break; - - case KEY_F1: if( shift_down() ) { mwindow->toggle_camera_xyz(); break; } - cwindow_operation = CWINDOW_PROTECT; break; - case KEY_F2: if( shift_down() ) { mwindow->toggle_projector_xyz(); break; } - cwindow_operation = CWINDOW_ZOOM; break; + } + } + if( !result && cwindow_operation < 0 && !ctrl_down() && !shift_down() ) { + switch( get_keypress() ) { case KEY_F3: cwindow_operation = CWINDOW_MASK; break; case KEY_F4: cwindow_operation = CWINDOW_RULER; break; case KEY_F5: cwindow_operation = CWINDOW_CAMERA; break; @@ -578,8 +598,9 @@ int CWindowGUI::keypress_event() case KEY_F8: cwindow_operation = CWINDOW_EYEDROP; break; case KEY_F9: cwindow_operation = CWINDOW_TOOL_WINDOW; break; case KEY_F10: cwindow_operation = CWINDOW_TITLESAFE; break; - case KEY_F11: canvas->reset_camera(); break; - case KEY_F12: canvas->reset_projector(); break; + case KEY_F11: canvas->reset_camera(); result = 1; break; + case KEY_F12: canvas->reset_projector(); result = 1; break; + } } if( cwindow_operation >= 0 ) { @@ -587,7 +608,8 @@ int CWindowGUI::keypress_event() result = 1; } - if(!result) result = transport->keypress_event(); + if( !result ) + result = transport->keypress_event(); return result; } diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index a79bb171..765d657c 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -220,10 +220,12 @@ Edit* Edits::insert_new_edit(int64_t position) { //printf("Edits::insert_new_edit 1\n"); Edit *current = split_edit(position); - if(current) current = PREVIOUS; //printf("Edits::insert_new_edit 1\n"); Edit *new_edit = create_edit(); + if( current ) new_edit->hard_right = current->hard_left; + if( current ) current = PREVIOUS; + if( current ) new_edit->hard_left = current->hard_right; //printf("Edits::insert_new_edit 1\n"); insert_after(current, new_edit); new_edit->startproject = position; @@ -409,12 +411,14 @@ int Edits::optimize() int64_t current_start = current->startproject; int64_t next_end = next_edit->startproject + next_edit->length; current->length = next_end - current_start; + current->hard_right = next_edit->hard_right; remove(next_edit); result = 1; } } - if( last && last->silence() && !last->transition ) { + if( last && last->silence() && + !last->transition && !last->hard_left && !last->hard_right ) { delete last; result = 1; } @@ -800,7 +804,7 @@ void Edits::paste_silence(int64_t start, int64_t end) Edit *new_edit = editof(start, PLAY_FORWARD, 0); if (!new_edit) return; - if( !new_edit->silence() ) { + if( !new_edit->silence() || new_edit->hard_right ) { new_edit = insert_new_edit(start); new_edit->length = end - start; } diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 77705fcf..c1c7e325 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -1638,3 +1638,22 @@ double EDL::get_cursor_position(int cursor_x, int pane_no) local_session->zoom_sample / session->sample_rate; } +int EDL::in_use(Indexable *indexable) +{ + for( Track *track=tracks->first; track; track=track->next ) { + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + Indexable *idxbl = (Indexable *)edit->asset; + if( !idxbl ) idxbl = (Indexable *)edit->nested_edl; + if( !idxbl ) continue; + if( idxbl->id == indexable->id ) return 1; + if( !indexable->is_asset != !idxbl->is_asset ) continue; + if( !strcmp(idxbl->path, indexable->path) ) return 1; + } + } + for( int i=0; iin_use(indexable) ) return 1; + for( int i=0; iin_use(indexable) ) return 1; + return 0; +} + diff --git a/cinelerra-5.1/cinelerra/edl.h b/cinelerra-5.1/cinelerra/edl.h index 8a96155e..4befb9ff 100644 --- a/cinelerra-5.1/cinelerra/edl.h +++ b/cinelerra-5.1/cinelerra/edl.h @@ -204,6 +204,7 @@ public: int edit_labels /* = 1 */, int edit_plugins, int edit_autos); + int in_use(Indexable *indexable); void remove_from_project(ArrayList *assets); void remove_from_project(ArrayList *clips); int blade(double position); diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 873abc2e..d13cf8b3 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -484,7 +484,7 @@ int FFStream::write_packet(FFPacket &pkt) int FFStream::encode_frame(AVFrame *frame) { int pkts = 0, ret = 0; - for( int retry=100; --retry>=0; ) { + for( int retry=MAX_RETRY; --retry>=0; ) { if( frame || !pkts ) ret = avcodec_send_frame(avctx, frame); if( !ret && frame ) return pkts; diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index 70bfca1e..f0a050a2 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -498,11 +498,11 @@ int GWindowGUI::keypress_event() { switch(get_keypress()) { case KEY_F1: - if( shift_down() ) + if( !ctrl_down() && shift_down() ) toggle_camera_xyz(); break; case KEY_F2: - if( shift_down() ) + if( !ctrl_down() && shift_down() ) toggle_projector_xyz(); break; case 'w': diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C index a94fb589..c3843292 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.C +++ b/cinelerra-5.1/cinelerra/mainmenu.C @@ -36,6 +36,7 @@ #include "dvdcreate.h" #include "edl.h" #include "edlsession.h" +#include "file.h" #include "filesystem.h" #include "filexml.h" #include "floatauto.h" @@ -272,9 +273,15 @@ void MainMenu::create_objects() 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)); + windowmenu->add_item(new BC_MenuItem("-")); + + windowmenu->add_item(new TileWindows(mwindow,_("Default positions"),-1,_("Ctrl-P"),'p')); + windowmenu->add_item(load_layout = new LoadLayout(mwindow, _("Load layout..."),LAYOUT_LOAD)); + load_layout->create_objects(); + windowmenu->add_item(save_layout = new LoadLayout(mwindow, _("Save layout..."),LAYOUT_SAVE)); + save_layout->create_objects(); } int MainMenu::load_defaults(BC_Hash *defaults) @@ -1568,3 +1575,58 @@ int TileMixers::handle_event() return 1; } + +LoadLayoutItem::LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey) + : BC_MenuItem(text, "", hotkey) +{ + this->no = no; + this->load_layout = load_layout; + if( hotkey ) { + char hot_txt[BCSTRLEN]; + sprintf(hot_txt, _("Ctl+Shift+F%d"), hotkey-KEY_F1+1); + set_ctrl(); set_shift(); + set_hotkey_text(hot_txt); + } +} + +int LoadLayoutItem::handle_event() +{ + char layout_path[BCTEXTLEN]; + snprintf(layout_path, sizeof(layout_path), "%s/" LAYOUT_FILE, + File::get_config_path(), no); + MWindow *mwindow = load_layout->mwindow; + switch( load_layout->action ) { + case LAYOUT_LOAD: + mwindow->session->load_file(layout_path); + break; + case LAYOUT_SAVE: + mwindow->session->save_file(layout_path); + break; + } + mwindow->restore_windows(); + mwindow->gui->default_positions(); + mwindow->save_defaults(); + return 1; +} + +LoadLayout::LoadLayout(MWindow *mwindow, const char *text, int action) + : BC_MenuItem(text) +{ + this->mwindow = mwindow; + this->action = action; +} + +void LoadLayout::create_objects() +{ + BC_SubMenu *layout_submenu = new BC_SubMenu(); + add_submenu(layout_submenu); + for( int i=1; i<=4; ++i ) { + char text[BCSTRLEN]; + sprintf(text, _("Layout %d"), i); + LoadLayoutItem *load_layout_item = + new LoadLayoutItem(this, text, i, + action==LAYOUT_LOAD ? KEY_F1-1+i : 0); + layout_submenu->add_submenuitem(load_layout_item); + } +} + diff --git a/cinelerra-5.1/cinelerra/mainmenu.h b/cinelerra-5.1/cinelerra/mainmenu.h index 2796e155..b87e8088 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.h +++ b/cinelerra-5.1/cinelerra/mainmenu.h @@ -44,6 +44,8 @@ class KeyframeCurveTypeItem; class SplitX; class SplitY; class MixerViewer; +class LoadLayoutItem; +class LoadLayout; #include "arraylist.h" @@ -67,6 +69,9 @@ class MixerViewer; #define TOTAL_LOADS 10 // number of files to cache #define TOTAL_EFFECTS 10 // number of effects to cache +#define LAYOUT_LOAD 0 +#define LAYOUT_SAVE 1 + class MainMenu : public BC_MenuBar { public: @@ -148,6 +153,8 @@ public: SplitX *split_x; SplitY *split_y; MixerViewer *mixer_viewer; + LoadLayout *load_layout; + LoadLayout *save_layout; }; // ========================================= edit @@ -705,4 +712,25 @@ public: MWindow *mwindow; }; + +class LoadLayoutItem : public BC_MenuItem +{ +public: + LoadLayoutItem(LoadLayout *load_layout, const char *text, int no, int hotkey); + int handle_event(); + + int no; + LoadLayout *load_layout; +}; + +class LoadLayout : public BC_MenuItem +{ +public: + LoadLayout(MWindow *mwindow, const char *text, int action); + void create_objects(); + + MWindow *mwindow; + int action; +}; + #endif diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index 86e5b36d..d8e563d6 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -603,3 +603,31 @@ void MainSession::update_clip_number() clip_number = clip_no+1; } +int MainSession::load_file(const char *path) +{ + int ret = 1; + FILE *fp = fopen(path,"r"); + if( fp ) { + BC_Hash defaults; + defaults.load_file(fp); + load_defaults(&defaults); + fclose(fp); + ret = 0; + } + return ret; +} + +int MainSession::save_file(const char *path) +{ + int ret = 1; + FILE *fp = fopen(path,"w"); + if( fp ) { + BC_Hash defaults; + save_defaults(&defaults); + defaults.save_file(fp); + fclose(fp); + ret = 0; + } + return ret; +} + diff --git a/cinelerra-5.1/cinelerra/mainsession.h b/cinelerra-5.1/cinelerra/mainsession.h index 06bd12c0..92e40a59 100644 --- a/cinelerra-5.1/cinelerra/mainsession.h +++ b/cinelerra-5.1/cinelerra/mainsession.h @@ -55,6 +55,8 @@ public: void boundaries(); Track *drag_handle_track(); void update_clip_number(); + int load_file(const char *path); + int save_file(const char *path); // For drag and drop events // The entire track where the dropped asset is going to go diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index c1cd79f6..601f5c24 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -2856,6 +2856,39 @@ void MWindow::show_lwindow() gui->mainmenu->show_lwindow->set_checked(1); } +void MWindow::restore_windows() +{ + if( !session->show_vwindow ) { + for( int i=0, n=vwindows.size(); igui->close(0); + } + } + else + show_vwindow(); + + if( !session->show_awindow ) + awindow->gui->close(0); + else + show_awindow(); + + if( !session->show_cwindow ) + cwindow->gui->close(0); + else + show_cwindow(); + + if( !session->show_gwindow ) + gwindow->gui->close(0); + else + show_gwindow(); + + if( !session->show_lwindow ) + lwindow->gui->close(0); + else + show_lwindow(); +} + int MWindow::tile_windows(int window_config) { int need_reload = 0; diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index e0f0d4f8..14f736ca 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -140,6 +140,7 @@ public: void show_cwindow(); void show_gwindow(); void hide_gwindow(); + void restore_windows(); int tile_windows(int window_config); char *get_cwindow_display(); void set_screens(int value); diff --git a/cinelerra-5.1/cinelerra/preferences.inc b/cinelerra-5.1/cinelerra/preferences.inc index 93a78f8e..29779763 100644 --- a/cinelerra-5.1/cinelerra/preferences.inc +++ b/cinelerra-5.1/cinelerra/preferences.inc @@ -26,6 +26,7 @@ #define DEAMON_PORT 400 #define BACKUP_FILE "backup.xml" #define BACKUP_FILE1 "backup.prev" +#define LAYOUT_FILE "layout%d_rc" #define DEFAULT_LV2_PATH CINDAT_DIR "/lv2" #define FFMPEG_EARLY_TIP _("Currently: Try FFMpeg first\n Click to: Try FFMpeg last") #define FFMPEG_LATE_TIP _("Currently: Try FFMpeg last\n Click to: Try FFMpeg first") diff --git a/cinelerra-5.1/doc/shortcuts.html b/cinelerra-5.1/doc/shortcuts.html index bc9ec7b8..99cbe910 100644 --- a/cinelerra-5.1/doc/shortcuts.html +++ b/cinelerra-5.1/doc/shortcuts.html @@ -1416,6 +1416,30 @@ 'Shift' Toggle on/off all XYZ of projector + +
+ F1 + 'Ctrl+Shift' + Use window layout #1 + + +
+ F2 + 'Ctrl+Shift' + Use window layout #2r + + +
+ F3 + 'Ctrl+Shift' + Use window layout #3 + + +
+ F4 + 'Ctrl+Shift' + Use window layout #4 +

diff --git a/cinelerra-5.1/ffmpeg/plugin.opts b/cinelerra-5.1/ffmpeg/plugin.opts index e59ea6a3..fefa9a51 100644 --- a/cinelerra-5.1/ffmpeg/plugin.opts +++ b/cinelerra-5.1/ffmpeg/plugin.opts @@ -1,62 +1,62 @@ abench -#abitscope rate=25:size=1024x256 -#abuffer abuffer=sample_rate=48000:sample_fmt=s16p:channel_layout=stereo -#abuffersink +#abitscope rate=25:size=1024x256 ###Input/output error +#abuffer abuffer=sample_rate=48000:sample_fmt=s16p:channel_layout=stereo ###Invalid argument +#abuffersink ###Input/output error acompressor -#acrossfade +#acrossfade ###Input/output error acrusher adelay delays=1 -#adrawgraph signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255 +#adrawgraph signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255 ###Input/output error aecho aemphasis aeval exprs=(sin(2*PI*t*440)+sin(2*PI*t*350))/2*mod(floor(2*t),2):channel_layout=1c -#aevalsrc 0 +#aevalsrc 0 ###Cannot allocate memory afade #afftfilt 1-clip((b/nb)*b,0,1) #afifo ###will not work within cin aformat sample_fmts=u8|s16:channel_layouts=stereo agate -#ahistogram dmode=single:r=25:s=hd720:scale=log:ascale=log:slide=replace +#ahistogram dmode=single:r=25:s=hd720:scale=log:ascale=log:slide=replace ###Input/output error #ainterleave #alimiter allpass #allrgb #allyuv aloop -#alphaextract -#alphamerge -#amerge -ametadata mode=print:file=/tmp/ametadata.txt -#amix -#amovie -#anequalizer c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1 +#alphaextract ###Operation not permitted +#alphamerge ###Input/output error +#amerge ###Operation not permitted +#ametadata mode=add:file=/tmp/ametadata.txt +#amix ###Operation not permitted +#amovie ###Operation not permitted +#anequalizer c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1 ###Operation not permitted anoisesrc d=60:c=pink:r=48000:a=0.5 #anull -#anullsink +#anullsink ###Input/output error #anullsrc #apad ###not part of frame data aperms -#aphasemeter r=25:s=800x400:rc=2:gc=7:bc=1 +#aphasemeter r=25:s=800x400:rc=2:gc=7:bc=1 ###Operation not permitted aphaser #apulsator arealtime aresample sample_rate=48000 #areverse -#aselect -#asendcmd +#aselect ###Operation not permitted +#asendcmd ###Invalid argument #asetnsamples #asetpts ###not part of frame data asetrate r=48000 #asettb #ashowinfo ###not part of frame data -#asidedata -#asplit +#asidedata ###Invalid argument +#asplit ###Operation not permitted astats -#astreamselect +#astreamselect ###Operation not permitted atadenoise atempo atrim start=1:end=240:start_pts=1:end_pts=2:duration=1:start_sample=1:end_sample=2 -#avectorscope +#avectorscope ###Input/output error avgblur bandpass bandreject @@ -66,14 +66,14 @@ bench biquad blackdetect blackframe -#blend +#blend ###Input/output error boxblur -#buffer size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1 -#buffersink +#buffer size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1 ###Invalid argument +#buffersink ###Input/output error bwdif #cellauto p=@:s=100x400:full=0:rule=18 -#channelmap 1|2|0|5|3|4:5.1 -#channelsplit +#channelmap 1|2|0|5|3|4:5.1 ###Invalid argument +#channelsplit ###Operation not permitted chorus in_gain=0.400000:out_gain=0.400000:delays=1|1:decays=1|1:speeds=1|1:depths=1|1 chromakey #codecview @@ -86,7 +86,7 @@ colormatrix src=bt601:dst=bt709 #colorspace bt709 compand compensationdelay -#concat +#concat ###Operation not permitted #convolution 0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0 #copy cover_rect @@ -111,35 +111,35 @@ drawgraph drawgrid dynaudnorm earwax -#ebur128 +#ebur128 ###Operation not permitted edgedetect elbg eq equalizer frequency=1000.000000:width_type=1:width=200.000000:gain=-10.000000 erosion -#extractplanes +#extractplanes ###Operation not permitted extrastereo fade fftfilt field -#fieldhint -#fieldmatch +#fieldhint ###Invalid argument +#fieldmatch ###Operation not permitted fieldorder #fifo ###will not work within cin fillborders -#find_rect +#find_rect ###Invalid argument #firequalizer delay=0.1:fixed=on:zero_phase=on flanger format pix_fmts=yuv420p|yuv444p|yuv410p #fps 30 -#framepack +#framepack ###Input/output error framerate framestep step=30 fspp gblur -#geq +#geq ###Invalid argument gradfun -#haldclut ###not working due to need for multiple video streams +#haldclut ###not working due to need for multiple video streams ###Input/output error haldclutsrc #hdcd hflip @@ -148,18 +148,18 @@ histeq histogram hqdn3d hqx -#hstack +#hstack ###Operation not permitted hue #hwdownload #hwmap #hwupload #hwupload_cuda -#hysteresis +#hysteresis ###Input/output error idet il inflate interlace -#interleave +#interleave ###Operation not permitted #join kerndeint lenscorrection @@ -167,35 +167,35 @@ life ratio=2/3:s=200x200 loudnorm lowpass lut -#lut2 +#lut2 ###Input/output error lut3d lutrgb lutyuv mandelbrot -#maskedclamp -#maskedmerge +#maskedclamp ###Input/output error +#maskedmerge ###Input/output error mcdeint #mergeplanes 0x03010200:yuva444p mestimate -metadata mode=print:file=/tmp/metadata.txt -#midequalizer +#metadata mode=add:file=/tmp/metadata.txt +#midequalizer ###Input/output error #minterpolate -#movie +#movie ###Operation not permitted mpdecimate mptestsrc t=dc_luma negate nlmeans r=15:p=7:s=2 -#nnedi +#nnedi ###Invalid argument #noformat ###not part of frame data noise #null -#nullsink +#nullsink ###Input/output error #nullsrc -#overlay x=main_w-overlay_w-10:y=main_h-overlay_h-10 +#overlay x=main_w-overlay_w-10:y=main_h-overlay_h-10 ###Input/output error owdenoise pad #palettegen -#paletteuse +#paletteuse ###Input/output error pan 1c|c0=0.9*c0+0.1*c1 perms perspective @@ -203,18 +203,18 @@ phase #pixdesctest pp pp7 -#premultiply +#premultiply ###Operation not permitted prewitt -#psnr PSNR=10*log10(MAX^2/MSE) +#psnr PSNR=10*log10(MAX^2/MSE) ###Input/output error #pullup #qp ###not part of frame data #random seed=-1 readeia608 readvitc realtime -#remap +#remap ###Input/output error removegrain -#removelogo +#removelogo ###Invalid argument repeatfields #replaygain #reverse @@ -222,32 +222,32 @@ rgbtestsrc rotate sab scale 200:100 -#scale2ref -#select +#scale2ref ###Input/output error +#select ###Operation not permitted #selectivecolor greens=.5 0 -.33 0:blues=0 .27 -#sendcmd +#sendcmd ###Invalid argument separatefields #setdar ###will not work because Format already set #setfield ###not part of frame data #setpts ###not part of frame data #setsar ###will not work because Format already set #settb -#showcqt -#showfreqs +#showcqt ###Input/output error +#showfreqs ###Input/output error #showinfo ###not part of frame data showpalette s=30 -#showspectrum s=1280x480:scale=log -#showspectrumpic -#showvolume r=30 -#showwaves -#showwavespic +#showspectrum s=1280x480:scale=log ###Input/output error +#showspectrumpic ###Input/output error +#showvolume r=30 ###Input/output error +#showwaves ###Input/output error +#showwavespic ###Input/output error shuffleframes shuffleplanes -#sidechaincompress -#sidechaingate -#sidedata mode=add +#sidechaincompress ###Input/output error +#sidechaingate ###Input/output error +#sidedata mode=add ###Invalid argument signalstats -#signature +#signature ###Operation not permitted #silencedetect n=0.001 ###does not appear to work silenceremove sine @@ -255,14 +255,14 @@ smartblur smptebars smptehdbars sobel -#spectrumsynth -#split +#spectrumsynth ###Input/output error +#split ###Operation not permitted spp -#ssim +#ssim ###Input/output error stereo3d stereotools stereowiden -#streamselect +#streamselect ###Operation not permitted super2xsai swaprect swapuv @@ -270,7 +270,7 @@ tblend all_mode=grainextract #telecine testsrc duration=5.3:size=qcif:rate=10 testsrc2 duration=5.3:size=qcif:rate=10 -#threshold +#threshold ###Input/output error #thumbnail n=50 tile layout=3x2:nb_frames=5:padding=7:margin=2 tinterlace @@ -287,7 +287,7 @@ vibrato vignette volume volumedetect -#vstack +#vstack ###Operation not permitted w3fdif waveform weave @@ -319,19 +319,19 @@ tlut2 #vmafmotion ; new in 4.0 acontrast -#afir -#convolve -#deconvolve +#afir ###Operation not permitted +#convolve ###Input/output error +#deconvolve ###Input/output error drmeter entropy fillborders #headphone hilbert mcompand -#mix +#mix ###Operation not permitted normalize setrange -#unpremultiply +#unpremultiply ###Operation not permitted vfrdet ; new in 4.1 acue @@ -357,10 +357,10 @@ setparams tmix vibrance ; broken in 4.1 -#acrossover -#aiir -#amultiply -#bm3d sigma=3:block=4:bstep=2:group=1:estim=basic -#sr -#xstack -#agraphmonitor +#acrossover ###Operation not permitted +#aiir ###Operation not permitted +#amultiply ###Input/output error +#bm3d sigma=3:block=4:bstep=2:group=1:estim=basic ###Operation not permitted +#sr ###Input/output error +#xstack ###Operation not permitted +#agraphmonitor ###Input/output error diff --git a/cinelerra-5.1/guicast/bcmenuitem.C b/cinelerra-5.1/guicast/bcmenuitem.C index 2c4469e4..1e9399b1 100644 --- a/cinelerra-5.1/guicast/bcmenuitem.C +++ b/cinelerra-5.1/guicast/bcmenuitem.C @@ -29,6 +29,7 @@ #include "bcsignals.h" #include "bcwindowbase.h" #include "bccolors.h" +#include "cstrdup.h" #include @@ -44,6 +45,8 @@ BC_MenuItem::BC_MenuItem(const char *text, const char *hotkey_text, int hotkey) { + this->text = 0; + this->hotkey_text = 0; reset(); if(text) set_text(text); @@ -74,10 +77,8 @@ BC_MenuItem::~BC_MenuItem() void BC_MenuItem::reset() { - text = new char[1]; - hotkey_text = new char[1]; - text[0] = 0; - hotkey_text[0] = 0; + set_text(""); + set_hotkey_text(""); icon = 0; } @@ -112,16 +113,14 @@ BC_Pixmap* BC_MenuItem::get_icon() void BC_MenuItem::set_text(const char *text) { - if(this->text) delete [] this->text; - this->text = new char[strlen(text) + 1]; - strcpy(this->text, text); + delete [] this->text; + this->text = cstrdup(text); } void BC_MenuItem::set_hotkey_text(const char *text) { - if(this->hotkey_text) delete [] this->hotkey_text; - this->hotkey_text = new char[strlen(text) + 1]; - strcpy(this->hotkey_text, text); + delete [] this->hotkey_text; + this->hotkey_text = cstrdup(text); } int BC_MenuItem::deactivate_submenus(BC_MenuPopup *exclude) diff --git a/cinelerra-5.1/guicast/vframe.C b/cinelerra-5.1/guicast/vframe.C index 5cd9901b..76d6ae1d 100644 --- a/cinelerra-5.1/guicast/vframe.C +++ b/cinelerra-5.1/guicast/vframe.C @@ -874,6 +874,28 @@ int VFrame::write_png(const char *path) return 0; } +void VFrame::write_ppm(VFrame *vfrm, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + char fn[BCTEXTLEN]; + vsnprintf(fn, sizeof(fn), fmt, ap); + va_end(ap); + FILE *fp = fopen(fn,"w"); + if( !fp ) { perror("write_ppm"); return; } + VFrame *frm = vfrm; + if( frm->get_color_model() != BC_RGB888 ) { + frm = new VFrame(frm->get_w(), frm->get_h(), BC_RGB888); + frm->transfer_from(vfrm); + } + int w = frm->get_w(), h = frm->get_h(); + fprintf(fp,"P6\n%d %d\n255\n",w,h); + unsigned char **rows = frm->get_rows(); + for( int i=0; iget_w(); + pane_h = get_image_set("ypane")[0]->get_h(); + pane_x = mcanvas_x + mcanvas_w; + pane_y = mcanvas_y + mcanvas_h; mhscroll_x = 0; mhscroll_y = mcanvas_y + mcanvas_h; mhscroll_w = w - BC_ScrollBar::get_span(SCROLL_VERT) - patchbay_w; diff --git a/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C b/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C index fff94e71..2d956f6f 100644 --- a/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C +++ b/cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C @@ -1007,6 +1007,11 @@ void BlueDotTheme::get_mwindow_sizes(MWindowGUI *gui, int w, int h) mcanvas_w = w; mcanvas_h = patchbay_h; //COPIED START + control_pixels = (mcanvas_w * control_pixels) / 1000; + pane_w = get_image_set("xpane")[0]->get_w(); + pane_h = get_image_set("ypane")[0]->get_h(); + pane_x = mcanvas_x + mcanvas_w; + pane_y = mcanvas_y + mcanvas_h; mhscroll_x = 0; mhscroll_y = mzoom_y - BC_ScrollBar::get_span(SCROLL_HORIZ); mhscroll_w = w - BC_ScrollBar::get_span(SCROLL_VERT); -- 2.26.2