diff --git a/Modules/AggregateProject/GNUmakefile b/Modules/AggregateProject/GNUmakefile new file mode 100644 index 0000000..eacbad8 --- /dev/null +++ b/Modules/AggregateProject/GNUmakefile @@ -0,0 +1,47 @@ +# +# GNUmakefile +# +include $(GNUSTEP_MAKEFILES)/common.make + + +# +# Bundle +# +PACKAGE_NAME = AggregateProject +BUNDLE_NAME = AggregateProject +AggregateProject_PRINCIPAL_CLASS = PCAggregateProj + +# +# Additional libraries +# +AggregateProject_LIBRARIES_DEPEND_UPON += -lProjectCenter + +# +# Resource files +# +AggregateProject_RESOURCE_FILES= \ +Resources/PC.project \ +Resources/Inspector.gorm + +# +# Header files +# +AggregateProject_HEADERS= \ +PCAggregateProj.h \ +PCAggregateProject.h + +# +# Class files +# +AggregateProject_OBJC_FILES= \ +PCAggregateProj.m \ +PCAggregateProject.m + +# +# C files +# + +AggregateProject_C_FILES= + +include ../GNUmakefile.bundles +include $(GNUSTEP_MAKEFILES)/bundle.make diff --git a/Modules/AggregateProject/PCAggregateProj.h b/Modules/AggregateProject/PCAggregateProj.h new file mode 100644 index 0000000..f06aac1 --- /dev/null +++ b/Modules/AggregateProject/PCAggregateProj.h @@ -0,0 +1,49 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2004 Free Software Foundation + + Authors: Serg Stoyan + + This file is part of GNUstep. + + This application is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This application is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +*/ + +#ifndef _PCAGGREGATEPROJ_H +#define _PCAGGREGATEPROJ_H + +#include +#include + +@interface PCAggregateProj : NSObject +{ +} + +//---------------------------------------------------------------------------- +// ProjectType +//---------------------------------------------------------------------------- + ++ (id)sharedCreator; + +- (Class)projectClass; +- (NSString *)projectTypeName; + +- (PCProject *)createProjectAt:(NSString *)path; +- (PCProject *)openProjectAt:(NSString *)path; + +@end + +#endif diff --git a/Modules/AggregateProject/PCAggregateProj.m b/Modules/AggregateProject/PCAggregateProj.m new file mode 100644 index 0000000..e4cf265 --- /dev/null +++ b/Modules/AggregateProject/PCAggregateProj.m @@ -0,0 +1,123 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2004 Free Software Foundation + + Author: Serg Stoyan + + This file is part of GNUstep. + + This application is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This application is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +*/ + +#include "ProjectCenter/PCFileCreator.h" +#include "ProjectCenter/PCMakefileFactory.h" + +#include "PCAggregateProj.h" +#include "PCAggregateProject.h" + +@implementation PCAggregateProj + +static PCAggregateProj *_creator = nil; + +//---------------------------------------------------------------------------- +// ProjectType +//---------------------------------------------------------------------------- + ++ (id)sharedCreator +{ + if (!_creator) + { + _creator = [[[self class] alloc] init]; + } + + return _creator; +} + +- (Class)projectClass +{ + return [PCAggregateProject class]; +} + +- (NSString *)projectTypeName +{ + return @"Aggregate"; +} + +- (PCProject *)createProjectAt:(NSString *)path +{ + PCAggregateProject *project = nil; + NSFileManager *fm = [NSFileManager defaultManager]; + + NSAssert(path,@"No valid project path provided!"); + + if ([fm createDirectoryAtPath:path attributes:nil]) + { + NSString *_file = nil; + NSMutableDictionary *projectDict = nil; + NSBundle *projectBundle = nil; + NSString *projectName = nil; + + project = [[[PCAggregateProject alloc] init] autorelease]; + projectBundle = [NSBundle bundleForClass:[self class]]; + + _file = [projectBundle pathForResource:@"PC" ofType:@"project"]; + projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file]; + + // Customise the project + projectName = [path lastPathComponent]; + if ([[projectName pathExtension] isEqualToString:@"subproj"]) + { + projectName = [projectName stringByDeletingPathExtension]; + } + [projectDict setObject:projectName forKey:PCProjectName]; + [projectDict setObject:[self projectTypeName] forKey:PCProjectType]; + // The path cannot be in the PC.project file! + [project setProjectPath:path]; + [project setProjectName:projectName]; + + // GNUmakefile.postamble + [[PCMakefileFactory sharedFactory] createPostambleForProject:project]; + + // Set the new dictionary - this causes the GNUmakefile to be written + if(![project assignProjectDict:projectDict]) + { + NSRunAlertPanel(@"Attention!", + @"Could not load %@!", + @"OK",nil,nil,path); + return nil; + } + + // Save the project to disc + [project save]; + } + + return project; +} + +- (PCProject *)openProjectAt:(NSString *)path +{ + NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path]; + NSString *pPath = [path stringByDeletingLastPathComponent]; + PCAggregateProject *project = nil; + + project = [[[PCAggregateProject alloc] + initWithProjectDictionary:dict + path:pPath] autorelease]; + + return project; +} + +@end diff --git a/Modules/AggregateProject/PCAggregateProject.h b/Modules/AggregateProject/PCAggregateProject.h new file mode 100644 index 0000000..85c5380 --- /dev/null +++ b/Modules/AggregateProject/PCAggregateProject.h @@ -0,0 +1,66 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2001 Free Software Foundation + + Authors: Serg Stoyan + + This file is part of GNUstep. + + This application is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This application is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +*/ + +#ifndef _PCAGGREGATEPROJECT_H +#define _PCAGGREGATEPROJECT_H + +#include +#include + +@class PCMakefileFactory; + +@interface PCAggregateProject : PCProject +{ + IBOutlet NSBox *projectAttributesView; + IBOutlet NSTextField *projectTypeField; + IBOutlet NSTextField *projectNameField; + + NSMutableDictionary *infoDict; +} + +//---------------------------------------------------------------------------- +// Init and free +//---------------------------------------------------------------------------- + +- (id)init; +- (void)dealloc; + +@end + +@interface PCAggregateProject (GeneratedFiles) + +- (BOOL)writeMakefile; +- (void)appendHead:(PCMakefileFactory *)mff; +- (void)appendTail:(PCMakefileFactory *)mff; + +@end + +@interface PCAggregateProject (Inspector) + +- (NSView *)projectAttributesView; +- (void)updateInspectorValues:(NSNotification *)aNotif; + +@end + +#endif diff --git a/Modules/AggregateProject/PCAggregateProject.m b/Modules/AggregateProject/PCAggregateProject.m new file mode 100644 index 0000000..f81b14b --- /dev/null +++ b/Modules/AggregateProject/PCAggregateProject.m @@ -0,0 +1,230 @@ +/* + GNUstep ProjectCenter - http://www.gnustep.org + + Copyright (C) 2001 Free Software Foundation + + Author: Philippe C.D. Robert + + This file is part of GNUstep. + + This application is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This application is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. +*/ + +#include "PCAggregateProject.h" +#include "PCAggregateProj.h" + +#include + +@implementation PCAggregateProject + +//---------------------------------------------------------------------------- +// Init and free +//---------------------------------------------------------------------------- + +- (id)init +{ + if ((self = [super init])) + { + rootKeys = [[NSArray arrayWithObjects: + PCSubprojects, + PCSupportingFiles, + PCNonProject, + nil] retain]; + + rootCategories = [[NSArray arrayWithObjects: + @"Subprojects", + @"Supporting Files", + @"Non Project Files", + nil] retain]; + + rootEntries = [[NSDictionary + dictionaryWithObjects:rootCategories forKeys:rootKeys] retain]; + + } + + return self; +} + +- (void)dealloc +{ + [rootCategories release]; + [rootKeys release]; + [rootEntries release]; + + [super dealloc]; +} + +//---------------------------------------------------------------------------- +// Project +//---------------------------------------------------------------------------- + +- (Class)builderClass +{ + return [PCAggregateProj class]; +} + +- (NSString *)projectDescription +{ + return @"Project that contains subprojects."; +} + +- (BOOL)isExecutable +{ + return NO; +} + +- (NSString *)execAggregateName +{ + return nil; +} + +- (NSArray *)fileTypesForCategoryKey:(NSString *)category +{ + if ([category isEqualToString:PCSubprojects]) + { + return [NSArray arrayWithObjects:@"subproj",nil]; + } + + return nil; +} + +- (NSString *)dirForCategory:(NSString *)category +{ + return projectPath; +} + +- (NSArray *)buildTargets +{ + return nil; +} + +- (NSArray *)sourceFileKeys +{ + return nil; +} + +- (NSArray *)resourceFileKeys +{ + return nil; +} + +- (NSArray *)otherKeys +{ + return [NSArray arrayWithObjects:PCSupportingFiles,nil]; +} + +- (NSArray *)allowableSubprojectTypes +{ + return [NSArray arrayWithObjects: + @"Application", @"Bundle", @"Library", @"Tool", nil]; +} + +- (NSArray *)defaultLocalizableKeys +{ + return nil; +} + +- (NSArray *)localizableKeys +{ + return nil; +} + +@end + +@implementation PCAggregateProject (GeneratedFiles) + +- (BOOL)writeMakefile +{ + PCMakefileFactory *mf = [PCMakefileFactory sharedFactory]; + NSString *mfl = nil; + NSData *mfd = nil; + + // Save the GNUmakefile backup + [super writeMakefile]; + + // Save GNUmakefile.preamble + [mf createPreambleForProject:self]; + + // Create the new file + [mf createMakefileForProject:projectName]; + + // Head + [self appendHead:mf]; + + // Subprojects + if ([[projectDict objectForKey:PCSubprojects] count] > 0) + { + [mf appendSubprojects:[projectDict objectForKey:PCSubprojects]]; + } + + // Tail + [self appendTail:mf]; + + // Write the new file to disc! + mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"]; + if ((mfd = [mf encodedMakefile])) + { + if ([mfd writeToFile:mfl atomically:YES]) + { + return YES; + } + } + + return NO; +} + +- (void)appendHead:(PCMakefileFactory *)mff +{ + [mff appendString:@"\n#\n# Aggregate\n#\n"]; + [mff appendString:[NSString stringWithFormat:@"PACKAGE_NAME = %@\n", + projectName]]; +} + +- (void)appendTail:(PCMakefileFactory *)mff +{ + [mff appendString:@"\n\n#\n# Makefiles\n#\n"]; + [mff appendString:@"-include GNUmakefile.preamble\n"]; + [mff appendString:@"include $(GNUSTEP_MAKEFILES)/aggregate.make\n"]; + [mff appendString:@"-include GNUmakefile.postamble\n"]; +} + +@end + +@implementation PCAggregateProject (Inspector) + +- (NSView *)projectAttributesView +{ + if (projectAttributesView == nil) + { + if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO) + { + NSLog(@"PCLibraryProject: error loading Inspector NIB!"); + return nil; + } + [projectAttributesView retain]; + [self updateInspectorValues:nil]; + } + + return projectAttributesView; +} + +- (void)updateInspectorValues:(NSNotification *)aNotif +{ + [projectTypeField setStringValue:@"Aggregate"]; + [projectNameField setStringValue:projectName]; +} + +@end + diff --git a/Modules/AggregateProject/Resources/Inspector.gorm/data.classes b/Modules/AggregateProject/Resources/Inspector.gorm/data.classes new file mode 100644 index 0000000..ed48144 --- /dev/null +++ b/Modules/AggregateProject/Resources/Inspector.gorm/data.classes @@ -0,0 +1,155 @@ +{ + FirstResponder = { + Actions = ( + "activateContextHelpMode:", + "alignCenter:", + "alignJustified:", + "alignLeft:", + "alignRight:", + "arrangeInFront:", + "cancel:", + "capitalizeWord:", + "changeColor:", + "changeFont:", + "checkSpelling:", + "close:", + "complete:", + "copy:", + "copyFont:", + "copyRuler:", + "cut:", + "delete:", + "deleteBackward:", + "deleteForward:", + "deleteToBeginningOfLine:", + "deleteToBeginningOfParagraph:", + "deleteToEndOfLine:", + "deleteToEndOfParagraph:", + "deleteToMark:", + "deleteWordBackward:", + "deleteWordForward:", + "deminiaturize:", + "deselectAll:", + "fax:", + "hide:", + "hideOtherApplications:", + "indent:", + "loosenKerning:", + "lowerBaseline:", + "lowercaseWord:", + "makeKeyAndOrderFront:", + "miniaturize:", + "miniaturizeAll:", + "moveBackward:", + "moveBackwardAndModifySelection:", + "moveDown:", + "moveDownAndModifySelection:", + "moveForward:", + "moveForwardAndModifySelection:", + "moveLeft:", + "moveRight:", + "moveToBeginningOfDocument:", + "moveToBeginningOfLine:", + "moveToBeginningOfParagraph:", + "moveToEndOfDocument:", + "moveToEndOfLine:", + "moveToEndOfParagraph:", + "moveUp:", + "moveUpAndModifySelection:", + "moveWordBackward:", + "moveWordBackwardAndModifySelection:", + "moveWordForward:", + "moveWordForwardAndModifySelection:", + "newDocument:", + "ok:", + "open:", + "openDocument:", + "orderBack:", + "orderFront:", + "orderFrontColorPanel:", + "orderFrontDataLinkPanel:", + "orderFrontFontPanel:", + "orderFrontHelpPanel:", + "orderFrontStandardAboutPanel:", + "orderFrontStandardInfoPanel:", + "orderOut:", + "pageDown:", + "pageUp:", + "paste:", + "pasteAsPlainText:", + "pasteAsRichText:", + "pasteFont:", + "pasteRuler:", + "performClose:", + "performMiniaturize:", + "performZoom:", + "print:", + "raiseBaseline:", + "revertDocumentToSaved:", + "runPageLayout:", + "runToolbarCustomizationPalette:", + "saveAllDocuments:", + "saveDocument:", + "saveDocumentAs:", + "saveDocumentTo:", + "scrollLineDown:", + "scrollLineUp:", + "scrollPageDown:", + "scrollPageUp:", + "scrollViaScroller:", + "selectAll:", + "selectLine:", + "selectNextKeyView:", + "selectParagraph:", + "selectPreviousKeyView:", + "selectText:", + "selectToMark:", + "selectWord:", + "showContextHelp:", + "showGuessPanel:", + "showHelp:", + "showWindow:", + "stop:", + "subscript:", + "superscript:", + "swapWithMark:", + "takeDoubleValueFrom:", + "takeFloatValueFrom:", + "takeIntValueFrom:", + "takeObjectValueFrom:", + "takeStringValueFrom:", + "terminate:", + "tightenKerning:", + "toggle:", + "toggleContinuousSpellChecking:", + "toggleRuler:", + "toggleToolbarShown:", + "toggleTraditionalCharacterShape:", + "transpose:", + "transposeWords:", + "turnOffKerning:", + "turnOffLigatures:", + "underline:", + "unhide:", + "unhideAllApplications:", + "unscript:", + "uppercaseWord:", + "useAllLigatures:", + "useStandardKerning:", + "useStandardLigatures:", + "yank:", + "zoom:" + ); + Super = NSObject; + }; + PCToolProject = { + Actions = ( + ); + Outlets = ( + projectAttributesView, + projectTypeField, + projectNameField + ); + Super = NSObject; + }; +} \ No newline at end of file diff --git a/Modules/AggregateProject/Resources/Inspector.gorm/objects.gorm b/Modules/AggregateProject/Resources/Inspector.gorm/objects.gorm new file mode 100644 index 0000000..c9a1e68 Binary files /dev/null and b/Modules/AggregateProject/Resources/Inspector.gorm/objects.gorm differ diff --git a/Modules/AggregateProject/Resources/PC.project b/Modules/AggregateProject/Resources/PC.project new file mode 100644 index 0000000..0e205d8 --- /dev/null +++ b/Modules/AggregateProject/Resources/PC.project @@ -0,0 +1,40 @@ +{ + BUILDTOOL = "/usr/bin/make"; + CLASS_FILES = (); + COMPILEROPTIONS = ""; + CPPOPTIONS = ""; + LINKEROPTIONS = ""; + CREATION_DATE = ""; + DOCU_FILES = (); + FRAMEWORKS = (); + HEADER_FILES = (); + IMAGES = (); + LANGUAGE = "English"; + LAST_EDITING = ""; + LIBRARIES = ("gnustep-base"); + MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)"; + INSTALLDIR = "$(HOME)/GNUstep"; + OBJC_COMPILEROPTIONS = ""; + OTHER_FILES = (); + OTHER_RESOURCES = (); + OTHER_SOURCES = (); + PROJECT_AUTHORS = (); + PROJECT_CREATOR = ""; + PROJECT_DESCRIPTION = "No description avaliable!"; + PROJECT_GROUP = "No group avaliable!"; + PROJECT_SUMMARY = "No summary avaliable!"; + PROJECT_RELEASE = "0.1"; + PROJECT_COPYRIGHT = "Copyright (C) 200x"; + PROJECT_COPYRIGHT_DESC = "Released under ..."; + PROJECT_SOURCE = "%{gs_name}-%{gs_version}.tar.gz"; + PROJECT_MAINTAINER = ""; + PROJECT_NAME = ""; + PROJECT_TYPE = "Aggregate"; + PROJECT_VERSION = 0.1; + PROJECT_URL = ""; + SEARCH_HEADER_DIRS = (); + SEARCH_LIB_DIRS = (); + SUBPROJECTS = (); + SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble"); + TOOLICON = ""; +}