mouse scroll to choose clippings and double click to paste

This commit is contained in:
Gennadiy Potapov 2016-04-03 15:59:19 +08:00
parent 5e259802d9
commit d583141f90
3 changed files with 25 additions and 2 deletions

View file

@ -98,6 +98,7 @@
-(void) showBezel; -(void) showBezel;
-(void) hideBezel; -(void) hideBezel;
-(void) processBezelKeyDown:(NSEvent *)theEvent; -(void) processBezelKeyDown:(NSEvent *)theEvent;
-(void) processBezelMouseEvents:(NSEvent *)theEvent;
-(void) metaKeysReleased; -(void) metaKeysReleased;
// Menu related // Menu related

View file

@ -1011,6 +1011,18 @@
} }
} }
-(void) processBezelMouseEvents:(NSEvent *)theEvent {
if (theEvent.type == NSScrollWheel) {
if (theEvent.deltaY > 0.0f) {
[self stackUp];
} else if (theEvent.deltaY < 0.0f) {
[self stackDown];
}
} else if (theEvent.type == NSLeftMouseUp && theEvent.clickCount == 2) {
[self pasteFromStack];
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification - (void)applicationDidFinishLaunching:(NSNotification *)notification
{ {
//Create our hot key //Create our hot key
@ -1048,7 +1060,8 @@
[bezel setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces]; [bezel setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
// if ([[NSUserDefaults standardUserDefaults] boolForKey:@"popUpAnimation"]) // if ([[NSUserDefaults standardUserDefaults] boolForKey:@"popUpAnimation"])
// [bezel makeKeyAndOrderFrontWithPopEffect]; // [bezel makeKeyAndOrderFrontWithPopEffect];
else [bezel makeKeyAndOrderFront:self]; // else
[bezel makeKeyAndOrderFront:self];
isBezelDisplayed = YES; isBezelDisplayed = YES;
} }

View file

@ -332,6 +332,15 @@ static const float lineHeight = 16;
} }
} }
- (void)mouseUp:(NSEvent *)theEvent
{
if ( [self delegate] )
{
[delegate performSelector:@selector(processBezelMouseEvents:) withObject:theEvent];
}
}
- (void)keyDown:(NSEvent *)theEvent { - (void)keyDown:(NSEvent *)theEvent {
if ( [self delegate] ) if ( [self delegate] )