add window layout feature, resource wdw select used, blue_dot/blond_cv theme fix...
authorGood Guy <good1.2guy@gmail.com>
Tue, 27 Nov 2018 00:22:53 +0000 (17:22 -0700)
committerGood Guy <good1.2guy@gmail.com>
Tue, 27 Nov 2018 00:22:53 +0000 (17:22 -0700)
25 files changed:
cinelerra-5.1/cinelerra/assetpopup.C
cinelerra-5.1/cinelerra/assetpopup.h
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/awindowgui.inc
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/edl.C
cinelerra-5.1/cinelerra/edl.h
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/gwindowgui.C
cinelerra-5.1/cinelerra/mainmenu.C
cinelerra-5.1/cinelerra/mainmenu.h
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/cinelerra/mainsession.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/preferences.inc
cinelerra-5.1/doc/shortcuts.html
cinelerra-5.1/ffmpeg/plugin.opts
cinelerra-5.1/guicast/bcmenuitem.C
cinelerra-5.1/guicast/vframe.C
cinelerra-5.1/guicast/vframe.h
cinelerra-5.1/plugins/theme_blond_cv/blondcvtheme.C
cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C

index c9bac6fd1d9bbae4dda377d2e0493703ae6dc4cc..244e472fe82f1bcfafb42ec0c64b80bd0dfdc80d 100644 (file)
@@ -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));
index 129cd335f0ff29e44c67db6098b4577512c90195..c30c155c5cfb50ad1a846a8ab0434c80719c7b5e 100644 (file)
@@ -217,6 +217,7 @@ public:
        AWindowListFormat *format;
        AssetSnapshot *asset_snapshot;
        AssetGrabshot *asset_grabshot;
+       AssetSelectUsed *select_used;
        int shots_displayed;
 };
 
index 2ef637964754a6f119ea87ef384379e7e39aff65..56347110c29358c2b756cf66510da519ab90f47b 100644 (file)
@@ -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<BC_ListBoxItem*> *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;
+}
+
index 436965c9b5cffeaffd2df12a66473b3c7a842620..41dd0491a4204db18f5874377ab0f01bbdc7c49c 100644 (file)
@@ -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
index fdb7525cf1a6eb954b4daa3d961222dca1de6f9d..b67da703a15976a8a7ebee01ae7dc56d35692436 100644 (file)
@@ -49,5 +49,7 @@ class AddPluginItem;
 class AVIconDrawing;
 class AWindowListFormat;
 class AWindowListSort;
+class AssetSelectUsedItem;
+class AssetSelectUsed;
 
 #endif
index 19ff101e3f0383a56ba20b8e9df6a2c981922416..86c7e42475c8a9f3062033ddf446e0dfc203488b 100644 (file)
@@ -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;
 }
index a79bb171d9ba2f4178f4d5a7b45b54506a4a9a44..765d657c40a95b658fabe0c4804ef8db81be2b1b 100644 (file)
@@ -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;
        }
index 77705fcf53f2e2b2b741373b696eecc48e3f905c..c1c7e3258854cf0a8444b913dcdf8d678fe06e86 100644 (file)
@@ -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; i<clips.size(); ++i )
+               if( clips[i]->in_use(indexable) ) return 1;
+       for( int i=0; i<nested_edls.size(); ++i )
+               if( nested_edls[i]->in_use(indexable) ) return 1;
+       return 0;
+}
+
index 8a96155e1933338cc11d3a83e80dacf29f019745..4befb9ffbb3100a0f6e7f430ee4b759df05f7408 100644 (file)
@@ -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<Indexable*> *assets);
        void remove_from_project(ArrayList<EDL*> *clips);
        int blade(double position);
