clip panel: change wording, update formatting, check values on submit

This commit is contained in:
rlx 2013-08-09 16:05:52 +00:00
parent 9f64f3e064
commit af3bcc67dd

View file

@ -67,7 +67,7 @@ Ox.ClipPanel = function(options, self) {
{}, {},
{id: 'split', title: Ox._('Split Selected Clips at Cuts'), disabled: !self.options.editable || !self.options.selected.length}, {id: 'split', title: Ox._('Split Selected Clips at Cuts'), disabled: !self.options.editable || !self.options.selected.length},
{id: 'join', title: Ox._('Join Selected Clips at Cuts'), disabled: !self.options.editable || !self.options.selected.length}, {id: 'join', title: Ox._('Join Selected Clips at Cuts'), disabled: !self.options.editable || !self.options.selected.length},
{id: 'dereference', title: Ox._('Make Selected Clips Static'), disabled: !self.options.editable || !self.options.selected.length} {id: 'replace', title: Ox._('Make Selected Clips Editable'), disabled: !self.options.editable || !self.options.selected.length}
], ],
title: 'set', title: 'set',
tooltip: Ox._('Options'), tooltip: Ox._('Options'),
@ -243,8 +243,11 @@ Ox.ClipPanel = function(options, self) {
{ {
align: 'right', align: 'right',
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value, data) {
return Ox.formatDuration(value, 3); return (
isEditable(data) ? ['', '']
: ['<span class="OxLight">', '</span>']
).join(Ox.formatDuration(value, 3));
}, },
id: 'in', id: 'in',
operator: '+', operator: '+',
@ -255,8 +258,11 @@ Ox.ClipPanel = function(options, self) {
{ {
align: 'right', align: 'right',
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value, data) {
return Ox.formatDuration(value, 3); return (
isEditable(data) ? ['', '']
: ['<span class="OxLight">', '</span>']
).join(Ox.formatDuration(value, 3));
}, },
id: 'out', id: 'out',
operator: '+', operator: '+',
@ -267,8 +273,11 @@ Ox.ClipPanel = function(options, self) {
{ {
align: 'right', align: 'right',
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value, data) {
return Ox.formatDuration(value, 3); return (
isEditable(data) ? ['', '']
: ['<span class="OxLight">', '</span>']
).join(Ox.formatDuration(value, 3));
}, },
id: 'duration', id: 'duration',
operator: '+', operator: '+',
@ -365,9 +374,25 @@ Ox.ClipPanel = function(options, self) {
that.triggerEvent('sort', self.options.sort); that.triggerEvent('sort', self.options.sort);
}, },
submit: function(data) { submit: function(data) {
var value = self.$list.value(data.id);
data.value = Ox.parseDuration(data.value); data.value = Ox.parseDuration(data.value);
self.$list.value(data.id, data.key, data.value); if (
that.triggerEvent('edit', data); (data.key == 'in' && data.value < value.out)
|| (data.key == 'out' && data.value > value['in'])
|| (data.key == 'duration' && data.value > 0)
) {
self.$list.value(data.id, data.key, data.value);
if (data.key == 'in') {
self.$list.value(data.id, 'duration', value.out - data.value);
} else if (data.key == 'out') {
self.$list.value(data.id, 'duration', data.value - value['in']);
} else if (data.key == 'duration') {
self.$list.value(data.id, 'out', value['in'] + data.value);
}
that.triggerEvent('edit', data);
} else {
self.$list.value(data.id, data.key, value[data.key]);
}
} }
}); });
return $list; return $list;