wire up 'make selected clips editable'

This commit is contained in:
rlx 2018-11-13 17:18:32 +00:00
parent 278f3fa6ca
commit 63f298e3e2

View file

@ -234,7 +234,7 @@ Ox.ClipPanel = function(options, self) {
{}, {},
{id: 'split', title: Ox._('Split Selected Clips at Cuts'), disabled: !self.options.editable || self.options.selected.length == 0 || self.options.view == 'annotations'}, {id: 'split', title: Ox._('Split Selected Clips at Cuts'), disabled: !self.options.editable || self.options.selected.length == 0 || self.options.view == 'annotations'},
{id: 'join', title: Ox._('Join Selected Clips at Cuts'), disabled: !self.options.editable || self.options.selected.length < 2 || self.options.view == 'annotations'}, {id: 'join', title: Ox._('Join Selected Clips at Cuts'), disabled: !self.options.editable || self.options.selected.length < 2 || self.options.view == 'annotations'},
{id: 'replace', title: Ox._('Make Selected Clips Editable'), disabled: !self.options.editable || self.options.selected.length == 0 || self.options.view == 'annotations'} {id: 'makeeditable', title: Ox._('Make Selected Clips Editable'), disabled: !self.options.editable || self.options.selected.length == 0 || self.options.view == 'annotations'}
], ],
title: 'set', title: 'set',
tooltip: Ox._('Options'), tooltip: Ox._('Options'),
@ -262,6 +262,8 @@ Ox.ClipPanel = function(options, self) {
splitClips(); splitClips();
} else if (data.id == 'join') { } else if (data.id == 'join') {
joinClips(); joinClips();
} else if (data.id == 'makeeditable') {
makeClipsEditable();
} }
} }
}) })
@ -618,6 +620,19 @@ Ox.ClipPanel = function(options, self) {
} }
} }
function makeClipsEditable() {
if (!self.options.editable) {
return
}
var clips = self.options.clips.filter(function(clip) {
return Ox.contains(self.options.selected, clip.id) && clip.annotation;
});
clips.forEach(function(clip) {
self.$list.value(clip.id, {annotation: ''});
that.triggerEvent('edit', {id: clip.id, key: 'annotation', value: ''});
})
}
function selectClips() { function selectClips() {
if (self.options.editable) { if (self.options.editable) {
self.$menu[ self.$menu[