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: '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',
tooltip: Ox._('Options'),
@ -243,8 +243,11 @@ Ox.ClipPanel = function(options, self) {
{
align: 'right',
editable: isEditable,
format: function(value) {
return Ox.formatDuration(value, 3);
format: function(value, data) {
return (
isEditable(data) ? ['', '']
: ['<span class="OxLight">', '</span>']
).join(Ox.formatDuration(value, 3));
},
id: 'in',
operator: '+',
@ -255,8 +258,11 @@ Ox.ClipPanel = function(options, self) {
{
align: 'right',
editable: isEditable,
format: function(value) {
return Ox.formatDuration(value, 3);
format: function(value, data) {
return (
isEditable(data) ? ['', '']
: ['<span class="OxLight">', '</span>']
).join(Ox.formatDuration(value, 3));
},
id: 'out',
operator: '+',
@ -267,8 +273,11 @@ Ox.ClipPanel = function(options, self) {
{
align: 'right',
editable: isEditable,
format: function(value) {
return Ox.formatDuration(value, 3);
format: function(value, data) {
return (
isEditable(data) ? ['', '']
: ['<span class="OxLight">', '</span>']
).join(Ox.formatDuration(value, 3));
},
id: 'duration',
operator: '+',
@ -365,9 +374,25 @@ Ox.ClipPanel = function(options, self) {
that.triggerEvent('sort', self.options.sort);
},
submit: function(data) {
var value = self.$list.value(data.id);
data.value = Ox.parseDuration(data.value);
if (
(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;