move pasted item to top of stack

This commit is contained in:
Nate Jones 2012-07-03 19:54:52 -07:00
parent 00737bb66c
commit d221961cc5
5 changed files with 302 additions and 220 deletions

View file

@ -57,6 +57,8 @@
@"removeDuplicates",
[NSNumber numberWithBool:YES],
@"popUpAnimation",
[NSNumber numberWithBool:NO],
@"pasteMovesToTop",
nil]];
return [super init];
}
@ -251,7 +253,7 @@
- (void)pasteFromStack
{
if ( [clippingStore jcListCount] > stackPosition ) {
[self addClipToPasteboardFromCount:stackPosition];
[self pasteIndex: stackPosition];
[self performSelector:@selector(hideApp) withObject:nil afterDelay:0.2];
[self performSelector:@selector(fakeCommandV) withObject:nil afterDelay:0.2];
} else {
@ -259,6 +261,16 @@
}
}
- (void)pasteIndex:(int) position {
[self addClipToPasteboardFromCount:position];
if ( [[DBUserDefaults standardUserDefaults] boolForKey:@"pasteMovesToTop"] ) {
[clippingStore clippingMoveToTop:position];
stackPosition = 0;
[self updateMenu];
}
}
- (void)metaKeysReleased
{
if ( ! isBezelPinned ) {
@ -541,8 +553,9 @@
-(IBAction)processMenuClippingSelection:(id)sender
{
int index=[[sender menu] indexOfItem:sender];
[self addClipToPasteboardFromCount:index];
int index=[[sender menu] indexOfItem:sender];
[self pasteIndex:index];
if ( [[DBUserDefaults standardUserDefaults] boolForKey:@"menuSelectionPastes"] ) {
[self performSelector:@selector(hideApp) withObject:nil];
[self performSelector:@selector(fakeCommandV) withObject:nil afterDelay:0.2];

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -78,5 +78,8 @@
// Delete all list clippings
-(void) clearList;
// Move the clipping at index to the top
-(void) clippingMoveToTop:(int)index;
// Delete all named clippings
@end

View file

@ -89,6 +89,13 @@
[jcList removeObjectAtIndex:index];
}
-(void) clippingMoveToTop:(int)index
{
JumpcutClipping *clipping = [jcList objectAtIndex:index];
[jcList insertObject:clipping atIndex:0];
[jcList removeObjectAtIndex:index+1];
}
// Set various values
-(void) setRememberNum:(int)nowRemembering
{