add mask color radio btn sel, fix del all mask btn, fix mask dflt kfrm draw name...
authorGood Guy <[email protected]>
Thu, 30 May 2019 23:00:41 +0000 (17:00 -0600)
committerGood Guy <[email protected]>
Thu, 30 May 2019 23:00:41 +0000 (17:00 -0600)
cinelerra-5.1/cinelerra/autos.C
cinelerra-5.1/cinelerra/autos.h
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/cwindowtool.h
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/shbtnprefs.C
cinelerra-5.1/cinelerra/shbtnprefs.h
cinelerra-5.1/doc/RenderMux.sh

index cb5a1bd265eb254ff165bd42a4c501f105614a24..73e89a917ceb448f5510379ecea05f6a63e74987 100644 (file)
@@ -397,17 +397,11 @@ Auto* Autos::insert_auto(int64_t position, Auto *templ)
        return result;
 }
 
-int Autos::clear_all()
+void Autos::clear_all()
 {
-       Auto *current_, *current;
-
-       for(current = first; current; current = current_)
-       {
-               current_ = NEXT;
-               remove(current);
-       }
-       append_auto();
-       return 0;
+       while( last ) delete last;
+       delete default_auto;
+       create_objects();
 }
 
 int Autos::insert(int64_t start, int64_t end)
index 2e841bfd4cb44611668366bb746bd4c128526253..ee53f63a9c21494b90afbe426229d6f378331232 100644 (file)
@@ -116,7 +116,7 @@ public:
 
 
 
-       int clear_all();
+       void clear_all();
        int insert(int64_t start, int64_t end);
        int paste_silence(int64_t start, int64_t end);
 // Copy for keyframe clipboard & drag & drop
index 58b1cbb36e2ad7d860b71bd3b421b2f20595c0a6..0ee1d6751906ec6a4992c6feaf4c90ade928c9a5 100644 (file)
@@ -1749,8 +1749,7 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                                                if( draw_boundary ) {
                                                        char mask_label[BCSTRLEN];
                                                        int k = mwindow->edl->session->cwindow_mask;
-                                                       if( !prev_mask || prev_mask->is_default ||
-                                                           k < 0 || k >= prev_mask->masks.size() )
+                                                       if( !prev_mask || k < 0 || k >= prev_mask->masks.size() )
                                                                sprintf(mask_label, "%d", k);
                                                        else
                                                                sprintf(mask_label, "%s", prev_mask->masks[k]->name);
index c38daafb0420a3502fff4087d5b89a9d0ff4c0a1..2ef53fa9041d13b51f35f4af6b5ddd748775fe12 100644 (file)
@@ -1527,9 +1527,6 @@ int CWindowMaskName::handle_event()
                                (MaskAuto*)autos->first : (MaskAuto*)NEXT;
                }
 #endif
-               int total_buttons = sizeof(gui->mask_buttons)/sizeof(gui->mask_buttons[0]);
-               for( int i=0; i<total_buttons; ++i )
-                       gui->mask_buttons[i]->update(i==k ? 1 : 0);
                gui->update();
                gui->update_preview();
        }
@@ -1565,10 +1562,8 @@ CWindowMaskButton::~CWindowMaskButton()
 int CWindowMaskButton::handle_event()
 {
        mwindow->edl->session->cwindow_mask = no;
-       int total_buttons = sizeof(gui->mask_buttons)/sizeof(gui->mask_buttons[0]);
-       for( int i=0; i<total_buttons; ++i )
-               gui->mask_buttons[i]->update(i==no ? 1 : 0);
        gui->name->update(gui->name->mask_items[no]->get_text());
+       gui->update();
        gui->update_preview();
        return 1;
 }
@@ -1601,10 +1596,8 @@ int CWindowMaskThumbler::do_event(int dir)
        if( (k+=dir) >= SUBMASKS ) k = 0;
        else if( k < 0 ) k = SUBMASKS-1;
        mwindow->edl->session->cwindow_mask = k;
-       int total_buttons = sizeof(gui->mask_buttons)/sizeof(gui->mask_buttons[0]);
-       for( int i=0; i<total_buttons; ++i )
-               gui->mask_buttons[i]->update(i==k ? 1 : 0);
        gui->name->update(gui->name->mask_items[k]->get_text());
+       gui->update();
        gui->update_preview();
        return 1;
 }
