* Framework/PCProjectManager.m:

(dealloc): Replace if() check with TEST_RELEASE.
(openFileAtPath:): Use class variable instead of method's local.
(saveFile): Call saveFile to project editor if project is active and
project window has key state. Call non-project editor manager otherwise.
* PCPrefController.m:
(stringForKey:defaultValue:): Set value to non-existent key only if
defaultValue is not 'nil' ('nil' when called via stringForKey: method).
(boolForKey:defaultValue:): Set value to non-existent key only if
defaultValue has positive value (has '-1' when called via boolForKey: method).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@28095 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2009-03-19 00:13:25 +00:00
parent 96516dd723
commit ace38821ad
2 changed files with 27 additions and 13 deletions

View file

@ -118,12 +118,12 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
RELEASE(projectTypeAccessaryView);
RELEASE(fileTypeAccessaryView);
if (editorManager) RELEASE(editorManager);
TEST_RELEASE(editorManager);
if (projectInspector) RELEASE(projectInspector);
if (loadedFilesPanel) RELEASE(loadedFilesPanel);
if (buildPanel) RELEASE(buildPanel);
if (launchPanel) RELEASE(launchPanel);
TEST_RELEASE(projectInspector);
TEST_RELEASE(loadedFilesPanel);
TEST_RELEASE(buildPanel);
TEST_RELEASE(launchPanel);
[super dealloc];
}
@ -1010,14 +1010,14 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
- (void)openFileAtPath:(NSString *)filePath
{
PCEditorManager *em = [self editorManager];
editorManager = [self editorManager];
if (filePath != nil)
{
[em openEditorForFile:filePath
editable:YES
windowed:YES];
[em orderFrontEditorForFile:filePath];
[editorManager openEditorForFile:filePath
editable:YES
windowed:YES];
[editorManager orderFrontEditorForFile:filePath];
}
}
@ -1045,7 +1045,17 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
- (BOOL)saveFile
{
return [[activeProject projectEditor] saveFile];
// We have active project and its window is key
if (activeProject && [[activeProject projectWindow] isKeyWindow])
{
return [[[activeProject projectEditor] activeEditor] saveFile];
}
else if (editorManager)
{
return [[editorManager activeEditor] saveFile];
}
return NO;
}
- (BOOL)saveFileAs

View file

@ -101,11 +101,13 @@ static PCPrefController *_prefCtrllr = nil;
{
return stringValue;
}
else
else if (defaultValue)
{
[self setString:defaultValue forKey:key notify:NO];
return defaultValue;
}
return defaultValue; // returns nil
}
- (BOOL)boolForKey:(NSString *)key
@ -122,11 +124,13 @@ static PCPrefController *_prefCtrllr = nil;
{
return [stringValue boolValue];
}
else
else if (defaultValue > 0)
{
[self setBool:defaultValue forKey:key notify:NO];
return defaultValue;
}
return defaultValue; // returns -1
}
- (float)floatForKey:(NSString *)key