mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-21 19:01:18 +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;
|
||||||
- (float)floatForKey:(NSString *)key
|
- (float)floatForKey:(NSString *)key
|
||||||
defaultValue:(float)defaultValue;
|
defaultValue:(float)defaultValue;
|
||||||
|
- (int) integerForKey: (NSString *)key
|
||||||
|
defaultValue: (int)defaultValue;
|
||||||
- (NSColor *)colorForKey:(NSString *)key;
|
- (NSColor *)colorForKey:(NSString *)key;
|
||||||
- (NSColor *)colorForKey:(NSString *)key
|
- (NSColor *)colorForKey:(NSString *)key
|
||||||
defaultValue:(NSColor *)defaultValue;
|
defaultValue:(NSColor *)defaultValue;
|
||||||
|
@ -61,6 +62,9 @@
|
||||||
- (void)setFloat:(float)floatValue
|
- (void)setFloat:(float)floatValue
|
||||||
forKey:(NSString *)aKey
|
forKey:(NSString *)aKey
|
||||||
notify:(BOOL)notify;
|
notify:(BOOL)notify;
|
||||||
|
- (void) setInteger: (int)intValue
|
||||||
|
forKey: (NSString *)aKey
|
||||||
|
notify: (BOOL)notify;
|
||||||
- (void)setColor:(NSColor *)color
|
- (void)setColor:(NSColor *)color
|
||||||
forKey:(NSString *)aKey
|
forKey:(NSString *)aKey
|
||||||
notify:(BOOL)notify;
|
notify:(BOOL)notify;
|
||||||
|
|
|
@ -36,7 +36,10 @@
|
||||||
#define IndentForHash @"IndentForHash"
|
#define IndentForHash @"IndentForHash"
|
||||||
#define IndentForReturn @"IndentForReturn"
|
#define IndentForReturn @"IndentForReturn"
|
||||||
#define IndentForSoloOpenCurly @"IndentForSoloOpenCurly"
|
#define IndentForSoloOpenCurly @"IndentForSoloOpenCurly"
|
||||||
#define IndentForNumberOfSpaces @"IndentForNumberOfSpaces"
|
#define IndentNumberOfSpaces @"IndentNumberOfSpaces"
|
||||||
|
#define IndentUsingSpaces @"IndentUsingSpaces"
|
||||||
|
#define IndentWidth @"IndentWidth"
|
||||||
|
#define TabWidth @"TabWidth"
|
||||||
|
|
||||||
@interface PCIndentationPrefs : NSObject <PCPrefsSection, NSTextFieldDelegate>
|
@interface PCIndentationPrefs : NSObject <PCPrefsSection, NSTextFieldDelegate>
|
||||||
{
|
{
|
||||||
|
@ -53,6 +56,10 @@
|
||||||
id _indentForReturn;
|
id _indentForReturn;
|
||||||
id _indentForSoloOpenCurly;
|
id _indentForSoloOpenCurly;
|
||||||
id _indentNumberOfSpaces;
|
id _indentNumberOfSpaces;
|
||||||
|
|
||||||
|
id _indentUsingSpaces;
|
||||||
|
id _indentWidth;
|
||||||
|
id _tabWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indentation
|
// Indentation
|
||||||
|
@ -70,4 +77,5 @@
|
||||||
- (void) setIndentUsingSpaces: (id)sender;
|
- (void) setIndentUsingSpaces: (id)sender;
|
||||||
- (void) setIndentWidth: (id)sender;
|
- (void) setIndentWidth: (id)sender;
|
||||||
- (void) setTabWidth: (id)sender;
|
- (void) setTabWidth: (id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -98,12 +98,33 @@
|
||||||
state = bVal ? NSOnState : NSOffState;
|
state = bVal ? NSOnState : NSOffState;
|
||||||
[_indentForSoloOpenCurly setState: state];
|
[_indentForSoloOpenCurly setState: state];
|
||||||
|
|
||||||
val = [prefs stringForKey: IndentForNumberOfSpaces
|
val = [prefs stringForKey: IndentNumberOfSpaces
|
||||||
defaultValue: spacesDefault];
|
defaultValue: spacesDefault];
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
[_indentNumberOfSpaces setStringValue: 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
|
- (NSView *) view
|
||||||
|
@ -124,7 +145,6 @@
|
||||||
[prefs setBool: state forKey: IndentForOpenCurly notify: YES];
|
[prefs setBool: state forKey: IndentForOpenCurly notify: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) setIndentForCloseCurlyBrace: (id)sender
|
- (void) setIndentForCloseCurlyBrace: (id)sender
|
||||||
{
|
{
|
||||||
BOOL state = ([sender state] == NSOffState) ? NO : YES;
|
BOOL state = ([sender state] == NSOffState) ? NO : YES;
|
||||||
|
@ -155,7 +175,6 @@
|
||||||
[prefs setBool: state forKey: IndentForReturn notify: YES];
|
[prefs setBool: state forKey: IndentForReturn notify: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) setIndentForSoloOpenBrace: (id)sender
|
- (void) setIndentForSoloOpenBrace: (id)sender
|
||||||
{
|
{
|
||||||
BOOL state = ([sender state] == NSOffState) ? NO : YES;
|
BOOL state = ([sender state] == NSOffState) ? NO : YES;
|
||||||
|
@ -164,19 +183,27 @@
|
||||||
|
|
||||||
- (void) setIndentNumberOfSpaces: (id)sender
|
- (void) setIndentNumberOfSpaces: (id)sender
|
||||||
{
|
{
|
||||||
|
int val = [sender intValue];
|
||||||
|
[prefs setInteger: val forKey: IndentNumberOfSpaces notify: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tabs/Spaces
|
// Tabs/Spaces
|
||||||
- (void) setIndentUsingSpaces: (id)sender
|
- (void) setIndentUsingSpaces: (id)sender
|
||||||
{
|
{
|
||||||
|
NSUInteger idx = [sender indexOfSelectedItem];
|
||||||
|
[prefs setInteger: idx forKey: IndentUsingSpaces notify: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setIndentWidth: (id)sender
|
- (void) setIndentWidth: (id)sender
|
||||||
{
|
{
|
||||||
|
int val = [sender intValue];
|
||||||
|
[prefs setInteger: val forKey: IndentWidth notify: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setTabWidth: (id)sender
|
- (void) setTabWidth: (id)sender
|
||||||
{
|
{
|
||||||
|
int val = [sender intValue];
|
||||||
|
[prefs setInteger: val forKey: TabWidth notify: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (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
|
- (NSColor *)colorForKey:(NSString *)key
|
||||||
{
|
{
|
||||||
return [self colorForKey:key defaultValue:nil];
|
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
|
- (void)setColor:(NSColor *)color
|
||||||
forKey:(NSString *)aKey
|
forKey:(NSString *)aKey
|
||||||
notify:(BOOL)notify
|
notify:(BOOL)notify
|
||||||
|
|
Loading…
Reference in a new issue