ResourceSetProject added

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_5@20626 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2005-01-28 00:02:28 +00:00
parent 37208513d6
commit 68a0a2346e
13 changed files with 606 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2005-01-28 Serg Stoyan <stoyan255@ukr.net>
* Moduleas/ResourceSetProject: Added.
2005-01-27 Serg Stoyan <stoyan255@ukr.net>
* Renaissance project type removed.

View file

@ -82,6 +82,7 @@ Modules/ApplicationProject/Application.project \
Modules/BundleProject/Bundle.project \
Modules/FrameworkProject/Framework.project \
Modules/LibraryProject/Library.project \
Modules/ResourceSetProject/ResourceSet.project \
Modules/ToolProject/Tool.project
#

View file

@ -56,7 +56,7 @@ static PCBundleProj *_creator = nil;
- (NSString *)projectTypeName
{
return @"Bundle";
return @"Loadable Bundle";
}
- (PCProject *)createProjectAt:(NSString *)path

View file

@ -15,6 +15,7 @@ SUBPROJECTS = \
BundleProject \
FrameworkProject \
LibraryProject \
ResourceSetProject \
ToolProject
# ObjCParser

View file

@ -0,0 +1,41 @@
#
# GNUmakefile - Aggregate.project
#
include $(GNUSTEP_MAKEFILES)/common.make
#
# Bundle
#
BUNDLE_NAME = ResourceSet
BUNDLE_EXTENSION = .project
ResourceSet_PRINCIPAL_CLASS = PCResourceSetProj
#
# Additional libraries
#
ResourceSet_LIBRARIES_DEPEND_UPON += -lProjectCenter
#
# Resource files
#
ResourceSet_RESOURCE_FILES= \
Resources/PC.project \
Resources/Inspector.gorm
#
# Header files
#
ResourceSet_HEADERS= \
PCResourceSetProj.h \
PCResourceSetProject.h
#
# Class files
#
ResourceSet_OBJC_FILES= \
PCResourceSetProj.m \
PCResourceSetProject.m
include ../GNUmakefile.bundles
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -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 _PCRESOURCESETPROJ_H
#define _PCRESOURCESETPROJ_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/ProjectCenter.h>
@interface PCResourceSetProj : NSObject <ProjectType>
{
}
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator;
- (Class)projectClass;
- (NSString *)projectTypeName;
- (PCProject *)createProjectAt:(NSString *)path;
- (PCProject *)openProjectAt:(NSString *)path;
@end
#endif

View file

