mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +00:00
Add Tabs section
This commit is contained in:
parent
5fc191e9d5
commit
ec3298e342
5 changed files with 77 additions and 5 deletions
|
@ -47,7 +47,8 @@
|
|||
- (float)floatForKey:(NSString *)key;
|
||||
- (float)floatForKey:(NSString *)key
|
||||
defaultValue:(float)defaultValue;
|
||||
|
||||
- (int) integerForKey: (NSString *)key
|
||||
defaultValue: (int)defaultValue;
|
||||
- (NSColor *)colorForKey:(NSString *)key;
|
||||
- (NSColor *)colorForKey:(NSString *)key
|
||||
defaultValue:(NSColor *)defaultValue;
|
||||
|
@ -61,6 +62,9 @@
|
|||
- (void)setFloat:(float)floatValue
|
||||
forKey:(NSString *)aKey
|
||||
notify:(BOOL)notify;
|
||||
- (void) setInteger: (int)intValue
|
||||
forKey: (NSString *)aKey
|
||||
notify: (BOOL)notify;
|
||||
- (void)setColor:(NSColor *)color
|
||||
forKey:(NSString *)aKey
|
||||
notify:(BOOL)notify;
|
||||
|
|
|
@ -36,7 +36,10 @@
|
|||
#define IndentForHash @"IndentForHash"
|
||||
#define IndentForReturn @"IndentForReturn"
|
||||
#define IndentForSoloOpenCurly @"IndentForSoloOpenCurly"
|
||||
#define IndentForNumberOfSpaces @"IndentForNumberOfSpaces"
|
||||
#define IndentNumberOfSpaces @"IndentNumberOfSpaces"
|
||||
#define IndentUsingSpaces @"IndentUsingSpaces"
|
||||
#define IndentWidth @"IndentWidth"
|
||||
#define TabWidth @"TabWidth"
|
||||
|
||||
@interface PCIndentationPrefs : NSObject <PCPrefsSection, NSTextFieldDelegate>
|
||||
{
|
||||
|
@ -53,6 +56,10 @@
|
|||
id _indentForReturn;
|
||||
id _indentForSoloOpenCurly;
|
||||
id _indentNumberOfSpaces;
|
||||
|
||||
id _indentUsingSpaces;
|
||||
id _indentWidth;
|
||||
id _tabWidth;
|
||||
}
|
||||
|
||||
// Indentation
|
||||
|
@ -70,4 +77,5 @@
|
|||
- (void) setIndentUsingSpaces: (id)sender;
|
||||
- (void) setIndentWidth: (id)sender;
|
||||
- (void) setTabWidth: (id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -98,12 +98,33 @@
|
|||
state = bVal ? NSOnState : NSOffState;
|
||||
[_indentForSoloOpenCurly setState: state];
|
||||
|
||||
val = [prefs stringForKey: IndentForNumberOfSpaces
|
||||
val = [prefs stringForKey: IndentNumberOfSpaces
|
||||
defaultValue: spacesDefault];
|
||||
if (val)
|
||||
{
|
||||
[_indentNumberOfSpaces setStringValue: val];
|
||||
}
|
||||
|
||||
val = [prefs stringForKey: IndentUsingSpaces
|
||||
defaultValue: spacesDefault];
|
||||
if (val)
|
||||
{
|
||||
[_indentUsingSpaces setStringValue: val];
|
||||
}
|
||||
|
||||
val = [prefs stringForKey: IndentWidth
|
||||
defaultValue: spacesDefault];
|
||||
if (val)
|
||||
{
|
||||
[_indentWidth setStringValue: val];
|
||||
}
|
||||
|
||||
val = [prefs stringForKey: TabWidth
|
||||
defaultValue: spacesDefault];
|
||||
if (val)
|
||||
{
|
||||
[_tabWidth setStringValue: val];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSView *) view
|
||||
|
@ -124,7 +145,6 @@
|
|||
[prefs setBool: state forKey: IndentForOpenCurly notify: YES];
|
||||
}
|
||||
|
||||
|
||||
- (void) setIndentForCloseCurlyBrace: (id)sender
|
||||
{
|
||||
BOOL state = ([sender state] == NSOffState) ? NO : YES;
|
||||
|
@ -155,7 +175,6 @@
|
|||
[prefs setBool: state forKey: IndentForReturn notify: YES];
|
||||
}
|
||||
|
||||
|
||||
- (void) setIndentForSoloOpenBrace: (id)sender
|
||||
{
|
||||
BOOL state = ([sender state] == NSOffState) ? NO : YES;
|
||||
|
@ -164,19 +183,27 @@
|
|||
|
||||
- (void) setIndentNumberOfSpaces: (id)sender
|
||||
{
|
||||
int val = [sender intValue];
|
||||
[prefs setInteger: val forKey: IndentNumberOfSpaces notify: YES];
|
||||
}
|
||||
|
||||
// Tabs/Spaces
|
||||
- (void) setIndentUsingSpaces: (id)sender
|
||||
{
|
||||
NSUInteger idx = [sender indexOfSelectedItem];
|
||||
[prefs setInteger: idx forKey: IndentUsingSpaces notify: YES];
|
||||
}
|
||||
|
||||
- (void) setIndentWidth: (id)sender
|
||||
{
|
||||
int val = [sender intValue];
|
||||
[prefs setInteger: val forKey: IndentWidth notify: YES];
|
||||
}
|
||||
|
||||
- (void) setTabWidth: (id)sender
|
||||
{
|
||||
int val = [sender intValue];
|
||||
[prefs setInteger: val forKey: TabWidth notify: YES];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
|
Binary file not shown.
|
@ -199,6 +199,22 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (int) integerForKey: (NSString *)key defaultValue: (int)defaultValue
|
||||
{
|
||||
NSString *stringValue = [[NSUserDefaults standardUserDefaults]
|
||||
objectForKey:key];
|
||||
|
||||
if (stringValue)
|
||||
{
|
||||
return [stringValue intValue];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setInteger: defaultValue forKey: key notify: NO];
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSColor *)colorForKey:(NSString *)key
|
||||
{
|
||||
return [self colorForKey:key defaultValue:nil];
|
||||
|
@ -275,6 +291,23 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setInteger: (int)intValue
|
||||
forKey: (NSString *)aKey
|
||||
notify: (BOOL)notify
|
||||
{
|
||||
NSString *stringValue = [NSString stringWithFormat:@"%d", intValue];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:stringValue
|
||||
forKey:aKey];
|
||||
|
||||
if (notify)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:PCPreferencesDidChangeNotification
|
||||
object:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setColor:(NSColor *)color
|
||||
forKey:(NSString *)aKey
|
||||
notify:(BOOL)notify
|
||||
|
|
Loading…
Reference in a new issue