int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits)
{
int64_t cut_length = newposition - oldposition;
- if( !cut_length ) return 0;
+ if( cut_length > length )
+ cut_length = length;
+ else if( cut_length < -length )
+ cut_length = -length;
+
int64_t start = startproject, end = start + length;
Edit *prev = this->previous, *next = this->next;
int edits_moved = 0, rest_moved = 0;
edit->startproject += cut_length;
break;
case MOVE_ROLL:
+ if( prev && prev->length + cut_length < 0 )
+ cut_length = -prev->length;
if( prev ) prev->trim(cut_length);
startproject += cut_length;
startsource += cut_length;
break;
case MOVE_SLIDE:
edits_moved = 1;
+ if( prev && prev->length + cut_length < 0 )
+ cut_length = -prev->length;
+ if( next && next->length - cut_length < 0 )
+ cut_length = next->length;
if( prev ) prev->trim(cut_length);
startproject += cut_length;
if( next ) {
break;
}
trim(0);
-
return follow_edits(start, end, cut_length, edits_moved, rest_moved,
edit_labels, edit_autos, edit_plugins, trim_edits);
}
int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits)
{
int64_t cut_length = newposition - oldposition;
- if( !cut_length ) return 0;
+ if( cut_length > length )
+ cut_length = length;
+ else if( cut_length < -length )
+ cut_length = -length;
int64_t start = startproject, end = start + length;
Edit *prev = this->previous, *next = this->next;
int edits_moved = 0, rest_moved = 0;
edit->startproject += cut_length;
break;
case MOVE_ROLL:
+ if( next && next->length - cut_length < 0 )
+ cut_length = next->length;
length += cut_length;
if( next ) {
next->startproject += cut_length;
break;
case MOVE_SLIDE:
edits_moved = 1;
+ if( prev && prev->length + cut_length < 0 )
+ cut_length = -prev->length;
+ if( next && next->length - cut_length < 0 )
+ cut_length = next->length;
if( prev ) prev->trim(cut_length);
startproject += cut_length;
if( next ) {
break;
}
trim(0);
-
return follow_edits(start, end, cut_length, edits_moved, rest_moved,
edit_labels, edit_autos, edit_plugins, trim_edits);
}
void PluginDialogThread::handle_done_event(int result)
{
- PluginDialog *window = (PluginDialog*)BC_DialogThread::get_gui();
- if(window->selected_available >= 0)
- {
- window->attach_new(window->selected_available);
- }
- else
- if(window->selected_shared >= 0)
- {
- window->attach_shared(window->selected_shared);
- }
- else
- if(window->selected_modules >= 0)
- {
- window->attach_module(window->selected_modules);
+ if( !result ) {
+ PluginDialog *dialog = (PluginDialog *)get_gui();
+ dialog->apply();
}
- if( mwindow->edl )
- mwindow->edl->session->single_standalone = single_standalone;
}
+
void PluginDialogThread::handle_close_event(int result)
{
- if(!result)
- {
- if(plugin_type)
- {
- mwindow->gui->lock_window("PluginDialogThread::run 3");
-
-
- mwindow->undo->update_undo_before();
- if(is_mainmenu)
- {
- mwindow->insert_effect(plugin_title,
- &shared_location,
- data_type,
- plugin_type,
- single_standalone);
- }
- else
- {
- if(plugin)
- {
- if(mwindow->edl->tracks->plugin_exists(plugin))
- {
- plugin->change_plugin(plugin_title,
- &shared_location,
- plugin_type);
- }
- }
- else
- {
- if(mwindow->edl->tracks->track_exists(track))
- {
- mwindow->insert_effect(plugin_title,
- &shared_location,
- track,
- 0,
- 0,
- 0,
- plugin_type);
- }
- }
- }
-
- mwindow->save_backup();
- mwindow->undo->update_undo_after(_("attach effect"), LOAD_EDITS | LOAD_PATCHES);
- mwindow->restart_brender();
- mwindow->update_plugin_states();
- mwindow->sync_parameters(CHANGE_EDL);
- mwindow->gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
- mwindow->gui->unlock_window();
- }
- }
- plugin = 0;
}
-
-
-
-
PluginDialog::PluginDialog(MWindow *mwindow,
PluginDialogThread *thread,
const char *window_title,
- add_subwindow(new BC_OKButton(this));
- add_subwindow(new BC_CancelButton(this));
-
+ add_subwindow(ok_btn = new BC_OKButton(this));
+ add_subwindow(can_btn = new BC_CancelButton(this));
+ int aw = PluginDialogApply::calculate_w(this, _("Apply"));
+ int ax = (ok_btn->get_x()+can_btn->get_x()-aw) / 2;
+ int ay = ok_btn->get_y() + ok_btn->get_h() - PluginDialogApply::calculate_h();
+ add_subwindow(apy_btn = new PluginDialogApply(this, ax, ay));
selected_available = -1;
selected_shared = -1;
selected_modules = -1;
mwindow->theme->plugindialog_new_y + mwindow->theme->plugindialog_new_h +
get_text_height(MEDIUMFONT));
+ int aw = PluginDialogApply::calculate_w(this, _("Apply"));
+ int ax = (ok_btn->get_x()+can_btn->get_x()-aw) / 2;
+ int ay = ok_btn->get_y() + ok_btn->get_h() - PluginDialogApply::calculate_h();
+ apy_btn->reposition_window(ax, ay);
+
flush();
return 0;
}
}
+void PluginDialog::apply()
+{
+ if( selected_available >= 0 ) {
+ attach_new(selected_available);
+ }
+ else if( selected_shared >= 0 ) {
+ attach_shared(selected_shared);
+ }
+ else if( selected_modules >= 0 ) {
+ attach_module(selected_modules);
+ }
+
+ thread->apply();
+}
+
+void PluginDialogThread::apply()
+{
+ if( mwindow->edl )
+ mwindow->edl->session->single_standalone = single_standalone;
+ if(plugin_type) {
+ mwindow->gui->lock_window("PluginDialogThread::run 3");
+ mwindow->undo->update_undo_before();
+ if( is_mainmenu ) {
+ mwindow->insert_effect(plugin_title, &shared_location,
+ data_type, plugin_type, single_standalone);
+ }
+ else {
+ if( plugin ) {
+ if( mwindow->edl->tracks->plugin_exists(plugin) ) {
+ plugin->change_plugin(plugin_title,
+ &shared_location, plugin_type);
+ }
+ }
+ else {
+ if( mwindow->edl->tracks->track_exists(track) ) {
+ mwindow->insert_effect(plugin_title, &shared_location,
+ track, 0, 0, 0, plugin_type);
+ }
+ }
+ }
+
+ mwindow->save_backup();
+ mwindow->undo->update_undo_after(_("attach effect"), LOAD_EDITS | LOAD_PATCHES);
+ mwindow->restart_brender();
+ mwindow->update_plugin_states();
+ mwindow->sync_parameters(CHANGE_EDL);
+ mwindow->gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
+ mwindow->gui->unlock_window();
+ }
+ plugin = 0;
+}
+
+PluginDialogApply::PluginDialogApply(PluginDialog *dialog, int x, int y)
+ : BC_GenericButton(x, y, _("Apply"))
+{
+ this->dialog = dialog;
+}
+
+int PluginDialogApply::handle_event()
+{
+ dialog->apply();
+ return 1;
+}
+
-
#ifndef PLUGINDIALOG_H
#define PLUGINDIALOG_H
-class PluginDialogTextBox;
-class PluginDialogDetach;
-class PluginDialogNew;
-class PluginDialogShared;
-class PluginDialogSearchText;
-class PluginDialogModules;
-class PluginDialogAttachNew;
-class PluginDialogChangeNew;
-class PluginDialogIn;
-class PluginDialogOut;
-class PluginDialogThru;
-class PluginDialogSingle;
-class PluginDialog;
-
#include "bcdialog.h"
#include "condition.inc"
#include "guicast.h"
#include "mutex.inc"
#include "mwindow.inc"
#include "plugin.inc"
+#include "plugindialog.inc"
#include "pluginserver.inc"
#include "sharedlocation.h"
#include "thread.h"
BC_Window* new_gui();
void handle_done_event(int result);
void handle_close_event(int result);
+ void apply();
MWindow *mwindow;
Track *track;
void save_settings();
int resize_event(int w, int h);
void load_plugin_list(int redraw);
+ void apply();
BC_Title *standalone_title;
PluginDialogNew *standalone_list;
PluginDialogModules *module_list;
PluginDialogSingle *single_standalone;
PluginDialogSearchText *search_text;
-
- PluginDialogThru *thru;
-
+ BC_OKButton *ok_btn;
+ BC_CancelButton *can_btn;
+ PluginDialogApply *apy_btn;
PluginDialogThread *thread;
ArrayList<BC_ListBoxItem*> standalone_data;
PluginDialog *dialog;
};
+class PluginDialogApply : public BC_GenericButton
+{
+public:
+ PluginDialogApply(PluginDialog *dialog, int x, int y);
+ int handle_event();
+
+ PluginDialog *dialog;
+};
/*
* class PluginDialogAttachShared : public BC_GenericButton
* {