Cleanup a bit the setting of the active project and the key win.

This commit is contained in:
Riccardo Mottola 2021-02-04 17:57:40 +01:00
parent b5324e9581
commit 263106b117
3 changed files with 24 additions and 18 deletions

View file

@ -1,3 +1,9 @@
2021-02-04 Riccardo Mottola <rm@gnu.org>
* Framework/PCProjectManager.m
* PCAppController.m:
Cleanup a bit the setting of the active project and the key win.
2021-02-03 Riccardo Mottola <rm@gnu.org>
* Framework/PCProjectInspector.m

View file

@ -1,7 +1,7 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2000-2017 Free Software Foundation
Copyright (C) 2000-2021 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
@ -552,7 +552,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
NSString *projectPath = nil;
NSString *projectFileType = nil;
PCProject *project = nil;
NSDictionary *wap = nil;
NSString *projectPathToSave;
// Check project path for invalid characters
@ -675,14 +674,13 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
[self startSaveTimer];
[project validateProjectDict];
if (!project)
{
return nil;
}
[loadedProjects setObject:project forKey:[project projectPath]];
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath:projectPathToSave]];
PCLogStatus(self, @"Saved opened Document as %@", projectPathToSave);
if (flag)
{
NSDictionary *wap = nil;
[project setProjectManager:self];
// Windows and panels
@ -699,14 +697,17 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
{
[[project projectWindow] showProjectLoadedFiles:self];
}
[[project projectWindow] makeKeyAndOrderFront:self];
[self setActiveProject: project];
}
PCLogStatus(self, @"Saved opened Document as %@", projectPathToSave);
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath:projectPathToSave]];
}
else
{
PCLogStatus(self, @"Project %@ already Open", [project projectName]);
}
if (flag)
{
[self setActiveProject: project];
}
return project;
}

View file

@ -1,7 +1,7 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2013 Free Software Foundation
Copyright (C) 2001-2021 Free Software Foundation
This file is part of GNUstep.
@ -19,6 +19,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 <ProjectCenter/PCLogController.h>
#import <ProjectCenter/PCFileManager.h>
@ -48,7 +49,7 @@
if ((self = [super init]))
{
infoController = [[PCInfoController alloc] init];
// Termporary workaround to initialize defaults values
// Temporary workaround to initialize defaults values
prefController = [PCPrefController sharedPCPreferences];
logController = [PCLogController sharedLogController];
@ -119,13 +120,13 @@
|| [[fileName pathExtension] isEqualToString:@"project"] == YES)
{
[projectManager openProjectAt: fileName makeActive: YES];
[[[projectManager activeProject] projectWindow]
makeKeyAndOrderFront:self];
}
else
{
[projectManager openFileAtPath:fileName];
}
[[[projectManager activeProject] projectWindow] makeKeyAndOrderFront:self];
return YES;
}
@ -136,8 +137,6 @@
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
// NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter"];
if ([prefController boolForKey:DisplayLog])
{
[logController showPanel];