mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Remember Filter Through Command output choice in user defaults
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#import <OakAppKit/OakUIConstructionFunctions.h>
|
||||
#import <OakTextView/OakTextView.h>
|
||||
|
||||
static NSString* const kUserDefaultsFilterOutputType = @"filterOutputType";
|
||||
|
||||
@interface OakRunCommandWindowController () <NSWindowDelegate>
|
||||
@property (nonatomic) NSTextField* commandLabel;
|
||||
@property (nonatomic) NSComboBox* commandComboBox;
|
||||
@@ -98,6 +100,8 @@
|
||||
for(size_t i = 0; i < sizeofA(keyViewLoop); ++i)
|
||||
keyViewLoop[i].nextKeyView = keyViewLoop[(i + 1) % sizeofA(keyViewLoop)];
|
||||
|
||||
self.outputType = (output::type)[[NSUserDefaults standardUserDefaults] integerForKey:kUserDefaultsFilterOutputType];
|
||||
|
||||
self.window.initialFirstResponder = self.commandComboBox;
|
||||
self.window.defaultButtonCell = self.executeButton.cell;
|
||||
}
|
||||
@@ -109,6 +113,19 @@
|
||||
self.outputType = (output::type)[sender tag];
|
||||
}
|
||||
|
||||
- (void)setOutputType:(output::type)newOutputType
|
||||
{
|
||||
if(_outputType == newOutputType)
|
||||
return;
|
||||
|
||||
_outputType = newOutputType;
|
||||
[self.resultPopUpButton selectItemWithTag:_outputType];
|
||||
|
||||
if(_outputType)
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:_outputType forKey:kUserDefaultsFilterOutputType];
|
||||
else [[NSUserDefaults standardUserDefaults] removeObjectForKey:kUserDefaultsFilterOutputType];
|
||||
}
|
||||
|
||||
- (void)commandChanged:(NSNotification*)notification
|
||||
{
|
||||
self.executeButton.enabled = OakNotEmptyString([self.commandComboBox.stringValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]);
|
||||
|
||||
Reference in New Issue
Block a user