X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=NJOutputController.m;h=5ceccba605dce87c09972270a3523f7f61457ba4;hp=25d04b125b7dcb04b0da737805f13edcdffa2cc7;hb=6044e47a97de33531c47cd209b30d4405aa0530a;hpb=055557513f5608af99f6736a6ce40da3df8618a7 diff --git a/NJOutputController.m b/NJOutputController.m index 25d04b1..5ceccba 100644 --- a/NJOutputController.m +++ b/NJOutputController.m @@ -26,7 +26,7 @@ NSInteger row = radioButtons.selectedRow; if (row != 1) { - keyInput.keyCode = -1; + keyInput.keyCode = NJKeyInputFieldEmpty; [keyInput resignIfFirstResponder]; } @@ -180,12 +180,10 @@ keyInput.keyCode = [(NJOutputKeyPress*)output vk]; } else if ([output isKindOfClass:NJOutputMapping.class]) { [radioButtons selectCellAtRow:2 column:0]; - NSUInteger idx = [mappingPopup indexOfItemWithRepresentedObject:[(NJOutputMapping *)output mapping]]; - if (idx == NSNotFound) { + NSMenuItem *item = [mappingPopup itemWithRepresentedObject:[(NJOutputMapping *)output mapping]]; + [mappingPopup selectItem:item]; + if (!item) [radioButtons selectCellAtRow:self.enabled ? 0 : -1 column:0]; - [mappingPopup selectItemAtIndex:-1]; - } else - [mappingPopup selectItemAtIndex:idx]; } else if ([output isKindOfClass:NJOutputMouseMove.class]) { [radioButtons selectCellAtRow:3 column:0]; @@ -229,7 +227,7 @@ item.representedObject = mapping; [mappingPopup.menu addItem:item]; } - [mappingPopup selectItemAtIndex:[mappingPopup indexOfItemWithRepresentedObject:current]]; + [mappingPopup selectItemWithRepresentedObject:current]; } @end