From: Good Guy Date: Fri, 25 Jan 2019 21:47:22 +0000 (-0700) Subject: fix trace locks hang, drag handle rework-again, 12 reset btns on plugins, booby on X-Git-Tag: 2019-08~118 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=54cc56bff09f5004b2a6cd454375f06e56acf5a0;p=goodguy%2Fcinelerra.git fix trace locks hang, drag handle rework-again, 12 reset btns on plugins, booby on --- diff --git a/cinelerra-5.1/bld.sh b/cinelerra-5.1/bld.sh index b8a80d6b..7c8837bf 100755 --- a/cinelerra-5.1/bld.sh +++ b/cinelerra-5.1/bld.sh @@ -1,6 +1,6 @@ #!/bin/bash ( ./autogen.sh - ./configure --with-single-user + ./configure --with-single-user --with-booby make && make install ) 2>&1 | tee log mv Makefile Makefile.cfg cp Makefile.devel Makefile diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index 7618d48d..2c8eefcf 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -384,20 +384,19 @@ int Edit::dump(FILE *fp) { fprintf(fp," EDIT %p\n", this); fflush(fp); fprintf(fp," nested_edl=%p %s asset=%p %s\n", - nested_edl, - nested_edl ? nested_edl->path : "", - asset, - asset ? asset->path : ""); + nested_edl, nested_edl ? nested_edl->path : "", + asset, asset ? asset->path : ""); fflush(fp); - fprintf(fp," channel %d, color %08x, group_id %d, is_selected %d\n", - channel, color, group_id, is_selected); - if(transition) - { + fprintf(fp," channel %d, color %08x, hard lt/rt %d/%d" + " group_id %d, is_selected %d\n", + channel, color, hard_left, hard_right, group_id, is_selected); + if( transition ) { fprintf(fp," TRANSITION %p\n", transition); transition->dump(fp); } - fprintf(fp," startsource %jd startproject %jd hard lt/rt %d/%d length %jd\n", - startsource, startproject, hard_left, hard_right, length); fflush(fp); + fprintf(fp," startsource %jd startproject %jd length %jd\n", + startsource, startproject, length); + fflush(fp); return 0; } @@ -421,149 +420,202 @@ void Edit::shift(int64_t difference) startproject += difference; } +void Edit::trim(int64_t difference) +{ + length += difference; + if( startproject < 0 ) { + if( (startsource+=startproject) < 0 ) startsource = 0; + if( (length+=startproject) < 0 ) length = 0; + startproject = 0; + } + if( startsource < 0 ) + startsource = 0; + int64_t src_len = get_source_end(INT64_MAX); + if( startsource + length > src_len ) { + length = src_len - startsource; + if( length < 0 ) length = 0; + } + if( length < 0 ) + length = 0; +} int Edit::shift_start(int edit_mode, int64_t newposition, int64_t oldposition, - int edit_edits, int edit_labels, int edit_plugins, int edit_autos, - Edits *trim_edits) + int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits) { - int64_t startproject = this->startproject; - int64_t startsource = this->startsource; - int64_t length = this->length; - int64_t source_len = get_source_end(startsource + length); int64_t cut_length = newposition - oldposition; - source_len -= cut_length; + if( !cut_length ) return 0; + int64_t start = startproject, end = start + length; + Edit *prev = this->previous, *next = this->next; + int edits_moved = 0, rest_moved = 0; switch( edit_mode ) { - case MOVE_EDGE: + case MOVE_RIPPLE: + edits_moved = rest_moved = 1; + if( prev ) prev->trim(cut_length); + for( Edit *edit=this; edit; edit=edit->next ) + edit->startproject += cut_length; + break; + case MOVE_ROLL: + if( prev ) prev->trim(cut_length); startproject += cut_length; startsource += cut_length; length -= cut_length; break; - case MOVE_MEDIA: - startsource += cut_length; + case MOVE_SLIP: + edits_moved = 1; + startsource -= cut_length; break; - case MOVE_EDGE_MEDIA: + case MOVE_SLIDE: + edits_moved = 1; + if( prev ) prev->trim(cut_length); startproject += cut_length; - length -= cut_length; + if( next ) { + next->startproject += cut_length; + next->startsource += cut_length; + next->trim(-cut_length); + } break; - } - - if( startproject < 0 ) { - startsource += startproject; - length += startproject; - startproject = 0; - } - if( startsource < 0 ) - startsource = 0; - if( length > source_len ) - length = source_len; - if( length < 0 ) - length = 0; - - int64_t start = this->startproject; - int64_t end = start + this->length; - if( edit_labels ) { - double cut_len = track->from_units(cut_length); - double start_pos = edits->track->from_units(start); - edits->edl->labels->insert(start_pos, cut_len); - double end_pos = edits->track->from_units(end); - edits->edl->labels->insert(end_pos + cut_len, -cut_len); - } - if( edit_autos ) { - edits->shift_keyframes_recursive(start, cut_length); - edits->shift_keyframes_recursive(end + cut_length, -cut_length); - } - if( edit_plugins ) { - edits->shift_effects_recursive(start, cut_length, 1); - edits->shift_effects_recursive(end + cut_length, -cut_length, 1); - } - if( !edit_edits && startproject < start ) { - edits->clear(startproject, start); - cut_length = start - startproject; + case MOVE_EDGE: + edits_moved = rest_moved = 1; + startsource -= cut_length; + length += cut_length; for( Edit *edit=next; edit; edit=edit->next ) edit->startproject += cut_length; + break; } + trim(0); - this->startproject = startproject; - this->startsource = startsource; - this->length = length; - - return 0; + return follow_edits(start, end, cut_length, edits_moved, rest_moved, + edit_labels, edit_autos, edit_plugins, trim_edits); } int Edit::shift_end(int edit_mode, int64_t newposition, int64_t oldposition, - int edit_edits, int edit_labels, int edit_plugins, int edit_autos, - Edits *trim_edits) + int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits) { - int64_t startproject = this->startproject; - int64_t startsource = this->startsource; - int64_t length = this->length; - int64_t source_len = get_source_end(startsource + length); int64_t cut_length = newposition - oldposition; - source_len += cut_length; + if( !cut_length ) return 0; + int64_t start = startproject, end = start + length; + Edit *prev = this->previous, *next = this->next; + int edits_moved = 0, rest_moved = 0; switch( edit_mode ) { - case MOVE_EDGE: + case MOVE_RIPPLE: + rest_moved = 1; length += cut_length; + for( Edit *edit=next; edit; edit=edit->next ) + edit->startproject += cut_length; break; - case MOVE_MEDIA: - startsource += cut_length; + case MOVE_ROLL: + length += cut_length; + if( next ) { + next->startproject += cut_length; + next->startsource += cut_length; + next->trim(-cut_length); + } break; - case MOVE_EDGE_MEDIA: + case MOVE_SLIP: + edits_moved = 1; startsource -= cut_length; - length += cut_length; + break; + case MOVE_SLIDE: + edits_moved = 1; + if( prev ) prev->trim(cut_length); + startproject += cut_length; + if( next ) { + next->startproject += cut_length; + next->startsource += cut_length; + next->trim(-cut_length); + } + break; + case MOVE_EDGE: + edits_moved = 1; + if( prev ) prev->trim(cut_length); + startproject += cut_length; + length -= cut_length; break; } - if( startproject < 0 ) { - startsource += startproject; - length += startproject; - startproject = 0; - } - if( startsource < 0 ) - startsource = 0; - if( length > source_len ) - length = source_len; - if( length < 0 ) - length = 0; + trim(0); - int64_t start = this->startproject; - int64_t end = start + this->length; - if( edit_labels ) { - double cut_len = track->from_units(cut_length); - double end_pos = edits->track->from_units(end); - if( cut_len < 0 ) - edits->edl->labels->clear(end_pos + cut_len, end_pos, 1); - else - edits->edl->labels->insert(end_pos, cut_len); + return follow_edits(start, end, cut_length, edits_moved, rest_moved, + edit_labels, edit_autos, edit_plugins, trim_edits); +} + +int Edit::follow_edits(int64_t start, int64_t end, int64_t cut_length, + int edits_moved, int rest_moved, int edit_labels, int edit_autos, + int edit_plugins, Edits *trim_edits) +{ + if( edits_moved && rest_moved ) { + if( edit_labels ) { + double cut_len = track->from_units(cut_length); + double start_pos = edits->track->from_units(start); + if( cut_len < 0 ) + edits->edl->labels->clear(start_pos + cut_len, start_pos, 1); + else if( cut_len > 0 ) + edits->edl->labels->insert(start_pos, cut_len); + } + if( cut_length < 0 ) + track->clear(start + cut_length, start, + 0, 0, edit_autos, edit_plugins, trim_edits); + else if( cut_length > 0 ) { + if( edit_autos ) + track->shift_keyframes(start, cut_length); + if( edit_plugins ) + track->shift_effects(start, cut_length, 1, trim_edits); + } } - Track *track = edits->track; - if( cut_length < 0 ) - track->clear(end+cut_length, end, - 0, 0, edit_autos, edit_plugins, trim_edits); - else if( cut_length > 0 ) { - if( edit_autos ) - track->shift_keyframes(end, cut_length); - if( edit_plugins ) - track->shift_effects(end, cut_length, 1, trim_edits); + else if( edits_moved ) { + if( edit_labels ) { + double cut_len = track->from_units(cut_length); + double start_pos = edits->track->from_units(start); + edits->edl->labels->insert(start_pos, cut_len); + double end_pos = edits->track->from_units(end); + edits->edl->labels->insert(end_pos + cut_len, -cut_len); + } + if( edit_autos ) { + if( cut_length > 0 ) { + track->clear(end, end+cut_length, 0, 0, 0, 1, 0); + track->shift_keyframes(start, cut_length); + } + else if( cut_length < 0 ) { + track->clear(start+cut_length, start, 0, 0, 0, 1, 0); + track->shift_keyframes(end+cut_length, -cut_length); + } + } + if( edit_plugins ) { + if( cut_length > 0 ) { + track->clear(end, end+cut_length, 0, 0, 1, 0, 0); + track->shift_effects(start, cut_length, 1, 0); + } + else if( cut_length < 0 ) { + track->clear(start+cut_length, start, 0, 0, 1, 0, 0); + track->shift_effects(end+cut_length, -cut_length, 1, 0); + } + } } - - int64_t new_end = startproject + length; - if( edit_edits ) { - cut_length = new_end - end; - for( Edit* edit=next; edit; edit=edit->next ) - edit->startproject += cut_length; + else if( rest_moved ) { + if( edit_labels ) { + double cut_len = track->from_units(cut_length); + double end_pos = edits->track->from_units(end); + if( cut_len < 0 ) + edits->edl->labels->clear(end_pos + cut_len, end_pos, 1); + else if( cut_len > 0 ) + edits->edl->labels->insert(end_pos, cut_len); + } + if( cut_length < 0 ) + track->clear(end + cut_length, end, + 0, 0, edit_autos, edit_plugins, trim_edits); + else if( cut_length > 0 ) { + if( edit_autos ) + track->shift_keyframes(end, cut_length); + if( edit_plugins ) + track->shift_effects(end, cut_length, 1, trim_edits); + } } - else if( new_end > end ) - edits->clear(end, new_end); - - this->startproject = startproject; - this->startsource = startsource; - this->length = length; - return 0; } + int Edit::popup_transition(float view_start, float zoom_units, int cursor_x, int cursor_y) { int64_t left, right, left_unit, right_unit; diff --git a/cinelerra-5.1/cinelerra/edit.h b/cinelerra-5.1/cinelerra/edit.h index ed0e22b8..cc7c7fab 100644 --- a/cinelerra-5.1/cinelerra/edit.h +++ b/cinelerra-5.1/cinelerra/edit.h @@ -77,12 +77,15 @@ public: // Shift in time virtual void shift(int64_t difference); + + void trim(int64_t difference); int shift_start(int edit_mode, int64_t newposition, int64_t oldposition, - int edit_edits, int edit_labels, int edit_plugins, int edit_autos, - Edits *trim_edits); + int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits); int shift_end(int edit_mode, int64_t newposition, int64_t oldposition, - int edit_edits, int edit_labels, int edit_plugins, int edit_autos, - Edits *trim_edits); + int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits); + int follow_edits(int64_t start, int64_t end, int64_t cut_length, + int edits_moved, int rest_moved, int edit_labels, int edit_autos, + int edit_plugins, Edits *trim_edits); void insert_transition(char *title); void detach_transition(); @@ -118,7 +121,6 @@ public: Transition *transition; Edits *edits; - Track *track; // points to an object in edl->assets if set diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index 26f49890..9e3c2a5e 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -730,17 +730,10 @@ int Edits::modify_handles(double oldposition, double newposition, int currentend double delta = newposition - oldposition; oldposition = track->from_units(current_edit->startproject); if( group_id > 0 ) newposition = oldposition + delta; - result = 1; -// dont move stuff if media playback does not shift in time - if( edit_mode != MOVE_MEDIA && edit_mode != MOVE_EDGE_MEDIA ) { - edit_labels = 0; - edit_plugins = 0; - edit_autos = 0; - } current_edit->shift_start(edit_mode, track->to_units(newposition, 0), track->to_units(oldposition, 0), - 0, edit_labels, edit_plugins, edit_autos, - trim_edits); + edit_labels, edit_autos, edit_plugins, trim_edits); + result = 1; } if(!result) current_edit = current_edit->next; @@ -760,7 +753,7 @@ int Edits::modify_handles(double oldposition, double newposition, int currentend current_edit->shift_end(edit_mode, track->to_units(newposition, 0), track->to_units(oldposition, 0), - edit_edits, edit_labels, edit_plugins, edit_autos, trim_edits); + edit_labels, edit_autos, edit_plugins, trim_edits); } if(!result) current_edit = current_edit->next; diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index d033b8d5..f7cf1b7c 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -909,7 +909,6 @@ void EDL::move_edit_labels(ArrayList *edits, double dist) } } - void EDL::modify_edithandles(double oldposition, double newposition, int currentend, int handle_mode, int edit_labels, int edit_plugins, int edit_autos, int group_id) @@ -917,8 +916,6 @@ void EDL::modify_edithandles(double oldposition, double newposition, tracks->modify_edithandles(oldposition, newposition, currentend, handle_mode, edit_labels, edit_plugins, edit_autos, group_id); - labels->modify_handles(oldposition, newposition, - currentend, handle_mode, edit_labels); } void EDL::modify_pluginhandles(double oldposition, double newposition, diff --git a/cinelerra-5.1/cinelerra/edl.inc b/cinelerra-5.1/cinelerra/edl.inc index b69e6595..944d76c5 100644 --- a/cinelerra-5.1/cinelerra/edl.inc +++ b/cinelerra-5.1/cinelerra/edl.inc @@ -45,14 +45,15 @@ class EDL; // default for left button -#define MOVE_EDGE 0 // default for middle button -#define MOVE_MEDIA 1 // default for right button -#define MOVE_EDGE_MEDIA 2 - -#define MOVE_EDITS_DISABLED 3 -#define EDIT_HANDLE_MODES 3 +#define MOVE_RIPPLE 0 +#define MOVE_ROLL 1 +#define MOVE_SLIP 2 +#define MOVE_SLIDE 3 +#define MOVE_EDGE 4 +#define MOVE_EDITS_DISABLED 5 +#define EDIT_HANDLE_MODES 5 // AWindow folders #define AW_NO_FOLDER -1 diff --git a/cinelerra-5.1/cinelerra/edlsession.C b/cinelerra-5.1/cinelerra/edlsession.C index 448116ae..98e7ea4a 100644 --- a/cinelerra-5.1/cinelerra/edlsession.C +++ b/cinelerra-5.1/cinelerra/edlsession.C @@ -75,9 +75,9 @@ EDLSession::EDLSession(EDL *edl) strcpy(default_atransition, INIT_ATRANSITION); strcpy(default_vtransition, INIT_VTRANSITION); default_transition_length = 1.0; - edit_handle_mode[0] = MOVE_EDGE; - edit_handle_mode[1] = MOVE_MEDIA; - edit_handle_mode[2] = MOVE_EDGE_MEDIA; + edit_handle_mode[0] = MOVE_RIPPLE; + edit_handle_mode[1] = MOVE_ROLL; + edit_handle_mode[2] = MOVE_SLIP; editing_mode = EDITING_IBEAM; enable_duplex = 1; folderlist_format = FOLDERS_ICONS; @@ -258,9 +258,9 @@ int EDLSession::load_defaults(BC_Hash *defaults) sprintf(default_vtransition, INIT_VTRANSITION); defaults->get("DEFAULT_VTRANSITION", default_vtransition); default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1); - edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_EDGE); - edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_MEDIA); - edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_EDGE_MEDIA); + edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_RIPPLE); + edit_handle_mode[1] = defaults->get("EDIT_HANDLE_MODE1", MOVE_ROLL); + edit_handle_mode[2] = defaults->get("EDIT_HANDLE_MODE2", MOVE_SLIP); editing_mode = defaults->get("EDITING_MODE", EDITING_IBEAM); enable_duplex = defaults->get("ENABLE_DUPLEX", 1); folderlist_format = defaults->get("FOLDERLIST_FORMAT", FOLDERS_TEXT); diff --git a/cinelerra-5.1/cinelerra/interfaceprefs.C b/cinelerra-5.1/cinelerra/interfaceprefs.C index c4abf35a..b75c0bfc 100644 --- a/cinelerra-5.1/cinelerra/interfaceprefs.C +++ b/cinelerra-5.1/cinelerra/interfaceprefs.C @@ -33,18 +33,14 @@ #include "shbtnprefs.h" #include "theme.h" -#if 0 -N_("Drag all following edits") -N_("Drag only one edit") -N_("Drag source only") -N_("No effect") -#endif - -#define MOVE_EDGE_TITLE N_("Drag edge only") -#define MOVE_MEDIA_TITLE N_("Drag media only") -#define MOVE_EDGE_MEDIA_TITLE N_("Drag edge and media") +#define MOVE_RIPPLE_TITLE N_("All Edits (ripple)") +#define MOVE_ROLL_TITLE N_("One Edit (roll)") +#define MOVE_SLIP_TITLE N_("Src Only (slip)") +#define MOVE_SLIDE_TITLE N_("Move Edit (slide)") +#define MOVE_EDGE_TITLE N_("Drag Edge (edge)") #define MOVE_EDITS_DISABLED_TITLE N_("No effect") + InterfacePrefs::InterfacePrefs(MWindow *mwindow, PreferencesWindow *pwindow) : PreferencesDialog(mwindow, pwindow) { @@ -92,11 +88,11 @@ void InterfacePrefs::create_objects() add_subwindow(snapshot_path = new SnapshotPathText(pwindow, this, x, y, get_w()-x-30)); x = x0; y = y2; - add_subwindow(new BC_Title(x, y, _("Clicking on edit boundaries does what:"))); - y += 25; + add_subwindow(title = new BC_Title(x, y, _("Clicking on edit boundaries does what:"))); + y += title->get_h() + 10; add_subwindow(new BC_Title(x, y, _("Button 1:"))); - int x1 = x + 100; + ViewBehaviourText *text; add_subwindow(text = new ViewBehaviourText(x1, y - 5, behavior_to_text(pwindow->thread->edl->session->edit_handle_mode[0]), @@ -240,13 +236,15 @@ void InterfacePrefs::create_objects() const char* InterfacePrefs::behavior_to_text(int mode) { - switch(mode) { - case MOVE_EDGE: return _(MOVE_EDGE_TITLE); - case MOVE_MEDIA: return _(MOVE_MEDIA_TITLE); - case MOVE_EDGE_MEDIA: return _(MOVE_EDGE_MEDIA_TITLE); - case MOVE_EDITS_DISABLED: return _(MOVE_EDITS_DISABLED_TITLE); - default: return ""; + switch( mode ) { + case MOVE_RIPPLE: return _(MOVE_RIPPLE_TITLE); + case MOVE_ROLL: return _(MOVE_ROLL_TITLE); + case MOVE_SLIP: return _(MOVE_SLIP_TITLE); + case MOVE_SLIDE: return _(MOVE_SLIDE_TITLE); + case MOVE_EDGE: return _(MOVE_EDGE_TITLE); + case MOVE_EDITS_DISABLED: return _(MOVE_EDITS_DISABLED_TITLE); } + return ""; } IndexPathText::IndexPathText(int x, int y, PreferencesWindow *pwindow, char *text) @@ -323,7 +321,7 @@ int IndexFFMPEGMarkerFiles::handle_event() ViewBehaviourText::ViewBehaviourText(int x, int y, const char *text, PreferencesWindow *pwindow, int *output) - : BC_PopupMenu(x, y, 200, text) + : BC_PopupMenu(x, y, 250, text) { this->output = output; } @@ -339,14 +337,14 @@ int ViewBehaviourText::handle_event() void ViewBehaviourText::create_objects() { - add_item(new ViewBehaviourItem(this, _(MOVE_EDGE_TITLE), MOVE_EDGE)); - add_item(new ViewBehaviourItem(this, _(MOVE_MEDIA_TITLE), MOVE_MEDIA)); - add_item(new ViewBehaviourItem(this, _(MOVE_EDGE_MEDIA_TITLE), MOVE_EDGE_MEDIA)); - add_item(new ViewBehaviourItem(this, _(MOVE_EDITS_DISABLED_TITLE), MOVE_EDITS_DISABLED)); + for( int mode=0; mode<=EDIT_HANDLE_MODES; ++mode ) + add_item(new ViewBehaviourItem(this, + InterfacePrefs::behavior_to_text(mode), mode)); } -ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour) +ViewBehaviourItem::ViewBehaviourItem(ViewBehaviourText *popup, + const char *text, int behaviour) : BC_MenuItem(text) { this->popup = popup; diff --git a/cinelerra-5.1/cinelerra/interfaceprefs.h b/cinelerra-5.1/cinelerra/interfaceprefs.h index 0a6f761a..7a890fb9 100644 --- a/cinelerra-5.1/cinelerra/interfaceprefs.h +++ b/cinelerra-5.1/cinelerra/interfaceprefs.h @@ -40,7 +40,7 @@ public: void create_objects(); // must delete each derived class int update(int new_value); - const char* behavior_to_text(int mode); + static const char* behavior_to_text(int mode); int start_shbtn_dialog(); void start_probe_dialog(); @@ -111,7 +111,7 @@ public: class ViewBehaviourItem : public BC_MenuItem { public: - ViewBehaviourItem(ViewBehaviourText *popup, char *text, int behaviour); + ViewBehaviourItem(ViewBehaviourText *popup, const char *text, int behaviour); ~ViewBehaviourItem(); int handle_event(); diff --git a/cinelerra-5.1/cinelerra/labels.C b/cinelerra-5.1/cinelerra/labels.C index 1435a985..211b8767 100644 --- a/cinelerra-5.1/cinelerra/labels.C +++ b/cinelerra-5.1/cinelerra/labels.C @@ -478,22 +478,19 @@ int Labels::paste_silence(double start, double end) return 0; } -int Labels::modify_handles(double oldposition, double newposition, - int currentend, int handle_mode, int edit_labels) +int Labels::modify_handles(double oldposition, double newposition, int currentend) { - if( edit_labels && handle_mode == MOVE_EDGE ) { - if( !currentend ) { // left handle - if( newposition < oldposition ) - insert(oldposition, oldposition - newposition); // shift all labels right - else - clear(oldposition, newposition); // clear selection - } - else { // right handle - if( newposition < oldposition ) - clear(newposition, oldposition); - else - insert(oldposition, newposition - oldposition); - } + if( !currentend ) { // left handle + if( newposition < oldposition ) + insert(oldposition, oldposition - newposition); // shift all labels right + else + clear(oldposition, newposition); // clear selection + } + else { // right handle + if( newposition < oldposition ) + clear(newposition, oldposition); + else + insert(oldposition, newposition - oldposition); } return 0; } diff --git a/cinelerra-5.1/cinelerra/labels.h b/cinelerra-5.1/cinelerra/labels.h index 2983926b..31015ea4 100644 --- a/cinelerra-5.1/cinelerra/labels.h +++ b/cinelerra-5.1/cinelerra/labels.h @@ -83,11 +83,7 @@ public: // Always add label without toggling void insert_label(double position); - int modify_handles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels); + int modify_handles(double oldposition, double newposition, int currentend); int copy(double start, double end, FileXML *xml); int copy_length(long start, long end); // return number of Labels in selection Label *add_label(double position); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index b6432aa6..7249f67a 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -825,15 +825,13 @@ void MWindow::insert_effect(char *title, int MWindow::modify_edithandles() { undo->update_undo_before(); + int handle_mode = edl->session->edit_handle_mode[session->drag_button]; edl->modify_edithandles(session->drag_start, - session->drag_position, - session->drag_handle, - edl->session->edit_handle_mode[session->drag_button], + session->drag_position, session->drag_handle, handle_mode, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, session->drag_edit->group_id); - finish_modify_handles(); //printf("MWindow::modify_handles 1\n"); return 0; @@ -861,9 +859,19 @@ int MWindow::modify_pluginhandles() void MWindow::finish_modify_handles() { int edit_mode = edl->session->edit_handle_mode[session->drag_button]; - if( edit_mode != MOVE_MEDIA ) { - double position = session->drag_position ; - if( position < 0 ) position = 0; + double position = -1; + switch( edit_mode ) { + case MOVE_RIPPLE: + case MOVE_ROLL: + case MOVE_SLIDE: + position = session->drag_position; + break; + case MOVE_SLIP: + case MOVE_EDGE: + position = session->drag_start; + break; + } + if( position >= 0 ) { edl->local_session->set_selectionstart(position); edl->local_session->set_selectionend(position); } diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 70b00a79..dd48141a 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -3808,17 +3808,28 @@ void TrackCanvas::update_drag_handle() edl->create_objects(); edl->copy_all(mwindow->edl); MainSession *session = mwindow->session; - int edit_mode = mwindow->edl->session->edit_handle_mode[session->drag_button]; + int handle_mode = mwindow->edl->session->edit_handle_mode[session->drag_button]; edl->modify_edithandles(session->drag_start, - session->drag_position, - session->drag_handle, - edit_mode, + session->drag_position, session->drag_handle, handle_mode, edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits, !session->drag_edit ? 0 : session->drag_edit->group_id); - double position = edit_mode == MOVE_EDGE || edit_mode == MOVE_EDGE_MEDIA ? - session->drag_position : session->drag_start ; + + double position = -1; + switch( handle_mode ) { + case MOVE_RIPPLE: + case MOVE_ROLL: + case MOVE_SLIDE: + position = session->drag_position; + break; + case MOVE_SLIP: + case MOVE_EDGE: + position = session->drag_start; + break; + } + + if( position < 0 ) position = 0; Track *track = session->drag_handle_track(); int64_t pos = track->to_units(position, 0); render_handle_frame(edl, pos, shift_down() ? 0 : diff --git a/cinelerra-5.1/cinelerra/tracksedit.C b/cinelerra-5.1/cinelerra/tracksedit.C index 35da7092..1129502a 100644 --- a/cinelerra-5.1/cinelerra/tracksedit.C +++ b/cinelerra-5.1/cinelerra/tracksedit.C @@ -214,12 +214,12 @@ void Tracks::set_edit_length(double start, double end, double length) // Go in using the edit handle interface int64_t starting_length = current_edit->length; - current_edit->shift_end(MOVE_EDGE, + current_edit->shift_end(MOVE_RIPPLE, current_edit->startproject + length_units, current_edit->startproject + current_edit->length, - 1, 0, - edl->session->plugins_follow_edits, + 0, edl->session->autos_follow_edits, + edl->session->plugins_follow_edits, 0); int64_t ending_length = current_edit->length; @@ -233,7 +233,7 @@ void Tracks::set_edit_length(double start, double end, double length) edl->labels->modify_handles( current_track->from_units(current_edit->startproject + starting_length), current_track->from_units(current_edit->startproject + ending_length), - 1, MOVE_EDGE, 1); + 1); } @@ -281,12 +281,12 @@ void Tracks::set_edit_length(double start, double end, double length) // Go in using the edit handle interface int64_t starting_length = current_edit->length; - current_edit->shift_end(MOVE_EDGE, + current_edit->shift_end(MOVE_RIPPLE, current_edit->startproject + length_units, current_edit->startproject + current_edit->length, - 1, 0, - edl->session->plugins_follow_edits, + 0, edl->session->autos_follow_edits, + edl->session->plugins_follow_edits, 0); int64_t ending_length = current_edit->length; @@ -298,7 +298,7 @@ void Tracks::set_edit_length(double start, double end, double length) edl->labels->modify_handles( current_track->from_units(current_edit->startproject + starting_length), current_track->from_units(current_edit->startproject + ending_length), - 1, MOVE_EDGE, 1); + 1); } @@ -1146,6 +1146,8 @@ int Tracks::modify_edithandles(double &oldposition, double &newposition, track->modify_edithandles(oldposition, newposition, currentend, handle_mode, edit_labels, edit_plugins, edit_autos, group_id); +// labels follow first armed track + edit_labels = 0; } return 0; } diff --git a/cinelerra-5.1/guicast/bctrace.C b/cinelerra-5.1/guicast/bctrace.C index 930eabfc..7e279673 100644 --- a/cinelerra-5.1/guicast/bctrace.C +++ b/cinelerra-5.1/guicast/bctrace.C @@ -98,8 +98,9 @@ void BC_Trace::disable_locks() trace_locks = 0; while( lock_table.last ) { lock_item *p = (lock_item*)lock_table.last; + lock_table.remove_pointer(p); p->info->trace = 0; - lock_table.remove_pointer(p); lock_free.append(p); + lock_free.append(p); } lock_free.clear(); lock_table.unlock(); @@ -170,9 +171,15 @@ void BC_Trace::unset_lock2(int table_id, trace_info *info) p = (lock_item*)lock_table.last; while( p && p->id != table_id ) p = (lock_item*)p->previous; } - else - info->trace = 0; - if( p ) { lock_table.remove_pointer(p); lock_free.append(p); } + if( p ) { + if( p->list == &lock_table ) { + lock_table.remove_pointer(p); + info->trace = 0; + lock_free.append(p); + } + else + printf("unset_lock2: free lock_item in lock_table %p\n", p); + } lock_table.unlock(); } @@ -185,9 +192,16 @@ void BC_Trace::unset_lock(trace_info *info) p = (lock_item*)lock_table.last; while( p && ( p->info!=info || !p->is_owner ) ) p = (lock_item*)p->previous; } - else - info->trace = 0; - if( p ) { lock_table.remove_pointer(p); lock_free.append(p); } + info->trace = 0; + if( p ) { + if( p->list == &lock_table ) { + lock_table.remove_pointer(p); + info->trace = 0; + lock_free.append(p); + } + else + printf("unset_lock: free lock_item in lock_table %p\n", p); + } lock_table.unlock(); } @@ -196,11 +210,13 @@ void BC_Trace::unset_all_locks(trace_info *info) { if( !global_trace || !trace_locks ) return; lock_table.lock(); + info->trace = 0; lock_item *p = (lock_item*)lock_table.first; while( p ) { lock_item *lp = p; p = (lock_item*)p->next; if( lp->info != info ) continue; - lock_table.remove_pointer(lp); lock_free.append(lp); + lock_table.remove_pointer(lp); + lock_free.append(lp); } lock_table.unlock(); } @@ -213,7 +229,9 @@ void BC_Trace::clear_locks_tid(pthread_t tid) while( p ) { lock_item *lp = p; p = (lock_item*)p->next; if( lp->tid != tid ) continue; - lock_table.remove_pointer(lp); lock_free.append(lp); + lock_table.remove_pointer(lp); + lp->info->trace = 0; + lock_free.append(lp); } lock_table.unlock(); } @@ -301,6 +319,13 @@ void BC_Trace::dump_locks(FILE *fp) fprintf(fp," %p %s %s %p%s\n", p->info, p->title, p->loc, (void*)p->tid, p->is_owner ? " *" : ""); } + int64_t lock_total = lock_table.total(); + int64_t free_total = lock_free.total(); + printf("lock_items: %jd\n", lock_total); + printf("lock_frees: %jd\n", free_total); + int64_t missed_locks = lock_table.size - (lock_total + free_total); + if( missed_locks ) + printf("miss locks: %jd\n", missed_locks); #endif } diff --git a/cinelerra-5.1/plugins/bluebanana/bluebanana.C b/cinelerra-5.1/plugins/bluebanana/bluebanana.C index 43fe2576..f5120eb8 100644 --- a/cinelerra-5.1/plugins/bluebanana/bluebanana.C +++ b/cinelerra-5.1/plugins/bluebanana/bluebanana.C @@ -78,8 +78,8 @@ BluebananaMain::~BluebananaMain() { // if ants are running, run one more pane update to hide them (gui // is already marked as closed) - if(server && server->mwindow && ants_counter>0) - server->mwindow->sync_parameters(); + //if(server && server->mwindow && ants_counter>0) + // server->mwindow->sync_parameters(); delete engine; } @@ -263,9 +263,9 @@ void BluebananaMain::load_nonauto(){ void BluebananaMain::read_data(KeyFrame *keyframe){ - FileXML input; + int result = 0; - +{ FileXML input; // release xbuf-shared_lock before nonaauto input.set_shared_input(keyframe->xbuf); while(!result){ @@ -335,7 +335,7 @@ void BluebananaMain::read_data(KeyFrame *keyframe){ } } - +} load_nonauto(); } @@ -613,7 +613,6 @@ int BluebananaMain::process_buffer(VFrame *frame, int64_t start_position, double frame_rate){ ants_counter++; - SET_TRACE load_configuration(); this->frame = frame; diff --git a/cinelerra-5.1/plugins/oilpainting/oil.C b/cinelerra-5.1/plugins/oilpainting/oil.C index 9dbe1e24..30d71577 100644 --- a/cinelerra-5.1/plugins/oilpainting/oil.C +++ b/cinelerra-5.1/plugins/oilpainting/oil.C @@ -44,13 +44,16 @@ class OilEffect; - +class OilWindow; +class OilReset; class OilConfig { public: OilConfig(); + void reset(); + void copy_from(OilConfig &src); int equivalent(OilConfig &src); void interpolate(OilConfig &prev, @@ -79,16 +82,28 @@ public: OilEffect *plugin; }; +class OilReset : public BC_GenericButton +{ +public: + OilReset(OilEffect *plugin, OilWindow *window, int x, int y); + ~OilReset(); + int handle_event(); + OilEffect *plugin; + OilWindow *window; +}; + + class OilWindow : public PluginClientWindow { public: OilWindow(OilEffect *plugin); ~OilWindow(); void create_objects(); - + void update(); OilEffect *plugin; OilRadius *radius; OilIntensity *intensity; + OilReset *reset; }; @@ -159,9 +174,12 @@ public: - - OilConfig::OilConfig() +{ + reset(); +} + +void OilConfig::reset() { radius = 5; use_intensity = 0; @@ -242,6 +260,22 @@ int OilIntensity::handle_event() } +OilReset::OilReset(OilEffect *plugin, OilWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +OilReset::~OilReset() +{ +} +int OilReset::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} @@ -250,9 +284,9 @@ int OilIntensity::handle_event() OilWindow::OilWindow(OilEffect *plugin) : PluginClientWindow(plugin, 300, - 160, + 120, 300, - 160, + 120, 0) { this->plugin = plugin; @@ -269,13 +303,20 @@ void OilWindow::create_objects() add_subwindow(radius = new OilRadius(plugin, x + 70, y)); y += 40; add_subwindow(intensity = new OilIntensity(plugin, x, y)); + y += 40; + add_subwindow(reset = new OilReset(plugin, this, x, y)); show_window(); flush(); } - +// for Reset button +void OilWindow::update() +{ + radius->update(plugin->config.radius); + intensity->update(plugin->config.use_intensity); +} diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.C b/cinelerra-5.1/plugins/rgbshift/rgbshift.C index d558687b..af60c041 100644 --- a/cinelerra-5.1/plugins/rgbshift/rgbshift.C +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.C @@ -19,76 +19,7 @@ * */ -#include "bcdisplayinfo.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "language.h" -#include "bccolors.h" -#include "pluginvclient.h" -#include "vframe.h" - -#include -#include - - -class RGBShiftEffect; - - -class RGBShiftConfig -{ -public: - RGBShiftConfig(); - - void copy_from(RGBShiftConfig &src); - int equivalent(RGBShiftConfig &src); - void interpolate(RGBShiftConfig &prev, - RGBShiftConfig &next, - long prev_frame, - long next_frame, - long current_frame); - - int r_dx, r_dy, g_dx, g_dy, b_dx, b_dy; -}; - -class RGBShiftLevel : public BC_ISlider -{ -public: - RGBShiftLevel(RGBShiftEffect *plugin, int *output, int x, int y); - int handle_event(); - RGBShiftEffect *plugin; - int *output; -}; - -class RGBShiftWindow : public PluginClientWindow -{ -public: - RGBShiftWindow(RGBShiftEffect *plugin); - void create_objects(); - RGBShiftLevel *r_dx, *r_dy, *g_dx, *g_dy, *b_dx, *b_dy; - RGBShiftEffect *plugin; -}; - - - -class RGBShiftEffect : public PluginVClient -{ - VFrame *temp_frame; -public: - RGBShiftEffect(PluginServer *server); - ~RGBShiftEffect(); - - - PLUGIN_CLASS_MEMBERS(RGBShiftConfig) - int process_realtime(VFrame *input, VFrame *output); - int is_realtime(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - void update_gui(); -}; - - +#include "rgbshift.h" @@ -99,8 +30,12 @@ REGISTER_PLUGIN(RGBShiftEffect) - RGBShiftConfig::RGBShiftConfig() +{ + reset(); +} + +void RGBShiftConfig::reset() { r_dx = r_dy = 0; g_dx = g_dy = 0; @@ -159,8 +94,26 @@ int RGBShiftLevel::handle_event() } +RGBShiftReset::RGBShiftReset(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +RGBShiftReset::~RGBShiftReset() +{ +} +int RGBShiftReset::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} + + RGBShiftWindow::RGBShiftWindow(RGBShiftEffect *plugin) - : PluginClientWindow(plugin, 300, 200, 300, 200, 0) + : PluginClientWindow(plugin, 300, 230, 300, 230, 0) { this->plugin = plugin; } @@ -186,12 +139,24 @@ void RGBShiftWindow::create_objects() add_subwindow(new BC_Title(x, y, _("B_dy:"))); add_subwindow(b_dy = new RGBShiftLevel(plugin, &plugin->config.b_dy, x1, y)); + y += 40; + add_subwindow(reset = new RGBShiftReset(plugin, this, x, y)); + show_window(); flush(); } - +// for Reset button +void RGBShiftWindow::update() +{ + r_dx->update(plugin->config.r_dx); + r_dy->update(plugin->config.r_dy); + g_dx->update(plugin->config.g_dx); + g_dy->update(plugin->config.g_dy); + b_dx->update(plugin->config.b_dx); + b_dy->update(plugin->config.b_dy); +} diff --git a/cinelerra-5.1/plugins/rgbshift/rgbshift.h b/cinelerra-5.1/plugins/rgbshift/rgbshift.h new file mode 100644 index 00000000..2092dc02 --- /dev/null +++ b/cinelerra-5.1/plugins/rgbshift/rgbshift.h @@ -0,0 +1,110 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef RGBSHIFT_H +#define RGBSHIFT_H + + +#include "bcdisplayinfo.h" +#include "clip.h" +#include "bchash.h" +#include "filexml.h" +#include "guicast.h" +#include "language.h" +#include "bccolors.h" +#include "pluginvclient.h" +#include "vframe.h" + +#include +#include + + +class RGBShiftEffect; +class RGBShiftWindow; +class RGBShiftReset; + + +class RGBShiftConfig +{ +public: + RGBShiftConfig(); + + void reset(); + void copy_from(RGBShiftConfig &src); + int equivalent(RGBShiftConfig &src); + void interpolate(RGBShiftConfig &prev, + RGBShiftConfig &next, + long prev_frame, + long next_frame, + long current_frame); + + int r_dx, r_dy, g_dx, g_dy, b_dx, b_dy; +}; + +class RGBShiftLevel : public BC_ISlider +{ +public: + RGBShiftLevel(RGBShiftEffect *plugin, int *output, int x, int y); + int handle_event(); + RGBShiftEffect *plugin; + int *output; +}; + +class RGBShiftReset : public BC_GenericButton +{ +public: + RGBShiftReset(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y); + ~RGBShiftReset(); + int handle_event(); + RGBShiftEffect *plugin; + RGBShiftWindow *window; +}; + +class RGBShiftWindow : public PluginClientWindow +{ +public: + RGBShiftWindow(RGBShiftEffect *plugin); + void create_objects(); + void update(); + RGBShiftLevel *r_dx, *r_dy, *g_dx, *g_dy, *b_dx, *b_dy; + RGBShiftEffect *plugin; + RGBShiftReset *reset; +}; + + + +class RGBShiftEffect : public PluginVClient +{ + VFrame *temp_frame; +public: + RGBShiftEffect(PluginServer *server); + ~RGBShiftEffect(); + + + PLUGIN_CLASS_MEMBERS(RGBShiftConfig) + int process_realtime(VFrame *input, VFrame *output); + int is_realtime(); + void save_data(KeyFrame *keyframe); + void read_data(KeyFrame *keyframe); + void update_gui(); +}; + +#endif diff --git a/cinelerra-5.1/plugins/rotate/rotate.C b/cinelerra-5.1/plugins/rotate/rotate.C index db30ad6e..de444618 100644 --- a/cinelerra-5.1/plugins/rotate/rotate.C +++ b/cinelerra-5.1/plugins/rotate/rotate.C @@ -19,216 +19,26 @@ * */ -#include "affine.h" -#include "bcdisplayinfo.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "language.h" -#include "pluginvclient.h" -#include "rotateframe.h" -#include "vframe.h" - - -#include - +#include "rotate.h" #define MAXANGLE 360 - -class RotateEffect; -class RotateWindow; - - -class RotateConfig -{ -public: - RotateConfig(); - - int equivalent(RotateConfig &that); - void copy_from(RotateConfig &that); - void interpolate(RotateConfig &prev, - RotateConfig &next, - long prev_frame, - long next_frame, - long current_frame); - - float angle; - float pivot_x; - float pivot_y; - int draw_pivot; -// int bilinear; -}; - -class RotateToggle : public BC_Radial -{ -public: - RotateToggle(RotateWindow *window, - RotateEffect *plugin, - int init_value, - int x, - int y, - int value, - const char *string); - int handle_event(); - - RotateEffect *plugin; - RotateWindow *window; - int value; -}; - -class RotateDrawPivot : public BC_CheckBox -{ -public: - RotateDrawPivot(RotateWindow *window, - RotateEffect *plugin, - int x, - int y); - int handle_event(); - RotateEffect *plugin; - RotateWindow *window; - int value; -}; - -class RotateInterpolate : public BC_CheckBox -{ -public: - RotateInterpolate(RotateEffect *plugin, int x, int y); - int handle_event(); - RotateEffect *plugin; -}; - -class RotateFine : public BC_FPot -{ -public: - RotateFine(RotateWindow *window, - RotateEffect *plugin, - int x, - int y); - int handle_event(); - - RotateEffect *plugin; - RotateWindow *window; -}; - -class RotateX : public BC_FPot -{ -public: - RotateX(RotateWindow *window, - RotateEffect *plugin, - int x, - int y); - int handle_event(); - RotateEffect *plugin; - RotateWindow *window; -}; - -class RotateY : public BC_FPot -{ -public: - RotateY(RotateWindow *window, - RotateEffect *plugin, - int x, - int y); - int handle_event(); - RotateEffect *plugin; - RotateWindow *window; -}; - - -class RotateText : public BC_TextBox -{ -public: - RotateText(RotateWindow *window, - RotateEffect *plugin, - int x, - int y); - int handle_event(); - - RotateEffect *plugin; - RotateWindow *window; -}; - -class RotateWindow : public PluginClientWindow -{ -public: - RotateWindow(RotateEffect *plugin); - - void create_objects(); - - int update(); - int update_fine(); - int update_text(); - int update_toggles(); - - RotateEffect *plugin; - RotateToggle *toggle0; - RotateToggle *toggle90; - RotateToggle *toggle180; - RotateToggle *toggle270; - RotateDrawPivot *draw_pivot; - RotateFine *fine; - RotateText *text; - RotateX *x; - RotateY *y; -// RotateInterpolate *bilinear; -}; - - - - -class RotateEffect : public PluginVClient -{ -public: - RotateEffect(PluginServer *server); - ~RotateEffect(); - - PLUGIN_CLASS_MEMBERS(RotateConfig) - int process_buffer(VFrame *frame, - int64_t start_position, - double frame_rate); - int is_realtime(); - void update_gui(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - int handle_opengl(); - - AffineEngine *engine; - int need_reconfigure; -}; - - - - - - - REGISTER_PLUGIN(RotateEffect) - - - - - - - - - - - - - - RotateConfig::RotateConfig() { - angle = 0; - pivot_x = 50; - pivot_y = 50; + reset(); +} + +void RotateConfig::reset() +{ + angle = 0.0; + pivot_x = 50.0; + pivot_y = 50.0; draw_pivot = 0; } @@ -286,13 +96,13 @@ RotateToggle::RotateToggle(RotateWindow *window, { this->value = value; this->plugin = plugin; - this->window = window; + this->window = window; } int RotateToggle::handle_event() { plugin->config.angle = (float)value; - window->update(); + window->update(); plugin->send_configure_change(); return 1; } @@ -310,7 +120,7 @@ RotateDrawPivot::RotateDrawPivot(RotateWindow *window, : BC_CheckBox(x, y, plugin->config.draw_pivot, _("Draw pivot")) { this->plugin = plugin; - this->window = window; + this->window = window; } int RotateDrawPivot::handle_event() @@ -369,7 +179,7 @@ RotateText::RotateText(RotateWindow *window, int y) : BC_TextBox(x, y, - 100, + 90, 1, (float)plugin->config.angle) { @@ -430,6 +240,22 @@ int RotateY::handle_event() } +RotateReset::RotateReset(RotateEffect *plugin, RotateWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +RotateReset::~RotateReset() +{ +} +int RotateReset::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} @@ -499,7 +325,7 @@ void RotateWindow::create_objects() add_tool(fine = new RotateFine(this, plugin, x, y)); y += fine->get_h() + 10; add_tool(text = new RotateText(this, plugin, x, y)); - y += 30; + y += 25; add_tool(new BC_Title(x, y, _("Degrees"))); @@ -513,14 +339,13 @@ void RotateWindow::create_objects() x += this->x->get_w() + 10; add_subwindow(this->y = new RotateY(this, plugin, x, y)); +// y += this->y->get_h() + 10; x = 10; - y += this->y->get_h() + 10; add_subwindow(draw_pivot = new RotateDrawPivot(this, plugin, x, y)); + y += 60; + add_subwindow(reset = new RotateReset(plugin, this, x, y)); show_window(); - - - } diff --git a/cinelerra-5.1/plugins/rotate/rotate.h b/cinelerra-5.1/plugins/rotate/rotate.h new file mode 100644 index 00000000..4a8870b1 --- /dev/null +++ b/cinelerra-5.1/plugins/rotate/rotate.h @@ -0,0 +1,216 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef ROTATE_H +#define ROTATE_H + + + +#include "affine.h" +#include "bcdisplayinfo.h" +#include "clip.h" +#include "bchash.h" +#include "filexml.h" +#include "guicast.h" +#include "language.h" +#include "pluginvclient.h" +#include "rotateframe.h" +#include "vframe.h" + + +#include + + +class RotateEffect; +class RotateWindow; + + +class RotateConfig +{ +public: + RotateConfig(); + + void reset(); + int equivalent(RotateConfig &that); + void copy_from(RotateConfig &that); + void interpolate(RotateConfig &prev, + RotateConfig &next, + long prev_frame, + long next_frame, + long current_frame); + + float angle; + float pivot_x; + float pivot_y; + int draw_pivot; +// int bilinear; +}; + +class RotateToggle : public BC_Radial +{ +public: + RotateToggle(RotateWindow *window, + RotateEffect *plugin, + int init_value, + int x, + int y, + int value, + const char *string); + int handle_event(); + + RotateEffect *plugin; + RotateWindow *window; + int value; +}; + +class RotateDrawPivot : public BC_CheckBox +{ +public: + RotateDrawPivot(RotateWindow *window, + RotateEffect *plugin, + int x, + int y); + int handle_event(); + RotateEffect *plugin; + RotateWindow *window; + int value; +}; + +class RotateInterpolate : public BC_CheckBox +{ +public: + RotateInterpolate(RotateEffect *plugin, int x, int y); + int handle_event(); + RotateEffect *plugin; +}; + +class RotateFine : public BC_FPot +{ +public: + RotateFine(RotateWindow *window, + RotateEffect *plugin, + int x, + int y); + int handle_event(); + + RotateEffect *plugin; + RotateWindow *window; +}; + +class RotateX : public BC_FPot +{ +public: + RotateX(RotateWindow *window, + RotateEffect *plugin, + int x, + int y); + int handle_event(); + RotateEffect *plugin; + RotateWindow *window; +}; + +class RotateY : public BC_FPot +{ +public: + RotateY(RotateWindow *window, + RotateEffect *plugin, + int x, + int y); + int handle_event(); + RotateEffect *plugin; + RotateWindow *window; +}; + + +class RotateText : public BC_TextBox +{ +public: + RotateText(RotateWindow *window, + RotateEffect *plugin, + int x, + int y); + int handle_event(); + + RotateEffect *plugin; + RotateWindow *window; +}; + +class RotateReset : public BC_GenericButton +{ +public: + RotateReset(RotateEffect *plugin, RotateWindow *window, int x, int y); + ~RotateReset(); + int handle_event(); + RotateEffect *plugin; + RotateWindow *window; +}; + + +class RotateWindow : public PluginClientWindow +{ +public: + RotateWindow(RotateEffect *plugin); + + void create_objects(); + + int update(); + int update_fine(); + int update_text(); + int update_toggles(); + + RotateEffect *plugin; + RotateToggle *toggle0; + RotateToggle *toggle90; + RotateToggle *toggle180; + RotateToggle *toggle270; + RotateDrawPivot *draw_pivot; + RotateFine *fine; + RotateText *text; + RotateX *x; + RotateY *y; +// RotateInterpolate *bilinear; + RotateReset *reset; +}; + + + + +class RotateEffect : public PluginVClient +{ +public: + RotateEffect(PluginServer *server); + ~RotateEffect(); + + PLUGIN_CLASS_MEMBERS(RotateConfig) + int process_buffer(VFrame *frame, + int64_t start_position, + double frame_rate); + int is_realtime(); + void update_gui(); + void save_data(KeyFrame *keyframe); + void read_data(KeyFrame *keyframe); + int handle_opengl(); + + AffineEngine *engine; + int need_reconfigure; +}; + +#endif diff --git a/cinelerra-5.1/plugins/rumbler/rumbler.C b/cinelerra-5.1/plugins/rumbler/rumbler.C index 20d0dc57..bb687a09 100644 --- a/cinelerra-5.1/plugins/rumbler/rumbler.C +++ b/cinelerra-5.1/plugins/rumbler/rumbler.C @@ -19,101 +19,17 @@ * */ -#include "bcdisplayinfo.h" -#include "affine.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "keyframe.h" -#include "language.h" -#include "pluginvclient.h" -#include "vframe.h" - -#include -#include -#include - - -class Rumbler; -class RumblerConfig; -class RumblerRate; -class RumblerSeq; -class RumblerWindow; - - -class RumblerConfig -{ -public: - RumblerConfig(); - float time_rumble, time_rate; - float space_rumble, space_rate; - int sequence; - void copy_from(RumblerConfig &that); - int equivalent(RumblerConfig &that); - void interpolate(RumblerConfig &prev, RumblerConfig &next, - int64_t prev_frame, int64_t next_frame, int64_t current_frame); -}; - -class RumblerRate : public BC_TextBox -{ -public: - RumblerRate(Rumbler *plugin, RumblerWindow *gui, - float &value, int x, int y); - int handle_event(); - Rumbler *plugin; - RumblerWindow *gui; - float *value; -}; - -class RumblerSeq : public BC_TextBox -{ -public: - RumblerSeq(Rumbler *plugin, RumblerWindow *gui, - int &value, int x, int y); - int handle_event(); - Rumbler *plugin; - RumblerWindow *gui; - int *value; -}; - - -class RumblerWindow : public PluginClientWindow -{ -public: - RumblerWindow(Rumbler *plugin); - ~RumblerWindow(); - void create_objects(); - - Rumbler *plugin; - RumblerRate *time_rumble, *time_rate; - RumblerRate *space_rumble, *space_rate; - RumblerSeq *seq; -}; - -class Rumbler : public PluginVClient -{ -public: - Rumbler(PluginServer *server); - ~Rumbler(); +#include "rumbler.h" - PLUGIN_CLASS_MEMBERS(RumblerConfig) - int process_buffer(VFrame *frame, int64_t start_position, double frame_rate); - int is_realtime(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - void update_gui(); - int handle_opengl(); - static double rumble(int64_t seq, double cur, double per, double amp); - - VFrame *input, *output, *temp; - float x1,y1, x2,y2, x3,y3, x4,y4; - AffineEngine *engine; -}; RumblerConfig::RumblerConfig() +{ + reset(); +} + +void RumblerConfig::reset() { time_rumble = 10; time_rate = 1.; @@ -153,7 +69,7 @@ void RumblerConfig::interpolate(RumblerConfig &prev, RumblerConfig &next, } RumblerWindow::RumblerWindow(Rumbler *plugin) - : PluginClientWindow(plugin, 300, 120, 300, 120, 0) + : PluginClientWindow(plugin, 300, 150, 300, 150, 0) { this->plugin = plugin; } @@ -181,11 +97,23 @@ void RumblerWindow::create_objects() y += title->get_h() + 10; add_subwindow(title = new BC_Title(x, y, _("seq:"))); add_subwindow(seq = new RumblerSeq(plugin, this, plugin->config.sequence, x1, y)); + y += 35; + add_subwindow(reset = new RumblerReset(plugin, this, x, y)); show_window(); flush(); } +// for Reset button +void RumblerWindow::update() +{ + time_rumble->update(plugin->config.time_rumble); + time_rate->update(plugin->config.time_rate); + space_rumble->update(plugin->config.space_rumble); + space_rate->update(plugin->config.space_rate); + seq->update((int64_t)(plugin->config.sequence)); +} + RumblerRate::RumblerRate(Rumbler *plugin, RumblerWindow *gui, float &value, int x, int y) @@ -220,6 +148,24 @@ int RumblerSeq::handle_event() } +RumblerReset::RumblerReset(Rumbler *plugin, RumblerWindow *gui, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->gui = gui; +} +RumblerReset::~RumblerReset() +{ +} +int RumblerReset::handle_event() +{ + plugin->config.reset(); + gui->update(); + plugin->send_configure_change(); + return 1; +} + + REGISTER_PLUGIN(Rumbler) Rumbler::Rumbler(PluginServer *server) diff --git a/cinelerra-5.1/plugins/rumbler/rumbler.h b/cinelerra-5.1/plugins/rumbler/rumbler.h new file mode 100644 index 00000000..d9aa4ea0 --- /dev/null +++ b/cinelerra-5.1/plugins/rumbler/rumbler.h @@ -0,0 +1,132 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef RUMBLER_H +#define RUMBLER_H + +#include "bcdisplayinfo.h" +#include "affine.h" +#include "clip.h" +#include "bchash.h" +#include "filexml.h" +#include "guicast.h" +#include "keyframe.h" +#include "language.h" +#include "pluginvclient.h" +#include "vframe.h" + +#include +#include +#include + + +class Rumbler; +class RumblerConfig; +class RumblerRate; +class RumblerSeq; +class RumblerWindow; +class RumblerReset; + + +class RumblerConfig +{ +public: + RumblerConfig(); + void reset(); + float time_rumble, time_rate; + float space_rumble, space_rate; + int sequence; + void copy_from(RumblerConfig &that); + int equivalent(RumblerConfig &that); + void interpolate(RumblerConfig &prev, RumblerConfig &next, + int64_t prev_frame, int64_t next_frame, int64_t current_frame); +}; + +class RumblerRate : public BC_TextBox +{ +public: + RumblerRate(Rumbler *plugin, RumblerWindow *gui, + float &value, int x, int y); + int handle_event(); + Rumbler *plugin; + RumblerWindow *gui; + float *value; +}; + +class RumblerSeq : public BC_TextBox +{ +public: + RumblerSeq(Rumbler *plugin, RumblerWindow *gui, + int &value, int x, int y); + int handle_event(); + Rumbler *plugin; + RumblerWindow *gui; + int *value; +}; + +class RumblerReset : public BC_GenericButton +{ +public: + RumblerReset(Rumbler *plugin, RumblerWindow *gui, int x, int y); + ~RumblerReset(); + int handle_event(); + Rumbler *plugin; + RumblerWindow *gui; +}; + + +class RumblerWindow : public PluginClientWindow +{ +public: + RumblerWindow(Rumbler *plugin); + ~RumblerWindow(); + void create_objects(); + void update(); + + Rumbler *plugin; + RumblerRate *time_rumble, *time_rate; + RumblerRate *space_rumble, *space_rate; + RumblerSeq *seq; + RumblerReset *reset; +}; + +class Rumbler : public PluginVClient +{ +public: + Rumbler(PluginServer *server); + ~Rumbler(); + + PLUGIN_CLASS_MEMBERS(RumblerConfig) + + int process_buffer(VFrame *frame, int64_t start_position, double frame_rate); + int is_realtime(); + void save_data(KeyFrame *keyframe); + void read_data(KeyFrame *keyframe); + void update_gui(); + int handle_opengl(); + static double rumble(int64_t seq, double cur, double per, double amp); + + VFrame *input, *output, *temp; + float x1,y1, x2,y2, x3,y3, x4,y4; + AffineEngine *engine; +}; + +#endif diff --git a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C index e4cf3c4a..853fb57f 100644 --- a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C +++ b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.C @@ -19,105 +19,10 @@ * */ -#include "bcdisplayinfo.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "language.h" -#include "pluginvclient.h" -#include "vframe.h" +#include "shiftinterlace.h" -#include -#include - - - - - - - -class ShiftInterlaceWindow; -class ShiftInterlaceMain; - -class ShiftInterlaceConfig -{ -public: - ShiftInterlaceConfig(); - - int equivalent(ShiftInterlaceConfig &that); - void copy_from(ShiftInterlaceConfig &that); - void interpolate(ShiftInterlaceConfig &prev, - ShiftInterlaceConfig &next, - long prev_frame, - long next_frame, - long current_frame); - - - int odd_offset; - int even_offset; -}; - - -class ShiftInterlaceOdd : public BC_ISlider -{ -public: - ShiftInterlaceOdd(ShiftInterlaceMain *plugin, int x, int y); - int handle_event(); - ShiftInterlaceMain *plugin; -}; - -class ShiftInterlaceEven : public BC_ISlider -{ -public: - ShiftInterlaceEven(ShiftInterlaceMain *plugin, int x, int y); - int handle_event(); - ShiftInterlaceMain *plugin; -}; - -class ShiftInterlaceWindow : public PluginClientWindow -{ -public: - ShiftInterlaceWindow(ShiftInterlaceMain *plugin); - - void create_objects(); - - ShiftInterlaceOdd *odd_offset; - ShiftInterlaceEven *even_offset; - ShiftInterlaceMain *plugin; -}; - - - - - - -class ShiftInterlaceMain : public PluginVClient -{ -public: - ShiftInterlaceMain(PluginServer *server); - ~ShiftInterlaceMain(); - -// required for all realtime plugins - PLUGIN_CLASS_MEMBERS(ShiftInterlaceConfig) - int process_realtime(VFrame *input_ptr, VFrame *output_ptr); - int is_realtime(); - void update_gui(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - - - void shift_row(VFrame *input_frame, - VFrame *output_frame, - int offset, - int row); - - -}; - - PluginClient* new_plugin(PluginServer *server) @@ -129,6 +34,11 @@ PluginClient* new_plugin(PluginServer *server) ShiftInterlaceConfig::ShiftInterlaceConfig() +{ + reset(); +} + +void ShiftInterlaceConfig::reset() { odd_offset = 0; even_offset = 0; @@ -168,9 +78,9 @@ void ShiftInterlaceConfig::interpolate(ShiftInterlaceConfig &prev, ShiftInterlaceWindow::ShiftInterlaceWindow(ShiftInterlaceMain *plugin) : PluginClientWindow(plugin, 310, - 100, + 110, 310, - 100, + 110, 0) { this->plugin = plugin; @@ -187,11 +97,19 @@ void ShiftInterlaceWindow::create_objects() y += margin; add_subwindow(new BC_Title(x, y, _("Even offset:"))); add_subwindow(even_offset = new ShiftInterlaceEven(plugin, x + 90, y)); - + y += 40; + add_subwindow(reset = new ShiftInterlaceReset(plugin, this, x, y)); show_window(); flush(); } +// for Reset button +void ShiftInterlaceWindow::update() +{ + odd_offset->update(plugin->config.odd_offset); + even_offset->update(plugin->config.even_offset); +} + ShiftInterlaceOdd::ShiftInterlaceOdd(ShiftInterlaceMain *plugin, int x, int y) @@ -240,6 +158,25 @@ int ShiftInterlaceEven::handle_event() +ShiftInterlaceReset::ShiftInterlaceReset(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->gui = gui; +} +ShiftInterlaceReset::~ShiftInterlaceReset() +{ +} +int ShiftInterlaceReset::handle_event() +{ + plugin->config.reset(); + gui->update(); + plugin->send_configure_change(); + return 1; +} + + + diff --git a/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h new file mode 100644 index 00000000..d4618a07 --- /dev/null +++ b/cinelerra-5.1/plugins/shiftinterlace/shiftinterlace.h @@ -0,0 +1,136 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef SHIFTINTERLACE_H +#define SHIFTINTERLACE_H + +#include "bcdisplayinfo.h" +#include "clip.h" +#include "bchash.h" +#include "filexml.h" +#include "guicast.h" +#include "language.h" +#include "pluginvclient.h" +#include "vframe.h" + + + +#include +#include + + + + + + + +class ShiftInterlaceWindow; +class ShiftInterlaceMain; + +class ShiftInterlaceConfig +{ +public: + ShiftInterlaceConfig(); + + void reset(); + int equivalent(ShiftInterlaceConfig &that); + void copy_from(ShiftInterlaceConfig &that); + void interpolate(ShiftInterlaceConfig &prev, + ShiftInterlaceConfig &next, + long prev_frame, + long next_frame, + long current_frame); + + + int odd_offset; + int even_offset; +}; + + +class ShiftInterlaceOdd : public BC_ISlider +{ +public: + ShiftInterlaceOdd(ShiftInterlaceMain *plugin, int x, int y); + int handle_event(); + ShiftInterlaceMain *plugin; +}; + +class ShiftInterlaceEven : public BC_ISlider +{ +public: + ShiftInterlaceEven(ShiftInterlaceMain *plugin, int x, int y); + int handle_event(); + ShiftInterlaceMain *plugin; +}; + +class ShiftInterlaceReset : public BC_GenericButton +{ +public: + ShiftInterlaceReset(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y); + ~ShiftInterlaceReset(); + int handle_event(); + ShiftInterlaceMain *plugin; + ShiftInterlaceWindow *gui; +}; + +class ShiftInterlaceWindow : public PluginClientWindow +{ +public: + ShiftInterlaceWindow(ShiftInterlaceMain *plugin); + + void create_objects(); + void update(); + + ShiftInterlaceOdd *odd_offset; + ShiftInterlaceEven *even_offset; + ShiftInterlaceMain *plugin; + ShiftInterlaceReset *reset; +}; + + + + + + +class ShiftInterlaceMain : public PluginVClient +{ +public: + ShiftInterlaceMain(PluginServer *server); + ~ShiftInterlaceMain(); + +// required for all realtime plugins + PLUGIN_CLASS_MEMBERS(ShiftInterlaceConfig) + int process_realtime(VFrame *input_ptr, VFrame *output_ptr); + int is_realtime(); + void update_gui(); + void save_data(KeyFrame *keyframe); + void read_data(KeyFrame *keyframe); + + + void shift_row(VFrame *input_frame, + VFrame *output_frame, + int offset, + int row); + + +}; + +#endif diff --git a/cinelerra-5.1/plugins/swapchannels/swapchannels.C b/cinelerra-5.1/plugins/swapchannels/swapchannels.C index cf169d26..52ab4caf 100644 --- a/cinelerra-5.1/plugins/swapchannels/swapchannels.C +++ b/cinelerra-5.1/plugins/swapchannels/swapchannels.C @@ -47,11 +47,16 @@ REGISTER_PLUGIN(SwapMain) SwapConfig::SwapConfig() +{ + reset_Config(); +} + +void SwapConfig::reset_Config() { red = RED_SRC; green = GREEN_SRC; blue = BLUE_SRC; - alpha = ALPHA_SRC; + alpha = ALPHA_SRC; } @@ -81,9 +86,9 @@ void SwapConfig::copy_from(SwapConfig &that) SwapWindow::SwapWindow(SwapMain *plugin) : PluginClientWindow(plugin, 250, - 170, + 200, 250, - 170, + 200, 0) { this->plugin = plugin; @@ -117,6 +122,9 @@ void SwapWindow::create_objects() add_subwindow(alpha = new SwapMenu(plugin, &(plugin->config.alpha), x, y)); alpha->create_objects(); + y += 40; + add_subwindow(reset = new SwapReset(plugin, this, x, y)); + show_window(); flush(); } @@ -128,7 +136,6 @@ void SwapWindow::create_objects() - SwapMenu::SwapMenu(SwapMain *client, int *output, int x, int y) : BC_PopupMenu(x, y, 150, client->output_to_text(*output)) { @@ -171,7 +178,22 @@ int SwapItem::handle_event() - +SwapReset::SwapReset(SwapMain *plugin, SwapWindow *gui, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->gui = gui; +} +SwapReset::~SwapReset() +{ +} +int SwapReset::handle_event() +{ + plugin->config.reset_Config(); + plugin->send_configure_change(); + plugin->update_gui(); + return 1; +} diff --git a/cinelerra-5.1/plugins/swapchannels/swapchannels.h b/cinelerra-5.1/plugins/swapchannels/swapchannels.h index 37e8f529..8baffaf5 100644 --- a/cinelerra-5.1/plugins/swapchannels/swapchannels.h +++ b/cinelerra-5.1/plugins/swapchannels/swapchannels.h @@ -33,6 +33,8 @@ class SwapMain; +class SwapWindow; +class SwapReset; #define RED_SRC 0 #define GREEN_SRC 1 @@ -48,6 +50,7 @@ class SwapConfig public: SwapConfig(); + void reset_Config(); int equivalent(SwapConfig &that); void copy_from(SwapConfig &that); @@ -84,13 +87,24 @@ public: char *title; }; + +class SwapReset : public BC_GenericButton +{ +public: + SwapReset(SwapMain *plugin, SwapWindow *gui, int x, int y); + ~SwapReset(); + int handle_event(); + SwapMain *plugin; + SwapWindow *gui; +}; + + class SwapWindow : public PluginClientWindow { public: SwapWindow(SwapMain *plugin); ~SwapWindow(); - void create_objects(); SwapMain *plugin; @@ -98,6 +112,7 @@ public: SwapMenu *green; SwapMenu *blue; SwapMenu *alpha; + SwapReset *reset; }; diff --git a/cinelerra-5.1/plugins/swapframes/swapframes.C b/cinelerra-5.1/plugins/swapframes/swapframes.C index 60a8a98c..6e37f7a0 100644 --- a/cinelerra-5.1/plugins/swapframes/swapframes.C +++ b/cinelerra-5.1/plugins/swapframes/swapframes.C @@ -45,6 +45,11 @@ REGISTER_PLUGIN(SwapFrames) SwapFramesConfig::SwapFramesConfig() +{ + reset(); +} + +void SwapFramesConfig::reset() { on = 1; swap_even = 1; @@ -155,12 +160,34 @@ int SwapFramesOdd::handle_event() + +SwapFramesReset::SwapFramesReset(SwapFrames *plugin, SwapFramesWindow *gui, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->gui = gui; +} +SwapFramesReset::~SwapFramesReset() +{ +} +int SwapFramesReset::handle_event() +{ + plugin->config.reset(); + gui->update(); + plugin->send_configure_change(); + return 1; +} + + + + + SwapFramesWindow::SwapFramesWindow(SwapFrames *plugin) : PluginClientWindow(plugin, 260, - 130, + 135, 260, - 130, + 135, 0) { this->plugin = plugin; @@ -183,10 +210,20 @@ void SwapFramesWindow::create_objects() this, x, y)); + + y += 35; + add_subwindow(reset = new SwapFramesReset(plugin, this, x, y)); + show_window(); } - +// for Reset button +void SwapFramesWindow::update() +{ + on->update(plugin->config.swap_even); + swap_even->update(plugin->config.swap_even); + swap_odd->update(!plugin->config.swap_even); +} diff --git a/cinelerra-5.1/plugins/swapframes/swapframes.h b/cinelerra-5.1/plugins/swapframes/swapframes.h index 6b547289..6ecebeef 100644 --- a/cinelerra-5.1/plugins/swapframes/swapframes.h +++ b/cinelerra-5.1/plugins/swapframes/swapframes.h @@ -28,12 +28,14 @@ class SwapFrames; class SwapFramesWindow; +class SwapFramesReset; class SwapFramesConfig { public: SwapFramesConfig(); + void reset(); int equivalent(SwapFramesConfig &that); void copy_from(SwapFramesConfig &that); void interpolate(SwapFramesConfig &prev, @@ -79,16 +81,28 @@ public: SwapFrames *plugin; }; +class SwapFramesReset : public BC_GenericButton +{ +public: + SwapFramesReset(SwapFrames *plugin, SwapFramesWindow *gui, int x, int y); + ~SwapFramesReset(); + int handle_event(); + SwapFrames *plugin; + SwapFramesWindow *gui; +}; + class SwapFramesWindow : public PluginClientWindow { public: SwapFramesWindow(SwapFrames *plugin); void create_objects(); + void update(); SwapFramesOn *on; SwapFramesEven *swap_even; SwapFramesOdd *swap_odd; SwapFrames *plugin; + SwapFramesReset *reset; }; diff --git a/cinelerra-5.1/plugins/translate/translate.C b/cinelerra-5.1/plugins/translate/translate.C index ce965b0c..d9d3c5ca 100644 --- a/cinelerra-5.1/plugins/translate/translate.C +++ b/cinelerra-5.1/plugins/translate/translate.C @@ -33,6 +33,11 @@ REGISTER_PLUGIN(TranslateMain) TranslateConfig::TranslateConfig() +{ + reset(); +} + +void TranslateConfig::reset() { in_x = 0; in_y = 0; @@ -44,6 +49,7 @@ TranslateConfig::TranslateConfig() out_h = 480; } + int TranslateConfig::equivalent(TranslateConfig &that) { return EQUIV(in_x, that.in_x) && diff --git a/cinelerra-5.1/plugins/translate/translate.h b/cinelerra-5.1/plugins/translate/translate.h index 416cacb5..27057c81 100644 --- a/cinelerra-5.1/plugins/translate/translate.h +++ b/cinelerra-5.1/plugins/translate/translate.h @@ -36,6 +36,7 @@ class TranslateConfig { public: TranslateConfig(); + void reset(); int equivalent(TranslateConfig &that); void copy_from(TranslateConfig &that); void interpolate(TranslateConfig &prev, diff --git a/cinelerra-5.1/plugins/translate/translatewin.C b/cinelerra-5.1/plugins/translate/translatewin.C index c1a6400e..7f01b30c 100644 --- a/cinelerra-5.1/plugins/translate/translatewin.C +++ b/cinelerra-5.1/plugins/translate/translatewin.C @@ -40,9 +40,9 @@ TranslateWin::TranslateWin(TranslateMain *client) : PluginClientWindow(client, 300, - 220, + 250, 300, - 220, + 250, 0) { this->client = client; @@ -78,8 +78,9 @@ void TranslateWin::create_objects() y += 20; in_h = new TranslateCoord(this, client, x, y, &client->config.in_h); in_h->create_objects(); - y += 30; + y += 40; + add_tool(reset = new TranslateReset(client, this, x, y)); x += 150; y = 10; @@ -107,12 +108,23 @@ void TranslateWin::create_objects() out_h->create_objects(); y += 30; - - show_window(); flush(); } +void TranslateWin::update() +{ + in_x->update((int64_t)client->config.in_x); + in_y->update((int64_t)client->config.in_y); + in_w->update((int64_t)client->config.in_w); + in_h->update((int64_t)client->config.in_h); + out_x->update((int64_t)client->config.out_x); + out_y->update((int64_t)client->config.out_y); + out_y->update((int64_t)client->config.out_y); + out_w->update((int64_t)client->config.out_w); + out_h->update((int64_t)client->config.out_h); +} + TranslateCoord::TranslateCoord(TranslateWin *win, @@ -146,4 +158,19 @@ int TranslateCoord::handle_event() return 1; } - +TranslateReset::TranslateReset(TranslateMain *client, TranslateWin *win, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->client = client; + this->win = win; +} +TranslateReset::~TranslateReset() +{ +} +int TranslateReset::handle_event() +{ + client->config.reset(); + win->update(); + client->send_configure_change(); + return 1; +} diff --git a/cinelerra-5.1/plugins/translate/translatewin.h b/cinelerra-5.1/plugins/translate/translatewin.h index 0f46eb0b..ba47d6b0 100644 --- a/cinelerra-5.1/plugins/translate/translatewin.h +++ b/cinelerra-5.1/plugins/translate/translatewin.h @@ -26,6 +26,7 @@ class TranslateThread; class TranslateWin; +class TranslateReset; #include "filexml.h" #include "mutex.h" @@ -43,9 +44,11 @@ public: ~TranslateWin(); void create_objects(); + void update(); TranslateCoord *in_x, *in_y, *in_w, *in_h, *out_x, *out_y, *out_w, *out_h; TranslateMain *client; + TranslateReset *reset; }; class TranslateCoord : public BC_TumbleTextBox @@ -64,5 +67,14 @@ public: float *value; }; +class TranslateReset : public BC_GenericButton +{ +public: + TranslateReset(TranslateMain *client, TranslateWin *win, int x, int y); + ~TranslateReset(); + int handle_event(); + TranslateMain *client; + TranslateWin *win; +}; #endif diff --git a/cinelerra-5.1/plugins/unsharp/unsharp.C b/cinelerra-5.1/plugins/unsharp/unsharp.C index 1de85f0a..bea4b6cf 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharp.C +++ b/cinelerra-5.1/plugins/unsharp/unsharp.C @@ -38,6 +38,11 @@ REGISTER_PLUGIN(UnsharpMain) UnsharpConfig::UnsharpConfig() +{ + reset(); +} + +void UnsharpConfig::reset() { radius = 5; amount = 0.5; diff --git a/cinelerra-5.1/plugins/unsharp/unsharp.h b/cinelerra-5.1/plugins/unsharp/unsharp.h index 8aa58d75..786dd42d 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharp.h +++ b/cinelerra-5.1/plugins/unsharp/unsharp.h @@ -41,6 +41,7 @@ class UnsharpConfig { public: UnsharpConfig(); + void reset(); int equivalent(UnsharpConfig &that); void copy_from(UnsharpConfig &that); diff --git a/cinelerra-5.1/plugins/unsharp/unsharpwindow.C b/cinelerra-5.1/plugins/unsharp/unsharpwindow.C index 6341b5cd..8839464a 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharpwindow.C +++ b/cinelerra-5.1/plugins/unsharp/unsharpwindow.C @@ -34,7 +34,7 @@ UnsharpWindow::UnsharpWindow(UnsharpMain *plugin) - : PluginClientWindow(plugin, 285, 160, 285, 160, 0) + : PluginClientWindow(plugin, 285, 170, 285, 170, 0) { this->plugin = plugin; } @@ -45,25 +45,22 @@ UnsharpWindow::~UnsharpWindow() void UnsharpWindow::create_objects() { - int x = 10, y = 10; + int x = 10, y = 10, x1 = 90; BC_Title *title; add_subwindow(title = new BC_Title(x, y + 10, _("Radius:"))); - add_subwindow(radius = new UnsharpRadius(plugin, - x + title->get_w() + 10, - y)); + add_subwindow(radius = new UnsharpRadius(plugin, x + x1, y)); y += 40; add_subwindow(title = new BC_Title(x, y + 10, _("Amount:"))); - add_subwindow(amount = new UnsharpAmount(plugin, - x + title->get_w() + 10, - y)); + add_subwindow(amount = new UnsharpAmount(plugin, x + x1, y)); y += 40; add_subwindow(title = new BC_Title(x, y + 10, _("Threshold:"))); - add_subwindow(threshold = new UnsharpThreshold(plugin, - x + title->get_w() + 10, - y)); + add_subwindow(threshold = new UnsharpThreshold(plugin, x + x1, y)); + + y += 50; + add_subwindow(reset = new UnsharpReset(plugin, this, x, y)); show_window(); flush(); @@ -122,6 +119,21 @@ int UnsharpThreshold::handle_event() return 1; } - +UnsharpReset::UnsharpReset(UnsharpMain *plugin, UnsharpWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +UnsharpReset::~UnsharpReset() +{ +} +int UnsharpReset::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} diff --git a/cinelerra-5.1/plugins/unsharp/unsharpwindow.h b/cinelerra-5.1/plugins/unsharp/unsharpwindow.h index d5dc1cf3..3e3c7b70 100644 --- a/cinelerra-5.1/plugins/unsharp/unsharpwindow.h +++ b/cinelerra-5.1/plugins/unsharp/unsharpwindow.h @@ -50,6 +50,16 @@ public: UnsharpMain *plugin; }; +class UnsharpReset : public BC_GenericButton +{ +public: + UnsharpReset(UnsharpMain *plugin, UnsharpWindow *window, int x, int y); + ~UnsharpReset(); + int handle_event(); + UnsharpMain *plugin; + UnsharpWindow *window; +}; + class UnsharpWindow : public PluginClientWindow { public: @@ -63,6 +73,7 @@ public: UnsharpAmount *amount; UnsharpThreshold *threshold; UnsharpMain *plugin; + UnsharpReset *reset; }; diff --git a/cinelerra-5.1/plugins/yuv/yuv.C b/cinelerra-5.1/plugins/yuv/yuv.C index 9e7dce83..75139b9d 100644 --- a/cinelerra-5.1/plugins/yuv/yuv.C +++ b/cinelerra-5.1/plugins/yuv/yuv.C @@ -34,12 +34,15 @@ class YUVEffect; +class YUVWindow; +class YUVReset; class YUVConfig { public: YUVConfig(); + void reset(); void copy_from(YUVConfig &src); int equivalent(YUVConfig &src); @@ -61,13 +64,25 @@ public: float *output; }; +class YUVReset : public BC_GenericButton +{ +public: + YUVReset(YUVEffect *plugin, YUVWindow *window, int x, int y); + ~YUVReset(); + int handle_event(); + YUVEffect *plugin; + YUVWindow *window; +}; + class YUVWindow : public PluginClientWindow { public: YUVWindow(YUVEffect *plugin); void create_objects(); + void update(); YUVLevel *y, *u, *v; YUVEffect *plugin; + YUVReset *reset; }; @@ -100,6 +115,11 @@ REGISTER_PLUGIN(YUVEffect) YUVConfig::YUVConfig() +{ + reset(); +} + +void YUVConfig::reset() { y = 0; u = 0; @@ -161,12 +181,30 @@ int YUVLevel::handle_event() } +YUVReset::YUVReset(YUVEffect *plugin, YUVWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +YUVReset::~YUVReset() +{ +} +int YUVReset::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} + + YUVWindow::YUVWindow(YUVEffect *plugin) : PluginClientWindow(plugin, 260, - 100, + 135, 260, - 100, + 135, 0) { this->plugin = plugin; @@ -174,7 +212,7 @@ YUVWindow::YUVWindow(YUVEffect *plugin) void YUVWindow::create_objects() { - int x = 10, y = 10, x1 = 50; + int x = 10, y = 10, x1 = 40; add_subwindow(new BC_Title(x, y, _("Y:"))); add_subwindow(this->y = new YUVLevel(plugin, &plugin->config.y, x1, y)); y += 30; @@ -183,13 +221,21 @@ void YUVWindow::create_objects() y += 30; add_subwindow(new BC_Title(x, y, _("V:"))); add_subwindow(v = new YUVLevel(plugin, &plugin->config.v, x1, y)); + y += 35; + add_subwindow(reset = new YUVReset(plugin, this, x, y)); show_window(); flush(); } - +// for Reset button +void YUVWindow::update() +{ + this->y->update(plugin->config.y); + u->update(plugin->config.u); + v->update(plugin->config.v); +} diff --git a/cinelerra-5.1/plugins/yuv411/yuv411.C b/cinelerra-5.1/plugins/yuv411/yuv411.C index 100541f5..c014ec75 100644 --- a/cinelerra-5.1/plugins/yuv411/yuv411.C +++ b/cinelerra-5.1/plugins/yuv411/yuv411.C @@ -13,6 +13,11 @@ REGISTER_PLUGIN(yuv411Main) yuv411Config::yuv411Config() +{ + reset(); +} + +void yuv411Config::reset() { int_horizontal = 0; avg_vertical = 0; diff --git a/cinelerra-5.1/plugins/yuv411/yuv411.h b/cinelerra-5.1/plugins/yuv411/yuv411.h index b4b0ca78..6499d78b 100644 --- a/cinelerra-5.1/plugins/yuv411/yuv411.h +++ b/cinelerra-5.1/plugins/yuv411/yuv411.h @@ -14,6 +14,8 @@ class yuv411Config { public: yuv411Config(); + void reset(); + void copy_from(yuv411Config &that); int equivalent(yuv411Config &that); void interpolate(yuv411Config &prev, yuv411Config &next, diff --git a/cinelerra-5.1/plugins/yuv411/yuv411win.C b/cinelerra-5.1/plugins/yuv411/yuv411win.C index 605f1aaf..6b729291 100644 --- a/cinelerra-5.1/plugins/yuv411/yuv411win.C +++ b/cinelerra-5.1/plugins/yuv411/yuv411win.C @@ -3,7 +3,7 @@ #include "language.h" yuv411Window::yuv411Window(yuv411Main *client) - : PluginClientWindow(client, 250, 220, 250, 220, 0) + : PluginClientWindow(client, 250, 255, 250, 255, 0) { this->client = client; } @@ -42,6 +42,7 @@ void yuv411Window::create_objects() add_subwindow(new BC_Title(x, y, _("Bias:"))); add_subwindow(bias=new yuv411Bias(client,x1,y)); y += 30; + add_subwindow(reset = new yuv411Reset(client, this, x, y+35)); show_window(); flush(); @@ -50,6 +51,16 @@ void yuv411Window::create_objects() yuv_warning->hide_window(); } +void yuv411Window::update() +{ + avg_vertical->update(client->config.avg_vertical); + int_horizontal->update(client->config.int_horizontal); + inpainting->update(client->config.inpainting); + offset->update(client->config.offset); + thresh->update(client->config.thresh); + bias->update(client->config.bias); +} + int yuv411Window::close_event() { set_done(1); @@ -116,6 +127,25 @@ int yuv411Bias::handle_event() return 1; } +yuv411Reset::yuv411Reset(yuv411Main *client, yuv411Window *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->client = client; + this->window = window; +} +yuv411Reset::~yuv411Reset() +{ +} +int yuv411Reset::handle_event() +{ + client->config.reset(); + window->update(); + window->update_enables(); + client->send_configure_change(); + return 1; +} + + void yuv411Window::update_enables() { yuv411Config &config = client->config; diff --git a/cinelerra-5.1/plugins/yuv411/yuv411win.h b/cinelerra-5.1/plugins/yuv411/yuv411win.h index a08eeffe..ebb30a1f 100644 --- a/cinelerra-5.1/plugins/yuv411/yuv411win.h +++ b/cinelerra-5.1/plugins/yuv411/yuv411win.h @@ -13,6 +13,7 @@ class yuv411Toggle; class yuv411Offset; class yuv411Thresh; class yuv411Bias; +class yuv411Reset; class yuv411Window : public PluginClientWindow { @@ -21,6 +22,7 @@ public: ~yuv411Window(); void create_objects(); + void update(); int close_event(); void update_enables(); void show_warning(int warn); @@ -33,6 +35,7 @@ public: yuv411Thresh *thresh; yuv411Bias *bias; BC_Title *yuv_warning; + yuv411Reset *reset; }; class yuv411Toggle : public BC_CheckBox @@ -70,4 +73,14 @@ public: yuv411Main *client; }; +class yuv411Reset : public BC_GenericButton +{ +public: + yuv411Reset(yuv411Main *client, yuv411Window *window, int x, int y); + ~yuv411Reset(); + int handle_event(); + yuv411Main *client; + yuv411Window *window; +}; + #endif diff --git a/cinelerra-5.1/plugins/yuvshift/yuvshift.C b/cinelerra-5.1/plugins/yuvshift/yuvshift.C index bab83bb4..3f68a6c8 100644 --- a/cinelerra-5.1/plugins/yuvshift/yuvshift.C +++ b/cinelerra-5.1/plugins/yuvshift/yuvshift.C @@ -19,76 +19,7 @@ * */ -#include "bcdisplayinfo.h" -#include "clip.h" -#include "bchash.h" -#include "filexml.h" -#include "guicast.h" -#include "language.h" -#include "bccolors.h" -#include "pluginvclient.h" -#include "vframe.h" - -#include -#include - - -class YUVShiftEffect; - - -class YUVShiftConfig -{ -public: - YUVShiftConfig(); - - void copy_from(YUVShiftConfig &src); - int equivalent(YUVShiftConfig &src); - void interpolate(YUVShiftConfig &prev, - YUVShiftConfig &next, - long prev_frame, - long next_frame, - long current_frame); - - int y_dx, y_dy, u_dx, u_dy, v_dx, v_dy; -}; - -class YUVShiftLevel : public BC_ISlider -{ -public: - YUVShiftLevel(YUVShiftEffect *plugin, int *output, int x, int y); - int handle_event(); - YUVShiftEffect *plugin; - int *output; -}; - -class YUVShiftWindow : public PluginClientWindow -{ -public: - YUVShiftWindow(YUVShiftEffect *plugin); - void create_objects(); - YUVShiftLevel *y_dx, *y_dy, *u_dx, *u_dy, *v_dx, *v_dy; - YUVShiftEffect *plugin; -}; - - - -class YUVShiftEffect : public PluginVClient -{ - VFrame *temp_frame; -public: - YUVShiftEffect(PluginServer *server); - ~YUVShiftEffect(); - - - PLUGIN_CLASS_MEMBERS(YUVShiftConfig) - int process_realtime(VFrame *input, VFrame *output); - int is_realtime(); - void save_data(KeyFrame *keyframe); - void read_data(KeyFrame *keyframe); - void update_gui(); -}; - - +#include "yuvshift.h" @@ -99,8 +30,12 @@ REGISTER_PLUGIN(YUVShiftEffect) - YUVShiftConfig::YUVShiftConfig() +{ + reset(); +} + +void YUVShiftConfig::reset() { y_dx = y_dy = 0; u_dx = u_dy = 0; @@ -159,8 +94,26 @@ int YUVShiftLevel::handle_event() } +YUVShiftReset::YUVShiftReset(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y) + : BC_GenericButton(x, y, _("Reset")) +{ + this->plugin = plugin; + this->window = window; +} +YUVShiftReset::~YUVShiftReset() +{ +} +int YUVShiftReset::handle_event() +{ + plugin->config.reset(); + window->update(); + plugin->send_configure_change(); + return 1; +} + + YUVShiftWindow::YUVShiftWindow(YUVShiftEffect *plugin) - : PluginClientWindow(plugin, 300, 200, 300, 200, 0) + : PluginClientWindow(plugin, 300, 230, 300, 230, 0) { this->plugin = plugin; } @@ -186,12 +139,24 @@ void YUVShiftWindow::create_objects() add_subwindow(new BC_Title(x, y, _("V_dy:"))); add_subwindow(v_dy = new YUVShiftLevel(plugin, &plugin->config.v_dy, x1, y)); + y += 40; + add_subwindow(reset = new YUVShiftReset(plugin, this, x, y)); + show_window(); flush(); } - +// for Reset button +void YUVShiftWindow::update() +{ + y_dx->update(plugin->config.y_dx); + y_dy->update(plugin->config.y_dy); + u_dx->update(plugin->config.u_dx); + u_dy->update(plugin->config.u_dy); + v_dx->update(plugin->config.v_dx); + v_dy->update(plugin->config.v_dy); +} diff --git a/cinelerra-5.1/plugins/yuvshift/yuvshift.h b/cinelerra-5.1/plugins/yuvshift/yuvshift.h new file mode 100644 index 00000000..c943f5b7 --- /dev/null +++ b/cinelerra-5.1/plugins/yuvshift/yuvshift.h @@ -0,0 +1,109 @@ + +/* + * CINELERRA + * Copyright (C) 2008 Adam Williams + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef YUVSHIFT_H +#define YUVSHIFT_H + +#include "bcdisplayinfo.h" +#include "clip.h" +#include "bchash.h" +#include "filexml.h" +#include "guicast.h" +#include "language.h" +#include "bccolors.h" +#include "pluginvclient.h" +#include "vframe.h" + +#include +#include + + +class YUVShiftEffect; +class YUVShiftWindow; +class YUVShiftReset; + + +class YUVShiftConfig +{ +public: + YUVShiftConfig(); + + void reset(); + void copy_from(YUVShiftConfig &src); + int equivalent(YUVShiftConfig &src); + void interpolate(YUVShiftConfig &prev, + YUVShiftConfig &next, + long prev_frame, + long next_frame, + long current_frame); + + int y_dx, y_dy, u_dx, u_dy, v_dx, v_dy; +}; + +class YUVShiftLevel : public BC_ISlider +{ +public: + YUVShiftLevel(YUVShiftEffect *plugin, int *output, int x, int y); + int handle_event(); + YUVShiftEffect *plugin; + int *output; +}; + +class YUVShiftReset : public BC_GenericButton +{ +public: + YUVShiftReset(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y); + ~YUVShiftReset(); + int handle_event(); + YUVShiftEffect *plugin; + YUVShiftWindow *window; +}; + +class YUVShiftWindow : public PluginClientWindow +{ +public: + YUVShiftWindow(YUVShiftEffect *plugin); + void create_objects(); + void update(); + YUVShiftLevel *y_dx, *y_dy, *u_dx, *u_dy, *v_dx, *v_dy; + YUVShiftEffect *plugin; + YUVShiftReset *reset; +}; + + + +class YUVShiftEffect : public PluginVClient +{ + VFrame *temp_frame; +public: + YUVShiftEffect(PluginServer *server); + ~YUVShiftEffect(); + + + PLUGIN_CLASS_MEMBERS(YUVShiftConfig) + int process_realtime(VFrame *input, VFrame *output); + int is_realtime(); + void save_data(KeyFrame *keyframe); + void read_data(KeyFrame *keyframe); + void update_gui(); +}; + +#endif