@@ -2406,6 +2399,7 @@ void CWindowMaskGUI::update()
 
                if(mask) {
                        int k = mwindow->edl->session->cwindow_mask;
+                       update_buttons(keyframe, k);
                        feather->update(autos->get_feather(position_i, k, PLAY_FORWARD));
                        fade->update(autos->get_fader(position_i, k, PLAY_FORWARD));
                        apply_before_plugins->update(keyframe->apply_before_plugins);
@@ -2483,12 +2477,24 @@ void CWindowMaskGUI::set_focused(int v, float cx, float cy)
        focus->update(focused = v);
 }
 
+void CWindowMaskGUI::update_buttons(MaskAuto *keyframe, int k)
+{
+       int text_color = get_resources()->default_text_color;
+       int high_color = get_resources()->button_highlighted;
+       for( int i=0; i<SUBMASKS; ++i ) {
+               int color = text_color;
+               if( keyframe ) {
+                       SubMask *submask = keyframe->get_submask(i);
+                       if( submask && submask->points.size() )
+                               color = high_color;
+               }
+               mask_blabels[i]->set_color(color);
+               mask_buttons[i]->update(i==k ? 1 : 0);
+       }
+}
+
 CWindowRulerGUI::CWindowRulerGUI(MWindow *mwindow, CWindowTool *thread)
- : CWindowToolGUI(mwindow,
-       thread,
-       _(PROGRAM_NAME ": Ruler"),
-       320,
-       240)
+ : CWindowToolGUI(mwindow, thread, _(PROGRAM_NAME ": Ruler"), 320, 240)
 {
 }
 
index db0b32b7cec5294b196e05b54875f125dd701005..e6922e4b4f295d117b64d745c134cc6df1494052 100644 (file)
@@ -359,6 +359,7 @@ public:
        void create_objects();
        void update();
        void set_focused(int v, float cx, float cy);
+       void update_buttons(MaskAuto *keyframe, int k);
        void handle_event();
        void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
                SubMask* &mask, MaskPoint* &point, int create_it);
index f4ccda6a47d6d60a02831ca62a111165c0602dc6..8ead6cdc84902562c651029f89b9466fe2bdaaa8 100644 (file)
@@ -405,10 +405,10 @@ int Preferences::load_defaults(BC_Hash *defaults)
        shbtn_prefs.remove_all_objects();
        int shbtns_total = defaults->get("SHBTNS_TOTAL", -1);
        if( shbtns_total < 0 ) {
-               shbtn_prefs.append(new ShBtnPref(_("Current Manual"), "$CIN_BROWSER https://cinelerra-gg.org/download/CinelerraGG_manual.pdf", 0));
-               shbtn_prefs.append(new ShBtnPref(_("Setting Shell Commands"), "$CIN_BROWSER file://$CIN_DAT/doc/ShellCmds.html", 0));
-               shbtn_prefs.append(new ShBtnPref(_("Shortcuts"), "$CIN_BROWSER file://$CIN_DAT/doc/shortcuts.html", 0));
-               shbtn_prefs.append(new ShBtnPref(_("RenderMux"), "$CIN_DAT/doc/RenderMux.sh",0));
+               shbtn_prefs.append(new ShBtnPref(_("Current Manual"), "$CIN_BROWSER https://cinelerra-gg.org/download/CinelerraGG_manual.pdf"));
+               shbtn_prefs.append(new ShBtnPref(_("Setting Shell Commands"), "$CIN_BROWSER file://$CIN_DAT/doc/ShellCmds.html"));
+               shbtn_prefs.append(new ShBtnPref(_("Shortcuts"), "$CIN_BROWSER file://$CIN_DAT/doc/shortcuts.html"));
+               shbtn_prefs.append(new ShBtnPref(_("RenderMux"), "$CIN_DAT/doc/RenderMux.sh"));
                shbtns_total = 0;
        }
        for( int i=0; i<shbtns_total; ++i ) {
@@ -419,7 +419,9 @@ int Preferences::load_defaults(BC_Hash *defaults)
                defaults->get(string, commands);
                sprintf(string, "SHBTN%d_WARN", i);
                int warn = defaults->get(string, 0);
-               shbtn_prefs.append(new ShBtnPref(name, commands, warn));
+               sprintf(string, "SHBTN%d_RUN_SCRIPT", i);
+               int run_script = defaults->get(string, 0);
+               shbtn_prefs.append(new ShBtnPref(name, commands, warn, run_script));
        }
 
        file_probes.remove_all_objects();