@ -0,0 +1,127 @@
/*
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.
*/
#include "ProjectCenter/PCFileCreator.h"
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCResourceSetProj.h"
#include "PCResourceSetProject.h"
@implementation PCResourceSetProj
static PCResourceSetProj *_creator = nil;
//----------------------------------------------------------------------------
// ProjectType
//----------------------------------------------------------------------------
+ (id)sharedCreator
{
if (!_creator)
{
_creator = [[[self class] alloc] init];
}
return _creator;
}
- (Class)projectClass
{
return [PCResourceSetProject class];
}
- (NSString *)projectTypeName
{
return @"Resource Set";
}
- (PCProject *)createProjectAt:(NSString *)path
{
PCResourceSetProject *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 = [[[PCResourceSetProject 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];
[projectDict setObject:[[NSCalendarDate date] description]
forKey:PCCreationDate];
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
// 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];
PCResourceSetProject *project = nil;
project = [[[PCResourceSetProject alloc]
initWithProjectDictionary:dict
path:pPath] autorelease];
return project;
}
@end

View file

@ -0,0 +1,64 @@
/*
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 _PCRESOURCESETPROJECT_H
#define _PCRESOURCESETPROJECT_H
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCProject.h>
@class PCMakefileFactory;
@interface PCResourceSetProject : PCProject
{
IBOutlet NSBox *projectAttributesView;
NSMutableDictionary *infoDict;
}
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init;
- (void)dealloc;
@end
@interface PCResourceSetProject (GeneratedFiles)
- (BOOL)writeMakefile;
- (void)appendHead:(PCMakefileFactory *)mff;
- (void)appendTail:(PCMakefileFactory *)mff;
@end
@interface PCResourceSetProject (Inspector)
- (NSView *)projectAttributesView;
- (void)updateInspectorValues:(NSNotification *)aNotif;
@end
#endif

View file

@ -0,0 +1,206 @@
/*
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.
*/
#include "PCResourceSetProject.h"
#include "PCResourceSetProj.h"
#include <ProjectCenter/PCMakefileFactory.h>
@implementation PCResourceSetProject
//----------------------------------------------------------------------------
// Init and free
//----------------------------------------------------------------------------
- (id)init
{
if ((self = [super init]))
{
rootKeys = [[NSArray arrayWithObjects:
PCOtherResources,
PCSupportingFiles,
PCNonProject,
nil] retain];
rootCategories = [[NSArray arrayWithObjects:
@"Other Resources",
@"Supporting Files",
@"Non Project Files",
nil] retain];
rootEntries = [[NSDictionary
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
}
return self;
}
- (void)dealloc
{
[rootCategories release];
[rootKeys release];
[rootEntries release];
if (projectAttributesView) [projectAttributesView release];
[super dealloc];
}
//----------------------------------------------------------------------------
// Project
//----------------------------------------------------------------------------
- (Class)builderClass
{
return [PCResourceSetProj class];
}
- (NSString *)projectDescription
{
return @"Project that contains resources.";
}
- (NSArray *)resourceFileKeys
{
return [NSArray arrayWithObjects:PCOtherResources, nil];
}
- (NSArray *)otherKeys
{
return [NSArray arrayWithObjects:PCNonProject, nil];
}
- (NSArray *)allowableSubprojectTypes
{
return [NSArray arrayWithObjects:
@"Application", @"Bundle", @"Library", @"Framework", @"Tool", nil];
}
@end
@implementation PCResourceSetProject (GeneratedFiles)
- (BOOL)writeMakefile
{
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
NSString *mfl = nil;
NSData *mfd = nil;
int i, j;
// Save the GNUmakefile backup
[super writeMakefile];
// Save GNUmakefile.preamble
[mf createPreambleForProject:self];
// Create the new file
[mf createMakefileForProject:projectName];
// Head
[self appendHead:mf];
// Resources
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
NSString *resourceItem = nil;
for (j = 0; j < [resources count]; j++)
{
resourceItem = [resources objectAtIndex:j];
if ([[resourceItem pathComponents] count] == 1)
{
resourceItem = [NSString stringWithFormat:@"Resources/%@",
resourceItem];
}
[resources replaceObjectAtIndex:j withObject:resourceItem];
}
[mf appendResourceItems:resources];
[resources release];
}
// 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# Resource Set\n#\n"];
[mff appendString:[NSString stringWithFormat:@"RESOURCE_SET_NAME = %@\n",
projectName]];
[mff appendString:
[NSString stringWithFormat:@"@%RESOURCE_FILES_INSTALL_DIR = %@\n",
[projectDict objectForKey:PCInstallDir]]];
}
- (void)appendTail:(PCMakefileFactory *)mff
{
[mff appendString:@"\n\n#\n# Makefiles\n#\n"];
[mff appendString:@"-include GNUmakefile.preamble\n"];
[mff appendString:@"include $(GNUSTEP_MAKEFILES)/resource-set.make\n"];
[mff appendString:@"-include GNUmakefile.postamble\n"];
}
@end
@implementation PCResourceSetProject (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
{
}
@end

View file

@ -0,0 +1,85 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"alignCenter:",
"alignLeft:",
"arrangeInFront:",
"capitalizeWord:",
"changeFont:",
"close:",
"copy:",
"copyRuler:",
"delete:",
"deleteForward:",
"deleteToBeginningOfParagraph:",
"deleteToEndOfParagraph:",
"deleteWordBackward:",
"deminiaturize:",
"fax:",
"hideOtherApplications:",
"loosenKerning:",
"lowercaseWord:",
"miniaturize:",
"moveBackward:",
"moveDown:",
"moveForward:",
"moveLeft:",
"moveToBeginningOfDocument:",
"moveToBeginningOfParagraph:",
"moveToEndOfLine:",
"moveUp:",
"moveWordBackward:",
"moveWordForward:",
"newDocument:",
"open:",
"orderBack:",
"orderFrontColorPanel:",
"orderFrontFontPanel:",
"orderFrontStandardAboutPanel:",
"orderOut:",
"pageUp:",
"pasteAsPlainText:",
"pasteFont:",
"performClose:",
"performZoom:",
"raiseBaseline:",
"runPageLayout:",
"saveAllDocuments:",
"saveDocumentAs:",
"scrollLineDown:",
"scrollPageDown:",
"scrollViaScroller:",
"selectLine:",
"selectParagraph:",
"selectText:",
"selectWord:",
"showGuessPanel:",
"showWindow:",
"subscript:",
"swapWithMark:",
"takeFloatValueFrom:",
"takeObjectValueFrom:",
"terminate:",
"toggle:",
"toggleRuler:",
"toggleTraditionalCharacterShape:",
"transposeWords:",
"turnOffLigatures:",
"unhide:",
"unscript:",
"useAllLigatures:",
"useStandardLigatures:",
"zoom:"
);
Super = NSObject;
};
PCToolProject = {
Actions = (
);
Outlets = (
projectAttributesView
);
Super = NSObject;
};
}

View file

@ -0,0 +1,27 @@
{
COMPILEROPTIONS = "";
CPPOPTIONS = "";
LINKEROPTIONS = "";
CREATION_DATE = "";
LANGUAGE = "English";
LAST_EDITING = "";
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
INSTALLDIR = "$(HOME)/GNUstep";
OBJC_COMPILEROPTIONS = "";
PROJECT_AUTHORS = ();
PROJECT_CREATOR = "";
PROJECT_DESCRIPTION = "No description avaliable!";
PROJECT_GROUP = "No group available!";
PROJECT_SUMMARY = "No summary available!";
PROJECT_RELEASE = "0.1";
PROJECT_COPYRIGHT = "Copyright (C) 200x";
PROJECT_COPYRIGHT_DESC = "Released under ...";
PROJECT_MAINTAINER = "";
PROJECT_NAME = "";
PROJECT_TYPE = "ResourceSet";
PROJECT_URL = "";
SEARCH_HEADER_DIRS = ();
SEARCH_LIB_DIRS = ();
SUBPROJECTS = ();
SUPPORTING_FILES = ("GNUmakefile.preamble", "GNUmakefile", "GNUmakefile.postamble");
}