• R/O
  • SSH
  • HTTPS

xspfqt: Commit


Commit MetaInfo

Révision327 (tree)
l'heure2010-06-05 23:24:56
Auteurmasakih

Message de Log

ホイールによるボリュームと再生時間のコントロールの調整。(#20760)

Change Summary

Modification

--- tags/release-1.9.324/XspfQTMovieView.m (revision 326)
+++ tags/release-1.9.324/XspfQTMovieView.m (revision 327)
@@ -85,4 +85,40 @@
8585
8686 [super keyDown:event];
8787 }
88+
89+- (void)scrollWheel:(NSEvent *)theEvent
90+{
91+ BOOL cancelVolumeControl = NO;
92+ CGFloat deltaX = [theEvent deltaX];
93+ CGFloat deltaY = [theEvent deltaY];
94+
95+ if(fabs(deltaY / deltaX) < 0.5) {
96+ cancelVolumeControl = YES;
97+ }
98+
99+// NSLog(@"X -> %.2f, Y -> %.2f", deltaX, deltaY);
100+
101+ if(deltaX != 0) {
102+ int sign = deltaX < 0 ? -1 : 1;
103+ if(sign == -1) deltaX = -deltaX;
104+
105+ QTMovie *movie = [self movie];
106+ QTTime current = [movie currentTime];
107+ NSTimeInterval cur;
108+ if(!QTGetTimeInterval(current, &cur)) return;
109+
110+ CGFloat newTime = cur - sign * 0.08 * (0.1 * deltaX * deltaX + deltaX);
111+ if(newTime < 0) newTime = 0;
112+ QTTime new = QTMakeTimeWithTimeInterval(newTime);
113+
114+ [movie setCurrentTime:new];
115+ }
116+ if(deltaY != 0 && !cancelVolumeControl) {
117+ QTMovie *movie = [self movie];
118+ CGFloat vol = [movie volume];
119+ [movie setVolume:vol + deltaY / 20];
120+ }
121+
122+// [super scrollWheel:theEvent];
123+}
88124 @end
Afficher sur ancien navigateur de dépôt.