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
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)
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();
}
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;
};
}
}
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();
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;
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));
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()
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"))
SplitX *split_x;
SplitY *split_y;
MixerItems *mixer_items;
- AlignTimecodes *align_timecodes;
LoadLayout *load_layout;
LoadLayout *save_layout;
};
int handle_event();
};
+class MixMasters : public MixerItem
+{
+public:
+ MixMasters(MixerItems *mixer_items);
+ int handle_event();
+};
+
class AlignTimecodes : public BC_MenuItem
{
public:
// 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();
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,
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();
+}
+
PluginGUIs::PluginGUIs(MWindow *mwindow)
{
this->mwindow = mwindow;
- this->next_id = 0;
}
PluginGUIs::~PluginGUIs()
{
void PluginGUIs::append(PluginServer *server)
{
- server->gui_id = next_id++;
+ server->gui_id = EDL::next_id();
ArrayList<PluginServer*>::append(server);
}
class PluginGUIs : public ArrayList<PluginServer*>
{
- int next_id;
MWindow *mwindow;
public:
PluginGUIs(MWindow *mwindow);
sw_gui->save_spumux_data();
}
else {
- eprintf(_("script microdvd file path required"));
+ eprintf(_("script file path required"));
}
return 1;
}
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;
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()
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()
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)
(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)
#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:
~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
{
SWindowLoadPath *load_path;
SWindowLoadFile *load_file;
SWindowSaveFile *save_file;
+ SWindowSaveFormat *save_format;
BC_Title *script_filesz;
BC_Title *script_lines;
BC_Title *script_entries;
ScriptScroll *script_scroll;
int xpad, ypad;
char *blank_line;
+ int sub_format;
char script_path[BCTEXTLEN];
ArrayList<ScriptLines *> script;
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;
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);
}
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,
void VRender::run()
{
- int reconfigure;
+ int reconfigure = 1;
const int debug = 0;
// Want to know how many samples rendering each frame takes.
// 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);
}
resize_history.remove_all_objects();
+ delete grab_lock;
#ifndef SINGLE_THREAD
common_events.remove_all_objects();
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;
}
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");
}
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()
{
#else
Condition *completion_lock;
#endif
-
-
+ Mutex *grab_lock;
int dump_windows();
-
BC_WindowEvents *event_thread;
int is_deleting;
// Hide cursor when video is enabled
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();
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
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";
(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";
~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();
VFrame *input, *output;
BoxBlur *box_blur;
+ int drag;
};
horz_radius = 0;
vert_radius = 0;
power = 1;
- drag = 0;
box_x = box_y = 0.0;
box_w = box_h = 0;
}
horz_radius = 2;
vert_radius = 2;
power = 2;
- drag = 0;
box_x = box_y = 0.0;
box_w = box_h = 0;
}
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;
}
{
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;
}
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;
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:")));
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()
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);
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);
-1, x,y, ow, oh);
}
- if( config.drag )
+ if( is_dragging() )
draw_boundry();
return 1;
}
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)
{
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;
int BoxBlurDrag::handle_event()
{
int ret = DragCheckBox::handle_event();
+ plugin->drag = get_value();
plugin->send_configure_change();
return ret;
}
{
threshold = 0.5f;
draw_mode = DRAW_ALPHA;
- drag = 0;
- selected = 0;
}
CriKeyConfig::~CriKeyConfig()
{
{
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];
{
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 ) {
{
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);
engine = 0;
msk = 0;
edg = 0;
+
+ drag = 0;
+ selected = 0;
}
CriKey::~CriKey()
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;
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");
}
output.terminate_string();
}
-
void CriKey::save_data(KeyFrame *keyframe)
{
config.save_data(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) ) {
}
}
}
-
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)
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();
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);
}
}
float threshold;
int draw_mode;
- int drag, selected;
};
class CriKeyPackage : public LoadPackage
// 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);
VFrame *src, *edg, *msk;
int w, h, color_model, bpp, comp;
int is_yuv, is_float;
+ int drag, selected;
};
#endif
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);
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");
}
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,
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);
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);
}
}
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;
}
}
else
gui->ungrab(cwindow_gui);
- gui->plugin->config.drag = value;
+ gui->plugin->drag = value;
gui->send_configure_change();
return 1;
}
int ret = ungrab(cwindow_gui);
if( ret ) {
drag->update(0);
- plugin->config.drag = 0;
- send_configure_change();
+ plugin->drag = 0;
}
return ret;
}
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);
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];
SketcherConfig::SketcherConfig()
{
- drag = 1;
aliasing = 0;
- cv_selected = 0;
- pt_selected = 0;
}
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;
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; }
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);
img = 0;
out = 0;
overlay_frame = 0;
+
+ drag = 1;
+ cv_selected = 0;
+ pt_selected = 0;
}
Sketcher::~Sketcher()
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;
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 ) {
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();
new_curve();
}
-
void SketcherPoint::update_parameter(SketcherPoint *prev, SketcherPoint *src)
{
if( prev->arc != src->arc ) arc = src->arc;
{
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();
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);
}
}
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();
}
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
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);
OverlayFrame *overlay_frame;
int w, h, color_model, bpp, comp;
int is_yuv, is_float;
+ int drag;
+ int cv_selected, pt_selected;
};
#endif
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;
{
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;
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;
{
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());
{
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());
{
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());
{
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());
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];
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);
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;
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
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)) ) {
gui->curve_color->update_gui(cv->color);
ci = k;
}
- plugin->config.cv_selected = ci;
+ plugin->cv_selected = ci;
update_list(ci);
}
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;
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--);
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];
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];
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 )
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;
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;
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)
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;
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);
}
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 )
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];
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 )
}
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;
}
}
else
gui->ungrab(cwindow_gui);
- gui->plugin->config.drag = value;
+ gui->plugin->drag = value;
gui->send_configure_change();
return 1;
}
int ret = ungrab(cwindow_gui);
if( ret ) {
drag->update(0);
- plugin->config.drag = 0;
- send_configure_change();
+ plugin->drag = 0;
}
return ret;
}
}
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;
{
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 )
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();
background = 0;
strcpy(background_path, "");
timecode_format = DEFAULT_TIMECODEFORMAT;
- drag = 0;
loop_playback = 0;
}
background == that.background &&
!strcmp(background_path, that.background_path) &&
timecode_format == that.timecode_format &&
-// drag == that.drag &&
loop_playback == that.loop_playback;
}
background = that.background;
strcpy(background_path, that.background_path);
timecode_format = that.timecode_format;
- drag = that.drag;
loop_playback = that.loop_playback;
}
background = prev.background;
strcpy(background_path, prev.background_path);
timecode_format = prev.timecode_format;
- drag = prev.drag;
loop_playback = prev.loop_playback;
}
if( cpus > 8 ) cpus = 8;
last_position = -1;
need_reconfigure = 1;
+ drag = 0;
}
TitleMain::~TitleMain()
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)
{
if( !result )
draw_overlay();
- if( config.drag )
+ if( is_dragging() )
draw_boundry();
return 0;
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);
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);
// Time Code Format
int timecode_format;
-// drag enable
- int drag;
// loop background playback
int loop_playback;
};
// 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();
int64_t last_position;
int need_reconfigure;
int cpus;
+ int drag;
};
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();
}
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)
{
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;
int TitleDrag::handle_event()
{
int ret = DragCheckBox::handle_event();
+ client->drag = get_value();
window->send_configure_change();
return ret;
}
{
}
+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()
{
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;
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;
bx = 0; by = 0;
cx = 0; cy = 0;
ex = 0; ey = 0;
+ drag = 0; selected = 0;
}
Tracer::~Tracer()
}
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)
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");
}
output.terminate_string();
}
-
void Tracer::save_data(KeyFrame *keyframe)
{
config.save_data(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) ) {
}
}
}
-
void Tracer::read_data(KeyFrame *keyframe)
{
config.read_data(keyframe);
}
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 )
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()
{
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);
}
}
draw_mask();
if( config.draw && edg )
draw_edge();
- if( config.drag )
+ if( is_dragging() )
draw_points();
return 0;
}
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);
int add_point();
void del_point(int i);
- int drag, draw, fill;
+ int draw, fill;
int invert, feather;
float radius;
- int selected;
};
class TracePoint
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);
int color_model, bpp;
int is_float, is_yuv, has_alpha;
int comps, comp;
+ int drag, selected;
};
#endif
{
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);
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");
}
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, _(
{
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);
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);
}
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;
}
}
else
gui->ungrab(cwindow_gui);
- gui->plugin->config.drag = value;
+ gui->plugin->drag = value;
gui->send_configure_change();
return 1;
}
int ret = ungrab(cwindow_gui);
if( ret ) {
drag->update(0);
- plugin->config.drag = 0;
- send_configure_change();
+ plugin->drag = 0;
}
return ret;
}
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);
}
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);
+ 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"
+ 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