@@ -536,6 +538,8 @@ int Preferences::save_defaults(BC_Hash *defaults)
                defaults->update(string, pref->commands);
                sprintf(string, "SHBTN%d_WARN", i);
                defaults->update(string, pref->warn);
+               sprintf(string, "SHBTN%d_RUN_SCRIPT", i);
+               defaults->update(string, pref->run_script);
        }
        defaults->update("FILE_PROBE_TOTAL", file_probes.size());
        for( int i=0; i<file_probes.size(); ++i ) {
index 5d719beb7c91486af8735ab973c1ca70392424d3..2945c0353b71d347b5ac9bbf3d2ef7fcd8ac4c4c 100644 (file)
@@ -1,8 +1,13 @@
 #include "bcwindowbase.h"
 #include "bcdisplayinfo.h"
 #include "bcdialog.h"
+#include "awindow.h"
+#include "awindowgui.h"
+#include "cstrdup.h"
+#include "indexable.h"
 #include "language.h"
 #include "mainerror.h"
+#include "mainsession.h"
 #include "mwindow.h"
 #include "shbtnprefs.h"
 #include "preferences.h"
 ShBtnRun::ShBtnRun(const char *nm, const char *cmds, int warn)
  : Thread(0, 0, 1)
 {
+       argv.set_array_delete();
        strncpy(name, nm, sizeof(name)-1);
        name[sizeof(name)-1] = 0;
        strncpy(commands, cmds, sizeof(commands)-1);
        commands[sizeof(commands)-1] = 0;
        this->warn = warn;
-       start();
+}
+ShBtnRun::~ShBtnRun()
+{
+       argv.remove_all_objects();
+}
+
+void ShBtnRun::add_arg(const char *v)
+{
+       argv.append(cstrdup(v));
 }
 
 void ShBtnRun::run()
@@ -38,24 +52,44 @@ void ShBtnRun::run()
                }
                return;
        }
-       char *const argv[4] = { (char*) "/bin/bash", (char*) "-c", commands, 0 };
+       argv.append(0);
        execvp(argv[0], &argv[0]);
 }
 
-ShBtnPref::ShBtnPref(const char *nm, const char *cmds, int warn)
+ShBtnPref::ShBtnPref(const char *nm, const char *cmds, int warn, int run_script)
 {
        strncpy(name, nm, sizeof(name));
        strncpy(commands, cmds, sizeof(commands));
        this->warn = warn;
+       this->run_script = run_script;
 }
 
 ShBtnPref::~ShBtnPref()
 {
 }
 
+void ShBtnPref::execute(ArrayList<Indexable*> &args)
+{
+// thread async+autodelete, no explicit delete
+       ShBtnRun *job = new ShBtnRun(name, commands, warn);
+       job->add_arg("/bin/bash");
+       job->add_arg(commands);
+       int n = args.size();
+       for( int i=0; i<n; ++i ) {
+               Indexable *idxbl = args[i];
+               if( !idxbl->is_asset ) continue;
+               job->add_arg(idxbl->path);
+       }
+       job->start();
+}
+
 void ShBtnPref::execute()
 {
-       new ShBtnRun(name, commands, warn);
+       ShBtnRun *job = new ShBtnRun(name, commands, warn);
+       job->add_arg("/bin/bash");
+       job->add_arg("-c");
+       job->add_arg(commands);
+       job->start();
 }
 
 ShBtnEditDialog::ShBtnEditDialog(PreferencesWindow *pwindow)
