cin_db Makefile tweak, awdw vicon stop draw lock rework,
authorGood Guy <good1.2guy@gmail.com>
Sun, 26 Jul 2020 20:00:19 +0000 (14:00 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 26 Jul 2020 20:00:19 +0000 (14:00 -0600)
fix align_timecodes clip overlaping moves, move align tc
from wdw to trk menu, add mix master menu item, load_filenames
sync edl to prevent plugin guis from flipping out, tweak
plugin gui_ids, add srt and sub subtitle formats, drag/drop
veffect fix gui_id, vrender reconfig tweak, grab gui lock
rework, vicon draw interrupt tweak, cc2txt xfont tweak,
move drag_chkbox drag plugin vars from keyfrm to client
in boxblur+crikey+sketcher+titler+tracer plugins and
listbox selection index range tests, tweak dav1d nasm
for not avx512icl

35 files changed:
cinelerra-5.1/Makefile.am
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/mainmenu.C
cinelerra-5.1/cinelerra/mainmenu.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/pluginserver.C
cinelerra-5.1/cinelerra/pluginserver.h
cinelerra-5.1/cinelerra/swindow.C
cinelerra-5.1/cinelerra/swindow.h
cinelerra-5.1/cinelerra/swindow.inc
cinelerra-5.1/cinelerra/tracks.C
cinelerra-5.1/cinelerra/tracksedit.C
cinelerra-5.1/cinelerra/vrender.C
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/bcwindowbase.h
cinelerra-5.1/guicast/vicon.C
cinelerra-5.1/libzmpeg3/xfont.C
cinelerra-5.1/plugins/boxblur/boxblur.C
cinelerra-5.1/plugins/crikey/crikey.C
cinelerra-5.1/plugins/crikey/crikey.h
cinelerra-5.1/plugins/crikey/crikeywindow.C
cinelerra-5.1/plugins/sketcher/sketcher.C
cinelerra-5.1/plugins/sketcher/sketcher.h
cinelerra-5.1/plugins/sketcher/sketcherwindow.C
cinelerra-5.1/plugins/titler/titler.C
cinelerra-5.1/plugins/titler/titler.h
cinelerra-5.1/plugins/titler/titlerwindow.C
cinelerra-5.1/plugins/tracer/tracer.C
cinelerra-5.1/plugins/tracer/tracer.h
cinelerra-5.1/plugins/tracer/tracerwindow.C
cinelerra-5.1/thirdparty/src/dav1d-0.7.1.patch1

index 2982fddae8819822702e2d62206807b4f87b423e..ea53b474a784e07af0dc912f9fc6e7cba497b662 100644 (file)
@@ -43,7 +43,7 @@ bin_install:  install-recursive
          if [ $$d = picon/cinfinity ]; then continue; fi; \
          cp -a $$d bin/plugins/picon/.; \
        done
-       cp -a db/utils/new_db "bin/cin_db" || true
+       test ! -f db/utils/new_db || cp -a db/utils/new_db "bin/cin_db"
 
 bin_uninstall:
        rm -rf bin
index d71d1588715e1e58e4d0f69028d38c5ba95e3edc..4688e7bc04cead9a205e6a0fd67288640dc10b25 100644 (file)
@@ -612,22 +612,10 @@ AssetVIconThread::AssetVIconThread(AWindowGUI *gui, Preferences *preferences)
        case VICON_COLOR_MODE_HIGH:  vicon_cmodel = BC_RGB888;  break;
        }
        this->vicon_cmodel = vicon_cmodel;
-       this->draw_lock = new Mutex("AssetVIconThread::draw_lock");
 }
 
 AssetVIconThread::~AssetVIconThread()
 {
-       delete draw_lock;
-}
-
-void AssetVIconThread::drawing_started()
-{
-       draw_lock->lock("AssetVIconThread::drawing_started");
-}
-
-void AssetVIconThread::drawing_stopped()
-{
-       draw_lock->unlock();
 }
 
 void AssetVIconThread::set_view_popup(AssetVIcon *v, int draw_mode)
@@ -691,10 +679,8 @@ ViewPopup *AssetVIconThread::new_view_window(ViewPopup *vpopup)
 void AssetVIconThread::stop_vicon_drawing(int wait)
 {
        stop_drawing();
-       if( wait ) {
-               drawing_started(); // waits for draw lock
-               drawing_stopped();
-       }
+       gui->lock_window("AssetVIconThread::stop_vicon_drawing");
+       gui->unlock_window();
 }
 
 
index aa182f9ecf57eb1c6aef9206ba8b400bc3be16ad..b52add9b2059f84f668084644b7456ecd3c52410 100644 (file)
@@ -209,13 +209,10 @@ public:
        void set_view_popup(AssetVIcon *v);
        ViewPopup *new_view_window(ViewPopup *popup);
        void stop_vicon_drawing(int wait=0);
-       void drawing_started();
-       void drawing_stopped();
 
        AWindowGUI *gui;
        int draw_mode;
        int vicon_cmodel;
-       Mutex *draw_lock;
 };
 
 
index b2bcaf98f1cf40eacdef8f6b19aa5c938781f10e..0bf6e0ae24eddd7804c3b1b1198210a90befa70c 100644 (file)
@@ -881,7 +881,11 @@ void Edits::align_timecodes(double offset)
                }
        }
        int64_t startproject = 0;
-       for( Edit *edit=first; edit; edit=edit->next ) {
+       for( Edit *edit=first, *next=0; edit; edit=next ) {
+               if( (next = edit->next) != 0 ) {
+                       int64_t length = next->startproject - startproject;
+                       if( length > edit->length ) edit->length = length;
+               }
                int64_t length = edit->startproject - startproject;
                if( length > 0 ) {
                        Edit *new_edit = create_edit();
index 061dd8c19f3c1f4d0e4669910efdf28663b7b4dc..72b9b68bc9535d20c4d2fcbc81266db10912a27a 100644 (file)
@@ -209,6 +209,7 @@ void MainMenu::create_objects()
        trackmenu->add_item(new DeleteFirstTrack(mwindow));
        trackmenu->add_item(new DeleteLastTrack(mwindow));
        trackmenu->add_item(new ConcatenateTracks(mwindow));
+       trackmenu->add_item(new AlignTimecodes(mwindow));
        trackmenu->add_item(new SwapTracksUp(mwindow));
        trackmenu->add_item(new SwapTracksDown(mwindow));
        AppendTracks *append_tracks;
@@ -282,7 +283,6 @@ void MainMenu::create_objects()
        windowmenu->add_item(split_x = new SplitX(mwindow));
        windowmenu->add_item(split_y = new SplitY(mwindow));
        windowmenu->add_item(mixer_items = new MixerItems(mwindow));
-       windowmenu->add_item(align_timecodes = new AlignTimecodes(mwindow));
        mixer_items->create_objects();
        windowmenu->add_item(new TileWindows(mwindow,_("Tile left"),0));
        windowmenu->add_item(new TileWindows(mwindow,_("Tile right"),1));
@@ -1674,6 +1674,7 @@ void MixerItems::create_objects()
        mixer_submenu->add_submenuitem(new MixerViewer(this));
        mixer_submenu->add_submenuitem(new TileMixers(this));
        mixer_submenu->add_submenuitem(new AlignMixers(this));
+       mixer_submenu->add_submenuitem(new MixMasters(this));
 }
 
 int MixerItems::activate_submenu()
@@ -1769,6 +1770,18 @@ int AlignMixers::handle_event()
        return 1;
 }
 
+MixMasters::MixMasters(MixerItems *mixer_items)
+ : MixerItem(mixer_items, _("Mix masters"), "", 0)
+{
+}
+
+int MixMasters::handle_event()
+{
+       MWindow *mwindow = mixer_items->mwindow;
+       mwindow->mix_masters();
+       return 1;
+}
+
 
 AlignTimecodes::AlignTimecodes(MWindow *mwindow)
  : BC_MenuItem(_("Align Timecodes"))
index f0c493b22a735af15ea23dc1f8fcef70c14ae636..3498c2adcdcab785f9537e07c2d440e38d31725a 100644 (file)
@@ -172,7 +172,6 @@ public:
        SplitX *split_x;
        SplitY *split_y;
        MixerItems *mixer_items;
-       AlignTimecodes *align_timecodes;
        LoadLayout *load_layout;
        LoadLayout *save_layout;
 };
@@ -539,6 +538,13 @@ public:
        int handle_event();
 };
 
