Pass options to createProjectAt and use those to create Gorm/Renaissance subtypes, enable the former by default

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@40290 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2017-01-13 01:33:37 +00:00
parent f1db0b7265
commit d894b87557
15 changed files with 94 additions and 51 deletions

View file

@ -1,3 +1,21 @@
2017-01-13 Riccardo Mottola <rm@gnu.org>
* Framework/PCProjectManager.m
* Headers/Protocols/ProjectType.h
* Modules/Projects/Aggregate/PCAggregateProject.h
* Modules/Projects/Aggregate/PCAggregateProject.m
* Modules/Projects/Application/PCAppProject.h
* Modules/Projects/Application/PCAppProject.m
* Modules/Projects/Bundle/PCBundleProject.h
* Modules/Projects/Bundle/PCBundleProject.m
* Modules/Projects/Framework/PCFrameworkProject.h
* Modules/Projects/Framework/PCFrameworkProject.m
* Modules/Projects/ResourceSet/PCResourceSetProject.h
* Modules/Projects/ResourceSet/PCResourceSetProject.m
* Modules/Projects/Tool/PCToolProject.h
* Modules/Projects/Tool/PCToolProject.m
Pass options to createProjectAt and use those to create Gorm/Renaissance subtypes, enable the former by default.
2016-12-16 Riccardo Mottola <rm@gnu.org>
* Modules/Debuggers/ProjectCenter/PipeDelegate.m

View file

