Added methods into PCFileManager

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@20519 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2005-01-04 23:11:20 +00:00
parent f44e640e8b
commit 1f6aad8624
20 changed files with 372 additions and 352 deletions

View file

@ -1,3 +1,12 @@
2005-01-04 Serg Stoyan <stoyan255@ukr.net>
* Library/PCFilesManager.[hm]:
(createDirectoriesIfNeededAtPath:): Added and implemented.
(copyFile:toFile:): ditto.
(copyFile:intoDirectory:): ditto.
* Use above methods where it's appropriate.
2005-01-03 Serg Stoyan <stoyan255@ukr.net>
* Library/PCAddFilesPanel.[hm]: New implementation. Derived from
@ -12,7 +21,7 @@
libraries.
* Library/PCProjectInspector.m: Observe project dictionary changes and
reread it.
reread it. Accept entered value when textfields are losting focus.
* Library/PCProjectBrowser.m:
(doubleClick:): Don't try to open libraries.
@ -27,6 +36,10 @@
* Library/PCEditor.m:
(_createEditorViewWithFrame:): Remove return of autoreleased ivar.
* Library/PCFileManager.m:
(filesForAddOfTypes:): Get list of categories from active project not
from root active project.
2004-12-24 Serg Stoyan <stoyan255@ukr.net>
* "Build Tool" setting from Project Inspector was moved to PC

View file

@ -21,10 +21,10 @@ ProjectCenter 0.5
- Add more project types stoyan
- Localization support for projects stoyan
- Add pending add/removal of files stoyan
- Editor enhancements (syntax highlighting, etc.) stoyan
- Finish ProjectWindow and its contents (Browser, FileIcon) stoyan
- ProjectBuilder enhancements (warnings,errors,options etc.) stoyan
- Editor enhancements (syntax highlighting, indentation) stoyan
- Add pending add/removal of files stoyan
ProjectCenter 0.6
-----------------

View file

@ -73,6 +73,7 @@ static PCAddFilesPanel *addFilesPanel = nil;
- (void)setCategories:(NSArray *)categories
{
[fileTypePopup removeAllItems];
[fileTypePopup addItemsWithTitles:categories];
}

View file