+class MixMasters : public MixerItem
+{
+public:
+       MixMasters(MixerItems *mixer_items);
+       int handle_event();
+};
+
 class AlignTimecodes : public BC_MenuItem
 {
 public:
index 7d0c140f17a90e1e986283c49f7822ac3041fd19..03e013099b61f2a919bdc33e52dc58e96b8eb19c 100644 (file)
@@ -2284,6 +2284,8 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
 // Start examining next batch of index files
        if(got_indexes) mainindexes->start_build();
 
+// reload renderengine edl or the plugin guis will flip out
+       sync_parameters(CHANGE_ALL);
 // Open plugin GUIs
        show_plugins();
 
index cbe172774d8ad3efa9b9d94ff3c1ee0309adc869..65a284123b6e9a66a98a7ba5df25eaa681619c4d 100644 (file)
@@ -292,6 +292,8 @@ public:
        void start_mixer();
        int select_zwindow(ZWindow *zwindow);
        void tile_mixers();
+       int masters_to_mixers();
+       void mix_masters();
        void set_gang_tracks(int v);
        int load_filenames(ArrayList<char*> *filenames,
                int load_mode = LOADMODE_REPLACE,
index 26aa4cb25054d2f3317c8d1222a16baa7202d48f..d424d60879335f2f4dc267f2b57dedb9f88f47dc 100644 (file)
@@ -2722,3 +2722,91 @@ void MWindow::align_timecodes()
        update_plugin_guis();
 }
 
+
+int MWindow::masters_to_mixers()
+{
+       Track *master_track = edl->tracks->first;
+       while( master_track && !master_track->master )
+               master_track = master_track->next;
+       while( master_track ) { // test for track/mixer conflicts
+               int failed = 0;
+               Track *mixer_last = master_track;
+               Track *track = master_track->next;
+               for( ; track && !track->master; track=track->next )
+                       mixer_last = track;
+               Track *next_track = track;
+               Mixer *master_mixer = 0;
+               for( int i=0, n=edl->mixers.size(); i<n; ++i ) {
+                       if( master_track->index_in(edl->mixers[i]) >= 0 ) {
+                               master_mixer = edl->mixers[i];
+                               break;
+                       }
+               }
+               if( master_mixer ) { // existing mixer track group
+                       for( track=master_track; !failed && track; track=track->next ) {
+                               if( track->index_in(master_mixer) < 0 ) {
+                                       eprintf("Mixer: %s missing track: %s",
+                                               master_mixer->title, track->title);
+                                       failed = 1;
+                               }
+                               if( track == mixer_last ) break;
+                       }
+                       for( int i=0, n=master_mixer->mixer_ids.size(); !failed && i<n; ++i ) {
+                               int mixer_id = master_mixer->mixer_ids[i], found = 0;
+                               for( track=master_track; track; track=track->next ) {
+                                       if( track->mixer_id == mixer_id ) {
+                                               found = 1;
+                                               break;
+                                       }
+                                       if( track == mixer_last ) break;
+                               }
+                               if( !found ) {
+                                       eprintf("Mixer: %s track missing: %s",
+                                               master_mixer->title, track->title);
+                                       failed = 1;
+                               }
+                       }
+               }
+               else { // create mixer
+                       for( track=master_track->next; !failed && track; track=track->next ) {
+                               for( int i=0, n=edl->mixers.size(); !failed && i<n; ++i ) {
+                                       Mixer *mixer = edl->mixers[i];
+                                       if( track->index_in(mixer) >= 0 ) {
+                                               eprintf("Track: %s already exists in mixer: %s",
+                                                       track->title, mixer->title);
+                                               failed = 1;
+                                               break;
+                                       }
+                               }
+                               if( track == mixer_last ) break;
+                       }
+                       if( !failed ) { // new mixer
+                               ZWindow *zwindow = get_mixer(master_mixer);
+                               zwindow->set_title(master_track->title);
+                               sprintf(master_track->title, _("Mixer %d"), zwindow->idx);
+                               for( track=master_track; track; track=track->next ) {
+                                       track->play = track->armed = 0;
+                                       master_mixer->mixer_ids.append(track->get_mixer_id());
+                                       if( track == mixer_last ) break;
+                               }
+                               zwindow->start();
+                       }
+               }
+               master_track = next_track;
+        }
+       return 0;
+}
+
+void MWindow::mix_masters()
+{
+       undo_before();
+       masters_to_mixers();
+       undo_after(_("mix masters"), LOAD_ALL);
+
+       restart_brender();
+       gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
+       gui->activate_timeline();
+       cwindow->refresh_frame(CHANGE_EDL);
+       save_backup();
+}
+
index 18619cc7ad98ff2d88c7f16eabb5df4128de393a..dec5824c97886da41ac77d05090ddef52ff60156 100644 (file)
@@ -661,7 +661,6 @@ void PluginServer::render_gui(void *data, int size)
 PluginGUIs::PluginGUIs(MWindow *mwindow)
 {
        this->mwindow = mwindow;
-       this->next_id = 0;
 }
 PluginGUIs::~PluginGUIs()
 {
@@ -669,7 +668,7 @@ PluginGUIs::~PluginGUIs()
 
 void PluginGUIs::append(PluginServer *server)
 {
-       server->gui_id = next_id++;
+       server->gui_id = EDL::next_id();
        ArrayList<PluginServer*>::append(server);
 }
 
index 1808db7e2435c502795eec3b8f23e113baa1f784..2b58f06c5dafcd9628712f08cbfdb67b7fa5a92c 100644 (file)
@@ -76,7 +76,6 @@ public:
 
 class PluginGUIs : public ArrayList<PluginServer*>
 {
-       int next_id;
        MWindow *mwindow;
 public:
        PluginGUIs(MWindow *mwindow);
index 8e558fd1c221853547b2d96a4e5e52627c22c11e..cbbde0e9fe40fcd76fe5ec474a683c873ff449a5 100644 (file)
@@ -129,7 +129,7 @@ int SWindowSaveFile::handle_event()
                sw_gui->save_spumux_data();
        }
        else {
-               eprintf(_("script microdvd file path required"));
+               eprintf(_("script file path required"));
        }
        return 1;
 }
@@ -150,6 +150,9 @@ void SWindowGUI::create_objects()
        add_subwindow(load_file = new SWindowLoadFile(this, x1, y1));
        x1 += load_file->get_w() + 2*xpad;
        add_subwindow(save_file = new SWindowSaveFile(this, x1, y1));
+       x1 += save_file->get_w() + 2*xpad;
+       add_subwindow(save_format = new SWindowSaveFormat(this, x1, y1));
+       save_format->create_objects();
        y += max(load_path->get_h(), load_file->get_h()) + ypad;
        x1 = x + ypad, y1 = y;
        BC_Title *title1, *title2;
@@ -276,6 +279,7 @@ SWindowGUI::SWindowGUI(SWindow *swindow, int x, int y, int w, int h)
        blank_line = 0;
        text_font = MEDIUMFONT;
        text_rowsz = get_text_ascent(text_font)+1 + get_text_descent(text_font)+1;
+       sub_format = SUB_FORMAT_SRT;
 }
 
 SWindowGUI::~SWindowGUI()
@@ -339,6 +343,7 @@ void SWindowGUI::load_defaults()
        defaults->get("SUBTTL_SCRIPT_PATH", script_path);
        script_entry_no = defaults->get("SUBTTL_SCRIPT_ENTRY_NO", script_entry_no);
        script_text_no = defaults->get("SUBTTL_SCRIPT_TEXT_NO", script_text_no);
+       sub_format = defaults->get("SUBTTL_SCRIPT_FORMAT", sub_format);
 }
 
 void SWindowGUI::save_defaults()
@@ -347,6 +352,7 @@ void SWindowGUI::save_defaults()
        defaults->update("SUBTTL_SCRIPT_PATH", script_path);
        defaults->update("SUBTTL_SCRIPT_ENTRY_NO", script_entry_no);
        defaults->update("SUBTTL_SCRIPT_TEXT_NO", script_text_no);
+       defaults->update("SUBTTL_SCRIPT_FORMAT", sub_format);
 }
 
 void SWindowGUI::set_script_pos(int64_t entry_no, int text_no)
@@ -847,29 +853,98 @@ void SWindowGUI::save_spumux_data()
                               (wch >= '0' && wch <= '9') ) ) wch = '_';
                        butf8(wch, cp);
                }
+               const char *sfx = "";
+               switch( sub_format ) {
+               case SUB_FORMAT_SRT:   sfx = ".srt";   break;
+               case SUB_FORMAT_RIP:   sfx = ".sub";   break;
+               case SUB_FORMAT_UDVD:  sfx = ".udvd";  break;
+               }
                *cp = 0;
-               snprintf(ext,len,"-%s.udvd",track_title);
+               snprintf(ext,len,"-%s%s",track_title, sfx);
                FILE *fp = fopen(filename, "w");
                if( !fp ) {
                        eprintf(_("Unable to open %s:\n%m"), filename);
                        continue;
                }
-               int64_t start = 0;
+               switch( sub_format ) {
+               case SUB_FORMAT_RIP:
+                       fprintf(fp,"[SUBTITLE]\n"
+                               "[COLF]&HFFFFFF,[SIZE]12,[FONT]Times New Roman\n");
+                       break;
+               }
+               int64_t start = 0;  int count = 0;
                for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
                        SEdit *sedit = (SEdit *)edit;
-                       if( sedit->length > 0 ) {
-                               int64_t end = start + sedit->length;
-                               char *text = sedit->get_text();
-                               if( *text ) {
+                       if( !sedit->length ) continue;
+                       int64_t end = start + sedit->length;
+                       double st = sedit->track->from_units(start);
+                       int shr = st/3600; st -= shr*3600;
+                       int smn = st/60;   st -= smn*60;
+                       int ssc = st;      st -= ssc;
+                       int sms = st*1000;
+                       double et = sedit->track->from_units(end);
+                       int ehr = et/3600; et -= ehr*3600;
+                       int emn = et/60;   et -= emn*60;
+                       int esc = et;      et -= esc;
+                       int ems = et*1000;
+                       char *text = sedit->get_text();
+                       if( *text ) {
+                               ++count;
+                               switch( sub_format ) {
+                               case SUB_FORMAT_SRT:
+                                       fprintf(fp, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n",
+                                                count, shr, smn, ssc, sms, ehr, emn, esc, ems, text);
+                                       break;
+                               case SUB_FORMAT_RIP:
+                                       fprintf(fp, "%02d:%02d:%02d.%02d,%02d:%02d:%02d.%02d\n%s\n\n",
+                                                shr, smn, ssc, sms/10, ehr, emn, esc, ems/10, text);
+                                       break;
+                               case SUB_FORMAT_UDVD:
                                        fprintf(fp, "{%jd}{%jd}%s\n", start, end-1, text);
+                                       break;
                                }
-                               start = end;
                        }
+                       start = end;
                }
                fclose(fp);
        }
 }
 
+SWindowItemFormat::SWindowItemFormat(SWindowSaveFormat *save_format,
+               const char *text, int id)
+ : BC_MenuItem(text)
+{
+       this->save_format = save_format;
+       this->id = id;
+}
+
+int SWindowItemFormat::handle_event()
+{
+       save_format->sw_gui->sub_format = id;
+       save_format->update_toggles();
+       return 1;
+}
+
+SWindowSaveFormat::SWindowSaveFormat(SWindowGUI *sw_gui, int x, int y)
+ : BC_PopupMenu(x, y, _("Format"))
+{
+       this->sw_gui = sw_gui;
+}
+
+void SWindowSaveFormat::create_objects()
+{
+       add_item(srt = new SWindowItemFormat(this, _("SRT"), SUB_FORMAT_SRT));
+       add_item(rip = new SWindowItemFormat(this, _("SUB"), SUB_FORMAT_RIP));
+       add_item(udvd = new SWindowItemFormat(this, _("UDVD"), SUB_FORMAT_UDVD));
+       update_toggles();
+}
+
+void SWindowSaveFormat::update_toggles()
+{
+       srt->set_checked(sw_gui->sub_format == SUB_FORMAT_SRT);
+       rip->set_checked(sw_gui->sub_format == SUB_FORMAT_RIP);
+       udvd->set_checked(sw_gui->sub_format == SUB_FORMAT_UDVD);
+}
 
 
 SWindow::SWindow(MWindow *mwindow)
index 019e71d0603642f0238323c993f8b21088633b47..ec3baafee91db24cce9f70d4c56ed1af2d942c00 100644 (file)
@@ -9,6 +9,10 @@
 #include "mwindow.inc"
 #include "swindow.inc"
 
+#define SUB_FORMAT_SRT  1
+#define SUB_FORMAT_RIP  2
+#define SUB_FORMAT_UDVD 3
+
 class SWindow : public Thread
 {
 public:
@@ -86,6 +90,29 @@ public:
        ~SWindowSaveFile();
 };
 
