added clip enabling/disabling
This commit is contained in:
@@ -799,3 +799,23 @@ void MainWindow::on_actionAuto_scale_by_Default_triggered() {
|
||||
void MainWindow::on_actionSet_Edit_Marker_triggered() {
|
||||
if (sequence != NULL) panel_timeline->set_marker();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEnable_Disable_Clip_triggered() {
|
||||
if (sequence != NULL) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
bool push_undo = false;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && panel_timeline->is_clip_selected(c, true)) {
|
||||
ca->append(new SetEnableCommand(c, !c->enabled));
|
||||
push_undo = true;
|
||||
}
|
||||
}
|
||||
if (push_undo) {
|
||||
undo_stack.push(ca);
|
||||
panel_timeline->repaint_timeline(true);
|
||||
} else {
|
||||
delete ca;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,6 +188,8 @@ private slots:
|
||||
|
||||
void on_actionSet_Edit_Marker_triggered();
|
||||
|
||||
void on_actionEnable_Disable_Clip_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
void setup_layout();
|
||||
|
||||
+10
-1
@@ -33,7 +33,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>653</width>
|
||||
<height>16</height>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
@@ -96,6 +96,7 @@
|
||||
<addaction name="actionRipple_Delete_In_Out"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSet_Edit_Marker"/>
|
||||
<addaction name="actionEnable_Disable_Clip"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuWindow">
|
||||
<property name="title">
|
||||
@@ -788,6 +789,14 @@
|
||||
<string>M</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Disable_Clip">
|
||||
<property name="text">
|
||||
<string>Enable/Disable Clip</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Shift+E</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
||||
@@ -761,6 +761,8 @@ bool Project::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
const QXmlStreamAttribute& attr = stream.attributes().at(j);
|
||||
if (attr.name() == "name") {
|
||||
c->name = attr.value().toString();
|
||||
} else if (attr.name() == "enabled") {
|
||||
c->enabled = (attr.value() == "1");
|
||||
} else if (attr.name() == "id") {
|
||||
c->load_id = attr.value().toInt();
|
||||
} else if (attr.name() == "clipin") {
|
||||
@@ -1074,6 +1076,7 @@ void Project::save_folder(QXmlStreamWriter& stream, QTreeWidgetItem* parent, int
|
||||
if (c != NULL) {
|
||||
stream.writeStartElement("clip"); // clip
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
stream.writeAttribute("enabled", QString::number(c->enabled));
|
||||
stream.writeAttribute("name", c->name);
|
||||
stream.writeAttribute("clipin", QString::number(c->clip_in));
|
||||
stream.writeAttribute("in", QString::number(c->timeline_in));
|
||||
|
||||
@@ -1505,3 +1505,20 @@ void SetSelectionsCommand::redo() {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
SetEnableCommand::SetEnableCommand(Clip* c, bool enable) :
|
||||
clip(c),
|
||||
old_val(c->enabled),
|
||||
new_val(enable),
|
||||
old_project_changed(mainWindow->isWindowModified())
|
||||
{}
|
||||
|
||||
void SetEnableCommand::undo() {
|
||||
clip->enabled = old_val;
|
||||
mainWindow->setWindowModified(old_project_changed);
|
||||
}
|
||||
|
||||
void SetEnableCommand::redo() {
|
||||
clip->enabled = new_val;
|
||||
mainWindow->setWindowModified(true);
|
||||
}
|
||||
|
||||
@@ -537,4 +537,16 @@ private:
|
||||
bool done;
|
||||
};
|
||||
|
||||
class SetEnableCommand : public QUndoCommand {
|
||||
public:
|
||||
SetEnableCommand(Clip* c, bool enable);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Clip* clip;
|
||||
bool old_val;
|
||||
bool new_val;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
#endif // UNDO_H
|
||||
|
||||
+12
-3
@@ -1039,6 +1039,7 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
long frame_diff = panel_timeline->getTimelineFrameFromScreenPoint(mouse_pos.x()) - panel_timeline->drag_frame_start;
|
||||
int track_diff = ((panel_timeline->tool == TIMELINE_TOOL_SLIDE || panel_timeline->transition_select != TA_NO_TRANSITION) && !panel_timeline->importing) ? 0 : mouse_track - panel_timeline->drag_track_start;
|
||||
long validator;
|
||||
long earliest_in_point = LONG_MAX;
|
||||
|
||||
// first try to snap
|
||||
long fm;
|
||||
@@ -1217,6 +1218,8 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
g.track += track_diff;
|
||||
}
|
||||
}
|
||||
|
||||
earliest_in_point = qMin(earliest_in_point, g.in);
|
||||
}
|
||||
|
||||
// apply changes to selections
|
||||
@@ -1251,7 +1254,11 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
|
||||
}
|
||||
}
|
||||
|
||||
QToolTip::showText(mapToGlobal(mouse_pos), ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), config.timecode_view, sequence->frame_rate));
|
||||
if (panel_timeline->importing) {
|
||||
QToolTip::showText(mapToGlobal(mouse_pos), frame_to_timecode(earliest_in_point, config.timecode_view, sequence->frame_rate));
|
||||
} else {
|
||||
QToolTip::showText(mapToGlobal(mouse_pos), ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), config.timecode_view, sequence->frame_rate));
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
@@ -1787,7 +1794,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
QRect actual_clip_rect = clip_rect;
|
||||
if (actual_clip_rect.x() < 0) actual_clip_rect.setX(0);
|
||||
if (actual_clip_rect.right() >= width()) actual_clip_rect.setRight(width());
|
||||
p.fillRect(actual_clip_rect, QColor(clip->color_r, clip->color_g, clip->color_b));
|
||||
p.fillRect(actual_clip_rect, (clip->enabled) ? QColor(clip->color_r, clip->color_g, clip->color_b) : QColor(96, 96, 96));
|
||||
|
||||
int thumb_x = clip_rect.x() + 1;
|
||||
|
||||
@@ -1944,7 +1951,9 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
|
||||
// draw text
|
||||
if (text_rect.width() > MAX_TEXT_WIDTH && text_rect.right() > 0 && text_rect.left() < width()) {
|
||||
if (color_brightness(clip->color_r, clip->color_g, clip->color_b) > 160) {
|
||||
if (!clip->enabled) {
|
||||
p.setPen(Qt::gray);
|
||||
} else if (color_brightness(clip->color_r, clip->color_g, clip->color_b) > 160) {
|
||||
// set to black if color is bright
|
||||
p.setPen(Qt::black);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user