mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-21 19:01:18 +00:00
bugfixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_4@18954 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c075cc2665
commit
926cb09f05
26 changed files with 520 additions and 403 deletions
|
@ -119,6 +119,7 @@ ProjectCenter_RESOURCE_FILES = \
|
|||
Resources/class.template \
|
||||
Resources/gsmarkup.template \
|
||||
Resources/header.template \
|
||||
Resources/postamble.template \
|
||||
Resources/protocol.template
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(activeProjectDidChange:)
|
||||
name:ActiveProjectDidChangeNotification
|
||||
name:PCActiveProjectDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
if (![self setFrameUsingName: @"ProjectBuilder"])
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(activeProjectDidChange:)
|
||||
name:ActiveProjectDidChangeNotification
|
||||
name:PCActiveProjectDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
if (![self setFrameUsingName: @"LoadedFiles"])
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(activeProjectDidChange:)
|
||||
name:ActiveProjectDidChangeNotification
|
||||
name:PCActiveProjectDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
if (![self setFrameUsingName: @"ProjectLauncher"])
|
||||
|
|
|
@ -36,27 +36,14 @@
|
|||
- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target;
|
||||
- (void)appendResources;
|
||||
- (void)appendResourceItems:(NSArray *)array;
|
||||
|
||||
- (void)appendSubprojects:(NSArray*)array;
|
||||
|
||||
- (NSData *)encodedMakefile;
|
||||
|
||||
- (void)appendTailForLibrary;
|
||||
- (void)appendTailForTool;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCMakefileFactory (LibraryProject)
|
||||
|
||||
- (void)appendLibrary;
|
||||
- (void)appendLibraryInstallDir:(NSString*)dir;
|
||||
- (void)appendLibraryLibraries:(NSArray*)array;
|
||||
- (void)appendLibraryHeaders:(NSArray*)array;
|
||||
- (void)appendLibraryClasses:(NSArray *)array;
|
||||
- (void)appendLibraryOtherSources:(NSArray *)array;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCMakefileFactory (ToolProject)
|
||||
|
||||
- (void)appendTool;
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* Project ProjectCenter
|
||||
*
|
||||
* Created with ProjectCenter - http://www.gnustep.org
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "PCDefines.h"
|
||||
|
@ -281,22 +279,6 @@ static PCMakefileFactory *_factory = nil;
|
|||
}
|
||||
|
||||
// Should be removed
|
||||
- (void)appendTailForLibrary
|
||||
{
|
||||
NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme];
|
||||
NSString *hinst;
|
||||
|
||||
[self appendString:@"\n\n"];
|
||||
|
||||
hinst = [NSString stringWithFormat:@"HEADERS_INSTALL = $(%@_HEADER_FILES)\n\n",libnme];
|
||||
[self appendString:hinst];
|
||||
|
||||
[self appendString:@"-include GNUmakefile.preamble\n"];
|
||||
[self appendString:@"-include GNUmakefile.local\n"];
|
||||
[self appendString:@"include $(GNUSTEP_MAKEFILES)/library.make\n"];
|
||||
[self appendString:@"-include GNUmakefile.postamble\n"];
|
||||
}
|
||||
|
||||
- (void)appendTailForTool
|
||||
{
|
||||
[self appendString:@"\n\n"];
|
||||
|
@ -310,77 +292,6 @@ static PCMakefileFactory *_factory = nil;
|
|||
|
||||
@end
|
||||
|
||||
@implementation PCMakefileFactory (LibraryProject)
|
||||
|
||||
- (void)appendLibrary
|
||||
{
|
||||
NSString *libnme;
|
||||
|
||||
[self appendString:COMMENT_LIBRARY];
|
||||
|
||||
[self appendString:[NSString stringWithFormat:@"PACKAGE_NAME=%@\n",pnme]];
|
||||
[self appendString:[NSString stringWithFormat:@"LIBRARY_VAR=%@\n",[pnme uppercaseString]]];
|
||||
|
||||
libnme = [NSString stringWithFormat:@"lib%@",pnme];
|
||||
[self appendString:[NSString stringWithFormat:@"LIBRARY_NAME=%@\n",libnme]];
|
||||
|
||||
[self appendString:[NSString stringWithFormat:@"%@_HEADER_FILES_DIR=.\n",libnme]];
|
||||
[self appendString:[NSString stringWithFormat:@"%@_HEADER_FILES_INSTALL_DIR=/%@\n",libnme,pnme]];
|
||||
|
||||
[self appendString:@"ADDITIONAL_INCLUDE_DIRS = -I..\n"];
|
||||
[self appendString:@"srcdir = .\n"];
|
||||
}
|
||||
|
||||
- (void)appendLibraryInstallDir:(NSString*)dir
|
||||
{
|
||||
[self appendString:[NSString stringWithFormat:@"%@_INSTALLATION_DIR=$(GNUSTEP_INSTALLATION_DIR)\n",[pnme uppercaseString]]];
|
||||
[self appendString:[NSString stringWithFormat:@"%@_INSTALL_PREFIX=$(GNUSTEP_INSTALLATION_DIR)\n",[pnme uppercaseString]]];
|
||||
}
|
||||
|
||||
- (void)appendLibraryLibraries:(NSArray*)array
|
||||
{
|
||||
NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme];
|
||||
|
||||
[self appendString:COMMENT_LIBRARIES];
|
||||
|
||||
[self appendString:
|
||||
[NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",libnme]];
|
||||
|
||||
if( array && [array count] )
|
||||
{
|
||||
NSString *tmp;
|
||||
NSEnumerator *enumerator = [array objectEnumerator];
|
||||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
if (![tmp isEqualToString:@"gnustep-base"])
|
||||
{
|
||||
[self appendString:[NSString stringWithFormat:@"-l%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appendLibraryHeaders:(NSArray*)array
|
||||
{
|
||||
NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme];
|
||||
[self appendHeaders: array forTarget: libnme];
|
||||
}
|
||||
|
||||
- (void)appendLibraryClasses:(NSArray *)array
|
||||
{
|
||||
NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme];
|
||||
[self appendClasses: array forTarget: libnme];
|
||||
}
|
||||
|
||||
- (void)appendLibraryOtherSources:(NSArray *)array
|
||||
{
|
||||
NSString *libnme = [NSString stringWithFormat:@"lib%@",pnme];
|
||||
[self appendOtherSources: array forTarget: libnme];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCMakefileFactory (ToolProject)
|
||||
|
||||
- (void)appendTool
|
||||
|
|
|
@ -115,6 +115,8 @@ extern NSString *PCProjectDictDidSaveNotification;
|
|||
// ==== To be overriden!
|
||||
// ===========================================================================
|
||||
|
||||
- (BOOL)isEditableCategory:(NSString *)category;
|
||||
|
||||
// TEMP! For compatibility with old PC*Project subclasses
|
||||
- (void)updateValuesFromProjectDict;
|
||||
|
||||
|
|
|
@ -311,6 +311,14 @@ NSString
|
|||
|
||||
- (void)setProjectDictObject:(id)object forKey:(NSString *)key
|
||||
{
|
||||
id currentObject = [projectDict objectForKey:key];
|
||||
|
||||
if ([object isKindOfClass:[NSString class]]
|
||||
&& [currentObject isEqualToString:object])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
[projectDict setObject:object forKey:key];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
@ -349,6 +357,25 @@ NSString
|
|||
// ==== To be overriden
|
||||
// ============================================================================
|
||||
|
||||
- (BOOL)isEditableCategory:(NSString *)category
|
||||
{
|
||||
NSString *key = [self keyForCategory:category];
|
||||
|
||||
if ([key isEqualToString:PCClasses]
|
||||
|| [key isEqualToString:PCHeaders]
|
||||
|| [key isEqualToString:PCSupportingFiles]
|
||||
|| [key isEqualToString:PCDocuFiles]
|
||||
|| [key isEqualToString:PCOtherSources]
|
||||
|| [key isEqualToString:PCOtherResources]
|
||||
|| [key isEqualToString:PCNonProject]
|
||||
|| [key isEqualToString:PCGSMarkupFiles])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
// TEMP! For compatibility with old PC*Project subclasses
|
||||
- (void)updateValuesFromProjectDict
|
||||
{
|
||||
|
@ -585,6 +612,7 @@ NSString
|
|||
[self addFiles:[NSArray arrayWithObjects:toFile,nil]
|
||||
forKey:selectedCategoryKey];
|
||||
|
||||
NSLog(@"PCproject: move %@ to %@", fromPath, toPath);
|
||||
[fm movePath:fromPath toPath:toPath handler:nil];
|
||||
|
||||
[projectBrowser setPathForFile:toFile category:selectedCategory];
|
||||
|
|
|
@ -45,11 +45,10 @@ extern NSString *PCBrowserDidSetPathNotification;
|
|||
- (void)dealloc;
|
||||
|
||||
// ============================================================================
|
||||
// ==== Accessor methods
|
||||
// ==== Accessory methods
|
||||
// ============================================================================
|
||||
- (NSView *)view;
|
||||
|
||||
- (BOOL)isEditableCategory:(NSString *)category file: (NSString *)title;
|
||||
- (NSString *)nameOfSelectedFile;
|
||||
- (NSString *)pathOfSelectedFile;
|
||||
- (NSArray *)selectedFiles;
|
||||
|
|
|
@ -78,7 +78,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
}
|
||||
|
||||
// ============================================================================
|
||||
// ==== Accessor methods
|
||||
// ==== Accessory methods
|
||||
// ============================================================================
|
||||
|
||||
- (NSView *)view
|
||||
|
@ -86,31 +86,6 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
return browser;
|
||||
}
|
||||
|
||||
// This is responsibility of PC*Project classes
|
||||
- (BOOL)isEditableCategory:(NSString *)category file:(NSString *)title
|
||||
{
|
||||
NSString *key = [project keyForCategory:category];
|
||||
|
||||
if ([key isEqualToString:PCClasses]
|
||||
|| [key isEqualToString:PCHeaders]
|
||||
|| [key isEqualToString:PCSupportingFiles]
|
||||
|| [key isEqualToString:PCDocuFiles]
|
||||
|| [key isEqualToString:PCOtherSources]
|
||||
|| [key isEqualToString:PCOtherResources]
|
||||
|| [key isEqualToString:PCNonProject])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([key isEqualToString:PCGSMarkupFiles]
|
||||
&& [[title pathExtension] isEqual: @"gorm"] == NO)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *)nameOfSelectedFile
|
||||
{
|
||||
NSString *name = nil;
|
||||
|
@ -183,13 +158,18 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)click:(id)sender
|
||||
{
|
||||
if (sender != browser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ([[sender selectedCell] isLeaf] && [[self selectedFiles] count] == 1)
|
||||
{
|
||||
NSString *category = [[sender selectedCellInColumn:0] stringValue];
|
||||
NSString *fn = [[sender selectedCell] stringValue];
|
||||
NSString *fp = [[project projectPath] stringByAppendingPathComponent:fn];
|
||||
|
||||
if ([self isEditableCategory:category file:fn])
|
||||
if ([project isEditableCategory:category])
|
||||
{
|
||||
[[project projectEditor] editorForFile:fp
|
||||
category:category
|
||||
|
@ -204,13 +184,18 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)doubleClick:(id)sender
|
||||
{
|
||||
if (sender != browser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ([[sender selectedCell] isLeaf])
|
||||
{
|
||||
NSString *category = [[sender selectedCellInColumn:0] stringValue];
|
||||
NSString *fn = [[sender selectedCell] stringValue];
|
||||
NSString *fp = [[project projectPath] stringByAppendingPathComponent:fn];
|
||||
|
||||
if ([self isEditableCategory:category file: fn])
|
||||
if ([project isEditableCategory:category])
|
||||
{
|
||||
[[project projectEditor] editorForFile:fp
|
||||
category:category
|
||||
|
@ -235,21 +220,17 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)projectDictDidChange:(NSNotification *)aNotif
|
||||
{
|
||||
if (browser)
|
||||
if (browser && ([aNotif object] == project))
|
||||
{
|
||||
NSString *browserPath = [browser path];
|
||||
NSString *path = nil;
|
||||
NSString *slctdCategory = [project selectedRootCategory];
|
||||
|
||||
if (slctdCategory && browserPath && ![browserPath isEqualToString:@"/"])
|
||||
{
|
||||
path = [[browserPath componentsSeparatedByString:@"/"]
|
||||
objectAtIndex:1];
|
||||
|
||||
if ([[[project projectEditor] allEditors] count] == 0
|
||||
&& [self isEditableCategory:slctdCategory file:nil])
|
||||
&& [project isEditableCategory:slctdCategory])
|
||||
{
|
||||
[self setPathForFile:nil category:path];
|
||||
[self setPathForFile:nil category:slctdCategory];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,16 +244,20 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
|
|||
|
||||
- (void)browser:(NSBrowser *)sender createRowsForColumn:(int)column inMatrix:(NSMatrix *)matrix
|
||||
{
|
||||
NSString *pathToCol = [sender pathToColumn:column];
|
||||
NSArray *files = [project contentAtCategoryPath:pathToCol];
|
||||
int i;
|
||||
int count = [files count];
|
||||
NSString *pathToCol = nil;
|
||||
NSArray *files = nil;
|
||||
int i = 0;
|
||||
int count = 0;
|
||||
|
||||
if (sender != browser)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pathToCol = [sender pathToColumn:column];
|
||||
files = [project contentAtCategoryPath:pathToCol];
|
||||
count = [files count];
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
NSMutableString *categoryPath = nil;
|
||||
|
|
|
@ -192,6 +192,11 @@
|
|||
|
||||
- (int)numberOfRowsInTableView: (NSTableView *)aTableView
|
||||
{
|
||||
if (aTableView != filesList)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return [editedFiles count];
|
||||
}
|
||||
|
||||
|
@ -199,6 +204,11 @@
|
|||
objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||
row: (int)rowIndex
|
||||
{
|
||||
if (aTableView != filesList)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [editedFiles objectAtIndex: rowIndex];
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
[self setEditableField:YES];
|
||||
// [super mouseDown:theEvent];
|
||||
[super mouseDown:theEvent];
|
||||
}
|
||||
|
||||
- (BOOL)textShouldSetEditable
|
||||
|
@ -109,7 +109,7 @@
|
|||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(activeProjectDidChange:)
|
||||
name:ActiveProjectDidChangeNotification
|
||||
name:PCActiveProjectDidChangeNotification
|
||||
object:nil];
|
||||
|
||||
[self inspectorPopupDidChange:inspectorPopup];
|
||||
|
@ -226,7 +226,8 @@
|
|||
NSString *newEntry = [sender stringValue];
|
||||
|
||||
// Build Atributes
|
||||
if (sender == installPathField)
|
||||
if (sender == installPathField
|
||||
&& ![[[project projectDict] objectForKey:PCInstallDir] isEqualToString:newEntry])
|
||||
{
|
||||
[project setProjectDictObject:newEntry forKey:PCInstallDir];
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <ProjectCenter/ProjectDelegate.h>
|
||||
#endif
|
||||
|
||||
extern NSString *ActiveProjectDidChangeNotification;
|
||||
extern NSString *PCActiveProjectDidChangeNotification;
|
||||
|
||||
@interface PCProjectManager : NSObject <ProjectBuilder>
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#define SavePeriodDCN @"SavePeriodDidChangeNotification"
|
||||
|
||||
NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
||||
NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||
|
||||
@implementation PCProjectManager
|
||||
|
||||
|
@ -308,7 +308,7 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
[activeProject projectName]);
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:ActiveProjectDidChangeNotification
|
||||
postNotificationName:PCActiveProjectDidChangeNotification
|
||||
object:activeProject];
|
||||
}
|
||||
}
|
||||
|
@ -355,22 +355,42 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
|
||||
- (PCProject *)loadProjectAt:(NSString *)aPath
|
||||
{
|
||||
NSDictionary *projectFile = nil;
|
||||
NSString *projectTypeName = nil;
|
||||
NSString *projectClassName = nil;
|
||||
id<ProjectType> projectCreator;
|
||||
PCProject *project = nil;
|
||||
NSMutableDictionary *projectFile = nil;
|
||||
NSString *projectTypeName = nil;
|
||||
NSString *projectClassName = nil;
|
||||
id<ProjectType> projectCreator;
|
||||
PCProject *project = nil;
|
||||
|
||||
projectFile = [NSDictionary dictionaryWithContentsOfFile:aPath];
|
||||
projectFile = [NSMutableDictionary dictionaryWithContentsOfFile:aPath];
|
||||
|
||||
// For compatibility with 0.3.x projects
|
||||
projectClassName = [projectFile objectForKey:PCProjectBuilderClass];
|
||||
|
||||
if (projectClassName == nil)
|
||||
{
|
||||
projectTypeName = [projectFile objectForKey:PCProjectType];
|
||||
projectClassName = [[delegate projectTypes]objectForKey:projectTypeName];
|
||||
}
|
||||
|
||||
projectCreator = [NSClassFromString(projectClassName) sharedCreator];
|
||||
|
||||
if (projectTypeName == nil)
|
||||
{
|
||||
NSString *pPath = nil;
|
||||
|
||||
pPath = [[aPath stringByDeletingLastPathComponent]
|
||||
stringByAppendingPathComponent:@"PC.project"];
|
||||
|
||||
[[NSFileManager defaultManager] removeFileAtPath:aPath handler:nil];
|
||||
|
||||
[projectFile removeObjectForKey:PCProjectBuilderClass];
|
||||
projectTypeName = [projectCreator projectTypeName];
|
||||
[projectFile setObject:projectTypeName forKey:PCProjectType];
|
||||
[projectFile writeToFile:pPath atomically:YES];
|
||||
|
||||
aPath = pPath;
|
||||
}
|
||||
|
||||
if ((project = [projectCreator openProjectAt:aPath]))
|
||||
{
|
||||
NSLog (@"Project loaded as %@", [projectCreator projectTypeName]);
|
||||
|
|
|
@ -255,7 +255,7 @@
|
|||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(activeProjectDidChange:)
|
||||
name:ActiveProjectDidChangeNotification
|
||||
name:PCActiveProjectDidChangeNotification
|
||||
object:project];
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@ Resources/AppController.h \
|
|||
Resources/AppController.m \
|
||||
Resources/main.m \
|
||||
Resources/PC.project \
|
||||
Resources/GNUmakefile.preamble \
|
||||
Resources/GNUmakefile.postamble \
|
||||
Resources/Main.gorm \
|
||||
Resources/Inspector.gorm
|
||||
|
||||
|
|
|
@ -51,30 +51,6 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification";
|
|||
|
||||
- (void)createProjectAttributes
|
||||
{
|
||||
/* if (projectAttributesView)
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Icons, Main NIB file, Help file
|
||||
/* _iconsBox = [[NSBox alloc] init];
|
||||
[_iconsBox setFrame:NSMakeRect(6,6,290,259)];
|
||||
[_iconsBox setContentViewMargins:NSMakeSize(4.0, 4.0)];
|
||||
[_iconsBox setTitlePosition:NSNoTitle];
|
||||
[projectAttributesView addSubview:_iconsBox];*/
|
||||
|
||||
// Icon view
|
||||
/* _iconViewBox = [[NSBox alloc] initWithFrame:NSMakeRect(220,189,56,56)];
|
||||
[_iconViewBox setTitlePosition:NSNoTitle];
|
||||
[_iconViewBox setBorderType:NSBezelBorder];
|
||||
[_iconViewBox setContentViewMargins:NSMakeSize(2.0, 2.0)];
|
||||
[_iconsBox addSubview:_iconViewBox];
|
||||
RELEASE(_iconViewBox);
|
||||
|
||||
iconView = [[NSImageView alloc] initWithFrame:NSMakeRect(220,0,56,56)];
|
||||
[_iconViewBox addSubview:iconView];
|
||||
RELEASE(iconView);*/
|
||||
|
||||
// TFs Buttons
|
||||
[setFieldButton setRefusesFirstResponder:YES];
|
||||
[clearFieldButton setRefusesFirstResponder:YES];
|
||||
|
|
|
@ -316,6 +316,10 @@
|
|||
success = YES;
|
||||
}
|
||||
}
|
||||
else if ([super renameFile:ff toFile:tf] == YES)
|
||||
{
|
||||
success = YES;
|
||||
}
|
||||
|
||||
[projectBrowser setPathForFile:toFile
|
||||
category:[self categoryForKey:key]];
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#include <Foundation/NSString.h>
|
||||
#include <ProjectCenter/PCFileCreator.h>
|
||||
|
||||
#include "PCBundleProj.h"
|
||||
|
@ -70,10 +69,10 @@ static PCBundleProj *_creator = nil;
|
|||
if ([fm createDirectoryAtPath:path attributes:nil])
|
||||
{
|
||||
NSBundle *projectBundle;
|
||||
NSMutableDictionary *projectDict;
|
||||
NSString *_file;
|
||||
NSString *_2file;
|
||||
// NSString *_resourcePath;
|
||||
NSMutableDictionary *projectDict;
|
||||
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
|
||||
|
||||
project = [[[PCBundleProject alloc] init] autorelease];
|
||||
|
@ -90,14 +89,6 @@ static PCBundleProj *_creator = nil;
|
|||
[projectDict setObject:[path lastPathComponent] forKey:PCPrincipalClass];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
_file = [projectBundle pathForResource:@"GNUmakefile"
|
||||
ofType:@"postamble"];
|
||||
_2file = [path stringByAppendingPathComponent:@"GNUmakefile.postamble"];
|
||||
[fm copyPath:_file toPath:_2file handler:nil];
|
||||
|
||||
_file = [projectBundle pathForResource:@"GNUmakefile" ofType:@"preamble"];
|
||||
_2file = [path stringByAppendingPathComponent:@"GNUmakefile.preamble"];
|
||||
[fm copyPath:_file toPath:_2file handler:nil];
|
||||
|
||||
// $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@", [path lastPathComponent]];
|
||||
|
@ -140,15 +131,18 @@ static PCBundleProj *_creator = nil;
|
|||
writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
|
||||
atomically:YES];
|
||||
}
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
- (PCProject *)openProjectAt:(NSString *)path
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
NSString *pPath = [path stringByDeletingLastPathComponent];
|
||||
|
||||
return [[[PCBundleProject alloc] initWithProjectDictionary:dict
|
||||
path:[path stringByDeletingLastPathComponent]] autorelease];
|
||||
return [[[PCBundleProject alloc]
|
||||
initWithProjectDictionary:dict
|
||||
path:pPath] autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,31 +40,33 @@
|
|||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
rootKeys = [[NSArray arrayWithObjects: PCClasses,
|
||||
PCHeaders,
|
||||
PCOtherSources,
|
||||
PCInterfaces,
|
||||
PCImages,
|
||||
PCOtherResources,
|
||||
PCSubprojects,
|
||||
PCDocuFiles,
|
||||
PCSupportingFiles,
|
||||
PCLibraries,
|
||||
PCNonProject,
|
||||
nil] retain];
|
||||
rootKeys = [[NSArray arrayWithObjects:
|
||||
PCClasses,
|
||||
PCHeaders,
|
||||
PCOtherSources,
|
||||
PCInterfaces,
|
||||
PCImages,
|
||||
PCOtherResources,
|
||||
PCSubprojects,
|
||||
PCDocuFiles,
|
||||
PCSupportingFiles,
|
||||
PCLibraries,
|
||||
PCNonProject,
|
||||
nil] retain];
|
||||
|
||||
rootCategories = [[NSArray arrayWithObjects: @"Classes",
|
||||
@"Headers",
|
||||
@"Other Sources",
|
||||
@"Interfaces",
|
||||
@"Images",
|
||||
@"Other Resources",
|
||||
@"Subprojects",
|
||||
@"Documentation",
|
||||
@"Supporting Files",
|
||||
@"Libraries",
|
||||
@"Non Project Files",
|
||||
nil] retain];
|
||||
rootCategories = [[NSArray arrayWithObjects:
|
||||
@"Classes",
|
||||
@"Headers",
|
||||
@"Other Sources",
|
||||
@"Interfaces",
|
||||
@"Images",
|
||||
@"Other Resources",
|
||||
@"Subprojects",
|
||||
@"Documentation",
|
||||
@"Supporting Files",
|
||||
@"Libraries",
|
||||
@"Non Project Files",
|
||||
nil] retain];
|
||||
|
||||
rootEntries = [[NSDictionary
|
||||
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
LANGUAGE = "English";
|
||||
LAST_EDITING = "";
|
||||
LIBRARIES = ("gnustep-base","gnustep-gui");
|
||||
MAININTERFACE = "";
|
||||
MAKEFILEDIR = "$(GNUSTEP_MAKEFILES)";
|
||||
INSTALLDIR = "$(HOME)/GNUstep/Library/Bundles";
|
||||
OBJC_COMPILEROPTIONS = "";
|
||||
|
|
|
@ -11,12 +11,6 @@
|
|||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
|
||||
#
|
||||
# Subprojects
|
||||
#
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bundle
|
||||
#
|
||||
|
@ -37,8 +31,9 @@ LibraryProject_LIBRARIES_DEPEND_UPON += -lProjectCenter
|
|||
#
|
||||
|
||||
LibraryProject_RESOURCE_FILES= \
|
||||
PC.proj \
|
||||
Version
|
||||
Resources/PC.project \
|
||||
Resources/Version \
|
||||
Resources/Inspector.gorm
|
||||
|
||||
#
|
||||
# Header files
|
||||
|
@ -64,3 +59,4 @@ LibraryProject_C_FILES=
|
|||
|
||||
include ../GNUmakefile.bundles
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
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.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef _PCLIBPROJ_H
|
||||
|
@ -41,9 +39,7 @@
|
|||
+ (id)sharedCreator;
|
||||
|
||||
- (Class)projectClass;
|
||||
|
||||
- (NSString *)projectTypeName;
|
||||
- (NSDictionary *)typeTable;
|
||||
|
||||
- (PCProject *)createProjectAt:(NSString *)path;
|
||||
- (PCProject *)openProjectAt:(NSString *)path;
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
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.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -31,12 +29,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#include <ProjectCenter/PCFileCreator.h>
|
||||
|
||||
#include "PCLibProj.h"
|
||||
#include "PCLibProject.h"
|
||||
|
||||
@implementation PCLibProj
|
||||
|
||||
static NSString *_projTypeName = @"Library";
|
||||
static PCLibProj *_creator = nil;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -45,97 +44,113 @@ static PCLibProj *_creator = nil;
|
|||
|
||||
+ (id)sharedCreator
|
||||
{
|
||||
if (!_creator) {
|
||||
_creator = [[[self class] alloc] init];
|
||||
if (!_creator)
|
||||
{
|
||||
_creator = [[[self class] alloc] init];
|
||||
}
|
||||
return _creator;
|
||||
|
||||
return _creator;
|
||||
}
|
||||
|
||||
- (Class)projectClass
|
||||
{
|
||||
return [PCLibProject class];
|
||||
return [PCLibProject class];
|
||||
}
|
||||
|
||||
- (NSString *)projectTypeName
|
||||
{
|
||||
return _projTypeName;
|
||||
}
|
||||
|
||||
- (NSDictionary *)typeTable
|
||||
{
|
||||
NSString *_path = [[NSBundle bundleForClass:[self class]] pathForResource:@"Info" ofType:@"table"];
|
||||
|
||||
return [NSDictionary dictionaryWithContentsOfFile:_path];
|
||||
return @"Library";
|
||||
}
|
||||
|
||||
- (PCProject *)createProjectAt:(NSString *)path
|
||||
{
|
||||
PCLibProject *project = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
PCLibProject *project = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
NSAssert(path,@"No valid project path provided!");
|
||||
NSAssert(path,@"No valid project path provided!");
|
||||
|
||||
if ([fm createDirectoryAtPath:path attributes:nil]) {
|
||||
NSString *_file;
|
||||
//NSString *_resourcePath;
|
||||
NSMutableDictionary *dict;
|
||||
NSString *projectFile;
|
||||
if ([fm createDirectoryAtPath:path attributes:nil])
|
||||
{
|
||||
NSBundle *projectBundle = nil;
|
||||
NSMutableDictionary *projectDict;
|
||||
NSString *_file = nil;
|
||||
NSString *_2file = nil;
|
||||
// NSString *_resourcePath;
|
||||
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
|
||||
|
||||
project = [[[PCLibProject alloc] init] autorelease];
|
||||
project = [[[PCLibProject alloc] init] autorelease];
|
||||
projectBundle = [NSBundle bundleForClass:[self class]];
|
||||
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC" ofType:@"proj"];
|
||||
dict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Customise the project
|
||||
[dict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
[dict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
|
||||
projectDict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
|
||||
|
||||
// Save the project to disc
|
||||
projectFile = [NSString stringWithString:[path lastPathComponent]];
|
||||
projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"];
|
||||
[dict writeToFile:[path stringByAppendingPathComponent:projectFile]
|
||||
atomically:YES];
|
||||
// Customise the project
|
||||
[project setProjectName:[path lastPathComponent]];
|
||||
[projectDict setObject:[path lastPathComponent] forKey:PCProjectName];
|
||||
[projectDict setObject:[self projectTypeName] forKey:PCProjectType];
|
||||
|
||||
// Copy the project files to the provided path
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"postamble"];
|
||||
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"] handler:nil];
|
||||
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"preamble"];
|
||||
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.preamble"] handler:nil];
|
||||
// Copy the project files to the provided path
|
||||
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"main" ofType:@"m"];
|
||||
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"main.m"] handler:nil];
|
||||
// $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@", [path lastPathComponent]];
|
||||
_2file = [NSString stringWithFormat:@"%@.m", [path lastPathComponent]];
|
||||
[pcfc createFileOfType:ObjCClass
|
||||
path:[path stringByAppendingPathComponent:_file]
|
||||
project:project];
|
||||
[projectDict setObject:[NSArray arrayWithObjects:_2file,nil]
|
||||
forKey:PCClasses];
|
||||
|
||||
// Resources
|
||||
/*
|
||||
_resourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
|
||||
[fm createDirectoryAtPath:_resourcePath attributes:nil];
|
||||
*/
|
||||
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
||||
_file = [NSString stringWithFormat:@"%@.h", [path lastPathComponent]];
|
||||
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
||||
forKey:PCHeaders];
|
||||
|
||||
[fm createDirectoryAtPath:[path stringByAppendingPathComponent:@"Documentation"] attributes:nil];
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"Version" ofType:@""];
|
||||
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"Version"] handler:nil];
|
||||
// Resources
|
||||
/*
|
||||
_resourcePath = [path stringByAppendingPathComponent:@"English.lproj"];
|
||||
[fm createDirectoryAtPath:_resourcePath attributes:nil];
|
||||
*/
|
||||
_file = [path stringByAppendingPathComponent:@"Images"];
|
||||
[fm createDirectoryAtPath:_file attributes:nil];
|
||||
_file = [path stringByAppendingPathComponent:@"Documentation"];
|
||||
[fm createDirectoryAtPath:_file attributes:nil];
|
||||
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
_file = [projectBundle pathForResource:@"Version" ofType:@""];
|
||||
_2file = [path stringByAppendingPathComponent:@"Version"];
|
||||
[fm copyPath:_file toPath:_2file handler:nil];
|
||||
|
||||
// The path cannot be in the PC.project file!
|
||||
[project setProjectPath:path];
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Save the project to disc
|
||||
[projectDict
|
||||
writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
|
||||
atomically:YES];
|
||||
|
||||
// Set the new dictionary - this causes the GNUmakefile to be written to disc
|
||||
if(![project assignProjectDict:dict]) {
|
||||
NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return project;
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
- (PCProject *)openProjectAt:(NSString *)path
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
|
||||
if ([[dict objectForKey:PCProjectBuilderClass] isEqualToString:@"PCLibProj"]) {
|
||||
return [[[PCLibProject alloc] initWithProjectDictionary:dict path:[path stringByDeletingLastPathComponent]] autorelease];
|
||||
}
|
||||
return nil;
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
NSString *pPath = [path stringByDeletingLastPathComponent];
|
||||
|
||||
return [[[PCLibProject alloc] initWithProjectDictionary:dict
|
||||
path:pPath] autorelease];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -20,16 +20,14 @@
|
|||
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.
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
Description:
|
||||
|
||||
This is the project type 'Application' for GNUstep. You never should create it yourself but
|
||||
use PCLibProj for doing this. Otherwise needed files don't get copied to the right place.
|
||||
Description:
|
||||
|
||||
This is the project type 'Library' for GNUstep. You never should create it
|
||||
yourself but use PCLibProj for doing this. Otherwise needed files don't get
|
||||
copied to the right place.
|
||||
*/
|
||||
|
||||
#ifndef _PCLIBPROJECT_H
|
||||
|
@ -38,8 +36,14 @@
|
|||
#include <AppKit/AppKit.h>
|
||||
#include <ProjectCenter/PCProject.h>
|
||||
|
||||
@class PCMakefileFactory;
|
||||
|
||||
@interface PCLibProject : PCProject
|
||||
{
|
||||
IBOutlet NSBox *projectAttributesView;
|
||||
IBOutlet NSTextField *projectTypeField;
|
||||
IBOutlet NSTextField *projectNameField;
|
||||
IBOutlet NSTextField *projectLanguageField;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -49,22 +53,23 @@
|
|||
- (id)init;
|
||||
- (void)dealloc;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Project
|
||||
//----------------------------------------------------------------------------
|
||||
@end
|
||||
|
||||
- (Class)builderClass;
|
||||
@interface PCLibProject (GeneratedFiles)
|
||||
|
||||
- (BOOL)writeMakefile;
|
||||
|
||||
- (NSArray *)sourceFileKeys;
|
||||
- (NSArray *)resourceFileKeys;
|
||||
- (NSArray *)otherKeys;
|
||||
- (NSArray *)buildTargets;
|
||||
- (NSString *)projectDescription;
|
||||
|
||||
- (void)updateValuesFromProjectDict;
|
||||
- (void)appendHead:(PCMakefileFactory *)mff;
|
||||
- (void)appendLibraries:(PCMakefileFactory*)mff;
|
||||
- (void)appendTail:(PCMakefileFactory *)mff;
|
||||
|
||||
@end
|
||||
|
||||
@interface PCLibProject (Inspector)
|
||||
|
||||
- (NSView *)projectAttributesView;
|
||||
- (void)updateInspectorValues:(NSNotification *)aNotif;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,33 +51,36 @@
|
|||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
rootKeys = [[NSArray arrayWithObjects: PCClasses,
|
||||
PCHeaders,
|
||||
PCOtherSources,
|
||||
PCOtherResources,
|
||||
PCSubprojects,
|
||||
PCDocuFiles,
|
||||
PCSupportingFiles,
|
||||
PCLibraries,
|
||||
PCNonProject,
|
||||
nil] retain];
|
||||
if ((self = [super init]))
|
||||
{
|
||||
rootKeys = [[NSArray arrayWithObjects:
|
||||
PCClasses,
|
||||
PCHeaders,
|
||||
PCOtherSources,
|
||||
PCOtherResources,
|
||||
PCSubprojects,
|
||||
PCDocuFiles,
|
||||
PCSupportingFiles,
|
||||
PCLibraries,
|
||||
PCNonProject,
|
||||
nil] retain];
|
||||
|
||||
rootCategories = [[NSArray arrayWithObjects: @"Classes",
|
||||
@"Headers",
|
||||
@"Other Sources",
|
||||
@"Other Resources",
|
||||
@"Subprojects",
|
||||
@"Documentation",
|
||||
@"Supporting Files",
|
||||
@"Libraries",
|
||||
@"Non Project Files",
|
||||
nil] retain];
|
||||
rootCategories = [[NSArray arrayWithObjects:
|
||||
@"Classes",
|
||||
@"Headers",
|
||||
@"Other Sources",
|
||||
@"Other Resources",
|
||||
@"Subprojects",
|
||||
@"Documentation",
|
||||
@"Supporting Files",
|
||||
@"Libraries",
|
||||
@"Non Project Files",
|
||||
nil] retain];
|
||||
|
||||
rootEntries = [[NSDictionary
|
||||
dictionaryWithObjects:rootCategories forKeys:rootKeys] retain];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -86,7 +89,7 @@
|
|||
[rootCategories release];
|
||||
[rootKeys release];
|
||||
[rootEntries release];
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -96,76 +99,261 @@
|
|||
|
||||
- (Class)builderClass
|
||||
{
|
||||
return [PCLibProj class];
|
||||
}
|
||||
|
||||
- (BOOL)writeMakefile
|
||||
{
|
||||
NSData *mfd;
|
||||
NSString *mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
|
||||
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
|
||||
NSDictionary *dict = [self projectDict];
|
||||
|
||||
// Save the project file
|
||||
[super writeMakefile];
|
||||
|
||||
[mf createMakefileForProject:[self projectName]];
|
||||
[mf appendString:@"include $(GNUSTEP_MAKEFILES)/common.make\n"];
|
||||
[mf appendString:@"include Version\n"];
|
||||
[mf appendSubprojects:[dict objectForKey:PCSubprojects]];
|
||||
|
||||
[mf appendLibrary];
|
||||
[mf appendLibraryInstallDir:[dict objectForKey:PCInstallDir]];
|
||||
[mf appendLibraryLibraries:[dict objectForKey:PCLibraries]];
|
||||
|
||||
[mf appendLibraryHeaders:[dict objectForKey:PCHeaders]];
|
||||
[mf appendLibraryClasses:[dict objectForKey:PCClasses]];
|
||||
[mf appendLibraryOtherSources:[dict objectForKey:PCOtherSources]];
|
||||
|
||||
[mf appendTailForLibrary];
|
||||
|
||||
// Write the new file to disc!
|
||||
if ((mfd = [mf encodedMakefile]))
|
||||
{
|
||||
if ([mfd writeToFile:mfl atomically:YES])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSArray *)sourceFileKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCClasses,PCOtherSources,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)resourceFileKeys
|
||||
{
|
||||
return [NSArray array];
|
||||
}
|
||||
|
||||
- (NSArray *)otherKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCDocuFiles,PCSupportingFiles,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)buildTargets
|
||||
{
|
||||
return nil;
|
||||
return [PCLibProj class];
|
||||
}
|
||||
|
||||
- (NSString *)projectDescription
|
||||
{
|
||||
return @"Project that handles GNUstep/ObjC based libraries.";
|
||||
return @"GNUstep Objective-C library project";
|
||||
}
|
||||
|
||||
- (void)updateValuesFromProjectDict
|
||||
- (BOOL)isExecutable
|
||||
{
|
||||
[super updateValuesFromProjectDict];
|
||||
return NO;
|
||||
}
|
||||
|
||||
//[appClassField setStringValue:[projectDict objectForKey:PCAppClass]];
|
||||
- (NSString *)execToolName
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *)fileTypesForCategory:(NSString *)category
|
||||
{
|
||||
if ([category isEqualToString:PCClasses])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"m",nil];
|
||||
}
|
||||
else if ([category isEqualToString:PCHeaders])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"h",nil];
|
||||
}
|
||||
else if ([category isEqualToString:PCOtherSources])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"c",@"C",nil];
|
||||
}
|
||||
else if ([category isEqualToString:PCInterfaces])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"gmodel",@"gorm",nil];
|
||||
}
|
||||
else if ([category isEqualToString:PCImages])
|
||||
{
|
||||
return [NSImage imageFileTypes];
|
||||
}
|
||||
else if ([category isEqualToString:PCSubprojects])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"subproj",nil];
|
||||
}
|
||||
else if ([category isEqualToString:PCLibraries])
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"so",@"a",@"lib",nil];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)dirForCategory:(NSString *)category
|
||||
{
|
||||
if ([category isEqualToString:PCImages])
|
||||
{
|
||||
return [projectPath stringByAppendingPathComponent:@"Images"];
|
||||
}
|
||||
else if ([category isEqualToString:PCDocuFiles])
|
||||
{
|
||||
return [projectPath stringByAppendingPathComponent:@"Documentation"];
|
||||
}
|
||||
|
||||
return projectPath;
|
||||
}
|
||||
|
||||
- (NSArray *)buildTargets
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"library", @"debug", @"profile", @"dist", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)sourceFileKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCClasses,PCOtherSources,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)resourceFileKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCInterfaces,PCOtherResources,PCImages,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)otherKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCDocuFiles,PCSupportingFiles,nil];
|
||||
}
|
||||
|
||||
- (NSArray *)allowableSubprojectTypes
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
@"Bundle", @"Tool", @"Palette", nil];
|
||||
}
|
||||
|
||||
- (NSArray *)defaultLocalizableKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:PCInterfaces, nil];
|
||||
}
|
||||
|
||||
- (NSArray *)localizableKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCLibProject (GeneratedFiles)
|
||||
|
||||
- (BOOL)writeMakefile
|
||||
{
|
||||
PCMakefileFactory *mf = [PCMakefileFactory sharedFactory];
|
||||
int i,j;
|
||||
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];
|
||||
|
||||
// Libraries
|
||||
[self appendLibraries:mf];
|
||||
|
||||
// Subprojects
|
||||
if ([[projectDict objectForKey:PCSubprojects] count] > 0)
|
||||
{
|
||||
[mf appendSubprojects:[projectDict objectForKey:PCSubprojects]];
|
||||
}
|
||||
|
||||
// Resources
|
||||
[mf appendResources];
|
||||
for (i = 0; i < [[self resourceFileKeys] count]; i++)
|
||||
{
|
||||
NSString *k = [[self resourceFileKeys] objectAtIndex:i];
|
||||
NSMutableArray *resources = [[projectDict objectForKey:k] mutableCopy];
|
||||
|
||||
if ([k isEqualToString:PCImages])
|
||||
{
|
||||
for (j=0; j<[resources count]; j++)
|
||||
{
|
||||
[resources replaceObjectAtIndex:j
|
||||
withObject:[NSString stringWithFormat:@"Images/%@",
|
||||
[resources objectAtIndex:j]]];
|
||||
}
|
||||
}
|
||||
|
||||
[mf appendResourceItems:resources];
|
||||
[resources release];
|
||||
}
|
||||
|
||||
[mf appendHeaders:[projectDict objectForKey:PCHeaders]
|
||||
forTarget:[NSString stringWithFormat:@"lib%@",projectName]];
|
||||
[mf appendClasses:[projectDict objectForKey:PCClasses]
|
||||
forTarget:[NSString stringWithFormat:@"lib%@",projectName]];
|
||||
[mf appendOtherSources:[projectDict objectForKey:PCOtherSources]
|
||||
forTarget:[NSString stringWithFormat:@"lib%@",projectName]];
|
||||
|
||||
// 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# Bundle\n#\n"];
|
||||
[mff appendString:[NSString stringWithFormat:@"PACKAGE_NAME = %@\n",
|
||||
projectName]];
|
||||
[mff appendString:[NSString stringWithFormat:@"LIBRARY_VAR = %@\n",
|
||||
[projectName uppercaseString]]];
|
||||
[mff appendString:[NSString stringWithFormat:@"LIBRARY_NAME = lib%@\n",
|
||||
projectName]];
|
||||
[mff appendString:[NSString stringWithFormat:@"lib%@_HEADER_FILES_DIR = %@\n",
|
||||
projectName,@"."]];
|
||||
[mff appendString:[NSString stringWithFormat:
|
||||
@"lib%@_HEADER_FILES_INSTALL_DIR = /%@\n", projectName, projectName]];
|
||||
}
|
||||
|
||||
- (void)appendLibraries:(PCMakefileFactory *)mff
|
||||
{
|
||||
NSArray *libs = [projectDict objectForKey:PCLibraries];
|
||||
|
||||
[mff appendString:@"\n#\n# Libraries\n#\n"];
|
||||
|
||||
[mff appendString:
|
||||
[NSString stringWithFormat:@"%@_LIBRARIES_DEPEND_UPON += ",projectName]];
|
||||
|
||||
if (libs && [libs count])
|
||||
{
|
||||
NSString *tmp;
|
||||
NSEnumerator *enumerator = [libs objectEnumerator];
|
||||
|
||||
while ((tmp = [enumerator nextObject]))
|
||||
{
|
||||
if (![tmp isEqualToString:@"gnustep-base"] &&
|
||||
![tmp isEqualToString:@"gnustep-gui"])
|
||||
{
|
||||
[mff appendString:[NSString stringWithFormat:@"-l%@ ",tmp]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (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 $(GNUSTEP_MAKEFILES)/library.make\n"];
|
||||
[mff appendString:@"-include GNUmakefile.postamble\n"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PCLibProject (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:@"Library"];
|
||||
[projectNameField setStringValue:projectName];
|
||||
[projectLanguageField setStringValue:[projectDict objectForKey:@"LANGUAGE"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue