From d4bd4d3637d9ec37a387b0b3a2c26dfe91f434b2 Mon Sep 17 00:00:00 2001 From: "Philippe C.D. Robert" Date: Tue, 29 Jan 2002 21:46:45 +0000 Subject: [PATCH] Fixed a bug preventing reopening projects. Also added 2 methods which will be used to make an editor embedded. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12266 72102866-910b-0410-8b05-ffd578937521 --- PCLib/PCEditor.h | 5 +++++ PCLib/PCEditor.m | 21 ++++++++++++++++++++- PCLib/PCProjectManager.m | 14 ++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/PCLib/PCEditor.h b/PCLib/PCEditor.h index 325c2a3..a913f5d 100644 --- a/PCLib/PCEditor.h +++ b/PCLib/PCEditor.h @@ -22,6 +22,8 @@ NSMutableString *path; id delegate; + + BOOL isEmbedded; } - (id)initWithPath:(NSString*)file; @@ -30,6 +32,9 @@ - (void)setDelegate:(id)aDelegate; - (id)delegate; +- (void)setEmbedded:(BOOL)yn; +- (BOOL)isEmbedded; + - (NSWindow *)editorWindow; - (void)show; diff --git a/PCLib/PCEditor.m b/PCLib/PCEditor.m index cc54459..3fa8729 100644 --- a/PCLib/PCEditor.m +++ b/PCLib/PCEditor.m @@ -76,6 +76,9 @@ { NSString *text = [NSString stringWithContentsOfFile:file]; + // Should take that from preferences! + isEmbedded = NO; + [self _initUI]; [window setTitle:file]; @@ -110,9 +113,25 @@ return window; } +- (void)setEmbedded:(BOOL)yn +{ + isEmbedded = yn; +} + +- (BOOL)isEmbedded +{ + return isEmbedded; +} + - (void)show { - [window makeKeyAndOrderFront:self]; + if( isEmbedded == NO ) + { + [window makeKeyAndOrderFront:self]; + } + else + { + } } - (void)close diff --git a/PCLib/PCProjectManager.m b/PCLib/PCProjectManager.m index 1bfa0ec..7806b6d 100644 --- a/PCLib/PCProjectManager.m +++ b/PCLib/PCProjectManager.m @@ -458,10 +458,20 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange"; - (void)closeProject:(PCProject *)aProject { - PCProject *currentProject; - NSString *key = [[aProject projectPath] stringByAppendingPathComponent:@"PC.project"]; + PCProject *currentProject = nil; + NSString *path = [aProject projectPath]; + NSString *projectName = [path lastPathComponent]; + NSString *key; + + key = [path stringByAppendingPathComponent:projectName]; + key = [key stringByAppendingPathExtension:@"pcproj"]; currentProject = [[loadedProjects objectForKey:key] retain]; + + if( !currentProject ) + { + return; + } // Remove it from the loaded projects! [loadedProjects removeObjectForKey:key];