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) hideBezel;
-(void) processBezelKeyDown:(NSEvent *)theEvent;
-(void) processBezelMouseEvents:(NSEvent *)theEvent;
-(void) metaKeysReleased;
// Menu related

View file

@ -1008,7 +1008,19 @@
DLog(@"CODE %ld", (long)[mainRecorder keyCombo].code);
break;
}
}
}
}
-(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
@ -1048,7 +1060,8 @@
[bezel setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
// if ([[NSUserDefaults standardUserDefaults] boolForKey:@"popUpAnimation"])
// [bezel makeKeyAndOrderFrontWithPopEffect];
else [bezel makeKeyAndOrderFront:self];
// else
[bezel makeKeyAndOrderFront:self];
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 {
if ( [self delegate] )