index 873abc2e45992454e00887dff701616f478f747d..d13cf8b32f0aeccb9f2296e9435aff66950f7d6a 100644 (file)
@@ -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;
index 70bfca1e96bf87736beaf39bda4e17c320222d34..f0a050a27b043b3150f1c849419c5072f037a0d1 100644 (file)
@@ -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':
index a94fb5894819aa649def542713bb147a18b5bc3f..c3843292ade0de05cc4cbc1d42ac8f4bccf0bd58 100644 (file)
@@ -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);
+       }
+}
+
index 2796e15571c84bd0f60de3985fd32f9ed9fafb41..b87e8088833b2b1e1f16586366d48d08ed3b7b26 100644 (file)
@@ -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
index 86e5b36d3f92c4c579bbbb973347191f85a6dc2d..d8e563d6b3a9411c7d3ceb2c32a9b0ecfbf40275 100644 (file)
@@ -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;
+}
+
index 06bd12c09b770b6f73ab08650625a9cc7e7eda73..92e40a59f11fcd3c5da8ef4379431141ecb6cbcd 100644 (file)
@@ -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
index c1cd79f6119ff4e027a804bc7d828b2ae72d9d80..601f5c24e0fdfd7a01c26078bd35d01fbf25cd81 100644 (file)
@@ -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(); i<n; ++i ) {
+                       VWindow *vwindow = vwindows[i];
+                       if( !vwindow ) continue;
+                       vwindow->gui->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;
index e0f0d4f8c19eab038534474199c58c7490503e79..14f736ca3c9280a41e4af3c2a8330abf5df51b83 100644 (file)
@@ -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);
index 93a78f8e3a11672185d1ecf5eedef4741126a227..29779763473b95fb2075a381ffb119b2e6ab56af 100644 (file)
@@ -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")
index bc9ec7b856afdd247b174b98b82ac5d1cb524da6..99cbe910bed02e399f18e08e350847a16dc3b1ac 100644 (file)
                <td align="left"><font face="Liberation Serif" size=4>'Shift'</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Toggle on/off all XYZ of projector</font></td>
        </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>F1</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl+Shift'</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Use window layout #1</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>F2</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl+Shift'</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Use window layout #2r</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>F3</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl+Shift'</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Use window layout #3</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>F4</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>'Ctrl+Shift'</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Use window layout #4</font></td>
+       </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4><br></font></td>
index e59ea6a3c81fa62829ea3e161343ae2e3b1c30b6..fefa9a51348303b20aeee537170a308be8bd1854 100644 (file)
@@ -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
index 2c4469e4cf6a9e0a90c6fb7c5ef54b0abd390453..1e9399b1396c62ad55f3d08f0e3cad85c4a51f9a 100644 (file)
@@ -29,6 +29,7 @@
 #include "bcsignals.h"
 #include "bcwindowbase.h"
 #include "bccolors.h"
+#include "cstrdup.h"
 
 #include <string.h>
 
@@ -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)
index 5cd9901b3666e38eb813ac4c0d1f92da3060a741..76d6ae1d0e024521626e5143ab75a0ab9b5dfe8f 100644 (file)
@@ -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; i<h; ++i ) fwrite(rows[i],3,w,fp);
+       fclose(fp);
+       if( frm != vfrm ) delete frm;
+}
+
 
 #define ZERO_YUV(components, type, max) \
 { \
index dbf4dab0a30d0c2f1e1860cbf41223ecee071394..4b7d51a3052fa827201ced7ac2e0332553e53e1c 100644 (file)
@@ -112,8 +112,11 @@ public:
                int data_size,
                int data_allocated);
 
-// Write a PNG for debugging
+// Write a PNG/PPM for debugging
        int write_png(const char *path);
+       static void write_ppm(VFrame *vfrm, const char *fmt, ...);
+       void write_ppm(const char *path) { write_ppm(this, "%s", path); }
+//static int n = 0; write_ppm(vframe, "/tmp/data/f%05d", ++n);
 
 // if frame points to the same data as this return 1
        int equals(VFrame *frame);
index a7bc2bab905f5664662e4effac5628f2eace831a..4d396a3e38a093ec48b2d4312e840d7ead4c4bb1 100644 (file)
@@ -952,6 +952,10 @@ void BlondCVTheme::get_mwindow_sizes(MWindowGUI *gui, int w, int h)
        mcanvas_y = mtimebar_y + mtimebar_h;
        mcanvas_w = w;
        mcanvas_h = patchbay_h;
+        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 = mcanvas_y + mcanvas_h;
        mhscroll_w = w - BC_ScrollBar::get_span(SCROLL_VERT) - patchbay_w;
index fff94e711e36d8a29170bf49e6b4e21d734d6018..2d956f6f07036404a135d163c9f1a11376f93c2b 100644 (file)
@@ -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);