diff --git a/GNUmakefile b/GNUmakefile index 8a8afa0..7d8bb55 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -94,7 +94,8 @@ Modules/Debuggers/ProjectCenter/ProjectCenter.debugger \ Modules/Preferences/Build/Build.preferences \ Modules/Preferences/Saving/Saving.preferences \ Modules/Preferences/Misc/Misc.preferences \ -Modules/Preferences/EditorFSC/EditorFSC.preferences +Modules/Preferences/EditorFSC/EditorFSC.preferences \ +Modules/Preferences/Indentation/Indentation.preferences # # Localization diff --git a/Modules/Preferences/Indentation/PCIndentationPrefs.h b/Modules/Preferences/Indentation/PCIndentationPrefs.h index bc4796d..7b9b59b 100644 --- a/Modules/Preferences/Indentation/PCIndentationPrefs.h +++ b/Modules/Preferences/Indentation/PCIndentationPrefs.h @@ -22,6 +22,7 @@ // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +// /* All rights reserved */ #import diff --git a/Modules/Preferences/Indentation/PCIndentationPrefs.m b/Modules/Preferences/Indentation/PCIndentationPrefs.m index e82e796..0231bb0 100644 --- a/Modules/Preferences/Indentation/PCIndentationPrefs.m +++ b/Modules/Preferences/Indentation/PCIndentationPrefs.m @@ -22,6 +22,7 @@ // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +// /* All rights reserved */ #import @@ -44,55 +45,126 @@ return self; } +- (void) dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver: self]; + RELEASE(_view); + [super dealloc]; +} + - (void) readPreferences { + NSString *val; + BOOL bVal; + int state; + NSString *spacesDefault = @"2"; + + bVal = [prefs boolForKey: IndentWhenTyping + defaultValue: YES]; + state = bVal ? NSOnState : NSOffState; + [_indentWhenTyping setState:state]; + + bVal = [prefs boolForKey: IndentForOpenCurly + defaultValue: YES]; + state = bVal ? NSOnState : NSOffState; + [_indentForOpenCurly setState:state]; + + bVal = [prefs boolForKey: IndentForCloseCurly + defaultValue: YES]; + state = bVal ? NSOnState : NSOffState; + [_indentForCloseCurly setState: state]; + + bVal = [prefs boolForKey: IndentForSemicolon + defaultValue: NO]; + state = bVal ? NSOnState : NSOffState; + [_indentForSemicolon setState: state]; + + bVal = [prefs boolForKey: IndentForColon + defaultValue: NO]; + state = bVal ? NSOnState : NSOffState; + [_indentForColon setState: state]; + + bVal = [prefs boolForKey: IndentForHash + defaultValue: NO]; + state = bVal ? NSOnState : NSOffState; + [_indentForHash setState: state]; + + bVal = [prefs boolForKey: IndentForReturn + defaultValue: NO]; + state = bVal ? NSOnState : NSOffState; + [_indentForReturn setState: state]; + + bVal = [prefs boolForKey:IndentForColon + defaultValue:NO]; + state = bVal ? NSOnState : NSOffState; + [_indentForColon setState:state]; + + bVal = [prefs boolForKey: IndentForSoloOpenCurly + defaultValue: NO]; + state = bVal ? NSOnState : NSOffState; + [_indentForSoloOpenCurly setState: state]; + + val = [prefs stringForKey: IndentForNumberOfSpaces + defaultValue: spacesDefault]; + if (val) + { + [_indentNumberOfSpaces setStringValue: val]; + } } - (void) setIndentWhenTyping: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentWhenTyping notify: YES]; } - (void) setIndentForOpenCurlyBrace: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForOpenCurly notify: YES]; } - (void) setIndentForCloseCurlyBrace: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForCloseCurly notify: YES]; } - (void) setIndentForSemicolon: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForSemicolon notify: YES]; } - (void) setIndentForColon: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForColon notify: YES]; } - (void) setIndentForHash: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForHash notify: YES]; } - (void) setIndentForReturn: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForReturn notify: YES]; } - (void) setIndentForSoloOpenBrace: (id)sender { - /* insert your code here */ + BOOL state = ([sender state] == NSOffState) ? NO : YES; + [prefs setBool: state forKey: IndentForSoloOpenCurly notify: YES]; } - (NSView *) view diff --git a/Modules/Preferences/Indentation/Resources/IndentationPrefs.gorm/objects.gorm b/Modules/Preferences/Indentation/Resources/IndentationPrefs.gorm/objects.gorm index 3c1d1de..6fa7f03 100644 Binary files a/Modules/Preferences/Indentation/Resources/IndentationPrefs.gorm/objects.gorm and b/Modules/Preferences/Indentation/Resources/IndentationPrefs.gorm/objects.gorm differ