@@ -122,7 +156,7 @@ int ShBtnAddButton::handle_event()
 {
 
        Preferences *preferences = sb_window->shbtn_edit->pwindow->thread->preferences;
-       ShBtnPref *pref = new ShBtnPref(_("new"), "", 0);
+       ShBtnPref *pref = new ShBtnPref(_("new"), "", 0, 0);
        preferences->shbtn_prefs.append(pref);
        sb_window->list_update();
        return sb_window->start_edit(pref);
@@ -182,6 +216,7 @@ ShBtnTextWindow::ShBtnTextWindow(ShBtnEditWindow *sb_window, int x, int y)
 {
         this->sb_window = sb_window;
        warn = sb_window->sb_dialog->pref->warn;
+       run_script = sb_window->sb_dialog->pref->run_script;
 }
 
 ShBtnTextWindow::~ShBtnTextWindow()
@@ -198,6 +233,16 @@ ShBtnErrWarn::~ShBtnErrWarn()
 {
 }
 
+ShBtnRunScript::ShBtnRunScript(ShBtnTextWindow *st_window, int x, int y)
+ : BC_CheckBox(x, y, &st_window->run_script, _("run /path/script.sh + argvs"))
+{
+        this->st_window = st_window;
+}
+
+ShBtnRunScript::~ShBtnRunScript()
+{
+}
+
 void ShBtnTextWindow::create_objects()
 {
        lock_window("ShBtnTextWindow::create_objects");
@@ -215,6 +260,8 @@ void ShBtnTextWindow::create_objects()
        cmd_text->create_objects();
        y += cmd_text->get_h() + 16;
         add_subwindow(st_err_warn = new ShBtnErrWarn(this, x1, y));
+       x1 += st_err_warn->get_w() + 20;
+        add_subwindow(st_run_script = new ShBtnRunScript(this, x1, y));
         y = get_h() - ShBtnTextOK::calculate_h() - 10;
         add_subwindow(new ShBtnTextOK(this, x, y));
         show_window();
@@ -237,6 +284,7 @@ int ShBtnTextOK::handle_event()
        strcpy(pref->name, st_window->cmd_name->get_text());
        strcpy(pref->commands, st_window->cmd_text->get_text());
        pref->warn = st_window->warn;
+       pref->run_script = st_window->run_script;
        return BC_OKButton::handle_event();
 }
 
@@ -331,7 +379,16 @@ MainShBtnItem::MainShBtnItem(MainShBtns *shbtns, ShBtnPref *pref)
 
 int MainShBtnItem::handle_event()
 {
-       pref->execute();
+       MWindow *mwindow = shbtns->mwindow;
+       if( pref->run_script ) {
+               AWindowGUI *agui = mwindow->awindow->gui;
+               agui->lock_window("MainShBtnItem::handle_event");
+               mwindow->awindow->gui->collect_assets();
+               pref->execute(*mwindow->session->drag_assets);
+               agui->unlock_window();
+       }
+       else
+               pref->execute();
        return 1;
 }
 
index 3005d78c5e62144761ae651f0bbae6adf5a04810..360222051899c6465a0a5275314c1a8c88f82ccc 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __SHBTNPREFS_H__
 #define __SHBTNPREFS_H__
 
+#include "arraylist.h"
 #include "bcwindowbase.h"
 #include "bcbutton.h"
 #include "bcdialog.h"
@@ -18,8 +19,11 @@ public:
        int warn;
        char name[BCSTRLEN];
        char commands[BCTEXTLEN];
+       ArrayList<char *> argv;
+       void add_arg(const char *v);
 
-       ShBtnRun(const char *name, const char *cmds, int warn=0);
+       ShBtnRun(const char *name, const char *cmds, int warn);
+       ~ShBtnRun();
        void run();
 };
 
@@ -28,10 +32,11 @@ class ShBtnPref
 public:
        char name[BCSTRLEN];
        char commands[BCTEXTLEN];
-       int warn;
+       int warn, run_script;
        void execute();
+       void execute(ArrayList<Indexable*> &args);
 
-       ShBtnPref(const char *nm, const char *cmds, int warn);
+       ShBtnPref(const char *nm, const char *cmds, int warn=0, int run_script=0);
        ~ShBtnPref();
 };
 
@@ -111,6 +116,15 @@ public:
        ShBtnTextWindow *st_window;
 };
 
+class ShBtnRunScript : public BC_CheckBox
+{
+public:
+       ShBtnRunScript(ShBtnTextWindow *st_window, int x, int y);
+       ~ShBtnRunScript();
+
+       ShBtnTextWindow *st_window;
+};
+
 class ShBtnTextWindow : public BC_Window
 {
 public:
@@ -118,7 +132,9 @@ public:
        BC_ScrollTextBox *cmd_text;
        ShBtnEditWindow *sb_window;
        ShBtnErrWarn *st_err_warn;
+       ShBtnRunScript *st_run_script;
        int warn;
+       int run_script;
 
        void create_objects();
 
index d109bd63c193cd764c8c0ca86e38da94a1b58527..ee5e6b85b83c5bec6bc68eadbcb5ae4b9eb4078d 100755 (executable)
@@ -1,3 +1,5 @@
 #!/bin/bash
+exec >& /tmp/render_mux.log
+echo == $0 $@
 # Render output mux-ed into a single file
 ffmpeg -f concat -safe 0 -i <(for f in "$CIN_RENDER"0*; do echo "file '$f'"; done) -c copy -y $CIN_RENDER