add slash and backslash keyboard commands to editor view

This commit is contained in:
rlx 2011-02-07 21:44:21 +00:00
parent 87b386e89e
commit e508313baf

View file

@ -7095,8 +7095,7 @@ requires
return;
}
//Ox.print('loadPage', page);
var keys = $.inArray('id', self.options.keys) > -1 ? self.options.keys :
$.merge(self.options.keys, ['id']),
var keys = $.merge(self.options.keys.indexOf(self.options.unique) == -1 ? [self.options.unique] : [], self.options.keys),
offset = page * self.pageLength,
range = [offset, offset + (page < self.pages - 1 ?
self.pageLength : self.listLength % self.pageLength)];
@ -8643,7 +8642,7 @@ requires
$('<div>')
.addClass('OxCell OxTarget')
.css({
width: (self.options.width - padding - 32) + 'px'
width: (self.options.width - padding - 32 + !data.items * 16) + 'px'
})
.html(data.title)
.appendTo($item);
@ -10712,8 +10711,12 @@ requires
.html(data.value);
},
items: $.map(self.options.items, function(v, i) {
return {value: v.value.replace(/\n/g, '<br/>')};
return {
id: i + '',
value: v.value.replace(/\n/g, '<br/>')
};
}),
unique: 'id'
})
.bindEvent({
select: selectAnnotation
@ -10736,13 +10739,9 @@ requires
*/
function selectAnnotation(event, data) {
var pos = data.selected.ids[0],
var pos = parseInt(data.ids[0]),
item = self.options.items[pos];
if (pos != self.selected) {
self.selected > -1 &&
self.$annotation[self.selected].removeClass('OxSelected');
self.selected = pos;
self.$annotation[self.selected].addClass('OxSelected');
that.triggerEvent('select', {
'in': item.in,
'out': item.out
@ -11602,16 +11601,16 @@ requires
key_alt_shift_right: function() {
},
key_backslash: function() {
// select current cut
select('subtitle');
},
key_closebracket: function() {
movePositionTo('cut', 1);
movePositionTo('subtitle', 1);
},
key_comma: function() {
movePositionTo('subtitle', -1);
movePositionTo('cut', -1);
},
key_dot: function() {
movePositionTo('subtitle', 1);
movePositionTo('cut', 1);
},
key_down: function() {
movePositionBy(self.sizes.timeline[0].width);
@ -11627,7 +11626,7 @@ requires
setPoint('out');
},
key_openbracket: function() {
movePositionTo('cut', -1);
movePositionTo('subtitle', -1);
},
key_p: playInToOut,
key_right: function() {
@ -11662,6 +11661,9 @@ requires
key_shift_up: function() {
movePositionBy(-self.options.duration);
},
key_slash: function() {
select('cut');
},
key_space: togglePlay,
key_up: function() {
movePositionBy(-self.sizes.timeline[0].width);
@ -11676,7 +11678,11 @@ requires
videoRatio: self.options.videoWidth / self.options.videoHeight
});
self.$video = new Ox.Element().addClass('OxVideoEditor');
self.$editor = new Ox.Element()
.addClass('OxVideoEditor')
.click(function() {
that.gainFocus()
});
self.sizes = getSizes();
@ -11709,7 +11715,7 @@ requires
setPoint(type);
}
})
.appendTo(self.$video);
.appendTo(self.$editor);
});
self.$timeline[0] = new Ox.LargeTimeline({
@ -11730,7 +11736,7 @@ requires
})
.bindEvent('change', changeTimelineLarge)
.bindEvent('changeEnd', changeTimelineLarge)
.appendTo(self.$video);
.appendTo(self.$editor);
self.$timeline[1] = new Ox.BlockTimeline({
cuts: self.options.cuts,
@ -11749,7 +11755,7 @@ requires
top: self.sizes.timeline[1].top + 'px'
})
.bindEvent('change', changeTimelineSmall)
.appendTo(self.$video);
.appendTo(self.$editor);
self.$annotations = new Ox.Element()
.css({
@ -11776,7 +11782,7 @@ requires
that.$element = new Ox.SplitPanel({
elements: [
{
element: self.$video
element: self.$editor
},
{
collapsed: !self.options.showAnnotations,
@ -11850,6 +11856,33 @@ requires
return position;
}
function getPoints(type) {
var found = false,
points,
positions = [];
if (type == 'cut') {
positions = self.options.cuts;
} else if (type == 'match') {
// ...
} else if (type == 'subtitle') {
self.options.subtitles.forEach(function(v, i) {
positions.push(v.in);
positions.push(v.out);
});
}
positions.indexOf(0) == -1 && positions.unshift(0);
positions.indexOf(self.options.duration) == -1 &&
positions.push(self.options.duration);
$.each(positions, function(i, v) {
if (v > self.options.position) {
points = [positions[i - 1], positions[i]];
found = true;
return false;
}
});
return points;
}
function getSizes(scrollbarIsVisible) {
//Ox.print('getSizes', scrollbarIsVisible)
var scrollbarWidth = oxui.scrollbarSize,
@ -11909,7 +11942,7 @@ requires
lines = Math.ceil(self.options.duration / size.timeline[1].width);
height = getHeight();
//Ox.print('lines', lines, getHeight(), self.options.height, (scrollbarIsVisible && getHeight() <= self.options.height) ? 'scroll' : 'auto')
self.$video.css({
self.$editor.css({
overflowY: (scrollbarIsVisible && height <= self.options.height) ? 'scroll' : 'auto'
});
return (!scrollbarIsVisible && height > self.options.height) ? getSizes(true) : size;
@ -11979,30 +12012,31 @@ requires
function selectAnnotation(event, data) {
self.options.position = data.in
self.options.points = [data.in, data.out];
self.options.points = [data.in, data.out - 0.001];
setPosition();
setPoints();
}
function select(type) {
self.options.points = getPoints(type);
setPoints();
}
function setPoint(point) {
self.options.points[point == 'in' ? 0 : 1] = self.options.position;
self.$player[point == 'in' ? 1 : 2].options({
position: self.options.position
});
if (self.options.points[1] < self.options.points[0]) {
self.options.points[point == 'in' ? 1 : 0] = self.options.position;
self.$player[point == 'in' ? 2 : 1].options({
position: self.options.position
});
}
setPoints();
}
function setPoints() {
$.each(self.$player, function(i, v) {
v.options({
v.options($.extend({
points: self.options.points
});
}, i ? {
position: self.options.points[i - 1]
} : {}));
});
$.each(self.$timeline, function(i, v) {
v.options({
@ -13227,7 +13261,7 @@ requires
},
{
align: 'left',
id: 'hash',
id: 'oshash',
operator: '+',
title: 'Hash',
unique: true,