+class SWindowItemFormat : public BC_MenuItem
+{
+public:
+       SWindowItemFormat(SWindowSaveFormat *save_format, const char *text, int id);
+       int handle_event();
+
+       SWindowSaveFormat *save_format;
+       int id;
+};
+
+class SWindowSaveFormat : public BC_PopupMenu
+{
+public:
+       SWindowSaveFormat(SWindowGUI *sw_gui, int x, int y);
+       void create_objects();
+       void update_toggles();
+
+       SWindowGUI *sw_gui;
+       SWindowItemFormat *srt;
+       SWindowItemFormat *rip;
+       SWindowItemFormat *udvd;
+};
+
 
 class ScriptLines
 {
@@ -189,6 +216,7 @@ public:
        SWindowLoadPath *load_path;
        SWindowLoadFile *load_file;
        SWindowSaveFile *save_file;
+       SWindowSaveFormat *save_format;
        BC_Title *script_filesz;
        BC_Title *script_lines;
        BC_Title *script_entries;
@@ -205,6 +233,7 @@ public:
        ScriptScroll *script_scroll;
        int xpad, ypad;
        char *blank_line;
+       int sub_format;
 
        char script_path[BCTEXTLEN];
        ArrayList<ScriptLines *> script;
index f88a26eed6aa1e0211a5abad482f8090506ea726..d948be3777e6a0ffca7afc3a3185bd4dc27e2ca2 100644 (file)
@@ -6,6 +6,17 @@ class SWindowOK;
 class SWindowCancel;
 class SWindowLoadPath;
 class SWindowLoadFile;
+class SWindowSaveFile;
+class SWindowItemFormat;
+class SWindowSaveFormat;
+class ScriptLines;
+class ScriptScroll;
+class ScriptPosition;
+class ScriptEntry;
+class ScriptPrev;
+class ScriptNext;
+class ScriptPaste;
+class ScriptClear;
 class SWindowGUI;
 class SubttlSWin;
 
index 170f2931af52857e1f2374f15e623eff36761bde..419f26d93690dc20c14533d9127fc6270195f75c 100644 (file)
@@ -790,14 +790,14 @@ void Tracks::move_tracks(Track *src, Track *dst, int n)
 double Tracks::align_timecodes()
 {
        double offset = -1;
-       for( Track *track=edl->tracks->first; track; track=track->next ) {
+       for( Track *track=first; track; track=track->next ) {
                if( !track->is_armed() ) continue;
                double early_offset = track->edits->early_timecode();
                if( offset < 0 || offset > early_offset )
                        offset = early_offset;
        }
        if( offset >= 0 ) {
-               for( Track *track=edl->tracks->first; track; track=track->next ) {
+               for( Track *track=first; track; track=track->next ) {
                        if( !track->is_armed() ) continue;
                        track->edits->align_timecodes(offset);
                }
index 29584b239f4db4368773154e4facc556979d40ec..bf250b36623cd26379552478abfc719c22d1e01c 100644 (file)
@@ -697,6 +697,7 @@ void Tracks::move_effect(Plugin *plugin, Track *track, int64_t position)
                                start, length, plugin->plugin_type);
        result->copy_from(plugin);
        result->shift(position - plugin->startproject);
+       result->gui_id = plugin->gui_id;
 
 // Clear new plugin from old set
        plugin->plugin_set->clear(plugin->startproject,
index 43893b2770106845d2fbe6533eadb657bc1e3d81..6438443019e6bc9bfee9a12395663a8d56d08ae2 100644 (file)
@@ -288,7 +288,7 @@ int VRender::get_colormodel(VEdit *playable_edit, int use_vconsole, int use_bren
 
 void VRender::run()
 {
-       int reconfigure;
+       int reconfigure = 1;
        const int debug = 0;
 
 // Want to know how many samples rendering each frame takes.
@@ -322,13 +322,13 @@ void VRender::run()
 // Want the condition before, since only 1 frame is rendered
 // and the number of frames skipped after this frame varies.
                current_input_length = 1;
-
-               reconfigure = vconsole->test_reconfigure(current_position,
-                       current_input_length);
-
-
+               if( !reconfigure ) reconfigure =
+                       vconsole->test_reconfigure(current_position, current_input_length);
                if(debug) printf("VRender::run %d\n", __LINE__);
-               if(reconfigure) restart_playback();
+               if( reconfigure ) {
+                       restart_playback();
+                       reconfigure = 0;
+               }
 
                if(debug) printf("VRender::run %d\n", __LINE__);
                process_buffer(current_position, use_opengl);
index 137b6790b5b8b68c2bb4120eb265054563b1f945..87148812489889c2d97640af4217eb8c51270e39 100644 (file)
@@ -224,6 +224,7 @@ BC_WindowBase::~BC_WindowBase()
        }
 
        resize_history.remove_all_objects();
+       delete grab_lock;
 
 #ifndef SINGLE_THREAD
        common_events.remove_all_objects();
@@ -346,6 +347,7 @@ int BC_WindowBase::initialize()
        event_condition = new Condition(0, "BC_WindowBase::event_condition");
        init_lock = new Condition(0, "BC_WindowBase::init_lock");
 #endif
+       grab_lock = new Mutex("BC_WindowBase::grab_lock");
 
        cursor_timer = new Timer;
        event_thread = 0;
@@ -959,10 +961,14 @@ if( debug && event->type != ClientMessage ) {
 }
 
        if( active_grab ) {
+               grab_lock->lock("BC_WindowBase::dispatch_event 3");
                unlock_window();
-               active_grab->lock_window("BC_WindowBase::dispatch_event 3");
-               result = active_grab->grab_event(event);
-               active_grab->unlock_window();
+               if( active_grab ) {
+                       active_grab->lock_window("BC_WindowBase::dispatch_event 3");
+                       result = active_grab->grab_event(event);
+                       active_grab->unlock_window();
+               }
+               grab_lock->unlock();
                if( result ) return result;
                lock_window("BC_WindowBase::dispatch_event 4");
        }
@@ -3415,28 +3421,36 @@ void BC_WindowBase::close(int return_value)
 
 int BC_WindowBase::grab(BC_WindowBase *window)
 {
-       int ret = 1;
-       if( window->active_grab ) {
+       int ret = 0;
+       BC_WindowBase *grab_window = window->active_grab;
+       if( grab_window ) {
                int locked = get_window_lock();
                if( locked ) unlock_window();
-               BC_WindowBase *active_grab = window->active_grab;
-               active_grab->lock_window("BC_WindowBase::grab(BC_WindowBase");
-               ret = active_grab->handle_ungrab();
-               active_grab->unlock_window();
+               grab_window->lock_window("BC_WindowBase::grab(BC_WindowBase");
+               grab_window->handle_ungrab();
+               grab_window->unlock_window();
                if( locked ) lock_window("BC_WindowBase::grab(BC_WindowBase");
        }
-       if( ret ) {
+       window->grab_lock->lock("BC_WindowBase::grab");
+       if( !window->active_grab ) {
                window->active_grab = this;
                this->grab_active = window;
+               ret = 1;
        }
+       window->grab_lock->unlock();
        return ret;
 }
 int BC_WindowBase::ungrab(BC_WindowBase *window)
 {
-       if( this != window->active_grab ) return 0;
-       window->active_grab = 0;
-       this->grab_active = 0;
-       return 1;
+       int ret = 0;
+       window->grab_lock->lock("BC_WindowBase::ungrab");
+       if( this == window->active_grab ) {
+               window->active_grab = 0;
+               this->grab_active = 0;
+               ret = 1;
+       }
+       window->grab_lock->unlock();
+       return ret;
 }
 int BC_WindowBase::grab_event_count()
 {
index d02a357ed3fe84e0af975e260a5a0c6b59fb0490..e4eb8ba4c812354305d27a2fea44b078b93a94dd 100644 (file)
@@ -917,11 +917,9 @@ private:
 #else
        Condition *completion_lock;
 #endif
-
-
+       Mutex *grab_lock;
        int dump_windows();
 
-
        BC_WindowEvents *event_thread;
        int is_deleting;
 // Hide cursor when video is enabled
index 5ebec4852dd3904d1bf6c18b2e1373f6619a5ea0..9d6b94e0ed0add20e2721b3437d1499d0605b680 100644 (file)
@@ -384,7 +384,7 @@ run()
                                update_view(1);
                        if( !solo ) {
                                VIcon *next = low_vicon();
-                               while( next && next->age < draw_flash ) {
+                               while( !interrupted && next && next->age < draw_flash ) {
                                        if( show_vicon(next) ) break;
                                        add_vicon(next);
                                        next = low_vicon();
index 70f411e34c623272b267cffac75b3a0b106dc533..545c0866baf852e3215531e4c62f60635012cac1 100644 (file)
@@ -150,6 +150,8 @@ init_xfont(zbitfont_t *font,char *font_name)
 static zbitfont_t *
 get_xfont(int style, int pen_size, int italics, int size)
 {
+  const char *family, *slant;
+#if 0
   int serif = 0, prop = 0, casual = 0; // fst_default
   switch( style ) {
   case 1: serif = 1;  prop = 0;  casual = 0;  break; // fst_mono_serif
@@ -159,8 +161,6 @@ get_xfont(int style, int pen_size, int italics, int size)
   case 5: serif = 1;  prop = 1;  casual = 1;  break; // fst_casual
   }
 
-  const char *family, *slant;
-#if 1
   if( casual ) {
     family = "adobe-utopia";
     slant = italics ? "i" : "r";
@@ -176,20 +176,8 @@ get_xfont(int style, int pen_size, int italics, int size)
      (slant = italics ? "i" : "r", "bitstream-bitstream charter");
   }
 #else
-  if( casual ) {
-    family = "bitstream-bitstream vera serif";
-    slant = "r";
-  }
-  if( serif == 0 ) {
-   family = prop == 0 ?
-     (slant = italics ? "o" : "r", "bitstream-bitstream vera sans mono") :
-     (slant = italics ? "o" : "r", "bitstream-bitstream vera sans");
-  }
-  else {
-   family = prop == 0 ?
-     (slant = italics ? "i" : "r", "bitstream-courier 10 pitch"):
-     (slant = italics ? "i" : "r", "bitstream-bitstream charter");
-  }
+  family = "bitstream-bitstream charter";
+  slant = "r";
 #endif
   const char *wght = pen_size > 1 ? "bold" : "medium";
 
index 7c8fb1e96f5fc531c761d0699764c545bc5754e2..132c1d987f4c6744ab676ea92051fcd916506ffa 100644 (file)
@@ -227,6 +227,8 @@ public:
        ~BoxBlurEffect();
 
        PLUGIN_CLASS_MEMBERS(BoxBlurConfig)
+       void render_gui(void *data);
+       int is_dragging();
        int process_realtime(VFrame *input, VFrame *output);
        void update_gui();
        int is_realtime();
@@ -236,6 +238,7 @@ public:
 
        VFrame *input, *output;
        BoxBlur *box_blur;
+       int drag;
 };
 
 
@@ -244,7 +247,6 @@ void BoxBlurConfig::reset()
        horz_radius = 0;
        vert_radius = 0;
        power = 1;
-       drag = 0;
        box_x = box_y = 0.0;
        box_w = box_h = 0;
 }
@@ -254,7 +256,6 @@ void BoxBlurConfig::preset()
        horz_radius = 2;
        vert_radius = 2;
        power = 2;
-       drag = 0;
        box_x = box_y = 0.0;
        box_w = box_h = 0;
 }
@@ -270,7 +271,6 @@ void BoxBlurConfig::copy_from(BoxBlurConfig &that)
        horz_radius = that.horz_radius;
        vert_radius = that.vert_radius;
        power = that.power;
-       drag = that.drag;
        box_x = that.box_x;  box_y = that.box_y;
        box_w = that.box_w;  box_h = that.box_h;
 }
@@ -279,7 +279,7 @@ int BoxBlurConfig::equivalent(BoxBlurConfig &that)
 {
        return horz_radius == that.horz_radius &&
                vert_radius == that.vert_radius &&
-               power == that.power && // drag == that.drag &&
+               power == that.power &&
                EQUIV(box_x, that.box_x) && EQUIV(box_y, that.box_y) &&
                box_w == that.box_w && box_h == that.box_h;
 }
@@ -292,7 +292,6 @@ void BoxBlurConfig::interpolate(BoxBlurConfig &prev, BoxBlurConfig &next,
        this->horz_radius = u*prev.horz_radius + v*next.horz_radius;
        this->vert_radius = u*prev.vert_radius + v*next.vert_radius;
        this->power = u*prev.power + v*next.power + 1e-6; // avoid truncation jitter
-       this->drag = prev.drag;
        this->box_x = u*prev.box_x + v*next.box_x;
        this->box_y = u*prev.box_y + v*next.box_y;
        this->box_w = u*prev.box_w + v*next.box_w + 1e-6;
@@ -454,10 +453,12 @@ void BoxBlurWindow::create_objects()
        add_subwindow(tbar = new BC_TitleBar(x, y, ww, bar_o, bar_m, _("Position & Size")));
        y += ys20;
        int x1 = ww - BoxBlurDrag::calculate_w(this) - margin;
+       if( plugin->drag && drag->drag_activate() ) {
+               eprintf("drag enabled, but compositor already grabbed\n");
+               plugin->drag = 0;
+       }
        add_subwindow(drag = new BoxBlurDrag(this, plugin, x1, y));
        drag->create_objects();
-       if( plugin->config.drag && drag->drag_activate() )
-               eprintf("drag enabled, but compositor already grabbed\n");
 
        BC_Title *title;
        add_subwindow(title = new BC_Title(t1, y, _("X:")));
@@ -521,11 +522,25 @@ REGISTER_PLUGIN(BoxBlurEffect)
 NEW_WINDOW_MACRO(BoxBlurEffect, BoxBlurWindow)
 LOAD_CONFIGURATION_MACRO(BoxBlurEffect, BoxBlurConfig)
 
+void BoxBlurEffect::render_gui(void *data)
+{
+       BoxBlurEffect *box_blur = (BoxBlurEffect *)data;
+       box_blur->drag = drag;
+}
+
+int BoxBlurEffect::is_dragging()
+{
+       drag = 0;
+       send_render_gui(this);
+       return drag;
+}
+
 
 BoxBlurEffect::BoxBlurEffect(PluginServer *server)
  : PluginVClient(server)
 {
        box_blur = 0;
+       drag = 0;
 }
 
 BoxBlurEffect::~BoxBlurEffect()
@@ -545,7 +560,6 @@ void BoxBlurEffect::save_data(KeyFrame *keyframe)
        output.tag.set_property("HORZ_RADIUS", config.horz_radius);
        output.tag.set_property("VERT_RADIUS", config.vert_radius);
        output.tag.set_property("POWER", config.power);
-       output.tag.set_property("DRAG", config.drag);
        output.tag.set_property("BOX_X", config.box_x);
        output.tag.set_property("BOX_Y", config.box_y);
        output.tag.set_property("BOX_W", config.box_w);
@@ -568,7 +582,6 @@ void BoxBlurEffect::read_data(KeyFrame *keyframe)
                        config.horz_radius = input.tag.get_property("HORZ_RADIUS", config.horz_radius);
                        config.vert_radius = input.tag.get_property("VERT_RADIUS", config.vert_radius);
                        config.power = input.tag.get_property("POWER", config.power);
-                       config.drag = input.tag.get_property("DRAG", config.drag);
                        config.box_x = input.tag.get_property("BOX_X", config.box_x);
                        config.box_y = input.tag.get_property("BOX_Y", config.box_y);
                        config.box_w = input.tag.get_property("BOX_W", config.box_w);
@@ -610,7 +623,7 @@ int BoxBlurEffect::process_realtime(VFrame *input, VFrame *output)
                        -1, x,y, ow, oh);
        }
 
-       if( config.drag )
+       if( is_dragging() )
                draw_boundry();
 
        return 1;
@@ -682,7 +695,7 @@ int BoxBlurH::handle_event()
 }
 
 BoxBlurDrag::BoxBlurDrag(BoxBlurWindow *gui, BoxBlurEffect *plugin, int x, int y)
- : DragCheckBox(plugin->server->mwindow, x, y, _("Drag"), &plugin->config.drag,
+ : DragCheckBox(plugin->server->mwindow, x, y, _("Drag"), &plugin->drag,
                plugin->config.box_x, plugin->config.box_y,
                plugin->config.box_w, plugin->config.box_h)
 {
@@ -711,7 +724,7 @@ int64_t BoxBlurDrag::get_drag_position()
 
 void BoxBlurDrag::update_gui()
 {
-       plugin->config.drag = get_value();
+       plugin->drag = get_value();
        plugin->config.box_x = drag_x;
        plugin->config.box_y = drag_y;
        plugin->config.box_w = drag_w+0.5;
@@ -726,6 +739,7 @@ void BoxBlurDrag::update_gui()
 int BoxBlurDrag::handle_event()
 {
        int ret = DragCheckBox::handle_event();
+       plugin->drag = get_value();
        plugin->send_configure_change();
        return ret;
 }
index 8431842294a62fbda76e1535f8ddb8b1d7e893a2..8686613c3d38220188017b6af2b9954aad36a113 100644 (file)
@@ -67,8 +67,6 @@ CriKeyConfig::CriKeyConfig()
 {
        threshold = 0.5f;
        draw_mode = DRAW_ALPHA;
-       drag = 0;
-       selected = 0;
 }
 CriKeyConfig::~CriKeyConfig()
 {
@@ -78,7 +76,6 @@ int CriKeyConfig::equivalent(CriKeyConfig &that)
 {
        if( !EQUIV(this->threshold, that.threshold) ) return 0;
        if( this->draw_mode != that.draw_mode ) return 0;
-       if( this->drag != that.drag ) return 0;
        if( this->points.size() != that.points.size() ) return 0;
        for( int i=0, n=points.size(); i<n; ++i ) {
                CriKeyPoint *ap = this->points[i], *bp = that.points[i];
@@ -95,8 +92,6 @@ void CriKeyConfig::copy_from(CriKeyConfig &that)
 {
        this->threshold = that.threshold;
        this->draw_mode = that.draw_mode;
-       this->drag = that.drag;
-       this->selected = that.selected;
 
        points.remove_all_objects();
        for( int i=0,n=that.points.size(); i<n; ++i ) {
@@ -110,8 +105,6 @@ void CriKeyConfig::interpolate(CriKeyConfig &prev, CriKeyConfig &next,
 {
        this->threshold = prev.threshold;
        this->draw_mode = prev.draw_mode;
-       this->drag = prev.drag;
-       this->selected = prev.selected;
 
        double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
        double prev_scale = (double)(next_frame - current_frame) / (next_frame - prev_frame);
@@ -234,6 +227,9 @@ CriKey::CriKey(PluginServer *server)
        engine = 0;
        msk = 0;
        edg = 0;
+
+       drag = 0;
+       selected = 0;
 }
 
 CriKey::~CriKey()
@@ -265,6 +261,21 @@ int CriKey::is_realtime() { return 1; }
 NEW_WINDOW_MACRO(CriKey, CriKeyWindow);
 LOAD_CONFIGURATION_MACRO(CriKey, CriKeyConfig)
 
+void CriKey::render_gui(void *data)
+{
+       CriKey *crikey = (CriKey *)data;
+       crikey->drag = drag;
+       crikey->selected = selected;
+}
+
+int CriKey::is_dragging()
+{
+       drag = 0;
+       selected = 0;
+       send_render_gui(this);
+       return drag;
+}
+
 int CriKey::new_point()
 {
        EDLSession *session = get_edl()->session;
@@ -283,8 +294,6 @@ void CriKeyConfig::save_data(KeyFrame *keyframe)
        output.tag.set_title("CRIKEY");
        output.tag.set_property("THRESHOLD", threshold);
        output.tag.set_property("DRAW_MODE", draw_mode);
-       output.tag.set_property("DRAG", drag);
-       output.tag.set_property("SELECTED", selected);
        output.append_tag();
        output.append_newline();
        output.tag.set_title("/CRIKEY");
@@ -306,7 +315,6 @@ void CriKeyConfig::save_data(KeyFrame *keyframe)
        }
        output.terminate_string();
 }
-
 void CriKey::save_data(KeyFrame *keyframe)
 {
        config.save_data(keyframe);
@@ -323,8 +331,6 @@ void CriKeyConfig::read_data(KeyFrame *keyframe)
                if( input.tag.title_is("CRIKEY") ) {
                        threshold = input.tag.get_property("THRESHOLD", threshold);
                        draw_mode = input.tag.get_property("DRAW_MODE", draw_mode);
-                       drag = input.tag.get_property("DRAG", drag);
-                       selected = input.tag.get_property("SELECTED", 0);
                        limits();
                }
                else if( !strncmp(input.tag.get_title(),"POINT_",6) ) {
@@ -337,11 +343,11 @@ void CriKeyConfig::read_data(KeyFrame *keyframe)
                }
        }
 }
-
 void CriKey::read_data(KeyFrame *keyframe)
 {
        config.read_data(keyframe);
-       if( !config.points.size() ) new_point();
+       if( !config.points.size() )
+               new_point();
 }
 
 void CriKey::span_keyframes(KeyFrame *src, int64_t start, int64_t end)
@@ -378,8 +384,6 @@ void CriKey::update_parameter(CriKeyConfig &prev_config, CriKeyConfig &src_confi
                dst_config.threshold = src_config.threshold;
        if( prev_config.draw_mode != src_config.draw_mode )
                dst_config.draw_mode = src_config.draw_mode;
-       if( prev_config.drag != src_config.drag )
-               dst_config.drag = src_config.drag;
        int src_points = src_config.points.size();
        int dst_points = dst_config.points.size();
        int prev_points = prev_config.points.size();
@@ -689,10 +693,10 @@ int CriKey::process_buffer(VFrame *frame, int64_t start_position, double frame_r
        case DRAW_MASK:  draw_mask(msk);   break;
        }
 
-       if( config.drag ) {
+       if( is_dragging() ) {
                for( int i=0, n=config.points.size(); i<n; ++i ) {
                        CriKeyPoint *pt = config.points[i];
-                       src->set_pixel_color(config.selected == i ? GREEN : WHITE);
+                       src->set_pixel_color(selected == i ? GREEN : WHITE);
                        draw_point(src, pt);
                }
        }
index ca452b04de462a65c7f9c623719bb41bd43f3c23..6cb3aa4f5ff85b68804abedb670c8c395a523229 100644 (file)
@@ -74,7 +74,6 @@ public:
 
        float threshold;
        int draw_mode;
-       int drag, selected;
 };
 
 class CriKeyPackage : public LoadPackage
@@ -121,8 +120,10 @@ public:
 // required for all realtime plugins
        PLUGIN_CLASS_MEMBERS2(CriKeyConfig)
        int is_realtime();
-       void update_gui();
+       void render_gui(void *data);
+       int is_dragging();
        int new_point();
+       void update_gui();
        int set_target(float *color, int x, int y);
        void save_data(KeyFrame *keyframe);
        void read_data(KeyFrame *keyframe);
@@ -139,6 +140,7 @@ public:
        VFrame *src, *edg, *msk;
        int w, h, color_model, bpp, comp;
        int is_yuv, is_float;
+       int drag, selected;
 };
 
 #endif
index d2d6c6ce1f3ed5322ee3a633a3c9fdf5b75be099..ec3ee2e0c7678bcdb20cb98db779c9779be78afd 100644 (file)
@@ -146,7 +146,7 @@ void CriKeyWindow::create_objects()
        draw_mode->create_objects();
        y += draw_mode->get_h() + ys10 + margin;
 
-       CriKeyPoint *pt = plugin->config.points[plugin->config.selected];
+       CriKeyPoint *pt = plugin->config.points[plugin->selected];
        add_subwindow(title_x = new BC_Title(x, y, _("X:")));
        x1 = x + title_x->get_w() + margin;
        point_x = new CriKeyPointX(this, x1, y, pt->x);
@@ -171,7 +171,7 @@ void CriKeyWindow::create_objects()
        y += threshold->get_h() + margin;
 
        add_subwindow(drag = new CriKeyDrag(this, x, y));
-       if( plugin->config.drag ) {
+       if( plugin->drag ) {
                if( !grab(plugin->server->mwindow->cwindow->gui) )
                        eprintf("drag enabled, but compositor already grabbed\n");
        }
@@ -180,7 +180,7 @@ void CriKeyWindow::create_objects()
        y += drag->get_h() + margin;
 
        add_subwindow(point_list = new CriKeyPointList(this, plugin, x, y));
-       point_list->update(plugin->config.selected);
+       point_list->update(plugin->selected);
 
        y += point_list->get_h() + ys10;
        add_subwindow(notes = new BC_Title(x, y,
@@ -470,7 +470,7 @@ void CriKeyPointList::update(int k)
        if( k >= 0 && k < sz ) {
                gui->point_x->update(gui->point_list->cols[PT_X].get(k)->get_text());
                gui->point_y->update(gui->point_list->cols[PT_Y].get(k)->get_text());
-               plugin->config.selected = k;
+               plugin->selected = k;
        }
 
        update_list(k);
@@ -478,9 +478,9 @@ void CriKeyPointList::update(int k)
 
 void CriKeyWindow::update_gui()
 {
-       draw_mode->update(plugin->config.draw_mode);
        threshold->update(plugin->config.threshold);
-       drag->update(plugin->config.drag);
+       draw_mode->update(plugin->config.draw_mode);
+       drag->update(plugin->drag);
        point_list->update(-1);
 }
 
@@ -568,7 +568,7 @@ int CriKeyPointDn::handle_event()
 }
 
 CriKeyDrag::CriKeyDrag(CriKeyWindow *gui, int x, int y)
- : BC_CheckBox(x, y, gui->plugin->config.drag, _("Drag"))
+ : BC_CheckBox(x, y, gui->plugin->drag, _("Drag"))
 {
        this->gui = gui;
 }
@@ -584,7 +584,7 @@ int CriKeyDrag::handle_event()
        }
        else
                gui->ungrab(cwindow_gui);
-       gui->plugin->config.drag = value;
+       gui->plugin->drag = value;
        gui->send_configure_change();
        return 1;
 }
@@ -594,8 +594,7 @@ int CriKeyWindow::handle_ungrab()
        int ret = ungrab(cwindow_gui);
        if( ret ) {
                drag->update(0);
-               plugin->config.drag = 0;
-               send_configure_change();
+               plugin->drag = 0;
        }
        return ret;
 }
index c57bfc0bda5888c22f69b0663bafa8f90135c9e5..151b42e11a0d6efadbe3a041bfb84d8b0443d7a3 100644 (file)
@@ -165,20 +165,24 @@ void SketcherCurve::read_data(FileXML &input)
        bclamp(pen, 0, PEN_SZ-1);
 }
 
-int Sketcher::new_curve(int pen, int width, int color)
+int SketcherConfig::new_curve(int pen, int width, int color)
 {
-       SketcherCurves &curves = config.curves;
        int k = curves.size(), id = 1;
        for( int i=k; --i>=0; ) {
-               int n = config.curves[i]->id;
+               int n = curves[i]->id;
                if( n >= id ) id = n + 1;
        }
        SketcherCurve *cv = new SketcherCurve(id, pen, width, color);
        curves.append(cv);
-       config.cv_selected = k;
        return k;
 }
 
+int Sketcher::new_curve(int pen, int width, int color)
+{
+       cv_selected = config.new_curve(pen, width, color);
+       return cv_selected;
+}
+
 int Sketcher::new_curve()
 {
        return new_curve(PEN_XLANT, 1, CV_COLOR);
@@ -200,7 +204,7 @@ int Sketcher::new_point(SketcherCurve *cv, int arc, coord x, coord y, int idx)
 
 int Sketcher::new_point(int idx, int arc)
 {
-       int ci = config.cv_selected;
+       int ci = cv_selected;
        if( ci < 0 || ci >= config.curves.size() )
                return -1;
        SketcherCurve *cv = config.curves[ci];
@@ -243,10 +247,7 @@ REGISTER_PLUGIN(Sketcher)
 
 SketcherConfig::SketcherConfig()
 {
-       drag = 1;
        aliasing = 0;
-       cv_selected = 0;
-       pt_selected = 0;
 }
 SketcherConfig::~SketcherConfig()
 {
@@ -254,10 +255,7 @@ SketcherConfig::~SketcherConfig()
 
 int SketcherConfig::equivalent(SketcherConfig &that)
 {
-       if( this->drag != that.drag ) return 0;
        if( this->aliasing != that.aliasing ) return 0;
-       if( this->cv_selected != that.cv_selected ) return 0;
-       if( this->pt_selected != that.pt_selected ) return 0;
        if( this->curves.size() != that.curves.size() ) return 0;
        for( int i=0, n=curves.size(); i<n; ++i ) {
                if( !curves[i]->equivalent(*that.curves[i]) ) return 0;
@@ -267,10 +265,7 @@ int SketcherConfig::equivalent(SketcherConfig &that)
 
 void SketcherConfig::copy_from(SketcherConfig &that)
 {
-       this->drag = that.drag;
        this->aliasing = that.aliasing;
-       this->cv_selected = that.cv_selected;
-       this->pt_selected = that.pt_selected;
        int m = curves.size(), n = that.curves.size();
        while( m > n ) curves.remove_object_number(--m);
        while( m < n ) { curves.append(new SketcherCurve());  ++m; }
@@ -280,9 +275,6 @@ void SketcherConfig::copy_from(SketcherConfig &that)
 void SketcherConfig::interpolate(SketcherConfig &prev, SketcherConfig &next,
                long prev_frame, long next_frame, long current_frame)
 {
-       this->cv_selected = prev.cv_selected;
-       this->pt_selected = prev.pt_selected;
-       this->drag = prev.drag;
        this->aliasing = prev.aliasing;
 
        double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
@@ -342,6 +334,10 @@ Sketcher::Sketcher(PluginServer *server)
        img = 0;
        out = 0;
        overlay_frame = 0;
+
+       drag = 1;
+       cv_selected = 0;
+       pt_selected = 0;
 }
 
 Sketcher::~Sketcher()
@@ -358,6 +354,24 @@ int Sketcher::is_synthesis() { return 1; }
 NEW_WINDOW_MACRO(Sketcher, SketcherWindow);
 LOAD_CONFIGURATION_MACRO(Sketcher, SketcherConfig)
 
+void Sketcher::render_gui(void *data)
+{
+       Sketcher *sketcher = (Sketcher *)data;
+       sketcher->drag = drag;
+       sketcher->cv_selected = cv_selected;
+       sketcher->pt_selected = pt_selected;
+}
+
+int Sketcher::is_dragging()
+{
+       drag = 0;
+       cv_selected = -1;
+       pt_selected = -1;
+       send_render_gui(this);
+       return drag;
+}
+
+
 void SketcherConfig::save_data(KeyFrame *keyframe)
 {
        FileXML output;
@@ -365,10 +379,7 @@ void SketcherConfig::save_data(KeyFrame *keyframe)
        output.set_shared_output(keyframe->xbuf);
 
        output.tag.set_title("SKETCHER");
-       output.tag.set_property("DRAG", drag);
        output.tag.set_property("ALIASING", aliasing);
-       output.tag.set_property("CV_SELECTED", cv_selected);
-       output.tag.set_property("PT_SELECTED", pt_selected);
        output.append_tag();
        output.append_newline();
        for( int i=0,n=curves.size(); i<n; ++i ) {
@@ -395,10 +406,7 @@ void SketcherConfig::read_data(KeyFrame *keyframe)
 
        while( !(result=input.read_tag()) ) {
                if( input.tag.title_is("SKETCHER") ) {
-                       drag = input.tag.get_property("DRAG", drag);
                        aliasing = input.tag.get_property("ALIASING", aliasing);
-                       cv_selected = input.tag.get_property("CV_SELECTED", 0);
-                       pt_selected = input.tag.get_property("PT_SELECTED", 0);
                }
                else if( !strncmp(input.tag.get_title(),"CURVE_",6) ) {
                        cv = new SketcherCurve();
@@ -428,7 +436,6 @@ void Sketcher::read_data(KeyFrame *keyframe)
                new_curve();
 }
 
-
 void SketcherPoint::update_parameter(SketcherPoint *prev, SketcherPoint *src)
 {
        if( prev->arc != src->arc ) arc = src->arc;
@@ -475,14 +482,8 @@ void Sketcher::update_parameter(SketcherConfig &prev_config, SketcherConfig &src
 {
        SketcherConfig dst_config;
        dst_config.read_data(keyframe);
-       if( prev_config.drag != src_config.drag )
-               dst_config.drag = src_config.drag;
        if( prev_config.aliasing != src_config.aliasing )
                dst_config.aliasing = src_config.aliasing;
-       if( prev_config.cv_selected != src_config.cv_selected )
-               dst_config.cv_selected = src_config.cv_selected;
-       if( prev_config.pt_selected != src_config.pt_selected )
-               dst_config.pt_selected = src_config.pt_selected;
        int src_curves = src_config.curves.size();
        int dst_curves = dst_config.curves.size();
        int prev_curves = prev_config.curves.size();
@@ -847,11 +848,11 @@ int Sketcher::process_realtime(VFrame *input, VFrame *output)
                                1.f, TRANSFER_SRC_OVER, NEAREST_NEIGHBOR);
        }
 
-       if( config.drag ) {
+       if( is_dragging() ) {
                for( int ci=0, n=config.curves.size(); ci<n; ++ci ) {
                        SketcherCurve *cv = config.curves[ci];
                        for( int pi=0,m=cv->points.size(); pi<m; ++pi ) {
-                               int color = pi==config.pt_selected && ci==config.cv_selected ?
+                               int color = pi==pt_selected && ci==cv_selected ?
                                        RED : cv->color ; 
                                draw_point(out, cv->points[pi], color);
                        }
@@ -887,8 +888,7 @@ void SketcherCurves::dump()
 }
 void SketcherConfig::dump()
 {
-       printf("Config drag=%d, cv_selected=%d, pt_selected=%d %d curves\n",
-                       drag, cv_selected, pt_selected, curves.size());
+       printf("Config %d curves\n", curves.size());
        curves.dump();
 }
 
index c8f3be5fda3ea5d15db5195397935491a3815a1d..3fb1afb1e27555c04f453ef98d62bccccc776de0 100644 (file)
@@ -165,12 +165,11 @@ public:
        void interpolate(SketcherConfig &prev, SketcherConfig &next,
                long prev_frame, long next_frame, long current_frame);
        double nearest_point(int &ci, int &pi, coord x, coord y);
+       int new_curve(int pen, int width, int color);
        void limits();
        void dump();
 
-       int drag;
        int aliasing;
-       int cv_selected, pt_selected;
 };
 
 class Sketcher : public PluginVClient
@@ -182,6 +181,8 @@ public:
        int is_realtime();
        int is_synthesis();
        void update_gui();
+       void render_gui(void *data);
+       int is_dragging();
        void save_data(KeyFrame *keyframe);
        void read_data(KeyFrame *keyframe);
        void span_keyframes(KeyFrame *src, int64_t start, int64_t end);
@@ -200,6 +201,8 @@ public:
        OverlayFrame *overlay_frame;
        int w, h, color_model, bpp, comp;
        int is_yuv, is_float;
+       int drag;
+       int cv_selected, pt_selected;
 };
 
 #endif
index 22abb7345aa8913f493d54e945ae4765d3aba793..796a84c4312a0920cde427caa84b0d8976d8aabf 100644 (file)
@@ -68,7 +68,7 @@ int SketcherCurvePenItem::handle_event()
        popup->update(pen);
        SketcherWindow *gui = popup->gui;
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                cv->pen = pen;
@@ -112,7 +112,7 @@ void SketcherCurveColor::handle_done_event(int result)
 {
        if( result ) color = orig_color | (~orig_alpha<<24);
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                cv->color = color;
@@ -129,7 +129,7 @@ int SketcherCurveColor::handle_new_color(int color, int alpha)
        gui->lock_window("SketcherCurveColor::update_gui");
        update_gui(color);
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 ) {
                SketcherCurve *cv = config.curves[ci];
                cv->color = color;
@@ -167,11 +167,11 @@ int SketcherPointX::handle_event()
 {
        if( !SketcherCoord::handle_event() ) return 0;
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                SketcherPointList *point_list = gui->point_list;
-               int pi = config.pt_selected;
+               int pi = gui->plugin->pt_selected;
                SketcherPoints &points = cv->points;
                if( pi >= 0 && pi < points.size() ) {
                        coord v = atof(get_text());
@@ -187,11 +187,11 @@ int SketcherPointY::handle_event()
 {
        if( !SketcherCoord::handle_event() ) return 0;
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                SketcherPointList *point_list = gui->point_list;
-               int pi = config.pt_selected;
+               int pi = gui->plugin->pt_selected;
                SketcherPoints &points = cv->points;
                if( pi >= 0 && pi < points.size() ) {
                        coord v = atof(get_text());
@@ -208,11 +208,11 @@ int SketcherPointId::handle_event()
 {
        if( !SketcherNum::handle_event() ) return 0;
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                SketcherPointList *point_list = gui->point_list;
-               int pi = config.pt_selected;
+               int pi = gui->plugin->pt_selected;
                SketcherPoints &points = cv->points;
                if( pi >= 0 && pi < points.size() ) {
                        int id = atoi(get_text());
@@ -238,7 +238,7 @@ int SketcherCurveWidth::handle_event()
 {
        if( !SketcherNum::handle_event() ) return 0;
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                int v = atoi(get_text());
@@ -344,7 +344,7 @@ void SketcherWindow::create_objects()
        int x = xS(10), y = yS(10), dy = 0, x1, y1;
        int margin = plugin->get_theme()->widget_border;
        BC_Title *title;
-       int ci = plugin->config.cv_selected;
+       int ci = plugin->cv_selected;
        if( ci < 0 || ci >= plugin->config.curves.size() )
                ci = plugin->new_curve();
        SketcherCurve *cv = plugin->config.curves[ci];
@@ -410,15 +410,15 @@ void SketcherWindow::create_objects()
        add_subwindow(bar);             dy = bmax(dy,bar->get_h());
        y += dy + yS(2)*margin;
 
-       int pi = plugin->config.pt_selected;
+       int pi = plugin->pt_selected;
        SketcherPoint *pt = pi >= 0 && pi < cv->points.size() ? cv->points[pi] : 0;
        reset_points = new SketcherResetPoints(this, plugin, x1=x, y+yS(3));
        add_subwindow(reset_points);    dy = bmax(dy,reset_points->get_h());
        x1 += reset_points->get_w() + xS(2)*margin;
-       if( plugin->config.drag ) {
+       if( plugin->drag ) {
                if( !grab(plugin->server->mwindow->cwindow->gui) ) {
                        eprintf("drag enabled, but compositor already grabbed\n");
-                       plugin->config.drag = 0;
+                       plugin->drag = 0;
                }
        }
        drag = new SketcherDrag(this, x1, y);
@@ -613,7 +613,7 @@ int SketcherWindow::do_grab_event(XEvent *event)
 int SketcherWindow::grab_button_press(XEvent *event)
 {
        SketcherConfig &config = plugin->config;
-       int ci = config.cv_selected;
+       int ci = plugin->cv_selected;
        if( ci < 0 || ci >= plugin->config.curves.size() )
                return 0;
         MWindow *mwindow = plugin->server->mwindow;
@@ -623,7 +623,7 @@ int SketcherWindow::grab_button_press(XEvent *event)
        SketcherCurves &curves = config.curves;
        SketcherCurve *cv = curves[ci];
        SketcherPoints &points = cv->points;
-       int pi = config.pt_selected;
+       int pi = plugin->pt_selected;
 
        float s = 1.001; // min scale
        float th = 0.1 * M_PI/180.f; // min theta .1 deg per wheel_btn
@@ -724,13 +724,13 @@ int SketcherWindow::grab_cursor_motion()
                return 0;
        pending_motion = 0;
        SketcherConfig &config = plugin->config;
-       int ci = config.cv_selected;
+       int ci = plugin->cv_selected;
        if( ci < 0 || ci >= plugin->config.curves.size() )
                return 0;
        SketcherCurves &curves = config.curves;
        SketcherCurve *cv = curves[ci];
        SketcherPoints &points = cv->points;
-       int pi = config.pt_selected;
+       int pi = plugin->pt_selected;
 
        if( (state & ShiftMask) ) {  // string of points
                if( (state & (Button1Mask|Button3Mask)) ) {
@@ -874,7 +874,7 @@ void SketcherCurveList::set_selected(int k)
                gui->curve_color->update_gui(cv->color);
                ci = k;
        }
-       plugin->config.cv_selected = ci;
+       plugin->cv_selected = ci;
        update_list(ci);
 }
 
@@ -932,7 +932,7 @@ int SketcherNewCurve::handle_event()
        int pen = gui->curve_pen->pen;
        int color = gui->curve_color->color;
        int width = gui->curve_width->width;
-       int ci = plugin->config.cv_selected;
+       int ci = plugin->cv_selected;
        if( ci >= 0 && ci < plugin->config.curves.size() ) {
                SketcherCurve *cv = plugin->config.curves[ci];
                pen = cv->pen;  width = cv->width;  color = cv->color;
@@ -956,7 +956,7 @@ SketcherDelCurve::~SketcherDelCurve()
 int SketcherDelCurve::handle_event()
 {
        SketcherConfig &config = plugin->config;
-       int ci = config.cv_selected;
+       int ci = plugin->cv_selected;
        SketcherCurves &curves = config.curves;
        if( ci >= 0 && ci < curves.size() ) {
                curves.remove_object_number(ci--);
@@ -982,7 +982,7 @@ SketcherCurveUp::~SketcherCurveUp()
 int SketcherCurveUp::handle_event()
 {
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        SketcherCurves &curves = config.curves;
        if( ci > 0 && ci < curves.size() ) {
                SketcherCurve *&cv0 = curves[ci];
@@ -1006,7 +1006,7 @@ SketcherCurveDn::~SketcherCurveDn()
 int SketcherCurveDn::handle_event()
 {
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        SketcherCurves &curves = config.curves;
        if( ci >= 0 && ci < curves.size()-1 ) {
                SketcherCurve *&cv0 = curves[ci];
@@ -1031,12 +1031,11 @@ int SketcherPointTypeItem::handle_event()
        SketcherWindow *gui = popup->gui;
        SketcherConfig &config = gui->plugin->config;
        SketcherCurves &curves = config.curves;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci < 0 || ci >= curves.size() )
                return 1;
        SketcherCurve *cv = curves[ci];
        SketcherPoints &points = cv->points;
-       int pi = config.pt_selected;
 
        ArrayList<int> selected;
        for( int v,i=0; (v=gui->point_list->get_selection_number(0, i))>=0; ++i )
@@ -1050,6 +1049,7 @@ int SketcherPointTypeItem::handle_event()
                gui->point_list->set_point(k, PT_TY, _(pt_type[arc]));
        }
 
+       int pi = gui->plugin->pt_selected;
        gui->point_list->update_list(pi);
        gui->send_configure_change();
        return 1;
@@ -1143,7 +1143,7 @@ void SketcherPointList::set_point(int i, int c, const char *cp)
 void SketcherPointList::set_selected(int k)
 {
        SketcherPoint *pt = 0;
-       int ci = plugin->config.cv_selected, pi = -1;
+       int ci = plugin->cv_selected, pi = -1;
        if( ci >= 0 && ci < plugin->config.curves.size() ) {
                SketcherCurve *cv = plugin->config.curves[ci];
                pt = k >= 0 && k < cv->points.size() ? cv->points[pi=k] : 0;
@@ -1152,7 +1152,7 @@ void SketcherPointList::set_selected(int k)
        gui->point_x->update(pt ? pt->x : 0.f);
        gui->point_y->update(pt ? pt->y : 0.f);
        gui->point_id->update(pt ? pt->id : 0);
-       plugin->config.pt_selected = pi;
+       plugin->pt_selected = pi;
        update_list(pi);
 }
 void SketcherPointList::update_list(int k)
@@ -1165,7 +1165,7 @@ void SketcherPointList::update_list(int k)
 void SketcherPointList::update(int k)
 {
        clear();
-       int ci = plugin->config.cv_selected, sz = 0;
+       int ci = plugin->cv_selected, sz = 0;
        if( ci >= 0 && ci < plugin->config.curves.size() ) {
                SketcherCurve *cv = plugin->config.curves[ci];
                SketcherPoints &points = cv->points;
@@ -1185,19 +1185,19 @@ void SketcherPointList::update(int k)
 void SketcherWindow::update_gui()
 {
        SketcherConfig &config = plugin->config;
-       int ci = config.cv_selected;
-       int pi = config.pt_selected;
-       curve_list->update(ci);
-       point_list->update(pi);
+       curve_list->update(plugin->cv_selected);
+       point_list->update(plugin->pt_selected);
+       int ci = plugin->cv_selected;
        SketcherCurve *cv = ci >= 0 ? config.curves[ci] : 0;
        curve_width->update(cv ? cv->width : 1);
        curve_pen->update(cv ? cv->pen : PEN_SQUARE);
        curve_color->set_color(cv ? cv->color : CV_COLOR);
-       SketcherPoint *pt = pi >= 0 ? cv->points[pi] : 0;
+       int pi = plugin->pt_selected;
+       SketcherPoint *pt = pi >= 0 && pi<cv->points.size() ? cv->points[pi] : 0;
        point_x->update(pt ? pt->x : 0);
        point_y->update(pt ? pt->y : 0);
        point_id->update(pt ? pt->id : 0);
-       drag->update(plugin->config.drag);
+       drag->update(plugin->drag);
 }
 
 
@@ -1213,14 +1213,16 @@ SketcherPointUp::~SketcherPointUp()
 int SketcherPointUp::handle_event()
 {
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci < 0 || ci >= config.curves.size() )
                return 1;
        SketcherCurve *cv = config.curves[ci];
        SketcherPoints &points = cv->points;
        if( points.size() < 2 )
                return 1;
-       int pi = config.pt_selected;
+       int pi = gui->plugin->pt_selected;
+       if( pi < 0 || pi >= points.size() )
+               return 1;
 
        ArrayList<int> selected;
        for( int v,i=0; (v=gui->point_list->get_selection_number(0, i))>=0; ++i )
@@ -1251,7 +1253,7 @@ SketcherPointDn::~SketcherPointDn()
 int SketcherPointDn::handle_event()
 {
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci < 0 || ci >= config.curves.size() )
                return 1;
        SketcherCurve *cv = config.curves[ci];
@@ -1259,7 +1261,9 @@ int SketcherPointDn::handle_event()
        int sz1 = points.size()-1;
        if( sz1 < 1 )
                return 1;
-       int pi = config.pt_selected;
+       int pi = gui->plugin->pt_selected;
+       if( pi < 0 || pi >= points.size() )
+               return 1;
 
        ArrayList<int> selected;
        for( int v,i=0; (v=gui->point_list->get_selection_number(0, i))>=0; ++i )
@@ -1279,7 +1283,7 @@ int SketcherPointDn::handle_event()
 }
 
 SketcherDrag::SketcherDrag(SketcherWindow *gui, int x, int y)
- : BC_CheckBox(x, y, gui->plugin->config.drag, (C_("Drag")))
+ : BC_CheckBox(x, y, gui->plugin->drag, (C_("Drag")))
 {
        this->gui = gui;
 }
@@ -1295,7 +1299,7 @@ int SketcherDrag::handle_event()
        }
        else
                gui->ungrab(cwindow_gui);
-       gui->plugin->config.drag = value;
+       gui->plugin->drag = value;
        gui->send_configure_change();
        return 1;
 }
@@ -1305,8 +1309,7 @@ int SketcherWindow::handle_ungrab()
        int ret = ungrab(cwindow_gui);
        if( ret ) {
                drag->update(0);
-               plugin->config.drag = 0;
-               send_configure_change();
+               plugin->drag = 0;
        }
        return ret;
 }
@@ -1322,9 +1325,18 @@ SketcherNewPoint::~SketcherNewPoint()
 }
 int SketcherNewPoint::handle_event()
 {
-       int pi = plugin->config.pt_selected;
+       SketcherConfig &config = gui->plugin->config;
+       SketcherCurves &curves = config.curves;
+       int ci = gui->plugin->cv_selected;
+       if( ci < 0 || ci >= curves.size() )
+               return -1;
+       SketcherCurve *cv = curves[ci];
+       SketcherPoints &points = cv->points;
+       int pi = gui->plugin->pt_selected;
+       if( pi < 0 || pi >= points.size() )
+               return -1;
        int arc = gui->point_type->type;
-       int k = plugin->new_point(pi+1, arc);
+       int k = plugin->new_point(pi<0 ? 0 : pi+1, arc);
        gui->point_list->update(k);
        gui->send_configure_change();
        return 1;
@@ -1343,12 +1355,14 @@ int SketcherDelPoint::handle_event()
 {
        SketcherConfig &config = gui->plugin->config;
        SketcherCurves &curves = config.curves;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci < 0 || ci >= curves.size() )
                return 1;
        SketcherCurve *cv = curves[ci];
        SketcherPoints &points = cv->points;
-       int pi = config.pt_selected;
+       int pi = gui->plugin->pt_selected;
+       if( pi < 0 || pi >= points.size() )
+               return 1;
 
        ArrayList<int> selected;
        for( int v,i=0; (v=gui->point_list->get_selection_number(0, i))>=0; ++i )
@@ -1397,7 +1411,7 @@ SketcherResetPoints::~SketcherResetPoints()
 int SketcherResetPoints::handle_event()
 {
        SketcherConfig &config = gui->plugin->config;
-       int ci = config.cv_selected;
+       int ci = gui->plugin->cv_selected;
        if( ci >= 0 && ci < config.curves.size() ) {
                SketcherCurve *cv = config.curves[ci];
                cv->points.remove_all_objects();
index 6722704d2ed0567ac86a6df571c997e72e811d5b..28333d4ee70544ed96511e7698d4dfe454e4b295 100644 (file)
@@ -114,7 +114,6 @@ TitleConfig::TitleConfig()
        background = 0;
        strcpy(background_path, "");
        timecode_format = DEFAULT_TIMECODEFORMAT;
-       drag = 0;
        loop_playback = 0;
 }
 
@@ -154,7 +153,6 @@ int TitleConfig::equivalent(TitleConfig &that)
                background == that.background &&
                !strcmp(background_path, that.background_path) &&
                timecode_format == that.timecode_format &&
-//             drag == that.drag &&
                loop_playback == that.loop_playback;
 }
 
@@ -189,7 +187,6 @@ void TitleConfig::copy_from(TitleConfig &that)
        background = that.background;
        strcpy(background_path, that.background_path);
        timecode_format = that.timecode_format;
-       drag = that.drag;
        loop_playback = that.loop_playback;
 }
 
@@ -236,7 +233,6 @@ void TitleConfig::interpolate(TitleConfig &prev, TitleConfig &next,
        background = prev.background;
        strcpy(background_path, prev.background_path);
        timecode_format = prev.timecode_format;
-       drag = prev.drag;
        loop_playback = prev.loop_playback;
 }
 
@@ -935,6 +931,7 @@ TitleMain::TitleMain(PluginServer *server)
        if( cpus > 8 ) cpus = 8;
        last_position = -1;
        need_reconfigure = 1;
+       drag = 0;
 }
 
 TitleMain::~TitleMain()
@@ -968,6 +965,18 @@ int TitleMain::is_synthesis() { return 1; }
 
 NEW_WINDOW_MACRO(TitleMain, TitleWindow);
 
+void TitleMain::render_gui(void *data)
+{
+       TitleMain *tilter = (TitleMain *)data;
+       tilter->drag = drag;
+}
+
+int TitleMain::is_dragging()
+{
+       drag = 0;
+       send_render_gui(this);
+       return drag;
+}
 
 void TitleMain::build_previews(TitleWindow *gui)
 {
@@ -2452,7 +2461,7 @@ int TitleMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
        if( !result )
                draw_overlay();
 
-       if( config.drag )
+       if( is_dragging() )
                draw_boundry();
 
        return 0;
@@ -2545,7 +2554,6 @@ void TitleMain::save_data(KeyFrame *keyframe)
        output.tag.set_property("TIMECODEFORMAT", config.timecode_format);
        output.tag.set_property("WINDOW_W", config.window_w);
        output.tag.set_property("WINDOW_H", config.window_h);
-       output.tag.set_property("DRAG", config.drag);
        output.tag.set_property("BACKGROUND", config.background);
        output.tag.set_property("BACKGROUND_PATH", config.background_path);
        output.tag.set_property("LOOP_PLAYBACK", config.loop_playback);
@@ -2609,7 +2617,6 @@ void TitleMain::read_data(KeyFrame *keyframe)
                        config.timecode_format = input.tag.get_property("TIMECODEFORMAT", config.timecode_format);
                        config.window_w = input.tag.get_property("WINDOW_W", config.window_w);
                        config.window_h = input.tag.get_property("WINDOW_H", config.window_h);
-                       config.drag = input.tag.get_property("DRAG", config.drag);
                        config.background = input.tag.get_property("BACKGROUND", config.background);
                        input.tag.get_property("BACKGROUND_PATH", config.background_path);
                        config.loop_playback = input.tag.get_property("LOOP_PLAYBACK", config.loop_playback);
index c047f990542ef95747f3f621f665a4cf9ce9eec2..6a56744f2c26ba96d0bd0a14543e9e68a28840aa 100644 (file)
@@ -182,8 +182,6 @@ public:
 
 // Time Code Format
        int timecode_format;
-// drag enable
-       int drag;
 // loop background playback
        int loop_playback;
 };
@@ -581,6 +579,8 @@ public:
 
 // required for all realtime plugins
        PLUGIN_CLASS_MEMBERS(TitleConfig)
+       void render_gui(void *data);
+       int is_dragging();
        int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
        int is_realtime();
        int is_synthesis();
@@ -674,6 +674,7 @@ public:
        int64_t last_position;
        int need_reconfigure;
        int cpus;
+       int drag;
 };
 
 
index de6d10cbda4d64c5e6e558ec3c5f99e9d7bc95b6..f8705dfd6d8fe2763767de452ad377b2d73b8fb8 100644 (file)
@@ -261,11 +261,13 @@ void TitleWindow::create_objects()
        add_tool(bold = new TitleBold(client, this, x, y + yS(50)));
        if( bold->get_w() > w1 ) w1 = bold->get_w();
 
+       if( client->drag && drag->drag_activate() ) {
+               eprintf("drag enabled, but compositor already grabbed\n");
+               client->drag = 0;
+       }
        add_tool(drag = new TitleDrag(client, this, x, y + yS(80)));
        drag->create_objects();
        if( drag->get_w() > w1 ) w1 = drag->get_w();
-       if( client->config.drag && drag->drag_activate() )
-               eprintf("drag enabled, but compositor already grabbed\n");
 
        add_tool(alias = new TitleAlias(client, this, x, y+yS(110)));
        if( alias->get_w() > w1 ) w1 = drag->get_w();
@@ -1232,7 +1234,7 @@ int TitleBottom::handle_event()
 }
 
 TitleDrag::TitleDrag(TitleMain *client, TitleWindow *window, int x, int y)
- : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->config.drag,
+ : DragCheckBox(client->server->mwindow, x, y, _("Drag"), &client->drag,
                client->config.title_x, client->config.title_y,
                client->config.title_w, client->config.title_h)
 {
@@ -1254,7 +1256,7 @@ int64_t TitleDrag::get_drag_position()
 
 void TitleDrag::update_gui()
 {
-       client->config.drag = get_value();
+       client->drag = get_value();
        client->config.title_x = drag_x;
        client->config.title_y = drag_y;
        client->config.title_w = drag_w+0.5;
@@ -1269,6 +1271,7 @@ void TitleDrag::update_gui()
 int TitleDrag::handle_event()
 {
        int ret = DragCheckBox::handle_event();
+       client->drag = get_value();
        window->send_configure_change();
        return ret;
 }
index 822b5d78b99cbf93ca8b3b5d17acf703a8c80343..a25654fe1e4f5a9b6f80bcbfc7b7d707fd71ce8a 100644 (file)
@@ -58,11 +58,19 @@ TracerPoint::~TracerPoint()
 {
 }
 
+int Tracer::new_point()
+{
+       EDLSession *session = get_edl()->session;
+       float x = !session ? 0.f : session->output_w / 2.f;
+       float y = !session ? 0.f : session->output_h / 2.f;
+       return config.add_point(x, y);
+}
+
 TracerConfig::TracerConfig()
 {
-       drag = draw = 1;  fill = 0;
+       draw = 1;  fill = 0;
        feather = 0;  radius = 1;
-       invert = 0;  selected = -1;
+       invert = 0;
 }
 TracerConfig::~TracerConfig()
 {
@@ -70,7 +78,6 @@ TracerConfig::~TracerConfig()
 
 int TracerConfig::equivalent(TracerConfig &that)
 {
-       if( this->drag != that.drag ) return 0;
        if( this->draw != that.draw ) return 0;
        if( this->fill != that.fill ) return 0;
        if( this->feather != that.feather ) return 0;
@@ -87,10 +94,8 @@ int TracerConfig::equivalent(TracerConfig &that)
 
 void TracerConfig::copy_from(TracerConfig &that)
 {
-       this->drag = that.drag;
        this->draw = that.draw;
        this->fill = that.fill;
-       this->selected = that.selected;
        this->feather = that.feather;
        this->invert = that.invert;
        this->radius = that.radius;
@@ -139,6 +144,7 @@ Tracer::Tracer(PluginServer *server)
        bx = 0;  by = 0;
        cx = 0;  cy = 0;
        ex = 0;  ey = 0;
+       drag = 0; selected = 0;
 }
 
 Tracer::~Tracer()
@@ -162,12 +168,17 @@ int Tracer::load_configuration1()
 }
 LOAD_CONFIGURATION_MACRO(Tracer, TracerConfig);
 
-int Tracer::new_point()
+void Tracer::render_gui(void *data)
 {
-       EDLSession *session = get_edl()->session;
-       float x = !session ? 0.f : session->output_w / 2.f;
-       float y = !session ? 0.f : session->output_h / 2.f;
-       return config.add_point(x, y);
+       Tracer *tracer = (Tracer *)data;
+       tracer->drag = drag;
+}
+
+int Tracer::is_dragging()
+{
+       drag = 0;
+       send_render_gui(this);
+       return drag;
 }
 
 void TracerConfig::save_data(KeyFrame *keyframe)
@@ -178,13 +189,11 @@ void TracerConfig::save_data(KeyFrame *keyframe)
        output.set_shared_output(keyframe->xbuf);
 
        output.tag.set_title("TRACER");
-       output.tag.set_property("DRAG", drag);
        output.tag.set_property("DRAW", draw);
        output.tag.set_property("FILL", fill);
        output.tag.set_property("FEATHER", feather);
        output.tag.set_property("RADIUS", radius);
        output.tag.set_property("INVERT", invert);
-       output.tag.set_property("SELECTED", selected);
        output.append_tag();
        output.append_newline();
        output.tag.set_title("/TRACER");
@@ -204,7 +213,6 @@ void TracerConfig::save_data(KeyFrame *keyframe)
        }
        output.terminate_string();
 }
-
 void Tracer::save_data(KeyFrame *keyframe)
 {
        config.save_data(keyframe);
@@ -219,13 +227,11 @@ void TracerConfig::read_data(KeyFrame *keyframe)
 
        while( !(result=input.read_tag()) ) {
                if( input.tag.title_is("TRACER") ) {
-                       drag = input.tag.get_property("DRAG", drag);
                        draw = input.tag.get_property("DRAW", draw);
                        fill = input.tag.get_property("FILL", fill);
                        feather = input.tag.get_property("FEATHER", feather);
                        radius = input.tag.get_property("RADIUS", radius);
                        invert = input.tag.get_property("INVERT", invert);
-                       selected = input.tag.get_property("SELECTED", 0);
                        limits();
                }
                else if( !strncmp(input.tag.get_title(),"POINT_",6) ) {
@@ -235,7 +241,6 @@ void TracerConfig::read_data(KeyFrame *keyframe)
                }
        }
 }
-
 void Tracer::read_data(KeyFrame *keyframe)
 {
        config.read_data(keyframe);
@@ -265,12 +270,10 @@ void TracerPoint::update_parameter(TracerPoint *prev, TracerPoint *src)
 }
 
 void Tracer::update_parameter(TracerConfig &prev_config, TracerConfig &src_config,
-                KeyFrame *keyframe)
+               KeyFrame *keyframe)
 {
-        TracerConfig dst_config;
-        dst_config.read_data(keyframe);
-       if( prev_config.drag != src_config.drag )
-               dst_config.drag = src_config.drag;
+       TracerConfig dst_config;
+       dst_config.read_data(keyframe);
        if( prev_config.draw != src_config.draw )
                dst_config.draw = src_config.draw;
        if( prev_config.fill != src_config.fill )
@@ -291,7 +294,7 @@ void Tracer::update_parameter(TracerConfig &prev_config, TracerConfig &src_confi
                TracerPoint *dst_point = dst_config.points[i];
                dst_point->update_parameter(prev_point, src_point);
        }
-        dst_config.save_data(keyframe);
+       dst_config.save_data(keyframe);
 }
 
 void Tracer::update_gui()
@@ -320,7 +323,7 @@ void Tracer::draw_points()
 {
        for( int i=0, n=config.points.size(); i<n; ++i ) {
                TracerPoint *pt = config.points[i];
-               frm->set_pixel_color(config.selected == i ? GREEN : WHITE);
+               frm->set_pixel_color(selected == i ? GREEN : WHITE);
                draw_point(pt);
        }
 }
@@ -748,7 +751,7 @@ int Tracer::process_buffer(VFrame *frame, int64_t start_position, double frame_r
                draw_mask();
        if( config.draw && edg )
                draw_edge();
-       if( config.drag )
+       if( is_dragging() )
                draw_points();
        return 0;
 }
index fdca6d16b8e4c5c3cc838c917451246fa924a39a..d2cfc0caa97e2187a8723f3a25b3b3fb9e025ff2 100644 (file)
@@ -52,9 +52,9 @@ public:
        TracerConfig();
        ~TracerConfig();
 
+       int equivalent(TracerConfig &that);
        void save_data(KeyFrame *keyframe);
        void read_data(KeyFrame *keyframe);
-       int equivalent(TracerConfig &that);
        void copy_from(TracerConfig &that);
        void interpolate(TracerConfig &prev, TracerConfig &next,
                long prev_frame, long next_frame, long current_frame);
@@ -65,10 +65,9 @@ public:
        int add_point();
        void del_point(int i);
 
-       int drag, draw, fill;
+       int draw, fill;
        int invert, feather;
        float radius; 
-       int selected;
 };
 
 class TracePoint
@@ -103,6 +102,8 @@ public:
        PLUGIN_CLASS_MEMBERS2(TracerConfig)
        int is_realtime();
        void update_gui();
+       void render_gui(void *data);
+       int is_dragging();
        int new_point();
        void save_data(KeyFrame *keyframe);
        void read_data(KeyFrame *keyframe);
@@ -132,6 +133,7 @@ public:
        int color_model, bpp;
        int is_float, is_yuv, has_alpha;
        int comps, comp;
+       int drag, selected;
 };
 
 #endif
index 980da954fcf3b13685905489c07527844dc73084..653f8624f46e340581526dfe8bad56cc3c0ab10b 100644 (file)
@@ -110,10 +110,12 @@ void TracerWindow::create_objects()
 {
        int x = xS(10), y = yS(10);
        int margin = plugin->get_theme()->widget_border;
-       int hot_point = plugin->config.selected;
+       int hot_point = plugin->selected;
        add_subwindow(title_x = new BC_Title(x, y, _("X:")));
        int x1 = x + title_x->get_w() + margin;
-       TracerPoint *pt = hot_point >= 0 ? plugin->config.points[hot_point] : 0;
+       TracerPoints &points = plugin->config.points;
+       TracerPoint *pt = hot_point >= 0 && hot_point<points.size() ?
+               points[hot_point] : 0;
        point_x = new TracerPointX(this, x1, y, !pt ? 0 : pt->x);
        point_x->create_objects();
        x1 += point_x->get_w() + margin + xS(20);
@@ -132,7 +134,7 @@ void TracerWindow::create_objects()
        y += point_y->get_h() + margin + yS(10);
 
        add_subwindow(drag = new TracerDrag(this, x, y));
-       if( plugin->config.drag ) {
+       if( plugin->drag ) {
                if( !grab(plugin->server->mwindow->cwindow->gui) )
                        eprintf("drag enabled, but compositor already grabbed\n");
        }
@@ -156,7 +158,7 @@ void TracerWindow::create_objects()
        y += radius->get_h() + margin + yS(5);
 
        add_subwindow(point_list = new TracerPointList(this, plugin, x, y));
-       point_list->update(plugin->config.selected);
+       point_list->update(plugin->selected);
        y += point_list->get_h() + yS(10);
 
        add_subwindow(new BC_Title(x, y, _(
@@ -438,7 +440,7 @@ void TracerPointList::update_list(int k)
 {
        int sz = plugin->config.points.size();
        if( k < 0 || k >= sz ) k = -1;
-       plugin->config.selected = k;
+       plugin->selected = k;
        update_selection(&cols[0], k);
        int xpos = get_xposition(), ypos = get_yposition();
        BC_ListBox::update(&cols[0], &titles[0],&widths[0],PT_SZ, xpos,ypos,k);
@@ -465,7 +467,7 @@ void TracerPointList::update(int k)
 void TracerWindow::update_gui()
 {
        TracerConfig &config = plugin->config;
-       drag->update(config.drag);
+       drag->update(plugin->drag);
        draw->update(config.draw);
        fill->update(config.fill);
        feather->update(config.feather);
@@ -525,7 +527,7 @@ int TracerPointDn::handle_event()
 }
 
 TracerDrag::TracerDrag(TracerWindow *gui, int x, int y)
- : BC_CheckBox(x, y, gui->plugin->config.drag, _("Drag"))
+ : BC_CheckBox(x, y, gui->plugin->drag, _("Drag"))
 {
        this->gui = gui;
 }
@@ -541,7 +543,7 @@ int TracerDrag::handle_event()
        }
        else
                gui->ungrab(cwindow_gui);
-       gui->plugin->config.drag = value;
+       gui->plugin->drag = value;
        gui->send_configure_change();
        return 1;
 }
@@ -551,8 +553,7 @@ int TracerWindow::handle_ungrab()
        int ret = ungrab(cwindow_gui);
        if( ret ) {
                drag->update(0);
-               plugin->config.drag = 0;
-               send_configure_change();
+               plugin->drag = 0;
        }
        return ret;
 }
@@ -656,11 +657,11 @@ TracerReset::~TracerReset()
 int TracerReset::handle_event()
 {
        TracerConfig &config = plugin->config;
-       if( !config.drag ) {
+       if( !plugin->drag ) {
                MWindow *mwindow = plugin->server->mwindow;
                CWindowGUI *cwindow_gui = mwindow->cwindow->gui;
                if( gui->grab(cwindow_gui) )
-                       config.drag = 1;
+                       plugin->drag = 1;
                else
                        gui->drag->flicker(10,50);
        }
@@ -669,7 +670,7 @@ int TracerReset::handle_event()
        config.invert = 0;
        config.feather = 0;
        config.radius = 1;
-       config.selected = -1;
+       plugin->selected = -1;
        TracerPoints &points = plugin->config.points;
        points.remove_all_objects();
        gui->point_list->update(-1);
index 671421700f8b8eccde497d1e96cf43759d811cdb..21c98a3ab8ce8ad7b455e01c72e0c50a4cc3504a 100644 (file)
@@ -206,7 +206,7 @@ diff -ruN dav1d-0.7.1.orig/Makefile dav1d-0.7.1/Makefile
 +      echo >> $@ "#define CONFIG_LOG 1"
 +      echo >> $@ "#define ENDIANNESS_BIG 0"
 +      echo >> $@ "#define HAVE_ASM 1"
-+      echo >> $@ "#define HAVE_AVX512ICL 1"
++      echo >> $@ "#define HAVE_AVX512ICL 0"
 +      echo >> $@ "#define HAVE_CLOCK_GETTIME 1"
 +      echo >> $@ "#define HAVE_DLSYM 1"
 +      echo >> $@ "#define HAVE_POSIX_MEMALIGN 1"
@@ -218,7 +218,7 @@ diff -ruN dav1d-0.7.1.orig/Makefile dav1d-0.7.1/Makefile
 +      echo >> $@ "%define ARCH_X86_64 $(ARCH_X86_64)"
 +      echo >> $@ "%define PIC 1"
 +      echo >> $@ "%define STACK_ALIGNMENT 32"
-+      echo >> $@ "%define HAVE_AVX512ICL 1"
++      echo >> $@ "%define HAVE_AVX512ICL 0"
 +
 +$(BUILD)/include/vcs_version.h:
 +      mkdir -p $(BUILD)/include