@ -24,8 +24,9 @@
*/
#include "PCDefines.h"
#include "PCFileCreator.h"
#include "PCProject.h"
#include "PCFileManager.h"
#include "PCFileCreator.h"
#include "PCLogController.h"
@ -120,7 +121,7 @@ static NSDictionary *dict = nil;
path:(NSString *)path
project:(PCProject *)aProject
{
NSFileManager *fm = [NSFileManager defaultManager];
PCFileManager *pcfm = [PCFileManager fileManager];
NSString *_file;
NSString *newFile = nil;
NSMutableDictionary *files;
@ -144,7 +145,7 @@ static NSDictionary *dict = nil;
{
newFile = [path stringByAppendingPathExtension:@"m"];
}
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[files setObject:ObjCClass forKey:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
@ -152,7 +153,7 @@ static NSDictionary *dict = nil;
// Header must be created as well!
newFile = [path stringByAppendingPathExtension:@"h"];
_file = [bundle pathForResource:@"header" ofType:@"template"];
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:ObjCHeader forKey:newFile];
@ -167,7 +168,7 @@ static NSDictionary *dict = nil;
{
newFile = [path stringByAppendingPathExtension:@"h"];
}
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:ObjCHeader forKey:newFile];
}
@ -182,7 +183,7 @@ static NSDictionary *dict = nil;
{
newFile = [path stringByAppendingPathExtension:@"c"];
}
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[files setObject:CFile forKey:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
@ -190,7 +191,7 @@ static NSDictionary *dict = nil;
// Header should be created as well.
newFile = [path stringByAppendingPathExtension:@"h"];
_file = [bundle pathForResource:@"cheader" ofType:@"template"];
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:CHeader forKey:newFile];
@ -205,7 +206,7 @@ static NSDictionary *dict = nil;
{
newFile = [path stringByAppendingPathExtension:@"h"];
}
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:CHeader forKey:newFile];
}
@ -219,7 +220,7 @@ static NSDictionary *dict = nil;
{
newFile = [path stringByAppendingPathExtension:@"gsmarkup"];
}
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[files setObject:GSMarkupFile forKey:newFile];
}
/*
@ -232,7 +233,7 @@ static NSDictionary *dict = nil;
{
newFile = [path stringByAppendingPathExtension:@"h"];
}
[fm copyPath:_file toPath:newFile handler:nil];
[pcfm copyFile:_file toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:ProtocolFile forKey:newFile];
}

View file

@ -79,7 +79,16 @@
title:(NSString *)title
accView:(NSView *)accessoryView;
// Return NO if coping of any file failed
// Checks if directories in path exists and creates if not.
- (BOOL)createDirectoriesIfNeededAtPath:(NSString *)path;
// Create directories in toFile path if needed
- (BOOL)copyFile:(NSString *)file toFile:(NSString *)toFile;
// Calls copyFile:toFile:
- (BOOL)copyFile:(NSString *)file intoDirectory:(NSString *)directory;
// Calls copyFile:intoDirectory in cycle
- (BOOL)copyFiles:(NSArray *)files intoDirectory:(NSString *)directory;
// Return NO if removing of any file failed

View file

@ -151,12 +151,91 @@ static PCFileManager *_mgr = nil;
return nil;
}
- (BOOL)createDirectoriesIfNeededAtPath:(NSString *)path
{
NSString *_path = [NSString stringWithString:path];
NSMutableArray *pathArray = [NSMutableArray array];
NSFileManager *fm = [NSFileManager defaultManager];
BOOL isDir;
int i;
while (![fm fileExistsAtPath:_path isDirectory:&isDir])
{
[pathArray addObject:[_path lastPathComponent]];
_path = [_path stringByDeletingLastPathComponent];
}
if (!isDir)
{
return NO;
}
if ([_path length] != [path length])
{
for (i = [pathArray count]-1; i >= 0; i--)
{
_path =
[_path stringByAppendingPathComponent:[pathArray objectAtIndex:i]];
if ([fm createDirectoryAtPath:_path attributes:nil] == NO)
{
return NO;
}
}
}
return YES;
}
- (BOOL)copyFile:(NSString *)file toFile:(NSString *)toFile
{
NSFileManager *fm = [NSFileManager defaultManager];
NSString *directory = nil;
if (!file)
{
return NO;
}
if (![fm fileExistsAtPath:toFile])
{
directory = [toFile stringByDeletingLastPathComponent];
if ([self createDirectoriesIfNeededAtPath:directory] == NO)
{
return NO;
}
if (![fm copyPath:file toPath:toFile handler:nil])
{
return NO;
}
}
return YES;
}
- (BOOL)copyFile:(NSString *)file intoDirectory:(NSString *)directory
{
NSString *path = nil;
if (!file)
{
return NO;
}
path = [directory stringByAppendingPathComponent:[file lastPathComponent]];
if (![self copyFile:file toFile:path])
{
return NO;
}
return YES;
}
- (BOOL)copyFiles:(NSArray *)files intoDirectory:(NSString *)directory
{
NSEnumerator *enumerator;
NSEnumerator *enumerator = nil;
NSString *file = nil;
NSString *fileName = nil;
NSString *path = nil;
if (!files)
{
@ -166,17 +245,9 @@ static PCFileManager *_mgr = nil;
enumerator = [files objectEnumerator];
while ((file = [enumerator nextObject]))
{
NSFileManager *fm = [NSFileManager defaultManager];
fileName = [file lastPathComponent];
path = [directory stringByAppendingPathComponent:fileName];
if (![fm fileExistsAtPath:path])
if ([self copyFile:file intoDirectory:directory] == NO)
{
if (![fm copyPath:file toPath:path handler:nil])
{
return NO;
}
return NO;
}
}
@ -340,7 +411,7 @@ static PCFileManager *_mgr = nil;
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *lastOpenDir = [ud objectForKey:@"LastOpenDirectory"];
PCProject *project = [projectManager rootActiveProject];
PCProject *project = [projectManager activeProject];
NSString *selectedCategory = nil;
int retval;

View file

@ -52,6 +52,7 @@
- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target;
- (void)appendResources;
- (void)appendResourceItems:(NSArray *)array;
- (void)appendLocalization;
- (void)appendSubprojects:(NSArray*)array;
- (NSData *)encodedMakefile;

View file

@ -27,16 +27,17 @@
#include "PCProject.h"
#include "PCMakefileFactory.h"
#define COMMENT_HEADERS @"\n\n#\n# Header files\n#\n"
#define COMMENT_RESOURCES @"\n\n#\n# Resource files\n#\n"
#define COMMENT_CLASSES @"\n\n#\n# Class files\n#\n"
#define COMMENT_CFILES @"\n\n#\n# C files\n#\n"
#define COMMENT_SUBPROJECTS @"\n\n#\n# Subprojects\n#\n"
#define COMMENT_APP @"\n\n#\n# Main application\n#\n"
#define COMMENT_LIBRARIES @"\n\n#\n# Additional libraries\n#\n"
#define COMMENT_BUNDLE @"\n\n#\n# Bundle\n#\n"
#define COMMENT_LIBRARY @"\n\n#\n# Library\n#\n"
#define COMMENT_TOOL @"\n\n#\n# Tool\n#\n"
#define COMMENT_HEADERS @"\n\n#\n# Header files\n#\n"
#define COMMENT_RESOURCES @"\n\n#\n# Resource files\n#\n"
#define COMMENT_CLASSES @"\n\n#\n# Class files\n#\n"
#define COMMENT_CFILES @"\n\n#\n# C files\n#\n"
#define COMMENT_SUBPROJECTS @"\n\n#\n# Subprojects\n#\n"
#define COMMENT_APP @"\n\n#\n# Main application\n#\n"
#define COMMENT_LIBRARIES @"\n\n#\n# Additional libraries\n#\n"
#define COMMENT_BUNDLE @"\n\n#\n# Bundle\n#\n"
#define COMMENT_LIBRARY @"\n\n#\n# Library\n#\n"
#define COMMENT_TOOL @"\n\n#\n# Tool\n#\n"
#define COMMENT_LOCALIZATION @"\n\n#\n# Localization\n#\n"
@implementation PCMakefileFactory
@ -197,47 +198,30 @@ static PCMakefileFactory *_factory = nil;
- (void)appendHeaders:(NSArray *)array
{
[self appendHeaders: array forTarget: pnme];
[self appendHeaders:array forTarget:pnme];
}
- (void)appendHeaders:(NSArray *)array forTarget: (NSString *)target
- (void)appendHeaders:(NSArray *)array forTarget:(NSString *)target
{
[self appendString:COMMENT_HEADERS];
[self appendString:[NSString stringWithFormat:@"%@_HEADER_FILES = ",
target]];
[self appendString:
[NSString stringWithFormat:@"%@_HEADER_FILES = \\\n", target]];
if( array && [array count] )
{
NSString *tmp;
NSEnumerator *enumerator = [array objectEnumerator];
while ( (tmp = [enumerator nextObject]) )
{
[self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
}
}
[self appendString:[array componentsJoinedByString:@" \\\n"]];
}
- (void)appendClasses:(NSArray *)array
{
[self appendClasses: array forTarget: pnme];
[self appendClasses:array forTarget:pnme];
}
- (void)appendClasses:(NSArray *)array forTarget: (NSString *)target
- (void)appendClasses:(NSArray *)array forTarget:(NSString *)target
{
[self appendString:COMMENT_CLASSES];
[self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES = ", target]];
[self appendString:
[NSString stringWithFormat:@"%@_OBJC_FILES = \\\n",target]];
if( array && [array count] )
{
NSString *tmp;
NSEnumerator *enumerator = [array objectEnumerator];
while ( (tmp = [enumerator nextObject] ))
{
[self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
}
}
[self appendString:[array componentsJoinedByString:@" \\\n"]];
}
- (void)appendOtherSources:(NSArray *)array
@ -248,8 +232,8 @@ static PCMakefileFactory *_factory = nil;
- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target
{
NSMutableArray *marray = nil;
NSEnumerator *oenum;
NSString *file;
NSEnumerator *oenum;
NSString *file;
[self appendString:COMMENT_CFILES];
[self appendString:[NSString stringWithFormat:@"%@_C_FILES = ", target]];
@ -272,7 +256,7 @@ static PCMakefileFactory *_factory = nil;
}
}
[self appendString: @"\n"];
[self appendString: @"\n\n"];
[self appendString:[NSString stringWithFormat:@"%@_OBJC_FILES += ",pnme]];
if ( marray )
{
@ -289,18 +273,24 @@ static PCMakefileFactory *_factory = nil;
- (void)appendResources
{
[self appendString:COMMENT_RESOURCES];
[self appendString:[NSString stringWithFormat:@"%@_RESOURCE_FILES = ",pnme]];
[self appendString:
[NSString stringWithFormat:@"%@_RESOURCE_FILES = ",pnme]];
}
- (void)appendResourceItems:(NSArray *)array
{
NSString *tmp;
NSEnumerator *enumerator = [array objectEnumerator];
while ((tmp = [enumerator nextObject]))
if ([array count] <= 0)
{
[self appendString:[NSString stringWithFormat:@"\\\n%@ ",tmp]];
return;
}
[self appendString:@"\\\n"];
[self appendString:[array componentsJoinedByString:@" \\\n"]];
}
- (void)appendLocalization
{
[self appendString:COMMENT_LOCALIZATION];
}
- (void)appendSubprojects:(NSArray*)array

View file

@ -157,6 +157,7 @@
- (void)beginFileRename;
- (void)browserDidSetPath:(NSNotification *)aNotif;
- (void)setFileName:(NSString *)name andIcon:(NSImage *)icon;
- (void)fileNameDidChange:(id)sender;
- (void)setPublicHeader:(id)sender;
@end

View file

@ -238,8 +238,7 @@
NSString *newEntry = [sender stringValue];
// Build Atributes
if (sender == installPathField
&& ![[[project projectDict] objectForKey:PCInstallDir] isEqualToString:newEntry])
if (sender == installPathField)
{
[project setProjectDictObject:newEntry forKey:PCInstallDir notify:YES];
}
@ -261,32 +260,32 @@
forKey:PCCompilerOptions
notify:YES];
}
else if ( sender == ldOptField )
else if (sender == ldOptField)
{
[project setProjectDictObject:newEntry
forKey:PCLinkerOptions
notify:YES];
}
// Project Description
else if ( sender == descriptionField )
else if (sender == descriptionField)
{
[project setProjectDictObject:newEntry forKey:PCDescription notify:YES];
}
else if ( sender == releaseField )
else if (sender == releaseField)
{
[project setProjectDictObject:newEntry forKey:PCRelease notify:YES];
}
else if ( sender == licenseField )
else if (sender == licenseField)
{
[project setProjectDictObject:newEntry forKey:PCCopyright notify:YES];
}
else if ( sender == licDescriptionField )
else if (sender == licDescriptionField)
{
[project setProjectDictObject:newEntry
forKey:PCCopyrightDescription
notify:YES];
notify:YES];
}
else if ( sender == urlField )
else if (sender == urlField)
{
[project setProjectDictObject:newEntry forKey:PCURL notify:YES];
}
@ -298,6 +297,18 @@
[self inspectorPopupDidChange:inspectorPopup];
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotif
{
NSControl *anObject = [aNotif object];
id target = [anObject target];
SEL action = [anObject action];
if ([target respondsToSelector:action])
{
[target performSelector:action withObject:anObject];
}
}
// ============================================================================
// ==== Notifications
// ============================================================================

View file

@ -1,141 +1,74 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"activateContextHelpMode:",
"alignCenter:",
"alignJustified:",
"alignLeft:",
"alignRight:",
"arrangeInFront:",
"cancel:",
"capitalizeWord:",
"changeColor:",
"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:",
"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:",
"fileNameDidChange:"
);

View file

@ -26,6 +26,7 @@
*/
#include "ProjectCenter/PCFileCreator.h"
#include "ProjectCenter/PCFileManager.h"
#include "ProjectCenter/PCMakefileFactory.h"
#include "PCAppProj.h"
@ -61,123 +62,113 @@ static PCAppProj *_creator = nil;
- (PCProject *)createProjectAt:(NSString *)path
{
PCAppProject *project = nil;
NSFileManager *fm = [NSFileManager defaultManager];
PCAppProject *project = nil;
PCFileManager *pcfm = [PCFileManager fileManager];
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
NSString *_file = nil;
NSString *_2file = nil;
NSString *_resourcePath = nil;
NSString *projectName = nil;
NSMutableDictionary *projectDict = nil;
NSDictionary *infoDict = nil;
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
NSString *mainNibFile = nil;
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath: path attributes: nil])
project = [[[PCAppProject alloc] init] autorelease];
// PC.project
_file = [projBundle pathForResource:@"PC" ofType:@"project"];
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
projectName = [path lastPathComponent];
if ([[projectName pathExtension] isEqualToString:@"subproj"])
{
NSString *_file = nil;
NSString *_2file = nil;
NSString *_resourcePath = nil;
// NSString *_lresourcePath = nil;
NSString *projectName = nil;
NSMutableDictionary *projectDict = nil;
NSDictionary *infoDict = nil;
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
NSString *mainNibFile = nil;
PCFileCreator *fc = [PCFileCreator sharedCreator];
project = [[[PCAppProject alloc] init] autorelease];
_file = [projBundle 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];
// Copy the project files to the provided path
_file = [projBundle pathForResource:@"main" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:@"main.m"];
[fm copyPath:_file toPath:_2file handler:nil];
[fc replaceTagsInFileAtPath:_2file withProject:project];
_file = [projBundle pathForResource:@"AppController" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:@"AppController.m"];
[fm copyPath:_file toPath:_2file handler:nil];
[fc replaceTagsInFileAtPath:_2file withProject:project];
_file = [projBundle pathForResource:@"AppController" ofType:@"h"];
_2file = [path stringByAppendingPathComponent:@"AppController.h"];
[fm copyPath:_file toPath:_2file handler:nil];
[fc replaceTagsInFileAtPath:_2file withProject:project];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
/* _lresourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];*/
_resourcePath = [path stringByAppendingPathComponent:@"Resources"];
[fm createDirectoryAtPath:_resourcePath attributes:nil];
// Main NIB
mainNibFile = [_resourcePath stringByAppendingPathComponent:
[NSString stringWithFormat:@"%@.gorm", projectName]];
_file = [projBundle pathForResource:@"Main" ofType:@"gorm"];
[fm copyPath:_file toPath:mainNibFile handler:nil];
[projectDict setObject:[mainNibFile lastPathComponent]
forKey:PCMainInterfaceFile];
[projectDict
setObject:[NSArray arrayWithObject:[mainNibFile lastPathComponent]]
forKey:PCInterfaces];
// Create the Info-gnutstep.plist
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"Generated by ProjectCenter, do not edit", @"!",
@"No description avaliable!", @"ApplicationDescription",
projectName, @"ApplicationName",
@"0.1", @"ApplicationRelease",
[NSArray array], @"Authors",
@"Copyright (C) 200x by ...", @"Copyright",
@"Released under...", @"CopyrightDescription",
@"0.1", @"FullVersionID",
projectName, @"NSExecutable",
[mainNibFile lastPathComponent], @"NSMainNibFile",
[projectDict objectForKey:PCPrincipalClass], @"NSPrincipalClass",
@"Application", @"NSRole",
nil];
_2file = [_resourcePath
stringByAppendingPathComponent:@"Info-gnustep.plist"];
[infoDict writeToFile:_2file atomically:YES];
// Add Info-gnustep.plist into OTHER_RESOURCES
[projectDict
setObject:[NSArray arrayWithObjects:@"Info-gnustep.plist",nil]
forKey:PCOtherResources];
// Set the new dictionary - this causes the GNUmakefile to be written
// to disc
if(![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK", nil, nil, path);
return nil;
}
[project assignInfoDict:(NSMutableDictionary *)infoDict];
// Save the project to disc
[project save];
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];
// Copy the project files to the provided path
_file = [projBundle pathForResource:@"main" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:@"main.m"];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:project];
_file = [projBundle pathForResource:@"AppController" ofType:@"m"];
_2file = [path stringByAppendingPathComponent:@"AppController.m"];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:project];
_file = [projBundle pathForResource:@"AppController" ofType:@"h"];
_2file = [path stringByAppendingPathComponent:@"AppController.h"];
[pcfm copyFile:_file toFile:_2file];
[pcfc replaceTagsInFileAtPath:_2file withProject:project];
// GNUmakefile.postamble
[[PCMakefileFactory sharedFactory] createPostambleForProject:project];
// Resources
_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];
[projectDict setObject:[mainNibFile lastPathComponent]
forKey:PCMainInterfaceFile];
[projectDict
setObject:[NSArray arrayWithObject:[mainNibFile lastPathComponent]]
forKey:PCInterfaces];
// Create the Info-gnutstep.plist
infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"Generated by ProjectCenter, do not edit", @"!",
@"No description avaliable!", @"ApplicationDescription",
projectName, @"ApplicationName",
@"0.1", @"ApplicationRelease",
[NSArray array], @"Authors",
@"Copyright (C) 200x by ...", @"Copyright",
@"Released under...", @"CopyrightDescription",
@"0.1", @"FullVersionID",
projectName, @"NSExecutable",
[mainNibFile lastPathComponent], @"NSMainNibFile",
[projectDict objectForKey:PCPrincipalClass], @"NSPrincipalClass",
@"Application", @"NSRole",
nil];
_2file = [_resourcePath stringByAppendingPathComponent:@"Info-gnustep.plist"];
[infoDict writeToFile:_2file atomically:YES];
// Add Info-gnustep.plist into OTHER_RESOURCES
[projectDict setObject:[NSArray arrayWithObjects:@"Info-gnustep.plist",nil]
forKey:PCOtherResources];
// Set the new dictionary - this causes the GNUmakefile to be written
// to disc
if (![project assignProjectDict:projectDict])
{
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK", nil, nil, path);
return nil;
}
[project assignInfoDict:(NSMutableDictionary *)infoDict];
// Save the project to disc
[project save];
return project;
}

