diff --git a/ChangeLog b/ChangeLog index e91dc3d..8b2ecca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2017-01-13 Riccardo Mottola + + * 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 * Modules/Debuggers/ProjectCenter/PipeDelegate.m diff --git a/Framework/PCProjectManager.m b/Framework/PCProjectManager.m index 0528f28..18628d5 100644 --- a/Framework/PCProjectManager.m +++ b/Framework/PCProjectManager.m @@ -759,6 +759,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSString *className = [projectTypes objectForKey:projectType]; PCProject *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!", diff --git a/Headers/Protocols/ProjectType.h b/Headers/Protocols/ProjectType.h index de371d8..cfb83e7 100644 --- a/Headers/Protocols/ProjectType.h +++ b/Headers/Protocols/ProjectType.h @@ -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 + 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 @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 diff --git a/Modules/Projects/Aggregate/PCAggregateProject.h b/Modules/Projects/Aggregate/PCAggregateProject.h index 9c3e0b9..3fb1a07 100644 --- a/Modules/Projects/Aggregate/PCAggregateProject.h +++ b/Modules/Projects/Aggregate/PCAggregateProject.h @@ -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 diff --git a/Modules/Projects/Aggregate/PCAggregateProject.m b/Modules/Projects/Aggregate/PCAggregateProject.m index 7cd5430..2363bfa 100644 --- a/Modules/Projects/Aggregate/PCAggregateProject.m +++ b/Modules/Projects/Aggregate/PCAggregateProject.m @@ -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; diff --git a/Modules/Projects/Application/PCAppProject.h b/Modules/Projects/Application/PCAppProject.h index 732630f..3509311 100644 --- a/Modules/Projects/Application/PCAppProject.h +++ b/Modules/Projects/Application/PCAppProject.h @@ -102,7 +102,7 @@ - (void)loadInfoFile; - (void)dealloc; -- (PCProject *)createProjectAt:(NSString *)path; +- (PCProject *)createProjectAt:(NSString *)path withOption:projOption; @end diff --git a/Modules/Projects/Application/PCAppProject.m b/Modules/Projects/Application/PCAppProject.m index da2a589..aa9a5d2 100644 --- a/Modules/Projects/Application/PCAppProject.m +++ b/Modules/Projects/Application/PCAppProject.m @@ -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"]; diff --git a/Modules/Projects/Bundle/PCBundleProject.h b/Modules/Projects/Bundle/PCBundleProject.h index 3e6a3aa..3e3231e 100644 --- a/Modules/Projects/Bundle/PCBundleProject.h +++ b/Modules/Projects/Bundle/PCBundleProject.h @@ -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 diff --git a/Modules/Projects/Bundle/PCBundleProject.m b/Modules/Projects/Bundle/PCBundleProject.m index db5fbe9..fea59e0 100644 --- a/Modules/Projects/Bundle/PCBundleProject.m +++ b/Modules/Projects/Bundle/PCBundleProject.m @@ -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; diff --git a/Modules/Projects/Framework/PCFrameworkProject.h b/Modules/Projects/Framework/PCFrameworkProject.h index b554f40..d1f0f8f 100644 --- a/Modules/Projects/Framework/PCFrameworkProject.h +++ b/Modules/Projects/Framework/PCFrameworkProject.h @@ -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 diff --git a/Modules/Projects/Framework/PCFrameworkProject.m b/Modules/Projects/Framework/PCFrameworkProject.m index 5635f50..4237c82 100644 --- a/Modules/Projects/Framework/PCFrameworkProject.m +++ b/Modules/Projects/Framework/PCFrameworkProject.m @@ -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]; diff --git a/Modules/Projects/ResourceSet/PCResourceSetProject.h b/Modules/Projects/ResourceSet/PCResourceSetProject.h index 71d531f..9a36249 100644 --- a/Modules/Projects/ResourceSet/PCResourceSetProject.h +++ b/Modules/Projects/ResourceSet/PCResourceSetProject.h @@ -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 diff --git a/Modules/Projects/ResourceSet/PCResourceSetProject.m b/Modules/Projects/ResourceSet/PCResourceSetProject.m index 9f7eae2..fb557d1 100644 --- a/Modules/Projects/ResourceSet/PCResourceSetProject.m +++ b/Modules/Projects/ResourceSet/PCResourceSetProject.m @@ -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; diff --git a/Modules/Projects/Tool/PCToolProject.h b/Modules/Projects/Tool/PCToolProject.h index 83b3769..ffe8896 100644 --- a/Modules/Projects/Tool/PCToolProject.h +++ b/Modules/Projects/Tool/PCToolProject.h @@ -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 diff --git a/Modules/Projects/Tool/PCToolProject.m b/Modules/Projects/Tool/PCToolProject.m index 2ed05e4..341fb98 100644 --- a/Modules/Projects/Tool/PCToolProject.m +++ b/Modules/Projects/Tool/PCToolProject.m @@ -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];