diff --git a/Documentation/TODO b/Documentation/TODO index be43a8e..0f7c317 100644 --- a/Documentation/TODO +++ b/Documentation/TODO @@ -50,7 +50,7 @@ ProjectCenter 0.6 - More options for file creation [done!] - Review all situations when dialogs must be popped up [done!] - Check all textfields if 'scrollable' attribute set [done!] -- Rewrite Preferences (3rd party sections etc.) stoyan +- Rewrite Preferences (3rd party sections etc.) [done!] --- Project Builder -------------------------------------------- - Finish parsing gcc output (make errors, etc.) stoyan - Implement interaction with Editor (errors, warnings) stoyan @@ -60,6 +60,7 @@ ProjectCenter 0.6 - Implement interaction with Builder (errors, warnings) stoyan - Implement indentation stoyan - implement undo inside editor stoyan + - Add and use basic editor preferences (fonts, colors, sizes) [25% done] - Think about imlementing pending adding/removal of files ??? - Split "Application" to "Application GORM" and "Application Renaissance" project types ??? diff --git a/Framework/GNUmakefile b/Framework/GNUmakefile index a344484..1e2fd58 100644 --- a/Framework/GNUmakefile +++ b/Framework/GNUmakefile @@ -7,9 +7,9 @@ include $(GNUSTEP_MAKEFILES)/common.make # # Framework # -VERSION = 0.5.0 +VERSION = 0.5.3 FRAMEWORK_NAME = ProjectCenter -ProjectCenter_CURRENT_VERSION_NAME = 0.5.0 +ProjectCenter_CURRENT_VERSION_NAME = 0.5.3 ProjectCenter_DEPLOY_WITH_CURRENT_VERSION = yes ProjectCenter_HEADER_FILES_DIR = ../Headers/ProjectCenter diff --git a/Framework/PCProjectManager.m b/Framework/PCProjectManager.m index 5dc8068..cc1f7f0 100644 --- a/Framework/PCProjectManager.m +++ b/Framework/PCProjectManager.m @@ -214,9 +214,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; { NSTimeInterval interval; -/* interval = [[[PCPrefController sharedPCPreferences] - objectForKey:AutoSavePeriod] intValue];*/ - interval = [[prefController stringForKey:AutoSavePeriod] intValue]; if (interval > 0 && saveTimer == nil) diff --git a/GNUmakefile b/GNUmakefile index bb54e92..1014726 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -16,7 +16,7 @@ include $(GNUSTEP_MAKEFILES)/common.make # # Main application # -VERSION = 0.5.1 +VERSION = 0.5.3 APP_NAME = ProjectCenter ProjectCenter_APPLICATION_ICON = Images/ProjectCenter.tiff diff --git a/Headers/Protocols/Preferences.h b/Headers/Protocols/Preferences.h index 3d427bb..fa9d11c 100644 --- a/Headers/Protocols/Preferences.h +++ b/Headers/Protocols/Preferences.h @@ -54,15 +54,11 @@ forKey:(NSString *)aKey notify:(BOOL)notify; -//- (id)objectForKey:(NSString *)key; -//- (void)setObject:(id)anObject forKey:(NSString *)aKey notify:(BOOL)notify; - @end @protocol PCPrefsSection - (id)initWithPrefController:(id )aPrefs; -//- (void)setDefaults; - (void)readPreferences; - (NSView *)view; diff --git a/Modules/Preferences/Build/PCBuildPrefs.m b/Modules/Preferences/Build/PCBuildPrefs.m index 61efc16..391b0f9 100644 --- a/Modules/Preferences/Build/PCBuildPrefs.m +++ b/Modules/Preferences/Build/PCBuildPrefs.m @@ -23,7 +23,6 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. -#import #import #import "PCBuildPrefs.h" diff --git a/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h b/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h index ae7488d..b272690 100644 --- a/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h +++ b/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.h @@ -59,6 +59,9 @@ NSFont *currentPlainFont; NSFont *currentRichFont; + NSColor *currentBackgroundColor; + NSColor *currentForegroundColor; + NSColor *currentSelectionColor; } - (void)setEditorPlainTextFont:(id)sender; diff --git a/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m b/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m index 3623bf9..bd72ec1 100644 --- a/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m +++ b/Modules/Preferences/EditorFSC/PCEditorFSCPrefs.m @@ -23,8 +23,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. -#import -#import +#import #import "PCEditorFSCPrefs.h" @@ -147,6 +146,33 @@ } } +- (NSColor *)colorFromString:(NSString *)colorString +{ + NSArray *colorComponents; + NSString *colorSpaceName; + NSColor *color; + + colorComponents = [colorString componentsSeparatedByString:@" "]; + colorSpaceName = [colorComponents objectAtIndex:0]; + + if ([colorSpaceName isEqualToString:@"White"]) // Treat as WhiteColorSpace + { + color = [NSColor + colorWithCalibratedWhite:[[colorComponents objectAtIndex:1] floatValue] + alpha:1.0]; + } + else if ([colorSpaceName isEqualToString:@"RGB"]) // Treat as RGBColorSpace + { + color = [NSColor + colorWithCalibratedRed:[[colorComponents objectAtIndex:1] floatValue] + green:[[colorComponents objectAtIndex:2] floatValue] + blue:[[colorComponents objectAtIndex:3] floatValue] + alpha:1.0]; + } + + return color; +} + // ---------------------------------------------------------------------------- // --- Protocol // ---------------------------------------------------------------------------- @@ -183,6 +209,19 @@ [editorLinesField setStringValue:val]; val = [prefs stringForKey:EditorColumns defaultValue:@"80"]; [editorColumnsField setStringValue:val]; + + // Colors + val = [prefs stringForKey:EditorForegroundColor defaultValue:@"White 0.0"]; + currentForegroundColor = [self colorFromString:val]; + [foregroundColorWell setColor:currentForegroundColor]; + + val = [prefs stringForKey:EditorBackgroundColor defaultValue:@"White 1.0"]; + currentBackgroundColor = [self colorFromString:val]; + [backgroundColorWell setColor:currentBackgroundColor]; + + val = [prefs stringForKey:EditorSelectionColor defaultValue:@"White 0.66"]; + currentSelectionColor = [self colorFromString:val]; + [selectionColorWell setColor:currentSelectionColor]; } - (NSView *)view @@ -227,6 +266,63 @@ - (void)setEditorColor:(id)sender { + NSColor *color; + NSColor *currentColor; + NSString *colorString; + NSString *key; + NSString *colorSpaceName; + + if (sender == foregroundColorWell) + { + NSLog(@"foregroundColorWell"); + color = [foregroundColorWell color]; + currentColor = currentForegroundColor; + key = EditorForegroundColor; + } + else if (sender == backgroundColorWell) + { + NSLog(@"backgroundColorWell"); + color = [backgroundColorWell color]; + currentColor = currentBackgroundColor; + key = EditorBackgroundColor; + } + else if (sender == selectionColorWell) + { + NSLog(@"selectionColorWell"); + color = [selectionColorWell color]; + currentColor = currentSelectionColor; + key = EditorSelectionColor; + } + + colorSpaceName = [color colorSpaceName]; + NSLog(@"Color's colorspace name: '%@'", colorSpaceName); + if ([colorSpaceName isEqualToString:@"NSCalibratedRGBColorSpace"]) + { +/* [sender setColor:currentColor]; + NSRunAlertPanel(@"Set Color", + @"Please, use RGB color.\n" + @"Color in color well left unchanged", + @"Close", nil, nil);*/ + colorString = [NSString stringWithFormat:@"RGB %0.1f %0.1f %0.1f", + [color redComponent], + [color greenComponent], + [color blueComponent]]; + } + else if ([colorSpaceName isEqualToString:@"NSCalibratedWhiteColorSpace"]) + { + colorString = [NSString stringWithFormat:@"White %0.1f", + [color whiteComponent]]; + } + else + { + return; + } + + currentColor = color; + + NSLog(@"Selected color: '%@'", colorString); + + [prefs setString:colorString forKey:key notify:YES]; } @end diff --git a/Modules/Preferences/Misc/PCMiscPrefs.m b/Modules/Preferences/Misc/PCMiscPrefs.m index ff1ea94..3103646 100644 --- a/Modules/Preferences/Misc/PCMiscPrefs.m +++ b/Modules/Preferences/Misc/PCMiscPrefs.m @@ -23,7 +23,6 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. -#import #import #import "PCMiscPrefs.h" diff --git a/Modules/Preferences/Saving/PCSavingPrefs.m b/Modules/Preferences/Saving/PCSavingPrefs.m index c5b49a5..1452db1 100644 --- a/Modules/Preferences/Saving/PCSavingPrefs.m +++ b/Modules/Preferences/Saving/PCSavingPrefs.m @@ -23,9 +23,6 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. -#import -#import - #import "PCSavingPrefs.h" @implementation PCSavingPrefs @@ -135,8 +132,6 @@ periodString = [autosaveField stringValue]; [prefs setString:periodString forKey:AutoSavePeriod notify:YES]; - // TODO: Check if this can be replaced with generic notification - // posted by PCPrefsController [[NSNotificationCenter defaultCenter] postNotificationName:PCSavePeriodDidChangeNotification object:periodString]; diff --git a/PCPrefController.m b/PCPrefController.m index 99c63ed..61415df 100644 --- a/PCPrefController.m +++ b/PCPrefController.m @@ -27,9 +27,6 @@ #import "PCPrefController.h" #import -// TODO: rewrite it as PCPreferences, use +sharedPreferences instead of -// [NSUserDefaults standardUserDefaults] in every part of ProjectCenter - @implementation PCPrefController // ===========================================================================