View file

@ -384,12 +384,12 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification";
NSMutableDictionary *entry = [NSMutableDictionary dictionaryWithCapacity:6];
int selectedRow = [docTypesList selectedRow];
[entry setObject:@"" forKey:@"NSName"];
[entry setObject:@"" forKey:@"NSHumanReadableName"];
[entry setObject:[NSArray array] forKey:@"NSUnixExtensions"];
[entry setObject:@"" forKey:@"NSIcon"];
[entry setObject:@"Editor" forKey:@"NSRole"];
[entry setObject:@"NSDocument" forKey:@"NSDocumentClass"];
[entry setObject:[docTypeField stringValue] forKey:@"NSName"];
[entry setObject:[docNameField stringValue] forKey:@"NSHumanReadableName"];
[entry setObject:[[docExtensionsField stringValue] componentsSeparatedByString:@","] forKey:@"NSUnixExtensions"];
[entry setObject:[docIconField stringValue] forKey:@"NSIcon"];
[entry setObject:[docRoleField stringValue] forKey:@"NSRole"];
[entry setObject:[docClassField stringValue] forKey:@"NSDocumentClass"];
if (selectedRow >= 0 && [docTypesItems count] > 0)
{
@ -433,6 +433,60 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification";
notify:YES];
}
- (void)docFieldSet:(id)sender
{
NSMutableDictionary *object = nil;
NSLog(@"docFieldSet");
if (sender != docTypeField && sender != docNameField
&& sender != docIconField && sender != docExtensionsField
&& sender != docRoleField && sender != docClassField)
{
return;
}
if ([docTypesItems count] <= 0)
{
[self addDocType:addDocTypeButton];
}
object = [[docTypesItems objectAtIndex:[docTypesList selectedRow]]
mutableCopy];
if (sender == docTypeField)
{
[object setObject:[sender stringValue] forKey:@"NSName"];
}
else if (sender == docNameField)
{
[object setObject:[sender stringValue] forKey:@"NSHumanReadableName"];
}
else if (sender == docIconField)
{
[object setObject:[sender stringValue] forKey:@"NSIcon"];
}
else if (sender == docExtensionsField)
{
[object
setObject:[[sender stringValue] componentsSeparatedByString:@","]
forKey:@"NSUnixExtensions"];
}
else if (sender == docRoleField)
{
[object setObject:[sender stringValue] forKey:@"NSRole"];
}
else if (sender == docClassField)
{
[object setObject:[sender stringValue] forKey:@"NSDocumentClass"];
}
[docTypesItems replaceObjectAtIndex:[docTypesList selectedRow]
withObject:object];
[docTypesList reloadData];
[object release];
}
// ----------------------------------------------------------------------------
// --- Document Types browser
// ----------------------------------------------------------------------------
@ -536,55 +590,6 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification";
[docClassField setStringValue:[type objectForKey:@"NSDocumentClass"]];
}
- (void)docFieldSet:(id)sender
{
NSMutableDictionary *object = nil;
NSLog(@"docFieldSet");
if (sender != docTypeField && sender != docNameField
&& sender != docIconField && sender != docExtensionsField
&& sender != docRoleField && sender != docClassField)
{
return;
}
object = [[docTypesItems objectAtIndex:[docTypesList selectedRow]]
mutableCopy];
if (sender == docTypeField)
{
[object setObject:[sender stringValue] forKey:@"NSName"];
}
else if (sender == docNameField)
{
[object setObject:[sender stringValue] forKey:@"NSHumanReadableName"];
}
else if (sender == docIconField)
{
[object setObject:[sender stringValue] forKey:@"NSIcon"];
}
else if (sender == docExtensionsField)
{
[object
setObject:[[sender stringValue] componentsSeparatedByString:@","]
forKey:@"NSUnixExtensions"];
}
else if (sender == docRoleField)
{
[object setObject:[sender stringValue] forKey:@"NSRole"];
}
else if (sender == docClassField)
{
[object setObject:[sender stringValue] forKey:@"NSDocumentClass"];
}
[docTypesItems replaceObjectAtIndex:[docTypesList selectedRow]
withObject:object];
[docTypesList reloadData];
[object release];
}
// ----------------------------------------------------------------------------
// --- Notifications
// ----------------------------------------------------------------------------
@ -665,20 +670,27 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification";
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
id anObject = [aNotification object];
if (anObject != appImageField
&& anObject != helpFileField
&& anObject != mainNIBField)
NSControl *anObject = [aNotification object];
id target = [anObject target];
SEL action = [anObject action];
if (anObject == appImageField
|| anObject == helpFileField
|| anObject == mainNIBField)
{
activeTextField = nil;
[self setIconViewImage:nil];
[setFieldButton setEnabled:NO];
[clearFieldButton setEnabled:NO];
return;
}
activeTextField = nil;
[self setIconViewImage:nil];
[setFieldButton setEnabled:NO];
[clearFieldButton setEnabled:NO];
if ([target respondsToSelector:action])
{
[target performSelector:action withObject:anObject];
}
}
@end

