18 new shapewipe transitions from rafa, rework savefile/confirm for nested edl edits
authorGood Guy <good1.2guy@gmail.com>
Sun, 15 Mar 2020 00:07:44 +0000 (18:07 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 15 Mar 2020 00:07:44 +0000 (18:07 -0600)
24 files changed:
cinelerra-5.1/cinelerra/confirmsave.C
cinelerra-5.1/cinelerra/confirmsave.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/savefile.C
cinelerra-5.1/cinelerra/savefile.h
cinelerra-5.1/plugins/shapes/Cinelerra16-9-Heavy.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/Cinelerra16-9-Light.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/CinelerraGG.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/asimetric_clocks.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/asimetric_clocks_2.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/audio.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/crazy_clock.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/cream.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/film.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/film2.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/mosaic.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/multi_box.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/rare_spiral.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/spiral_clock.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/square.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/squares.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/star.png [new file with mode: 0644]
cinelerra-5.1/plugins/shapes/water.png [new file with mode: 0644]

index 02fa7bbcb13e9c1a6a10c4887b6b8c78c9e5d648..fe89aff8b886f8c94e7e9a255f571769a7bea8a0 100644 (file)
  */
 
 #include "asset.h"
+#include "bchash.h"
 #include "confirmsave.h"
 #include "language.h"
 #include "mwindow.h"
 #include "mwindowgui.h"
 
 
-
-
 ConfirmSave::ConfirmSave()
 {
 }
@@ -36,6 +35,38 @@ ConfirmSave::~ConfirmSave()
 {
 }
 
+int ConfirmSave::get_save_path(MWindow *mwindow, char *filename)
+{
+       int result = 1;
+       char directory[BCTEXTLEN];
+       sprintf(directory, "~");
+       mwindow->defaults->get("DIRECTORY", directory);
+       while( result ) {
+               int mx, my;  mwindow->gui->get_abs_cursor(mx, my);
+               my -= BC_WindowBase::get_resources()->filebox_h / 2;
+               char string[BCTEXTLEN];
+               sprintf(string, _("Enter a filename to save as"));
+               BC_FileBox *filebox = new BC_FileBox(mx, my, directory,
+                       _(PROGRAM_NAME ": Save"), string);
+               filebox->lock_window("ConfirmSave::get_save_path");
+               filebox->create_objects();
+               filebox->unlock_window();
+               result = filebox->run_window();
+               mwindow->defaults->update("DIRECTORY", filebox->get_submitted_path());
+               strcpy(filename, filebox->get_submitted_path());
+               delete filebox;
+               if( result == 1 ) return 1;     // user cancelled
+               if( !filename[0] ) return 1;    // no filename given
+// Extend the filename with .xml
+               if( strlen(filename) < 4 ||
+                   strcasecmp(&filename[strlen(filename) - 4], ".xml") ) {
+                       strcat(filename, ".xml");
+               }
+               result = ConfirmSave::test_file(mwindow, filename);
+       }
+       return result;
+}
+
 int ConfirmSave::test_file(MWindow *mwindow, char *path)
 {
        ArrayList<char*> paths;
index 84e15be76ba77b7a6580a00a306e135633e76a1b..34e3ee347857245e0961935502b28e810342776f 100644 (file)
@@ -35,12 +35,12 @@ public:
        ConfirmSave();
        ~ConfirmSave();
 
+       static int get_save_path(MWindow *mwindow, char *filename);
 // Return values:
 // 1 cancel
 // 0 replace or doesn't exist yet
        static int test_file(MWindow *mwindow, char *path);
        static int test_files(MWindow *mwindow, ArrayList<char*> *paths);
-
 };
 
 class ConfirmSaveWindow : public BC_Window
index 63522d6872690e155ccc96e351a6e4dc02eb53db..86e15ad796aeb7d994ec9e1f996f36a40c15311c 100644 (file)
@@ -2261,27 +2261,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
        if(got_indexes) mainindexes->start_build();
 
 // Open plugin GUIs
-       Track *track = edl->tracks->first;
-       while( track ) {
-               for( int j = 0; j < track->plugin_set.size(); j++ ) {
-                       PluginSet *plugins = track->plugin_set[j];
-                       Plugin *plugin = plugins->get_first_plugin();
-
-                       while(plugin) {
-                               if( load_mode == LOADMODE_REPLACE ||
-                                   load_mode == LOADMODE_REPLACE_CONCATENATE ) {
-                                       if( plugin->plugin_type == PLUGIN_STANDALONE &&
-                                           plugin->show ) {
-                                               show_plugin(plugin);
-                                       }
-                               }
-
-                               plugin = (Plugin*)plugin->next;
-                       }
-               }
-
-               track = track->next;
-       }
+       show_plugins();
 
        // opening new session
        if( ( load_mode == LOADMODE_REPLACE ||
@@ -3823,6 +3803,7 @@ void MWindow::stack_push(EDL *new_edl, Indexable *idxbl)
        gui->lock_window("MWindow::stack_push");
        if( stack.size() < 9 ) {
                save_backup();
+               hide_plugins();
                undo_before();
                StackItem &item = stack.append();
                item.edl = edl;
@@ -3845,6 +3826,7 @@ void MWindow::stack_push(EDL *new_edl, Indexable *idxbl)
                update_project(LOADMODE_REPLACE);
        }
        gui->unlock_window();
+       show_plugins();
 }
 
 void MWindow::stack_pop()
@@ -3852,6 +3834,7 @@ void MWindow::stack_pop()
        if( !stack.size() ) return;
 // writes on config_path/backup%d.xml
        save_backup();
+       hide_plugins();
 // already have gui lock
        StackItem &item = stack.last();
 // session edl replaced, overwrite and save clip data
@@ -3876,6 +3859,7 @@ void MWindow::stack_pop()
        strcpy(session->filename, edl->path);
        update_project(LOADMODE_REPLACE);
        undo_after(_("open edl"), LOAD_ALL);
+       show_plugins();
        gui->stack_button->update();
        if( mtime && idxbl && idxbl->is_asset ) {
                struct stat st;
@@ -3890,6 +3874,77 @@ void MWindow::stack_pop()
        }
 }
 
+int MWindow::save(EDL *edl, char *filename, int stat)
+{
+       FileXML file;
+       edl->save_xml(&file, filename);
+       file.terminate_string();
+       if( file.write_to_file(filename) ) {
+               eprintf(_("Couldn't open %s"), filename);
+               return 1;
+       }
+       if( stat ) {
+               char string[BCTEXTLEN];
+               char *filename = stack.size() ?
+                       stack[0].edl->path : session->filename;
+               sprintf(string, _("\"%s\" %jdC written"),
+                        filename, file.length());
+               gui->lock_window("SaveAs::run");
+               gui->show_message(string);
+               gui->unlock_window();
+       }
+       return 0;
+}
+
+int MWindow::save(int save_as)
+{
+       char new_path[BCTEXTLEN];  new_path[0] = 0;
+       char *path = stack.size() ? stack[0].edl->path : session->filename;
+       if( save_as || !path[0] ) {
+               if( ConfirmSave::get_save_path(this, new_path) )
+                       return 1;
+               if( stack.size() ) {
+                       strcpy(path, new_path);
+                       set_titlebar(new_path);
+               }
+               else
+                       set_filename(new_path);
+               gui->mainmenu->add_load(new_path);
+               path = new_path;
+       }
+       for( int i=stack.size(); --i>=0;  ) {
+               StackItem &item = stack[i];
+               Indexable *idxbl = item.idxbl;
+               if( idxbl->is_asset ) {
+                       Asset *asset = (Asset *)idxbl;
+                       if( asset->format == FILE_REF ) {
+                               if( save(item.new_edl, asset->path, 0) )
+                                       return 1;
+                       }
+               }
+               else if( item.new_edl != item.idxbl )
+                       item.new_edl->overwrite_clip((EDL*)item.idxbl);
+       }
+       EDL *new_edl = stack.size() ? stack[0].edl : edl;
+       save(new_edl, path, 1);
+       return 0;
+}
+
+void MWindow::show_plugins()
+{
+       for( Track *track=edl->tracks->first; track; track=track->next ) {
+               for( int i=0; i<track->plugin_set.size(); ++i ) {
+                       PluginSet *plugins = track->plugin_set[i];
+                       Plugin *plugin = plugins->get_first_plugin();
+                       for( ; plugin; plugin=(Plugin*)plugin->next ) {
+                               if( plugin->plugin_type == PLUGIN_STANDALONE &&
+                                   plugin->show )
+                                       show_plugin(plugin);
+                       }
+               }
+       }
+}
+
 void MWindow::clip_to_media()
 {
        if( edl->session->proxy_scale != 1 ) {
@@ -4724,32 +4779,25 @@ int MWindow::set_filename(const char *filename)
                strcpy(session->filename, filename);
        if( filename != edl->path )
                strcpy(edl->path, filename);
+       return set_titlebar(filename);
+}
 
-       if(gui)
-       {
-               if(filename[0] == 0)
-               {
-                       gui->set_title(PROGRAM_NAME);
-               }
-               else
-               {
-                       FileSystem dir;
-                       char string[BCTEXTLEN], string2[BCTEXTLEN];
-                       dir.extract_name(string, filename);
-                       sprintf(string2, PROGRAM_NAME ": %s", string);
-                       gui->set_title(string2);
-               }
+int MWindow::set_titlebar(const char *filename)
+{
+       if( !gui ) return 0;
+       if( filename[0] ) {
+               FileSystem dir;
+               char string[BCTEXTLEN], string2[BCTEXTLEN];
+               dir.extract_name(string, filename);
+               sprintf(string2, PROGRAM_NAME ": %s", string);
+               gui->set_title(string2);
        }
+       else
+               gui->set_title(PROGRAM_NAME);
        return 0;
 }
 
 
-
-
-
-
-
-
 int MWindow::set_loop_boundaries()
 {
        double start = edl->local_session->get_selectionstart();
index 109f4ecece9f9a600c1663a5a97d9349dad8dabe..eccc0a3bb8d5ba02aad953f6fea3b720f281b239 100644 (file)
@@ -169,6 +169,7 @@ public:
        int load_defaults();
        int save_defaults();
        int set_filename(const char *filename);
+       int set_titlebar(const char *filename);
 // Total vertical pixels in timeline
        int get_tracks_height();
 // Total horizontal pixels in timeline
@@ -176,6 +177,9 @@ public:
 // session stack
        void stack_push(EDL *edl, Indexable *idxbl);
        void stack_pop();
+       int save(EDL *edl, char *filename, int stat);
+       int save(int save_as);
+       void show_plugins();
        void clip_to_media();
        void media_to_clip();
        int create_ref(Asset *asset, EDL *ref);
index 552f2d353e9cf3b43745c1e9c1970c1715b92542..a40fcac2aa7d53cb7a7b5b076fe4b637f0bb99b9 100644 (file)
@@ -65,37 +65,10 @@ void Save::create_objects(SaveAs *saveas)
 
 int Save::handle_event()
 {
-       if(mwindow->session->filename[0] == 0)
-       {
-               saveas->start();
-       }
-       else
-       {
-// save it
-// TODO: Move this into mwindow.
-               FileXML file;
-               mwindow->edl->save_xml(&file, mwindow->session->filename);
-               file.terminate_string();
-
-               if(file.write_to_file(mwindow->session->filename))
-               {
-                       char string2[256];
-                       sprintf(string2, _("Couldn't open %s"), mwindow->session->filename);
-                       ErrorBox error(_(PROGRAM_NAME ": Error"),
-                               mwindow->gui->get_abs_cursor_x(1),
-                               mwindow->gui->get_abs_cursor_y(1));
-                       error.create_objects(string2);
-                       error.raise_window();
-                       error.run_window();
-                       return 1;
-               }
-               else
-               {
-                       char string[BCTEXTLEN];
-                       sprintf(string, _("\"%s\" %dC written"),
-                                mwindow->session->filename, (int)strlen(file.string()));
-                       mwindow->gui->show_message(string);
-               }
+       mwindow->gui->unlock_window();
+       int ret = mwindow->save(0);
+       mwindow->gui->lock_window("Save::handle_event");
+       if( !ret ) {
                mwindow->session->changes_made = 0;
 // Last command in program
                if( saveas->quit_now )
@@ -136,99 +109,15 @@ int SaveAs::handle_event()
 
 void SaveAs::run()
 {
-// ======================================= get path from user
-       int result;
-//printf("SaveAs::run 1\n");
-       char directory[1024], filename[1024];
-       sprintf(directory, "~");
-       mwindow->defaults->get("DIRECTORY", directory);
-
-// Loop if file exists
-       do{
-               SaveFileWindow *window;
-
-               window = new SaveFileWindow(mwindow, directory);
-               window->lock_window("SaveAs::run");
-               window->create_objects();
-               window->unlock_window();
-               result = window->run_window();
-               mwindow->defaults->update("DIRECTORY", window->get_submitted_path());
-               strcpy(filename, window->get_submitted_path());
-               delete window;
-
-// Extend the filename with .xml
-               if(strlen(filename) < 4 ||
-                       strcasecmp(&filename[strlen(filename) - 4], ".xml"))
-               {
-                       strcat(filename, ".xml");
-               }
-
-// ======================================= try to save it
-               if(filename[0] == 0) return;              // no filename given
-               if(result == 1) return;          // user cancelled
-               result = ConfirmSave::test_file(mwindow, filename);
-       }while(result);        // file exists so repeat
-
-//printf("SaveAs::run 6 %s\n", filename);
-
-
-
-
-// save it
-       FileXML file;
-       mwindow->gui->lock_window("SaveAs::run 1");
-// update the project name
-       mwindow->set_filename(filename);
-       mwindow->edl->save_xml(&file, filename);
-       mwindow->gui->unlock_window();
-       file.terminate_string();
-
-       if(file.write_to_file(filename))
-       {
-               char string2[256];
-               mwindow->set_filename("");      // update the project name
-               sprintf(string2, _("Couldn't open %s."), filename);
-               ErrorBox error(_(PROGRAM_NAME ": Error"),
-                       mwindow->gui->get_abs_cursor_x(1),
-                       mwindow->gui->get_abs_cursor_y(1));
-               error.create_objects(string2);
-               error.raise_window();
-               error.run_window();
+       if( mwindow->save(1) )
                return;
-       }
-       else
-       {
-               char string[BCTEXTLEN];
-               sprintf(string, _("\"%s\" %dC written"), filename, (int)strlen(file.string()));
-               mwindow->gui->lock_window("SaveAs::run 2");
-               mwindow->gui->show_message(string);
-               mwindow->gui->unlock_window();
-       }
-
-
        mwindow->session->changes_made = 0;
-       mmenu->add_load(filename);
-// Last command in program
        if( quit_now )
                mwindow->quit();
        return;
 }
 
 
-SaveFileWindow::SaveFileWindow(MWindow *mwindow, char *init_directory)
- : BC_FileBox(mwindow->gui->get_abs_cursor_x(1),
-       mwindow->gui->get_abs_cursor_y(1) - BC_WindowBase::get_resources()->filebox_h / 2,
-       init_directory,
-       _(PROGRAM_NAME ": Save"),
-       _("Enter a filename to save as"))
-{
-       this->mwindow = mwindow;
-}
-
-SaveFileWindow::~SaveFileWindow() {}
-
-
-
 int SaveProjectModeItem::handle_event()
 {
        ((SaveProjectMode *)get_popup_menu())->update(id);
index bfbcbddd9009c6b6ada5ee36d9d9fe0f970e3eaf..15a1ec71cffc9988626dfa50d9fc3f0faf390b31 100644 (file)
@@ -61,15 +61,6 @@ public:
        MainMenu *mmenu;
 };
 
-class SaveFileWindow : public BC_FileBox
-{
-public:
-       SaveFileWindow(MWindow *mwindow, char *init_directory);
-       ~SaveFileWindow();
-       MWindow *mwindow;
-};
-
-
 class SaveProjectModeItem : public BC_MenuItem
 {
 public:
diff --git a/cinelerra-5.1/plugins/shapes/Cinelerra16-9-Heavy.png b/cinelerra-5.1/plugins/shapes/Cinelerra16-9-Heavy.png
new file mode 100644 (file)
index 0000000..c82c92b
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/Cinelerra16-9-Heavy.png differ
diff --git a/cinelerra-5.1/plugins/shapes/Cinelerra16-9-Light.png b/cinelerra-5.1/plugins/shapes/Cinelerra16-9-Light.png
new file mode 100644 (file)
index 0000000..77df7ce
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/Cinelerra16-9-Light.png differ
diff --git a/cinelerra-5.1/plugins/shapes/CinelerraGG.png b/cinelerra-5.1/plugins/shapes/CinelerraGG.png
new file mode 100644 (file)
index 0000000..3cd49ad
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/CinelerraGG.png differ
diff --git a/cinelerra-5.1/plugins/shapes/asimetric_clocks.png b/cinelerra-5.1/plugins/shapes/asimetric_clocks.png
new file mode 100644 (file)
index 0000000..a5e4bac
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/asimetric_clocks.png differ
diff --git a/cinelerra-5.1/plugins/shapes/asimetric_clocks_2.png b/cinelerra-5.1/plugins/shapes/asimetric_clocks_2.png
new file mode 100644 (file)
index 0000000..e0c6e35
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/asimetric_clocks_2.png differ
diff --git a/cinelerra-5.1/plugins/shapes/audio.png b/cinelerra-5.1/plugins/shapes/audio.png
new file mode 100644 (file)
index 0000000..9a5651b
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/audio.png differ
diff --git a/cinelerra-5.1/plugins/shapes/crazy_clock.png b/cinelerra-5.1/plugins/shapes/crazy_clock.png
new file mode 100644 (file)
index 0000000..52b2b85
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/crazy_clock.png differ
diff --git a/cinelerra-5.1/plugins/shapes/cream.png b/cinelerra-5.1/plugins/shapes/cream.png
new file mode 100644 (file)
index 0000000..6b4933c
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/cream.png differ
diff --git a/cinelerra-5.1/plugins/shapes/film.png b/cinelerra-5.1/plugins/shapes/film.png
new file mode 100644 (file)
index 0000000..c1382ec
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/film.png differ
diff --git a/cinelerra-5.1/plugins/shapes/film2.png b/cinelerra-5.1/plugins/shapes/film2.png
new file mode 100644 (file)
index 0000000..2b19f1f
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/film2.png differ
diff --git a/cinelerra-5.1/plugins/shapes/mosaic.png b/cinelerra-5.1/plugins/shapes/mosaic.png
new file mode 100644 (file)
index 0000000..eea4177
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/mosaic.png differ
diff --git a/cinelerra-5.1/plugins/shapes/multi_box.png b/cinelerra-5.1/plugins/shapes/multi_box.png
new file mode 100644 (file)
index 0000000..4d71a8d
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/multi_box.png differ
diff --git a/cinelerra-5.1/plugins/shapes/rare_spiral.png b/cinelerra-5.1/plugins/shapes/rare_spiral.png
new file mode 100644 (file)
index 0000000..d31a9f0
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/rare_spiral.png differ
diff --git a/cinelerra-5.1/plugins/shapes/spiral_clock.png b/cinelerra-5.1/plugins/shapes/spiral_clock.png
new file mode 100644 (file)
index 0000000..0e5e15d
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/spiral_clock.png differ
diff --git a/cinelerra-5.1/plugins/shapes/square.png b/cinelerra-5.1/plugins/shapes/square.png
new file mode 100644 (file)
index 0000000..239d632
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/square.png differ
diff --git a/cinelerra-5.1/plugins/shapes/squares.png b/cinelerra-5.1/plugins/shapes/squares.png
new file mode 100644 (file)
index 0000000..3a58471
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/squares.png differ
diff --git a/cinelerra-5.1/plugins/shapes/star.png b/cinelerra-5.1/plugins/shapes/star.png
new file mode 100644 (file)
index 0000000..ca97e5a
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/star.png differ
diff --git a/cinelerra-5.1/plugins/shapes/water.png b/cinelerra-5.1/plugins/shapes/water.png
new file mode 100644 (file)
index 0000000..21790f0
Binary files /dev/null and b/cinelerra-5.1/plugins/shapes/water.png differ