made menu items for effect copy/paste
This commit is contained in:
@@ -53,7 +53,7 @@ EffectControls::EffectControls(QWidget *parent) :
|
||||
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
|
||||
connect(keyframeView, SIGNAL(wheel_event_signal(QWheelEvent*)), effects_area, SLOT(receive_wheel_event(QWheelEvent*)));
|
||||
connect(keyframeView, SIGNAL(wheel_event_signal(QWheelEvent*)), effects_area, SLOT(receive_wheel_event(QWheelEvent*)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
||||
@@ -150,6 +150,15 @@ void EffectControls::scroll_to_frame(long frame) {
|
||||
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, keyframeView->width());
|
||||
}
|
||||
|
||||
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||
}
|
||||
|
||||
void EffectControls::cut() {
|
||||
copy(true);
|
||||
}
|
||||
|
||||
void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
effect_menu_type = type;
|
||||
effect_menu_subtype = subtype;
|
||||
@@ -291,6 +300,8 @@ void EffectControls::setup_ui() {
|
||||
scrollAreaLayout->setMargin(0);
|
||||
|
||||
effects_area = new EffectsArea(scrollAreaWidgetContents);
|
||||
effects_area->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(effects_area, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(effects_area_context_menu()));
|
||||
|
||||
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
||||
effects_area_layout->setSpacing(0);
|
||||
@@ -441,17 +452,25 @@ void EffectControls::setup_ui() {
|
||||
|
||||
hlayout->addWidget(splitter);
|
||||
|
||||
setWidget(contents);
|
||||
setWidget(contents);
|
||||
}
|
||||
|
||||
void EffectControls::update_scrollbar() {
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
||||
}
|
||||
|
||||
void EffectControls::queue_post_update() {
|
||||
keyframeView->update();
|
||||
update_scrollbar();
|
||||
keyframeView->update();
|
||||
update_scrollbar();
|
||||
}
|
||||
|
||||
void EffectControls::effects_area_context_menu() {
|
||||
QMenu menu(this);
|
||||
|
||||
add_effect_paste_action(&menu);
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void EffectControls::load_effects() {
|
||||
@@ -484,7 +503,7 @@ void EffectControls::load_effects() {
|
||||
keyframeView->setEnabled(true);
|
||||
headers->setVisible(true);
|
||||
|
||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -544,7 +563,7 @@ void EffectControls::audio_transition_click() {
|
||||
}
|
||||
|
||||
void EffectControls::resizeEvent(QResizeEvent*) {
|
||||
update_scrollbar();
|
||||
update_scrollbar();
|
||||
}
|
||||
|
||||
bool EffectControls::is_focused() {
|
||||
@@ -569,5 +588,5 @@ EffectsArea::EffectsArea(QWidget* parent) :
|
||||
{}
|
||||
|
||||
void EffectsArea::receive_wheel_event(QWheelEvent *e) {
|
||||
QApplication::sendEvent(this, e);
|
||||
QApplication::sendEvent(this, e);
|
||||
}
|
||||
|
||||
+11
-7
@@ -19,20 +19,19 @@ class QScrollBar;
|
||||
class QHBoxLayout;
|
||||
|
||||
class EffectsArea : public QWidget {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
EffectsArea(QWidget* parent = 0);
|
||||
EffectsArea(QWidget* parent = 0);
|
||||
QScrollArea* parent_widget;
|
||||
KeyframeView* keyframe_area;
|
||||
TimelineHeader* header;
|
||||
public slots:
|
||||
void receive_wheel_event(QWheelEvent* e);
|
||||
void receive_wheel_event(QWheelEvent* e);
|
||||
};
|
||||
|
||||
class EffectControls : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectControls(QWidget *parent = 0);
|
||||
~EffectControls();
|
||||
@@ -44,7 +43,6 @@ public:
|
||||
void set_zoom(bool in);
|
||||
bool keyframe_focus();
|
||||
void delete_selected_keyframes();
|
||||
void copy(bool del);
|
||||
bool multiple;
|
||||
void scroll_to_frame(long frame);
|
||||
|
||||
@@ -56,7 +54,11 @@ public:
|
||||
QScrollBar* verticalScrollBar;
|
||||
|
||||
QMutex effects_loaded;
|
||||
|
||||
void add_effect_paste_action(QMenu* menu);
|
||||
public slots:
|
||||
void cut();
|
||||
void copy(bool del = false);
|
||||
void update_keyframes();
|
||||
private slots:
|
||||
void menu_select(QAction* q);
|
||||
@@ -68,8 +70,10 @@ private slots:
|
||||
|
||||
void deselect_all_effects(QWidget*);
|
||||
|
||||
void update_scrollbar();
|
||||
void queue_post_update();
|
||||
void update_scrollbar();
|
||||
void queue_post_update();
|
||||
|
||||
void effects_area_context_menu();
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
private:
|
||||
|
||||
+1
-1
@@ -78,7 +78,6 @@ public:
|
||||
bool focused();
|
||||
void set_zoom(bool in);
|
||||
void copy(bool del);
|
||||
void paste(bool insert);
|
||||
Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
||||
Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
@@ -207,6 +206,7 @@ public:
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
public slots:
|
||||
void paste(bool insert = false);
|
||||
void repaint_timeline();
|
||||
void toggle_show_all();
|
||||
void deselect();
|
||||
|
||||
+11
-6
@@ -16,6 +16,7 @@
|
||||
#include "io/path.h"
|
||||
#include "mainwindow.h"
|
||||
#include "io/math.h"
|
||||
#include "io/clipboard.h"
|
||||
#include "transition.h"
|
||||
|
||||
#include "effects/internal/transformeffect.h"
|
||||
@@ -377,20 +378,24 @@ void Effect::show_context_menu(const QPoint& pos) {
|
||||
|
||||
int index = get_index_in_clip();
|
||||
|
||||
menu.addAction(tr("Cu&t"), panel_effect_controls, SLOT(cut()));
|
||||
menu.addAction(tr("&Copy"), panel_effect_controls, SLOT(copy(bool)));
|
||||
|
||||
panel_effect_controls->add_effect_paste_action(&menu);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
if (index > 0) {
|
||||
QAction* move_up = menu.addAction(tr("Move &Up"));
|
||||
connect(move_up, SIGNAL(triggered(bool)), this, SLOT(move_up()));
|
||||
menu.addAction(tr("Move &Up"), this, SLOT(move_up()));
|
||||
}
|
||||
|
||||
if (index < parent_clip->effects.size() - 1) {
|
||||
QAction* move_down = menu.addAction(tr("Move &Down"));
|
||||
connect(move_down, SIGNAL(triggered(bool)), this, SLOT(move_down()));
|
||||
menu.addAction(tr("Move &Down"), this, SLOT(move_down()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* del_action = menu.addAction(tr("D&elete"));
|
||||
connect(del_action, SIGNAL(triggered(bool)), this, SLOT(delete_self()));
|
||||
menu.addAction(tr("D&elete"), this, SLOT(delete_self()));
|
||||
|
||||
menu.exec(container->title_bar->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user