View file

@ -425,12 +425,6 @@
}
// Resources
// TODO: proper support for localization
/* [mf appendString:
[NSString stringWithFormat:@"%@_LANGUAGES = English\n", projectName]];
[mf appendString:
[NSString stringWithFormat:@"%@_LOCALIZED_RESOURCE_FILES = ", projectName]];
*/
[mf appendResources];
for (i = 0; i < [[self resourceFileKeys] count]; i++)
{
@ -454,6 +448,16 @@
[resources release];
}
// Localization
// TODO: proper support for localization
/* [mf appendLocalization];
[mf appendString:
[NSString stringWithFormat:@"%@_LANGUAGES = %@\n",
projectName, [[projectDict objectForKey:PCUserLanguages] componentsJoinedByString:@" "]]];
[mf appendString:
[NSString stringWithFormat:@"%@_LOCALIZED_RESOURCE_FILES = ", projectName]];
*/
[mf appendHeaders:[projectDict objectForKey:PCHeaders]];
[mf appendClasses:[projectDict objectForKey:PCClasses]];
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]];

View file

@ -2,7 +2,6 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"unhide:",
"setAppClass:",
"setFile:",
"clearFile:",

View file

@ -2,39 +2,22 @@
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"alignLeft:",
"capitalizeWord:",
"complete:",
"cut:",
"deleteToBeginningOfLine:",
"deleteToMark:",
"deselectAll:",
"indent:",
"makeKeyAndOrderFront:",
"moveBackwardAndModifySelection:",
"moveForwardAndModifySelection:",
"moveToBeginningOfLine:",
"moveToEndOfParagraph:",
"moveWordBackwardAndModifySelection:",
"ok:",
"orderFront:",
"orderFrontStandardAboutPanel:",
"pageUp:",
"pasteFont:",
"performZoom:",
"runPageLayout:",
"saveDocumentAs:",
"scrollPageDown:",
"selectLine:",
"selectText:",
"showGuessPanel:",
"subscript:",
"takeFloatValueFrom:",
"terminate:",
"toggleRuler:",
"transposeWords:",
"unhide:",
"useAllLigatures:",
"zoom:",
"setBuildTool:"
);