@ -759,6 +759,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
NSString *className = [projectTypes objectForKey:projectType];
PCProject<ProjectType> *projectCreator;
PCProject *project = nil;
NSString *subType = nil;
if ((project = [loadedProjects objectForKey: [aPath stringByDeletingLastPathComponent]]) != nil)
{
@ -766,6 +767,9 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
return project;
}
if ([projectType isEqualToString:@"Application"])
subType = PCProjectInterfaceGorm;
projectCreator = [bundleManager objectForClassName:className
bundleType:@"project"
protocol:@protocol(ProjectType)];
@ -791,7 +795,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
}
// Create project
if (!(project = [projectCreator createProjectAt:aPath]))
if (!(project = [projectCreator createProjectAt:aPath withOption:subType]))
{
NSRunAlertPanel(@"New Project",
@"Project %@ could not be created.\nReport bug, please!",

View file

@ -1,9 +1,10 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2000-2002 Free Software Foundation
Copyright (C) 2000-2017 Free Software Foundation
Author: Philippe C.D. Robert <probert@siggraph.org>
Riccardo Mottola
This file is part of GNUstep.
@ -29,15 +30,20 @@
Description: A ProjectType is used to create a project of a certain type.
With this approach this procedure can be implemented as a bundle
and therefore PC remains open for future extensions!
Options are used to further customize types.
*/
#import <Foundation/Foundation.h>
@class PCProject;
static NSString* const PCProjectInterfaceGorm = @"GormInterface";
static NSString* const PCProjectInterfaceRenaissance = @"RenaissanceInterface";
@protocol ProjectType
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:(NSString *)option;
@end

View file

@ -1,9 +1,10 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Copyright (C) 2004-2017 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
@ -45,7 +46,7 @@
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption;
@end

View file

@ -1,9 +1,10 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Copyright (C) 2004-2017 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
@ -91,7 +92,7 @@
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption
{
PCFileManager *pcfm = [PCFileManager defaultManager];
NSString *_file;

View file

@ -102,7 +102,7 @@
- (void)loadInfoFile;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption;
@end

View file

@ -1,7 +1,7 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2015 Free Software Foundation
Copyright (C) 2001-2017 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
@ -141,7 +141,7 @@
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
- (PCProject *)createProjectAt:(NSString *)path withOption:(NSString *)projOption
{
PCFileManager *pcfm = [PCFileManager defaultManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
@ -203,38 +203,46 @@
// into English.lproj and copied into all available .lproj subdirs.
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
// Main NIB
_file = [projBundle pathForResource:@"Main" ofType:@"gorm"];
mainNibFile = [NSString stringWithFormat:@"%@.gorm", projectName];
mainNibFile = [_resourcePath stringByAppendingPathComponent:mainNibFile];
[pcfm copyFile:_file toFile:mainNibFile];
if ([projOption isEqualToString: PCProjectInterfaceGorm])
{
// Main NIB (Gorm)
_file = [projBundle pathForResource:@"Main" ofType:@"gorm"];
mainNibFile = [NSString stringWithFormat:@"%@.gorm", projectName];
mainNibFile = [_resourcePath stringByAppendingPathComponent:mainNibFile];
[pcfm copyFile:_file toFile:mainNibFile];
[projectDict setObject:[mainNibFile lastPathComponent]
forKey:PCMainInterfaceFile];
[projectDict setObject:[NSArray arrayWithObjects:[mainNibFile lastPathComponent], nil]
forKey:PCInterfaces];
}
else if ([projOption isEqualToString: PCProjectInterfaceRenaissance])
{
// Renaissance
_file = [projBundle pathForResource:@"Main" ofType:@"gsmarkup"];
_2file = [_resourcePath stringByAppendingPathComponent:@"Main.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
_file = [projBundle pathForResource:@"MainMenu-GNUstep" ofType:@"gsmarkup"];
_2file = [_resourcePath
stringByAppendingPathComponent:@"MainMenu-GNUstep.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
_file = [projBundle pathForResource:@"MainMenu-OSX" ofType:@"gsmarkup"];
_2file = [_resourcePath
stringByAppendingPathComponent:@"MainMenu-OSX.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
[projectDict setObject:[mainNibFile lastPathComponent]
forKey:PCMainInterfaceFile];
// Renaissance
_file = [projBundle pathForResource:@"Main" ofType:@"gsmarkup"];
_2file = [_resourcePath stringByAppendingPathComponent:@"Main.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
_file = [projBundle pathForResource:@"MainMenu-GNUstep" ofType:@"gsmarkup"];
_2file = [_resourcePath
stringByAppendingPathComponent:@"MainMenu-GNUstep.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
_file = [projBundle pathForResource:@"MainMenu-OSX" ofType:@"gsmarkup"];
_2file = [_resourcePath
stringByAppendingPathComponent:@"MainMenu-OSX.gsmarkup"];
[pcfm copyFile:_file toFile:_2file];
[projectDict setObject:[NSArray arrayWithObjects:[mainNibFile lastPathComponent], @"Main.gsmarkup", @"MainMenu-GNUstep.gsmarkup", @"MainMenu-OSX.gsmarkup", nil]
forKey:PCInterfaces];
[projectDict setObject:[NSArray arrayWithObjects:@"Main.gsmarkup", @"MainMenu-GNUstep.gsmarkup", @"MainMenu-OSX.gsmarkup", nil]
forKey:PCInterfaces];
}
// Info-gnustep.plist
_file = [projBundle pathForResource:@"Info" ofType:@"gnustep"];
infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:_file];
[infoDict setObject:projectName forKey:@"ApplicationName"];
[infoDict setObject:projectName forKey:@"NSExecutable"];
[infoDict setObject:[mainNibFile lastPathComponent]
forKey:@"NSMainNibFile"];
if (mainNibFile)
[infoDict setObject:[mainNibFile lastPathComponent]
forKey:@"NSMainNibFile"];
[infoDict setObject:[projectDict objectForKey:PCPrincipalClass]
forKey:@"NSPrincipalClass"];
[infoDict setObject:[projectDict objectForKey:PCBundleIdentifier] forKey:@"CFBundleIdentifier"];

View file

@ -1,10 +1,11 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Copyright (C) 2001-2017 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Riccardo Mottola
Description: This is the project type 'Bundle' for GNUstep. You never
should create it yourself but use PCBundleProj for doing this.
@ -50,7 +51,7 @@
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption;
@end

View file

@ -1,7 +1,7 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2016 Free Software Foundation
Copyright (C) 2001-2017 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
@ -104,7 +104,7 @@
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption
{
NSBundle *projectBundle = nil;
NSString *_file = nil;

View file

@ -1,9 +1,10 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Copyright (C) 2004-2017 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
Description: This is the project type 'Library' for GNUstep. You never
should create it yourself but use PCFrameworkProj for doing
@ -50,7 +51,7 @@
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption;
@end

View file

@ -1,7 +1,7 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2005-2015 Free Software Foundation
Copyright (C) 2005-2017 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
@ -94,7 +94,7 @@
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption
{
// PCFileManager *pcfm = [PCFileManager defaultManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];

View file

@ -1,9 +1,10 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004 Free Software Foundation
Copyright (C) 2004-2017 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
@ -47,7 +48,7 @@
- (id)init;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption;
@end

View file

@ -1,9 +1,10 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2004-2013 Free Software Foundation
Copyright (C) 2004-2017 Free Software Foundation
Authors: Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
@ -79,7 +80,7 @@
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
- (PCProject *)createProjectAt:(NSString *)path withOption:projOption
{
NSBundle *projectBundle = nil;
NSString *_file = nil;

View file

@ -1,10 +1,11 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2001-2004 Free Software Foundation
Copyright (C) 2001-2017 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Riccardo Mottola
Description: This is the project type 'Tool' for GNUstep. You never should
create it yourself but use PCToolProj for doing this. Otherwise
@ -54,7 +55,7 @@
- (void)loadInfoFile;
- (void)dealloc;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)createProjectAt:(NSString *)path withOption:(NSString *)option;
@end

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-2017 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
@ -137,7 +137,7 @@
// --- ProjectType protocol
// ----------------------------------------------------------------------------
- (PCProject *)createProjectAt:(NSString *)path
- (PCProject *)createProjectAt:(NSString *)path withOption:(NSString *)option
{
PCFileManager *pcfm = [PCFileManager defaultManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];