From dec193e4c52e22adf3aa64cd1704ef3edcd7a797 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Fri, 29 Sep 2006 08:25:12 +0000 Subject: [PATCH] Support specification of help file. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@23665 72102866-910b-0410-8b05-ffd578937521 --- Library/PCProjectManager.m | 532 +++++++++--------- .../PCAppProject+Inspector.m | 505 +++++++++-------- Modules/ApplicationProject/PCAppProject.m | 270 ++++----- .../RenaissanceProject/PCRenaissanceProject.m | 261 ++++----- PCInfoController.m | 20 +- 5 files changed, 800 insertions(+), 788 deletions(-) diff --git a/Library/PCProjectManager.m b/Library/PCProjectManager.m index e7c5489..3138553 100644 --- a/Library/PCProjectManager.m +++ b/Library/PCProjectManager.m @@ -1,5 +1,5 @@ /* - GNUstep ProjectCenter - http://www.gnustep.org + GNUstep ProjectCenter - http: //www.gnustep.org Copyright (C) 2000-2004 Free Software Foundation @@ -70,25 +70,25 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; nonProjectEditors = [[NSMutableDictionary alloc] init]; - rootBuildPath = [[defs stringForKey:RootBuildDirectory] copy]; - if (!rootBuildPath || [rootBuildPath isEqualToString:@""]) + rootBuildPath = [[defs stringForKey: RootBuildDirectory] copy]; + if (!rootBuildPath || [rootBuildPath isEqualToString: @""]) { rootBuildPath = [NSTemporaryDirectory() copy]; } [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(resetSaveTimer:) - name:PCSavePeriodDidChangeNotification - object:nil]; + addObserver: self + selector: @selector(resetSaveTimer:) + name: PCSavePeriodDidChangeNotification + object: nil]; [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(editorDidClose:) - name:PCEditorDidCloseNotification - object:nil]; + addObserver: self + selector: @selector(editorDidClose:) + name: PCEditorDidCloseNotification + object: nil]; - fileManager = [[PCFileManager alloc] initWithProjectManager:self]; + fileManager = [[PCFileManager alloc] initWithProjectManager: self]; } return self; @@ -100,7 +100,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSLog (@"PCProjectManager: dealloc"); #endif - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver: self]; if ([saveTimer isValid]) { @@ -125,7 +125,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; [super dealloc]; } -- (void)setDelegate:(id)aDelegate +- (void)setDelegate: (id)aDelegate { delegate = aDelegate; } @@ -135,7 +135,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return delegate; } -- (void)setPrefController:(id)aController +- (void)setPrefController: (id)aController { prefController = aController; } @@ -155,23 +155,23 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; } // For "Open Project" and "New Project" panels - projectTypePopup = [[NSPopUpButton alloc] initWithFrame:fr pullsDown:NO]; - [projectTypePopup setRefusesFirstResponder:YES]; - [projectTypePopup setAutoenablesItems:NO]; - [projectTypePopup addItemsWithTitles: + projectTypePopup = [[NSPopUpButton alloc] initWithFrame: fr pullsDown: NO]; + [projectTypePopup setRefusesFirstResponder: YES]; + [projectTypePopup setAutoenablesItems: NO]; + [projectTypePopup addItemsWithTitles: [[projectTypes allKeys] - sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]]; + sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)]]; [projectTypePopup sizeToFit]; [projectTypeAccessaryView sizeToFit]; - [projectTypePopup selectItemAtIndex:0]; + [projectTypePopup selectItemAtIndex: 0]; projectTypeAccessaryView = [[NSBox alloc] init]; - [projectTypeAccessaryView setTitle:@"Project Types"]; - [projectTypeAccessaryView setTitlePosition:NSAtTop]; - [projectTypeAccessaryView setBorderType:NSGrooveBorder]; - [projectTypeAccessaryView addSubview:projectTypePopup]; + [projectTypeAccessaryView setTitle: @"Project Types"]; + [projectTypeAccessaryView setTitlePosition: NSAtTop]; + [projectTypeAccessaryView setBorderType: NSGrooveBorder]; + [projectTypeAccessaryView addSubview: projectTypePopup]; [projectTypeAccessaryView sizeToFit]; - [projectTypeAccessaryView setAutoresizingMask:NSViewMinXMargin + [projectTypeAccessaryView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin]; RELEASE(projectTypePopup); } @@ -185,22 +185,22 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSTimeInterval interval; interval = [[[PCPrefController sharedPCPreferences] - objectForKey:AutoSavePeriod] intValue]; + objectForKey: AutoSavePeriod] intValue]; if (interval > 0 && saveTimer == nil) { saveTimer = [NSTimer - scheduledTimerWithTimeInterval:interval - target:self - selector:@selector(saveAllProjects) - userInfo:nil - repeats:YES]; + scheduledTimerWithTimeInterval: interval + target: self + selector: @selector(saveAllProjects) + userInfo: nil + repeats: YES]; return YES; } return NO; } -- (BOOL)resetSaveTimer:(NSNotification *)notif +- (BOOL)resetSaveTimer: (NSNotification *)notif { [self stopSaveTimer]; @@ -233,7 +233,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; if (!projectInspector) { projectInspector = - [[PCProjectInspector alloc] initWithProjectManager:self]; + [[PCProjectInspector alloc] initWithProjectManager: self]; } return projectInspector; @@ -244,9 +244,9 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return [[self projectInspector] panel]; } -- (void)showProjectInspector:(id)sender +- (void)showProjectInspector: (id)sender { - [[[self projectInspector] panel] makeKeyAndOrderFront:self]; + [[[self projectInspector] panel] makeKeyAndOrderFront: self]; } - (NSPanel *)loadedFilesPanel @@ -254,16 +254,16 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; if (!loadedFilesPanel - && [[ud objectForKey:SeparateLoadedFiles] isEqualToString:@"YES"]) + && [[ud objectForKey: SeparateLoadedFiles] isEqualToString: @"YES"]) { loadedFilesPanel = - [[PCLoadedFilesPanel alloc] initWithProjectManager:self]; + [[PCLoadedFilesPanel alloc] initWithProjectManager: self]; } return loadedFilesPanel; } -- (void)showProjectLoadedFiles:(id)sender +- (void)showProjectLoadedFiles: (id)sender { if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] objectForKey: SeparateLoadedFiles] isEqualToString: @"YES"]) @@ -277,9 +277,9 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; if (!buildPanel - && [[ud objectForKey:SeparateBuilder] isEqualToString:@"YES"]) + && [[ud objectForKey: SeparateBuilder] isEqualToString: @"YES"]) { - buildPanel = [[PCBuildPanel alloc] initWithProjectManager:self]; + buildPanel = [[PCBuildPanel alloc] initWithProjectManager: self]; } return buildPanel; @@ -290,9 +290,9 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; if (!launchPanel - && [[ud objectForKey:SeparateLauncher] isEqualToString:@"YES"]) + && [[ud objectForKey: SeparateLauncher] isEqualToString: @"YES"]) { - launchPanel = [[PCLaunchPanel alloc] initWithProjectManager:self]; + launchPanel = [[PCLaunchPanel alloc] initWithProjectManager: self]; } return launchPanel; @@ -350,15 +350,15 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return rootProject; } -- (void)setActiveProject:(PCProject *)aProject +- (void)setActiveProject: (PCProject *)aProject { if (aProject != activeProject) { activeProject = aProject; [[NSNotificationCenter defaultCenter] - postNotificationName:PCActiveProjectDidChangeNotification - object:activeProject]; + postNotificationName: PCActiveProjectDidChangeNotification + object: activeProject]; } } @@ -369,7 +369,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; // PCLogInfo(self, @"saveAllProjectsIfNeeded"); // If this method was called not by NSTimer, check if we should save projects - if ([[defs objectForKey:SaveOnQuit] isEqualToString:@"YES"]) + if ([[defs objectForKey: SaveOnQuit] isEqualToString: @"YES"]) { [self saveAllProjects]; } @@ -383,7 +383,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; while ((key = [enumerator nextObject])) { - project = [loadedProjects objectForKey:key]; + project = [loadedProjects objectForKey: key]; if ([project save] == NO) { @@ -398,8 +398,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; // ==== Project actions // ============================================================================ -- (NSString *)convertLegacyProject:(NSMutableDictionary *)pDict - atPath:(NSString *)aPath +- (NSString *)convertLegacyProject: (NSMutableDictionary *)pDict + atPath: (NSString *)aPath { NSString *pPath = nil; NSString *projectClassName = nil; @@ -417,7 +417,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSMutableArray *otherResArray = nil; NSString *plistFile = nil; - projectClassName = [pDict objectForKey:PCProjectBuilderClass]; + projectClassName = [pDict objectForKey: PCProjectBuilderClass]; if (projectClassName == nil) { // Project created by 0.4 release or later @@ -425,96 +425,96 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; } // Gorm project type doesn't exists anymore - if ([projectClassName isEqualToString:@"PCGormProj"]) + if ([projectClassName isEqualToString: @"PCGormProj"]) { - projectTypeName = [NSString stringWithString:@"Application"]; - projectClassName = [projectTypes objectForKey:projectTypeName]; + projectTypeName = [NSString stringWithString: @"Application"]; + projectClassName = [projectTypes objectForKey: projectTypeName]; } // Handling directory layout _projectPath = [aPath stringByDeletingLastPathComponent]; - _resPath = [_projectPath stringByAppendingPathComponent:@"Resources"]; - [fm createDirectoryAtPath:_resPath attributes:nil]; + _resPath = [_projectPath stringByAppendingPathComponent: @"Resources"]; + [fm createDirectoryAtPath: _resPath attributes: nil]; // Documents - _fromDirPath = [_projectPath stringByAppendingPathComponent:@"Documentation"]; - _fromDirArray = [pDict objectForKey:PCDocuFiles]; + _fromDirPath = [_projectPath stringByAppendingPathComponent: @"Documentation"]; + _fromDirArray = [pDict objectForKey: PCDocuFiles]; for (i = 0; i < [_fromDirArray count]; i++) { - _resFile = [_fromDirArray objectAtIndex:i]; - _file = [_fromDirPath stringByAppendingPathComponent:_resFile]; - _2file = [_resPath stringByAppendingPathComponent:_resFile]; - [fm movePath:_file toPath:_2file handler:nil]; + _resFile = [_fromDirArray objectAtIndex: i]; + _file = [_fromDirPath stringByAppendingPathComponent: _resFile]; + _2file = [_resPath stringByAppendingPathComponent: _resFile]; + [fm movePath: _file toPath: _2file handler: nil]; } - [fm removeFileAtPath:_fromDirPath handler:nil]; + [fm removeFileAtPath: _fromDirPath handler: nil]; // Images - _fromDirPath = [_projectPath stringByAppendingPathComponent:@"Images"]; - _fromDirArray = [pDict objectForKey:PCImages]; + _fromDirPath = [_projectPath stringByAppendingPathComponent: @"Images"]; + _fromDirArray = [pDict objectForKey: PCImages]; for (i = 0; i < [_fromDirArray count]; i++) { - _resFile = [_fromDirArray objectAtIndex:i]; - _file = [_fromDirPath stringByAppendingPathComponent:_resFile]; - _2file = [_resPath stringByAppendingPathComponent:_resFile]; - [fm movePath:_file toPath:_2file handler:nil]; + _resFile = [_fromDirArray objectAtIndex: i]; + _file = [_fromDirPath stringByAppendingPathComponent: _resFile]; + _2file = [_resPath stringByAppendingPathComponent: _resFile]; + [fm movePath: _file toPath: _2file handler: nil]; } - [fm removeFileAtPath:_fromDirPath handler:nil]; + [fm removeFileAtPath: _fromDirPath handler: nil]; // Interfaces - _fromDirArray = [pDict objectForKey:PCInterfaces]; + _fromDirArray = [pDict objectForKey: PCInterfaces]; for (i = 0; i < [_fromDirArray count]; i++) { - _resFile = [_fromDirArray objectAtIndex:i]; - _file = [_projectPath stringByAppendingPathComponent:_resFile]; - _2file = [_resPath stringByAppendingPathComponent:_resFile]; - [fm movePath:_file toPath:_2file handler:nil]; + _resFile = [_fromDirArray objectAtIndex: i]; + _file = [_projectPath stringByAppendingPathComponent: _resFile]; + _2file = [_resPath stringByAppendingPathComponent: _resFile]; + [fm movePath: _file toPath: _2file handler: nil]; } // Other resources otherResArray = [NSMutableArray - arrayWithArray:[pDict objectForKey:PCOtherResources]]; - plistFile = [NSString stringWithFormat:@"%@Info.plist", - [pDict objectForKey:PCProjectName]]; + arrayWithArray: [pDict objectForKey: PCOtherResources]]; + plistFile = [NSString stringWithFormat: @"%@Info.plist", + [pDict objectForKey: PCProjectName]]; for (i = 0; i < [otherResArray count]; i++) { - _resFile = [otherResArray objectAtIndex:i]; - _file = [_projectPath stringByAppendingPathComponent:_resFile]; - if ([_resFile isEqualToString:plistFile]) + _resFile = [otherResArray objectAtIndex: i]; + _file = [_projectPath stringByAppendingPathComponent: _resFile]; + if ([_resFile isEqualToString: plistFile]) { _2file = - [_resPath stringByAppendingPathComponent:@"Info-gnustep.plist"]; - [otherResArray replaceObjectAtIndex:i - withObject:@"Info-gnustep.plist"]; - [pDict setObject:otherResArray forKey:PCOtherResources]; + [_resPath stringByAppendingPathComponent: @"Info-gnustep.plist"]; + [otherResArray replaceObjectAtIndex: i + withObject: @"Info-gnustep.plist"]; + [pDict setObject: otherResArray forKey: PCOtherResources]; } else { - _2file = [_resPath stringByAppendingPathComponent:_resFile]; + _2file = [_resPath stringByAppendingPathComponent: _resFile]; } - [fm movePath:_file toPath:_2file handler:nil]; + [fm movePath: _file toPath: _2file handler: nil]; } - // GNUmakefiles will be generated in [PCProject initWithProjectDictionary:] + // GNUmakefiles will be generated in [PCProject initWithProjectDictionary: ] // Remove obsolete records from project dictionary and write to PC.project pPath = [[aPath stringByDeletingLastPathComponent] - stringByAppendingPathComponent:@"PC.project"]; + stringByAppendingPathComponent: @"PC.project"]; projectCreator = [NSClassFromString(projectClassName) sharedCreator]; projectTypeName = [projectCreator projectTypeName]; - [pDict setObject:projectTypeName forKey:PCProjectType]; - [pDict removeObjectForKey:PCProjectBuilderClass]; - [pDict removeObjectForKey:PCPrincipalClass]; + [pDict setObject: projectTypeName forKey: PCProjectType]; + [pDict removeObjectForKey: PCProjectBuilderClass]; + [pDict removeObjectForKey: PCPrincipalClass]; - if ([pDict writeToFile:pPath atomically:YES] == YES) + if ([pDict writeToFile: pPath atomically: YES] == YES) { -// [[NSFileManager defaultManager] removeFileAtPath:aPath handler:nil]; +// [[NSFileManager defaultManager] removeFileAtPath: aPath handler: nil]; } return projectClassName; } -- (PCProject *)loadProjectAt:(NSString *)aPath +- (PCProject *)loadProjectAt: (NSString *)aPath { NSMutableDictionary *projectFile = nil; NSString *projectTypeName = nil; @@ -522,26 +522,26 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; id projectCreator; PCProject *project = nil; - projectFile = [NSMutableDictionary dictionaryWithContentsOfFile:aPath]; + projectFile = [NSMutableDictionary dictionaryWithContentsOfFile: aPath]; // For compatibility with 0.3.x projects - projectClassName = [self convertLegacyProject:projectFile atPath:aPath]; + projectClassName = [self convertLegacyProject: projectFile atPath: aPath]; if (projectClassName) { aPath = [[aPath stringByDeletingLastPathComponent] - stringByAppendingPathComponent:@"PC.project"]; + stringByAppendingPathComponent: @"PC.project"]; } // No conversion were taken if (projectClassName == nil) { - projectTypeName = [projectFile objectForKey:PCProjectType]; - projectClassName = [projectTypes objectForKey:projectTypeName]; + projectTypeName = [projectFile objectForKey: PCProjectType]; + projectClassName = [projectTypes objectForKey: projectTypeName]; } projectCreator = [NSClassFromString(projectClassName) sharedCreator]; - if ((project = [projectCreator openProjectAt:aPath])) + if ((project = [projectCreator openProjectAt: aPath])) { PCLogStatus(self, @"Project %@ loaded as %@", [project projectName], [projectCreator projectTypeName]); @@ -559,51 +559,51 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return nil; } -- (BOOL)openProjectAt:(NSString *)aPath +- (BOOL)openProjectAt: (NSString *)aPath { - NSDictionary *pDict = [NSDictionary dictionaryWithContentsOfFile:aPath]; + NSDictionary *pDict = [NSDictionary dictionaryWithContentsOfFile: aPath]; NSString *projectName = nil; PCProject *project = nil; NSDictionary *wap = nil; BOOL isDir = NO; - projectName = [pDict objectForKey:PCProjectName]; + projectName = [pDict objectForKey: PCProjectName]; - if ((project = [loadedProjects objectForKey:projectName]) != nil) + if ((project = [loadedProjects objectForKey: projectName]) != nil) { - [[project projectWindow] makeKeyAndOrderFront:self]; + [[project projectWindow] makeKeyAndOrderFront: self]; return YES; } - if ([[NSFileManager defaultManager] fileExistsAtPath:aPath - isDirectory:&isDir] && !isDir) + if ([[NSFileManager defaultManager] fileExistsAtPath: aPath + isDirectory: &isDir] && !isDir) { - project = [self loadProjectAt:aPath]; + project = [self loadProjectAt: aPath]; if (!project) { return NO; } - [loadedProjects setObject:project forKey:projectName]; - [self setActiveProject:project]; - [project setProjectManager:self]; + [loadedProjects setObject: project forKey: projectName]; + [self setActiveProject: project]; + [project setProjectManager: self]; // Windows and panels - wap = [pDict objectForKey:@"PC_WINDOWS"]; - if ([[wap allKeys] containsObject:@"ProjectBuild"]) + wap = [pDict objectForKey: @"PC_WINDOWS"]; + if ([[wap allKeys] containsObject: @"ProjectBuild"]) { - [[project projectWindow] showProjectBuild:self]; + [[project projectWindow] showProjectBuild: self]; } - if ([[wap allKeys] containsObject:@"ProjectLaunch"]) + if ([[wap allKeys] containsObject: @"ProjectLaunch"]) { - [[project projectWindow] showProjectLaunch:self]; + [[project projectWindow] showProjectLaunch: self]; } - if ([[wap allKeys] containsObject:@"LoadedFiles"]) + if ([[wap allKeys] containsObject: @"LoadedFiles"]) { - [[project projectWindow] showProjectLoadedFiles:self]; + [[project projectWindow] showProjectLoadedFiles: self]; } - [[project projectWindow] orderFront:self]; + [[project projectWindow] orderFront: self]; return YES; } @@ -611,33 +611,33 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return NO; } -- (PCProject *)createProjectOfType:(NSString *)projectType - path:(NSString *)aPath +- (PCProject *)createProjectOfType: (NSString *)projectType + path: (NSString *)aPath { - NSString *className = [projectTypes objectForKey:projectType]; + NSString *className = [projectTypes objectForKey: projectType]; Class creatorClass = NSClassFromString(className); PCProject *project = nil; NSString *projectName = [aPath lastPathComponent]; - if ((project = [loadedProjects objectForKey:projectName]) != nil) + if ((project = [loadedProjects objectForKey: projectName]) != nil) { - [[project projectWindow] makeKeyAndOrderFront:self]; + [[project projectWindow] makeKeyAndOrderFront: self]; return project; } - if (![creatorClass conformsToProtocol:@protocol(ProjectType)]) + if (![creatorClass conformsToProtocol: @protocol(ProjectType)]) { - [NSException raise:NOT_A_PROJECT_TYPE_EXCEPTION - format:@"%@ does not conform to ProjectType!", projectType]; + [NSException raise: NOT_A_PROJECT_TYPE_EXCEPTION + format: @"%@ does not conform to ProjectType!", projectType]; return nil; } - if (!(project = [[creatorClass sharedCreator] createProjectAt:aPath])) + if (!(project = [[creatorClass sharedCreator] createProjectAt: aPath])) { return nil; } - [project setProjectManager:self]; + [project setProjectManager: self]; [self startSaveTimer]; return project; @@ -647,15 +647,15 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; { NSArray *files = nil; NSString *filePath = nil; - NSArray *fileTypes = [NSArray arrayWithObjects:@"project",@"pcproj",nil]; + NSArray *fileTypes = [NSArray arrayWithObjects: @"project",@"pcproj",nil]; - files = [fileManager filesForOpenOfType:fileTypes - multiple:NO - title:@"Open Project" - accView:nil]; - filePath = [files objectAtIndex:0]; + files = [fileManager filesForOpenOfType: fileTypes + multiple: NO + title: @"Open Project" + accView: nil]; + filePath = [files objectAtIndex: 0]; - if (filePath != nil && [self openProjectAt:filePath] == NO) + if (filePath != nil && [self openProjectAt: filePath] == NO) { NSRunAlertPanel(@"Attention!", @"Couldn't open project %@!", @@ -667,29 +667,29 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; - (void)newProject { NSString *filePath = nil; - NSArray *fileTypes = [NSArray arrayWithObjects:@"project",@"pcproj",nil]; + NSArray *fileTypes = [NSArray arrayWithObjects: @"project",@"pcproj",nil]; NSString *projectType = nil; PCProject *project = nil; [self createProjectTypeAccessaryView]; - filePath = [fileManager fileForSaveOfType:fileTypes - title:@"New Project" - accView:projectTypeAccessaryView]; + filePath = [fileManager fileForSaveOfType: fileTypes + title: @"New Project" + accView: projectTypeAccessaryView]; if (filePath != nil) { projectType = [projectTypePopup titleOfSelectedItem]; - if (!(project = [self createProjectOfType:projectType path:filePath])) + if (!(project = [self createProjectOfType: projectType path: filePath])) { NSRunAlertPanel(@"Attention!", @"Failed to create %@!", @"OK",nil,nil,filePath); } - [loadedProjects setObject:project forKey:[project projectName]]; - [self setActiveProject:project]; - [[project projectWindow] orderFront:self]; + [loadedProjects setObject: project forKey: [project projectName]]; + [self setActiveProject: project]; + [[project projectWindow] orderFront: self]; } } @@ -720,20 +720,20 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; { PCProject *project = [self rootActiveProject]; NSString *category = [[project projectBrowser] nameOfSelectedCategory]; - NSString *categoryKey = [activeProject keyForCategory:category]; + NSString *categoryKey = [activeProject keyForCategory: category]; NSMutableArray *files = nil; NSString *file = nil; NSString *projectFile = nil; - NSArray *fileTypes = [project fileTypesForCategoryKey:categoryKey]; + NSArray *fileTypes = [project fileTypesForCategoryKey: categoryKey]; - files = [fileManager filesForAddOfTypes:fileTypes]; + files = [fileManager filesForAddOfTypes: fileTypes]; /* PCLogInfo(self, @"[addProjectFiles] %@ to category: %@ of project %@", files, categoryKey, [activeProject projectName]);*/ // Category may be changed category = [[project projectBrowser] nameOfSelectedCategory]; - categoryKey = [activeProject keyForCategory:category]; + categoryKey = [activeProject keyForCategory: category]; // No files was selected if (!files) @@ -741,18 +741,18 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return NO; } - file = [[files objectAtIndex:0] lastPathComponent]; - projectFile = [activeProject projectFileFromFile:[files objectAtIndex:0] - forKey:categoryKey]; + file = [[files objectAtIndex: 0] lastPathComponent]; + projectFile = [activeProject projectFileFromFile: [files objectAtIndex: 0] + forKey: categoryKey]; - if (![projectFile isEqualToString:file]) + if (![projectFile isEqualToString: file]) { - [activeProject addFiles:files forKey:categoryKey notify:YES]; + [activeProject addFiles: files forKey: categoryKey notify: YES]; } else { // Copy and add files - [activeProject addAndCopyFiles:files forKey:categoryKey]; + [activeProject addAndCopyFiles: files forKey: categoryKey]; } return YES; @@ -768,22 +768,22 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; PCProject *project = [self rootActiveProject]; NSArray *files = [[project projectBrowser] selectedFiles]; NSString *category = [[project projectBrowser] nameOfSelectedCategory]; - NSString *categoryKey = [project keyForCategory:category]; - NSString *directory = [activeProject dirForCategoryKey:categoryKey]; - NSString *removeString = [NSString stringWithString:@"Remove files..."]; + NSString *categoryKey = [project keyForCategory: category]; + NSString *directory = [activeProject dirForCategoryKey: categoryKey]; + NSString *removeString = [NSString stringWithString: @"Remove files..."]; NSMutableArray *subprojs = [NSMutableArray array]; int i; // Determining target project - if ([categoryKey isEqualToString:PCSubprojects]) + if ([categoryKey isEqualToString: PCSubprojects]) { if ([activeProject isSubproject]) { project = [activeProject superProject]; - [self setActiveProject:project]; + [self setActiveProject: project]; } - removeString = [NSString stringWithString:@"Remove subprojects..."]; - directory = [project dirForCategoryKey:categoryKey]; + removeString = [NSString stringWithString: @"Remove subprojects..."]; + directory = [project dirForCategoryKey: categoryKey]; } else { @@ -791,14 +791,14 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; } /* PCLogInfo(self, @"%@: %@ from %@", removeString, files, directory); - PCLogInfo(self, @"[removeProjectFiles]:%@ KEY:%@", + PCLogInfo(self, @"[removeProjectFiles]: %@ KEY: %@", [activeProject projectName], categoryKey);*/ if (files) { int ret; - if ([categoryKey isEqualToString:PCLibraries]) + if ([categoryKey isEqualToString: PCLibraries]) { ret = NSRunAlertPanel(@"Remove", @"Remove libraries from Project?", @@ -820,23 +820,23 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; BOOL flag = (ret == NSAlertDefaultReturn) ? YES : NO; // Remove from projectDict - ret = [project removeFiles:files forKey:categoryKey notify:YES]; + ret = [project removeFiles: files forKey: categoryKey notify: YES]; // Remove files from disk - if (flag && ret && ![categoryKey isEqualToString:PCLibraries]) + if (flag && ret && ![categoryKey isEqualToString: PCLibraries]) { - if ([categoryKey isEqualToString:PCSubprojects]) + if ([categoryKey isEqualToString: PCSubprojects]) { for (i = 0; i < [files count]; i++) { - [subprojs addObject: - [[files objectAtIndex:i] - stringByAppendingPathExtension:@"subproj"]]; + [subprojs addObject: + [[files objectAtIndex: i] + stringByAppendingPathExtension: @"subproj"]]; } files = subprojs; } - ret = [fileManager removeFiles:files - fromDirectory:directory]; + ret = [fileManager removeFiles: files + fromDirectory: directory]; } if (!ret) @@ -862,19 +862,19 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return YES; } -- (void)closeProject:(PCProject *)aProject +- (void)closeProject: (PCProject *)aProject { PCProject *currentProject = nil; NSString *projectName = [aProject projectName]; - currentProject = RETAIN([loadedProjects objectForKey:projectName]); + currentProject = RETAIN([loadedProjects objectForKey: projectName]); if (!currentProject) { return; } // Remove it from the loaded projects! - [loadedProjects removeObjectForKey:projectName]; + [loadedProjects removeObjectForKey: projectName]; if ([loadedProjects count] == 0) { @@ -899,7 +899,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; } else if (currentProject == [self activeProject]) { - [self setActiveProject:[[loadedProjects allValues] lastObject]]; + [self setActiveProject: [[loadedProjects allValues] lastObject]]; } RELEASE(currentProject); @@ -909,12 +909,12 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; { NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; - if ([[defs objectForKey:SaveOnQuit] isEqualToString:@"YES"]) + if ([[defs objectForKey: SaveOnQuit] isEqualToString: @"YES"]) { [activeProject save]; } - [activeProject close:self]; + [activeProject close: self]; } - (BOOL)closeAllProjects @@ -928,11 +928,11 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; while ([loadedProjects count] > 0) { project = [enumerator nextObject]; - if ([[defs objectForKey:SaveOnQuit] isEqualToString:@"YES"]) + if ([[defs objectForKey: SaveOnQuit] isEqualToString: @"YES"]) { [project save]; } - if ([project close:self] == NO) + if ([project close: self] == NO) { return NO; } @@ -950,15 +950,15 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSArray *files = nil; NSString *filePath = nil; - files = [fileManager filesForOpenOfType:nil - multiple:NO - title:@"Open File" - accView:nil]; - filePath = [files objectAtIndex:0]; + files = [fileManager filesForOpenOfType: nil + multiple: NO + title: @"Open File" + accView: nil]; + filePath = [files objectAtIndex: 0]; if (filePath != nil) { - [self openFileWithEditor:filePath]; + [self openFileWithEditor: filePath]; } } @@ -972,20 +972,20 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return [[activeProject projectEditor] saveFile]; } -- (BOOL)saveFileAs:(NSString *)path +- (BOOL)saveFileAs: (NSString *)path { - return [[activeProject projectEditor] saveFileAs:path]; + return [[activeProject projectEditor] saveFileAs: path]; } - (BOOL)saveFileTo { NSString *filePath = nil; - filePath = [fileManager fileForSaveOfType:nil - title:@"Save To..." - accView:nil]; + filePath = [fileManager fileForSaveOfType: nil + title: @"Save To..." + accView: nil]; - if (filePath != nil && ![[activeProject projectEditor] saveFileTo:filePath]) + if (filePath != nil && ![[activeProject projectEditor] saveFileTo: filePath]) { NSRunAlertPanel(@"Alert", @"Couldn't save file to\n%@!", @"OK", nil, nil, filePath); @@ -1002,8 +1002,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; - (BOOL)renameFile { - [self showProjectInspector:self]; - [projectInspector selectSectionWithTitle:@"File Attributes"]; + [self showProjectInspector: self]; + [projectInspector selectSectionWithTitle: @"File Attributes"]; [projectInspector beginFileRename]; return YES; @@ -1011,7 +1011,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; - (void)closeFile { - return [[activeProject projectEditor] closeActiveEditor:self]; + return [[activeProject projectEditor] closeActiveEditor: self]; } // Project menu @@ -1019,21 +1019,21 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; // ==== Non project editors // ============================================================================ -- (void)openFileWithEditor:(NSString *)path +- (void)openFileWithEditor: (NSString *)path { PCEditor *editor; - editor = [PCProjectEditor openFileInEditor:path]; + editor = [PCProjectEditor openFileInEditor: path]; - [nonProjectEditors setObject:editor forKey:path]; + [nonProjectEditors setObject: editor forKey: path]; RELEASE(editor); } -- (void)editorDidClose:(NSNotification *)aNotif +- (void)editorDidClose: (NSNotification *)aNotif { PCEditor *editor = [aNotif object]; - [nonProjectEditors removeObjectForKey:[editor path]]; + [nonProjectEditors removeObjectForKey: [editor path]]; } @end @@ -1041,28 +1041,28 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; @implementation PCProjectManager (FileManagerDelegates) // willCreateFile -- (NSString *)fileManager:(id)sender - willCreateFile:(NSString *)aFile - withKey:(NSString *)key +- (NSString *)fileManager: (id)sender + willCreateFile: (NSString *)aFile + withKey: (NSString *)key { NSString *path = nil; - if ([activeProject doesAcceptFile:aFile forKey:key]) + if ([activeProject doesAcceptFile: aFile forKey: key]) { - path = [[activeProject projectPath] stringByAppendingPathComponent:aFile]; + path = [[activeProject projectPath] stringByAppendingPathComponent: aFile]; } return path; } // didCreateFiles -- (void)fileManager:(id)sender - didCreateFile:(NSString *)aFile - withKey:(NSString *)key +- (void)fileManager: (id)sender + didCreateFile: (NSString *)aFile + withKey: (NSString *)key { - [activeProject addFiles:[NSArray arrayWithObject:aFile] - forKey:key - notify:YES]; + [activeProject addFiles: [NSArray arrayWithObject: aFile] + forKey: key + notify: YES]; } @end @@ -1074,7 +1074,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; projectTypes = [[NSMutableDictionary alloc] init]; bundleLoader = [[PCBundleLoader alloc] init]; - [bundleLoader setDelegate:self]; + [bundleLoader setDelegate: self]; [bundleLoader loadBundles]; } @@ -1088,7 +1088,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return projectTypes; } -- (void)bundleLoader:(id)sender didLoadBundle:(NSBundle *)aBundle +- (void)bundleLoader: (id)sender didLoadBundle: (NSBundle *)aBundle { Class principalClass; NSString *projectTypeName = nil; @@ -1098,10 +1098,10 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; principalClass = [aBundle principalClass]; projectTypeName = [[principalClass sharedCreator] projectTypeName]; - if (![projectTypes objectForKey:projectTypeName]) + if (![projectTypes objectForKey: projectTypeName]) { - [projectTypes setObject:NSStringFromClass(principalClass) - forKey:projectTypeName]; + [projectTypes setObject: NSStringFromClass(principalClass) + forKey: projectTypeName]; } } @@ -1115,44 +1115,44 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; if (!nsPanel) { - if ([NSBundle loadNibNamed:@"NewSubproject" owner:self] == NO) + if ([NSBundle loadNibNamed: @"NewSubproject" owner: self] == NO) { PCLogError(self, @"error loading NewSubproject NIB!"); return NO; } - [nsPanel setFrameAutosaveName:@"NewSubproject"]; + [nsPanel setFrameAutosaveName: @"NewSubproject"]; if (![nsPanel setFrameUsingName: @"NewSubproject"]) { [nsPanel center]; } - [nsImage setImage:[NSApp applicationIconImage]]; + [nsImage setImage: [NSApp applicationIconImage]]; [nsTypePB removeAllItems]; - [nsTypePB addItemsWithTitles: + [nsTypePB addItemsWithTitles: [[activeProject allowableSubprojectTypes] - sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]]; - [nsTypePB setRefusesFirstResponder:YES]; - [nsTypePB selectItemAtIndex:0]; - [nsCancelButton setRefusesFirstResponder:YES]; - [nsCreateButton setRefusesFirstResponder:YES]; + sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)]]; + [nsTypePB setRefusesFirstResponder: YES]; + [nsTypePB selectItemAtIndex: 0]; + [nsCancelButton setRefusesFirstResponder: YES]; + [nsCreateButton setRefusesFirstResponder: YES]; } - [projectNameField setStringValue:[activeProject projectName]]; - [nsPanel makeKeyAndOrderFront:nil]; - [nsNameField setStringValue:@""]; - [nsPanel makeFirstResponder:nsNameField]; + [projectNameField setStringValue: [activeProject projectName]]; + [nsPanel makeKeyAndOrderFront: nil]; + [nsNameField setStringValue: @""]; + [nsPanel makeFirstResponder: nsNameField]; return YES; } -- (void)closeNewSubprojectPanel:(id)sender +- (void)closeNewSubprojectPanel: (id)sender { - [nsPanel orderOut:self]; + [nsPanel orderOut: self]; } -- (BOOL)createSubproject:(id)sender +- (BOOL)createSubproject: (id)sender { - [nsPanel orderOut:self]; + [nsPanel orderOut: self]; return [self createSubproject]; } @@ -1164,59 +1164,59 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSString *spPath = nil; NSString *spType = [nsTypePB titleOfSelectedItem]; - if (![[spName pathExtension] isEqualToString:@"subproj"]) + if (![[spName pathExtension] isEqualToString: @"subproj"]) { spName = [[nsNameField stringValue] - stringByAppendingPathExtension:@"subproj"]; + stringByAppendingPathExtension: @"subproj"]; } - spPath = [[activeProject projectPath] stringByAppendingPathComponent:spName]; + spPath = [[activeProject projectPath] stringByAppendingPathComponent: spName]; PCLogStatus(self, @"creating subproject with type %@ at path %@", spType, spPath); // Create subproject - subproject = [self createSubprojectOfType:spType path:spPath]; + subproject = [self createSubprojectOfType: spType path: spPath]; return YES; } -- (PCProject *)createSubprojectOfType:(NSString *)projectType - path:(NSString *)aPath +- (PCProject *)createSubprojectOfType: (NSString *)projectType + path: (NSString *)aPath { - NSString *className = [projectTypes objectForKey:projectType]; + NSString *className = [projectTypes objectForKey: projectType]; Class creatorClass = NSClassFromString(className); PCProject *subproject = nil; /* NSString *subprojectName = [aPath lastPathComponent]; - if ((project = [activeProject objectForKey:projectName]) != nil) + if ((project = [activeProject objectForKey: projectName]) != nil) { - [[project projectWindow] makeKeyAndOrderFront:self]; + [[project projectWindow] makeKeyAndOrderFront: self]; return project; }*/ - if (![creatorClass conformsToProtocol:@protocol(ProjectType)]) + if (![creatorClass conformsToProtocol: @protocol(ProjectType)]) { - [NSException raise:NOT_A_PROJECT_TYPE_EXCEPTION - format:@"%@ does not conform to ProjectType!", projectType]; + [NSException raise: NOT_A_PROJECT_TYPE_EXCEPTION + format: @"%@ does not conform to ProjectType!", projectType]; return nil; } - if (!(subproject = [[creatorClass sharedCreator] createProjectAt:aPath])) + if (!(subproject = [[creatorClass sharedCreator] createProjectAt: aPath])) { return nil; } - [subproject setIsSubproject:YES]; - [subproject setSuperProject:activeProject]; - [subproject setProjectManager:self]; + [subproject setIsSubproject: YES]; + [subproject setSuperProject: activeProject]; + [subproject setProjectManager: self]; // PCLogInfo(self, @"{createSubproject} add to %@", [activeProject projectName]); - [activeProject addSubproject:subproject]; + [activeProject addSubproject: subproject]; return subproject; } -- (void)controlTextDidChange:(NSNotification *)aNotif +- (void)controlTextDidChange: (NSNotification *)aNotif { if ([aNotif object] != nsNameField) { @@ -1226,11 +1226,11 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; // TODO: Add check for valid subproject named if ([[nsNameField stringValue] length] > 0) { - [nsCreateButton setEnabled:YES]; + [nsCreateButton setEnabled: YES]; } else { - [nsCreateButton setEnabled:NO]; + [nsCreateButton setEnabled: NO]; } } @@ -1245,38 +1245,38 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; int i; files = [fileManager - filesForAddOfTypes:[NSArray arrayWithObjects:@"subproj",nil]]; + filesForAddOfTypes: [NSArray arrayWithObjects: @"subproj",nil]]; // Validate if it real projects for (i = 0; i < [files count]; i++) { - spDir = [files objectAtIndex:i]; - pcProject = [spDir stringByAppendingPathComponent:@"PC.project"]; - if (![[spDir pathExtension] isEqualToString:@"subproj"] - || ![fm fileExistsAtPath:pcProject]) + spDir = [files objectAtIndex: i]; + pcProject = [spDir stringByAppendingPathComponent: @"PC.project"]; + if (![[spDir pathExtension] isEqualToString: @"subproj"] + || ![fm fileExistsAtPath: pcProject]) { - [files removeObjectAtIndex:i]; + [files removeObjectAtIndex: i]; } } // PCLogInfo(self, @"{addSubproject} %@", files); - if (![fileManager copyFiles:files - intoDirectory:[activeProject projectPath]]) + if (![fileManager copyFiles: files + intoDirectory: [activeProject projectPath]]) { return NO; } for (i = 0; i < [files count]; i++) { - spDir = [files objectAtIndex:i]; - pcProject = [spDir stringByAppendingPathComponent:@"PC.project"]; - spDict = [NSDictionary dictionaryWithContentsOfFile:pcProject]; - spName = [spDict objectForKey:PCProjectName]; + spDir = [files objectAtIndex: i]; + pcProject = [spDir stringByAppendingPathComponent: @"PC.project"]; + spDict = [NSDictionary dictionaryWithContentsOfFile: pcProject]; + spName = [spDict objectForKey: PCProjectName]; // PCLogInfo(self, @"{addSubproject} dir: %@ file: %@", spDir, pcProject); - [activeProject addSubprojectWithName:spName]; + [activeProject addSubprojectWithName: spName]; } return YES; diff --git a/Modules/ApplicationProject/PCAppProject+Inspector.m b/Modules/ApplicationProject/PCAppProject+Inspector.m index 6ffd80d..67d5d83 100644 --- a/Modules/ApplicationProject/PCAppProject+Inspector.m +++ b/Modules/ApplicationProject/PCAppProject+Inspector.m @@ -1,5 +1,5 @@ /* - GNUstep ProjectCenter - http://www.gnustep.org + GNUstep ProjectCenter - http: //www.gnustep.org Copyright (C) 2001 Free Software Foundation @@ -19,7 +19,8 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA */ #include @@ -32,11 +33,11 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; @implementation PCAppTextField -- (BOOL)becomeFirstResponder +- (BOOL) becomeFirstResponder { [[NSNotificationCenter defaultCenter] - postNotificationName:PCITextFieldGetFocus - object:self]; + postNotificationName: PCITextFieldGetFocus + object: self]; return [super becomeFirstResponder]; } @@ -45,12 +46,12 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; @implementation PCAppProject (Inspector) -- (void)awakeFromNib +- (void) awakeFromNib { - [docBasedAppButton setRefusesFirstResponder:YES]; + [docBasedAppButton setRefusesFirstResponder: YES]; - [docBasedAppButton setState: - ([[projectDict objectForKey:PCDocumentBasedApp] + [docBasedAppButton setState: + ([[projectDict objectForKey: PCDocumentBasedApp] isEqualToString: @"YES"]) ? NSOnState : NSOffState]; } @@ -58,40 +59,40 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; // --- User Interface // ---------------------------------------------------------------------------- -- (void)createProjectAttributes +- (void) createProjectAttributes { // Languages [projectLanguagePB removeAllItems]; [projectLanguagePB - addItemsWithTitles:[projectDict objectForKey:PCUserLanguages]]; + addItemsWithTitles: [projectDict objectForKey: PCUserLanguages]]; [projectLanguagePB - selectItemWithTitle:[projectDict objectForKey:PCLanguage]]; + selectItemWithTitle: [projectDict objectForKey: PCLanguage]]; // TFs Buttons - [setFieldButton setRefusesFirstResponder:YES]; - [clearFieldButton setRefusesFirstResponder:YES]; + [setFieldButton setRefusesFirstResponder: YES]; + [clearFieldButton setRefusesFirstResponder: YES]; // Document types buttons - [addDocTypeButton setRefusesFirstResponder:YES]; - [removeDocTypeButton setRefusesFirstResponder:YES]; - [docBasedAppButton setRefusesFirstResponder:YES]; + [addDocTypeButton setRefusesFirstResponder: YES]; + [removeDocTypeButton setRefusesFirstResponder: YES]; + [docBasedAppButton setRefusesFirstResponder: YES]; - [self setDocBasedApp:docBasedAppButton]; + [self setDocBasedApp: docBasedAppButton]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(tfGetFocus:) - name:PCITextFieldGetFocus - object:nil]; + [[NSNotificationCenter defaultCenter] addObserver: self + selector: @selector(tfGetFocus:) + name: PCITextFieldGetFocus + object: nil]; [projectAttributesView retain]; - [self updateInspectorValues:nil]; + [self updateInspectorValues: nil]; } -- (NSView *)projectAttributesView +- (NSView *) projectAttributesView { if (!projectAttributesView) { - if ([NSBundle loadNibNamed:@"Inspector" owner:self] == NO) + if ([NSBundle loadNibNamed: @"Inspector" owner: self] == NO) { NSLog(@"PCAppProject: error loading Inspector NIB!"); return nil; @@ -106,24 +107,24 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; // --- Actions // ---------------------------------------------------------------------------- -- (void)setCurrentLanguage:(id)sender +- (void) setCurrentLanguage: (id)sender { NSLog(@"set current language to %@", [sender titleOfSelectedItem]); - [self setProjectDictObject:[sender titleOfSelectedItem] - forKey:PCLanguage - notify:YES]; + [self setProjectDictObject: [sender titleOfSelectedItem] + forKey: PCLanguage + notify: YES]; } -- (void)setAppClass:(id)sender +- (void) setAppClass: (id)sender { - [self setProjectDictObject:[appClassField stringValue] - forKey:PCPrincipalClass - notify:YES]; + [self setProjectDictObject: [appClassField stringValue] + forKey: PCPrincipalClass + notify: YES]; } -- (void)setIconViewImage:(NSImage *)image +- (void) setIconViewImage: (NSImage *)image { - [iconView setImage:nil]; + [iconView setImage: nil]; [iconView display]; if (image == nil) @@ -131,11 +132,11 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; return; } - [iconView setImage:image]; + [iconView setImage: image]; [iconView display]; } -- (void)setFile:(id)sender +- (void) setFile: (id)sender { if (!activeTextField) { @@ -144,18 +145,22 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; if (activeTextField == appImageField) { - [self setAppIcon:self]; + [self setAppIcon: self]; } else if (activeTextField == helpFileField) { + NSString *value = [activeTextField stringValue]; + + [self setProjectDictObject: value forKey: PCHelpFile notify: YES]; +NSLog(@"Set %@", value); } else if (activeTextField == mainNIBField) { - [self setMainNib:self]; + [self setMainNib: self]; } } -- (void)clearFile:(id)sender +- (void) clearFile: (id)sender { if (!activeTextField) { @@ -164,40 +169,42 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; if (activeTextField == appImageField) { - [self clearAppIcon:self]; + [self clearAppIcon: self]; } else if (activeTextField == helpFileField) { + [infoDict removeObjectForKey: @"GSHelpContentsFile"]; + [self setProjectDictObject: @"" forKey: PCHelpFile notify: YES]; } else if (activeTextField == mainNIBField) { - [self clearMainNib:self]; + [self clearMainNib: self]; } - [self setIconViewImage:nil]; + [self setIconViewImage: nil]; } // Application Icon -- (void)setAppIcon:(id)sender +- (void) setAppIcon: (id)sender { int result; NSArray *fileTypes = [NSImage imageFileTypes]; NSOpenPanel *openPanel = [NSOpenPanel openPanel]; NSString *dir = nil; - [openPanel setAllowsMultipleSelection:NO]; - [openPanel setTitle:@"Set Application Icon"]; + [openPanel setAllowsMultipleSelection: NO]; + [openPanel setTitle: @"Set Application Icon"]; dir = [[NSUserDefaults standardUserDefaults] - objectForKey:@"LastOpenDirectory"]; - result = [openPanel runModalForDirectory:dir - file:nil - types:fileTypes]; + objectForKey: @"LastOpenDirectory"]; + result = [openPanel runModalForDirectory: dir + file: nil + types: fileTypes]; if (result == NSOKButton) { - NSString *imageFilePath = [[openPanel filenames] objectAtIndex:0]; + NSString *imageFilePath = [[openPanel filenames] objectAtIndex: 0]; - if (![self setAppIconWithImageAtPath:imageFilePath]) + if (![self setAppIconWithImageAtPath: imageFilePath]) { NSRunAlertPanel(@"Error while opening file!", @"Couldn't open %@", @"OK", nil, nil,imageFilePath); @@ -205,62 +212,62 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; } } -- (void)clearAppIcon:(id)sender +- (void) clearAppIcon: (id)sender { - [appImageField setStringValue:@""]; - [infoDict setObject:@"" forKey:@"NSIcon"]; - [infoDict setObject:@"" forKey:@"ApplicationIcon"]; + [appImageField setStringValue: @""]; + [infoDict setObject: @"" forKey: @"NSIcon"]; + [infoDict setObject: @"" forKey: @"ApplicationIcon"]; - [self setProjectDictObject:@"" forKey:PCAppIcon notify:YES]; + [self setProjectDictObject: @"" forKey: PCAppIcon notify: YES]; } -- (BOOL)setAppIconWithImageAtPath:(NSString *)path +- (BOOL) setAppIconWithImageAtPath: (NSString *)path { NSImage *image = nil; NSString *imageName = nil; - if (!(image = [[NSImage alloc] initWithContentsOfFile:path])) + if (!(image = [[NSImage alloc] initWithContentsOfFile: path])) { return NO; } imageName = [path lastPathComponent]; - [appImageField setStringValue:imageName]; + [appImageField setStringValue: imageName]; - [self setIconViewImage:image]; + [self setIconViewImage: image]; - [self addAndCopyFiles:[NSArray arrayWithObject:path] forKey:PCImages]; + [self addAndCopyFiles: [NSArray arrayWithObject: path] forKey: PCImages]; - [infoDict setObject:imageName forKey:@"NSIcon"]; - [infoDict setObject:imageName forKey:@"ApplicationIcon"]; + [infoDict setObject: imageName forKey: @"NSIcon"]; + [infoDict setObject: imageName forKey: @"ApplicationIcon"]; - [self setProjectDictObject:imageName forKey:PCAppIcon notify:YES]; + [self setProjectDictObject: imageName forKey: PCAppIcon notify: YES]; return YES; } // Main Interface File -- (void)setMainNib:(id)sender +- (void) setMainNib: (id)sender { int result; NSOpenPanel *openPanel = [NSOpenPanel openPanel]; NSString *dir = nil; - [openPanel setAllowsMultipleSelection:NO]; - [openPanel setTitle:@"Set Main Interface File"]; + [openPanel setAllowsMultipleSelection: NO]; + [openPanel setTitle: @"Set Main Interface File"]; dir = [[NSUserDefaults standardUserDefaults] - objectForKey:@"LastOpenDirectory"]; - result = [openPanel runModalForDirectory:dir - file:nil - types:[NSArray arrayWithObject:@"gorm"]]; + objectForKey: @"LastOpenDirectory"]; + result = [openPanel runModalForDirectory: dir + file: nil + types: [NSArray arrayWithObject: @"gorm"]]; if (result == NSOKButton) { - NSString *file = [[openPanel filenames] objectAtIndex:0]; + NSString *file = [[openPanel filenames] objectAtIndex: 0]; - if (![self setMainNibWithFileAtPath:file]) + if (![self setMainNibWithFileAtPath: file]) { NSRunAlertPanel(@"Error while opening file!", @"Couldn't open %@", @"OK", nil, nil,file); @@ -268,223 +275,224 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; } } -- (BOOL)setMainNibWithFileAtPath:(NSString *)path +- (BOOL) setMainNibWithFileAtPath: (NSString *)path { NSString *nibName = [path lastPathComponent]; - [self setIconViewImage:[[NSWorkspace sharedWorkspace] iconForFile:path]]; + [self setIconViewImage: [[NSWorkspace sharedWorkspace] iconForFile: path]]; - [self addAndCopyFiles:[NSArray arrayWithObject:path] forKey:PCInterfaces]; - [infoDict setObject:nibName forKey:@"NSMainNibFile"]; + [self addAndCopyFiles: [NSArray arrayWithObject: path] forKey: PCInterfaces]; + [infoDict setObject: nibName forKey: @"NSMainNibFile"]; - [self setProjectDictObject:nibName forKey:PCMainInterfaceFile notify:YES]; + [self setProjectDictObject: nibName forKey: PCMainInterfaceFile notify: YES]; - [mainNIBField setStringValue:nibName]; + [mainNIBField setStringValue: nibName]; return YES; } -- (void)clearMainNib:(id)sender +- (void) clearMainNib: (id)sender { - [mainNIBField setStringValue:@""]; - [infoDict setObject:@"" forKey:@"NSMainNibFile"]; + [mainNIBField setStringValue: @""]; + [infoDict setObject: @"" forKey: @"NSMainNibFile"]; - [self setProjectDictObject:@"" forKey:PCMainInterfaceFile notify:YES]; + [self setProjectDictObject: @"" forKey: PCMainInterfaceFile notify: YES]; } // Document Types -- (void)showDocTypesPanel:(id)sender +- (void) showDocTypesPanel: (id)sender { - [docTypesPanel makeKeyAndOrderFront:nil]; + [docTypesPanel makeKeyAndOrderFront: nil]; } -- (void)setDocBasedApp:(id)sender +- (void) setDocBasedApp: (id)sender { - NSString *docBased = [projectDict objectForKey:PCDocumentBasedApp]; + NSString *docBased = [projectDict objectForKey: PCDocumentBasedApp]; if ([docBasedAppButton state] == NSOnState) { - [docTypeLabel setTextColor:[NSColor blackColor]]; - [docTypeField setBackgroundColor:[NSColor whiteColor]]; - [docTypeField setTextColor:[NSColor blackColor]]; - [docTypeField setEditable:YES]; + [docTypeLabel setTextColor: [NSColor blackColor]]; + [docTypeField setBackgroundColor: [NSColor whiteColor]]; + [docTypeField setTextColor: [NSColor blackColor]]; + [docTypeField setEditable: YES]; - [docNameLabel setTextColor:[NSColor blackColor]]; - [docNameField setBackgroundColor:[NSColor whiteColor]]; - [docNameField setTextColor:[NSColor blackColor]]; - [docNameField setEditable:YES]; + [docNameLabel setTextColor: [NSColor blackColor]]; + [docNameField setBackgroundColor: [NSColor whiteColor]]; + [docNameField setTextColor: [NSColor blackColor]]; + [docNameField setEditable: YES]; - [docRoleLabel setTextColor:[NSColor blackColor]]; - [docRoleField setBackgroundColor:[NSColor whiteColor]]; - [docRoleField setTextColor:[NSColor blackColor]]; - [docRoleField setEditable:YES]; + [docRoleLabel setTextColor: [NSColor blackColor]]; + [docRoleField setBackgroundColor: [NSColor whiteColor]]; + [docRoleField setTextColor: [NSColor blackColor]]; + [docRoleField setEditable: YES]; - [docClassLabel setTextColor:[NSColor blackColor]]; - [docClassField setBackgroundColor:[NSColor whiteColor]]; - [docClassField setTextColor:[NSColor blackColor]]; - [docClassField setEditable:YES]; + [docClassLabel setTextColor: [NSColor blackColor]]; + [docClassField setBackgroundColor: [NSColor whiteColor]]; + [docClassField setTextColor: [NSColor blackColor]]; + [docClassField setEditable: YES]; - [nameColumn setIdentifier:@"NSHumanReadableName"]; - [[nameColumn headerCell] setStringValue:@"Name"]; - [docTypesList addTableColumn:roleColumn]; - [docTypesList addTableColumn:classColumn]; + [nameColumn setIdentifier: @"NSHumanReadableName"]; + [[nameColumn headerCell] setStringValue: @"Name"]; + [docTypesList addTableColumn: roleColumn]; + [docTypesList addTableColumn: classColumn]; RELEASE(roleColumn); RELEASE(classColumn); - if (![docBased isEqualToString:@"YES"]) + if (![docBased isEqualToString: @"YES"]) { - [self setProjectDictObject:@"YES" - forKey:PCDocumentBasedApp - notify:YES]; + [self setProjectDictObject: @"YES" + forKey: PCDocumentBasedApp + notify: YES]; } } else { - [docTypeLabel setTextColor:[NSColor darkGrayColor]]; - [docTypeField setBackgroundColor:[NSColor lightGrayColor]]; - [docTypeField setTextColor:[NSColor darkGrayColor]]; - [docTypeField setEditable:NO]; + [docTypeLabel setTextColor: [NSColor darkGrayColor]]; + [docTypeField setBackgroundColor: [NSColor lightGrayColor]]; + [docTypeField setTextColor: [NSColor darkGrayColor]]; + [docTypeField setEditable: NO]; - [docNameLabel setTextColor:[NSColor darkGrayColor]]; - [docNameField setBackgroundColor:[NSColor lightGrayColor]]; - [docNameField setTextColor:[NSColor darkGrayColor]]; - [docNameField setEditable:NO]; + [docNameLabel setTextColor: [NSColor darkGrayColor]]; + [docNameField setBackgroundColor: [NSColor lightGrayColor]]; + [docNameField setTextColor: [NSColor darkGrayColor]]; + [docNameField setEditable: NO]; - [docRoleLabel setTextColor:[NSColor darkGrayColor]]; - [docRoleField setBackgroundColor:[NSColor lightGrayColor]]; - [docRoleField setTextColor:[NSColor darkGrayColor]]; - [docRoleField setEditable:NO]; + [docRoleLabel setTextColor: [NSColor darkGrayColor]]; + [docRoleField setBackgroundColor: [NSColor lightGrayColor]]; + [docRoleField setTextColor: [NSColor darkGrayColor]]; + [docRoleField setEditable: NO]; - [docClassLabel setTextColor:[NSColor darkGrayColor]]; - [docClassField setBackgroundColor:[NSColor lightGrayColor]]; - [docClassField setTextColor:[NSColor darkGrayColor]]; - [docClassField setEditable:NO]; + [docClassLabel setTextColor: [NSColor darkGrayColor]]; + [docClassField setBackgroundColor: [NSColor lightGrayColor]]; + [docClassField setTextColor: [NSColor darkGrayColor]]; + [docClassField setEditable: NO]; // Columns -// [docTypesList removeTableColumn:nameColumn]; - [nameColumn setIdentifier:@"NSIcon"]; - [[nameColumn headerCell] setStringValue:@"Icon"]; +// [docTypesList removeTableColumn: nameColumn]; + [nameColumn setIdentifier: @"NSIcon"]; + [[nameColumn headerCell] setStringValue: @"Icon"]; RETAIN(roleColumn); RETAIN(classColumn); - [docTypesList removeTableColumn:roleColumn]; - [docTypesList removeTableColumn:classColumn]; + [docTypesList removeTableColumn: roleColumn]; + [docTypesList removeTableColumn: classColumn]; - if (![docBased isEqualToString:@"NO"]) + if (![docBased isEqualToString: @"NO"]) { - [self setProjectDictObject:@"NO" - forKey:PCDocumentBasedApp - notify:YES]; + [self setProjectDictObject: @"NO" + forKey: PCDocumentBasedApp + notify: YES]; } } } -- (void)addDocType:(id)sender +- (void) addDocType: (id)sender { int row; - NSMutableDictionary *entry = [NSMutableDictionary dictionaryWithCapacity:6]; + 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:@"" forKey:@"NSRole"]; - [entry setObject:@"NSDocumentClass" forKey:@"NSDocumentClass"]; + [entry setObject: @"" forKey: @"NSName"]; + [entry setObject: @"" forKey: @"NSHumanReadableName"]; + [entry setObject: [NSArray array] forKey: @"NSUnixExtensions"]; + [entry setObject: @"" forKey: @"NSIcon"]; + [entry setObject: @"" forKey: @"NSRole"]; + [entry setObject: @"NSDocumentClass" forKey: @"NSDocumentClass"]; if (selectedRow >= 0 && [docTypesItems count] > 0) { - [docTypesItems insertObject:entry atIndex:selectedRow + 1]; + [docTypesItems insertObject: entry atIndex: selectedRow + 1]; row = selectedRow + 1; } else { - [docTypesItems addObject:entry]; + [docTypesItems addObject: entry]; row = [docTypesItems count] - 1; } [docTypesList reloadData]; - [docTypesList selectRow:row byExtendingSelection:NO]; - [docTypesList scrollRowToVisible:row]; + [docTypesList selectRow: row byExtendingSelection: NO]; + [docTypesList scrollRowToVisible: row]; - [self fillFieldsForRow:row]; + [self fillFieldsForRow: row]; - [self setProjectDictObject:docTypesItems - forKey:PCDocumentTypes - notify:YES]; + [self setProjectDictObject: docTypesItems + forKey: PCDocumentTypes + notify: YES]; } -- (void)removeDocType:(id)sender +- (void) removeDocType: (id)sender { int selectedRow = [docTypesList selectedRow]; if (selectedRow >= 0) { - [docTypesItems removeObjectAtIndex:selectedRow]; + [docTypesItems removeObjectAtIndex: selectedRow]; [docTypesList reloadData]; } if (([docTypesList selectedRow] < 0) && ([docTypesItems count] > 0)) { - [docTypesList selectRow:[docTypesItems count]-1 byExtendingSelection:NO]; + [docTypesList selectRow: + [docTypesItems count]-1 byExtendingSelection: NO]; } - [self fillFieldsForRow:[docTypesList selectedRow]]; + [self fillFieldsForRow: [docTypesList selectedRow]]; - [self setProjectDictObject:docTypesItems - forKey:PCDocumentTypes - notify:YES]; + [self setProjectDictObject: docTypesItems + forKey: PCDocumentTypes + notify: YES]; } -- (void)docFieldSet:(id)sender +- (void) docFieldSet: (id)sender { NSMutableDictionary *object = nil; NSLog(@"docFieldSet"); if (sender != docTypeField && sender != docNameField - && sender != docIconField && sender != docExtensionsField - && sender != docRoleField && sender != docClassField) + && sender != docIconField && sender != docExtensionsField + && sender != docRoleField && sender != docClassField) { return; } if ([docTypesItems count] <= 0) { - [self addDocType:addDocTypeButton]; + [self addDocType: addDocTypeButton]; } - object = [[docTypesItems objectAtIndex:[docTypesList selectedRow]] + object = [[docTypesItems objectAtIndex: [docTypesList selectedRow]] mutableCopy]; if (sender == docTypeField) { - [object setObject:[sender stringValue] forKey:@"NSName"]; + [object setObject: [sender stringValue] forKey: @"NSName"]; } else if (sender == docNameField) { - [object setObject:[sender stringValue] forKey:@"NSHumanReadableName"]; + [object setObject: [sender stringValue] forKey: @"NSHumanReadableName"]; } else if (sender == docIconField) { - [object setObject:[sender stringValue] forKey:@"NSIcon"]; + [object setObject: [sender stringValue] forKey: @"NSIcon"]; } else if (sender == docExtensionsField) { [object - setObject:[[sender stringValue] componentsSeparatedByString:@","] - forKey:@"NSUnixExtensions"]; + setObject: [[sender stringValue] componentsSeparatedByString: @","] + forKey: @"NSUnixExtensions"]; } else if (sender == docRoleField) { - [object setObject:[sender stringValue] forKey:@"NSRole"]; + [object setObject: [sender stringValue] forKey: @"NSRole"]; } else if (sender == docClassField) { - [object setObject:[sender stringValue] forKey:@"NSDocumentClass"]; + [object setObject: [sender stringValue] forKey: @"NSDocumentClass"]; } - [docTypesItems replaceObjectAtIndex:[docTypesList selectedRow] - withObject:object]; + [docTypesItems replaceObjectAtIndex: [docTypesList selectedRow] + withObject: object]; [docTypesList reloadData]; [object release]; } @@ -493,39 +501,39 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; // --- Document Types browser // ---------------------------------------------------------------------------- -- (int)numberOfRowsInTableView:(NSTableView *)aTableView +- (int) numberOfRowsInTableView: (NSTableView *)aTableView { return [docTypesItems count]; } -- (id) tableView:(NSTableView *)aTableView - objectValueForTableColumn:(NSTableColumn *)aTableColumn - row:(int)rowIndex +- (id) tableView: (NSTableView *)aTableView + objectValueForTableColumn: (NSTableColumn *)aTableColumn + row: (int)rowIndex { NSDictionary *object = nil; if (docTypesItems != nil || [docTypesItems count] > 0) { - object = [docTypesItems objectAtIndex:rowIndex]; + object = [docTypesItems objectAtIndex: rowIndex]; if (aTableColumn == extensionsColumn) { - return [[object objectForKey:@"NSUnixExtensions"] - componentsJoinedByString:@","]; + return [[object objectForKey: @"NSUnixExtensions"] + componentsJoinedByString: @","]; } else { - return [object objectForKey:[aTableColumn identifier]]; + return [object objectForKey: [aTableColumn identifier]]; } } return nil; } -- (void)tableView:(NSTableView *)aTableView - setObjectValue:anObject - forTableColumn:(NSTableColumn *)aTableColumn - row:(int)rowIndex +- (void) tableView: (NSTableView *)aTableView + setObjectValue: anObject + forTableColumn: (NSTableColumn *)aTableColumn + row: (int)rowIndex { NSMutableDictionary *type = nil; @@ -534,94 +542,95 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; return; } - type = [docTypesItems objectAtIndex:rowIndex]; - if ([[aTableColumn identifier] isEqualToString:@"NSUnixExtensions"]) + type = [docTypesItems objectAtIndex: rowIndex]; + if ([[aTableColumn identifier] isEqualToString: @"NSUnixExtensions"]) { - [type removeObjectForKey:@"Extension"]; - [type setObject:anObject forKey:@"Extension"]; + [type removeObjectForKey: @"Extension"]; + [type setObject: anObject forKey: @"Extension"]; } - else if ([[aTableColumn identifier] isEqualToString:@"NSIcon"]) + else if ([[aTableColumn identifier] isEqualToString: @"NSIcon"]) { - [type removeObjectForKey:@"Icon"]; - [type setObject:anObject forKey:@"Icon"]; + [type removeObjectForKey: @"Icon"]; + [type setObject: anObject forKey: @"Icon"]; } - [self setProjectDictObject:docTypesItems - forKey:PCDocumentTypes - notify:YES]; + [self setProjectDictObject: docTypesItems + forKey: PCDocumentTypes + notify: YES]; } -- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex +- (BOOL) tableView: (NSTableView *)aTableView shouldSelectRow: (int)rowIndex { - [self fillFieldsForRow:rowIndex]; + [self fillFieldsForRow: rowIndex]; return YES; } -- (void)fillFieldsForRow:(int)rowIndex +- (void) fillFieldsForRow: (int)rowIndex { NSDictionary *type = nil; int itemCount = [docTypesItems count]; if (itemCount <= 0 || rowIndex > itemCount || rowIndex < 0) { - [docTypeField setStringValue:@""]; - [docNameField setStringValue:@""]; - [docIconField setStringValue:@""]; - [docExtensionsField setStringValue:@""]; - [docRoleField setStringValue:@""]; - [docClassField setStringValue:@""]; + [docTypeField setStringValue: @""]; + [docNameField setStringValue: @""]; + [docIconField setStringValue: @""]; + [docExtensionsField setStringValue: @""]; + [docRoleField setStringValue: @""]; + [docClassField setStringValue: @""]; return; } - type = [docTypesItems objectAtIndex:rowIndex]; + type = [docTypesItems objectAtIndex: rowIndex]; - [docTypeField setStringValue:[type objectForKey:@"NSName"]]; - [docNameField setStringValue:[type objectForKey:@"NSHumanReadableName"]]; - [docIconField setStringValue:[type objectForKey:@"NSIcon"]]; + [docTypeField setStringValue: [type objectForKey: @"NSName"]]; + [docNameField setStringValue: [type objectForKey: @"NSHumanReadableName"]]; + [docIconField setStringValue: [type objectForKey: @"NSIcon"]]; - [docExtensionsField setStringValue:@""]; - if ([[type objectForKey:@"NSUnixExtensions"] count] > 0) + [docExtensionsField setStringValue: @""]; + if ([[type objectForKey: @"NSUnixExtensions"] count] > 0) { - [docExtensionsField setStringValue: - [[type objectForKey:@"NSUnixExtensions"] - componentsJoinedByString:@","]]; + [docExtensionsField setStringValue: + [[type objectForKey: @"NSUnixExtensions"] + componentsJoinedByString: @","]]; } - [docRoleField setStringValue:[type objectForKey:@"NSRole"]]; - [docClassField setStringValue:[type objectForKey:@"NSDocumentClass"]]; + [docRoleField setStringValue: [type objectForKey: @"NSRole"]]; + [docClassField setStringValue: [type objectForKey: @"NSDocumentClass"]]; } // ---------------------------------------------------------------------------- // --- Notifications // ---------------------------------------------------------------------------- -- (void)updateInspectorValues:(NSNotification *)aNotif +- (void) updateInspectorValues: (NSNotification *)aNotif { // NSLog (@"PCAppProject: updateInspectorValues"); // Project Attributes view - [projectTypeField setStringValue:[projectDict objectForKey:PCProjectType]]; - [projectNameField setStringValue:[projectDict objectForKey:PCProjectName]]; -// [projectLanguageField setStringValue:[projectDict objectForKey:PCLanguage]]; - [appClassField setStringValue:[projectDict objectForKey:PCPrincipalClass]]; + [projectTypeField setStringValue: [projectDict objectForKey: PCProjectType]]; + [projectNameField setStringValue: [projectDict objectForKey: PCProjectName]]; +// [projectLanguageField setStringValue: [projectDict objectForKey: PCLanguage]]; + [appClassField setStringValue: [projectDict objectForKey: PCPrincipalClass]]; - [appImageField setStringValue:[projectDict objectForKey:PCAppIcon]]; - [helpFileField setStringValue:[projectDict objectForKey:PCHelpFile]]; - [mainNIBField setStringValue:[projectDict objectForKey:PCMainInterfaceFile]]; + [appImageField setStringValue: [projectDict objectForKey: PCAppIcon]]; + [helpFileField setStringValue: [projectDict objectForKey: PCHelpFile]]; + [mainNIBField setStringValue: + [projectDict objectForKey: PCMainInterfaceFile]]; - docTypesItems = [projectDict objectForKey:PCDocumentTypes]; + docTypesItems = [projectDict objectForKey: PCDocumentTypes]; [docTypesList reloadData]; } // TextFields (PCITextField subclass) // // NSTextField become first responder when user clicks on it and immediately -// lost first resonder status, so we can't catch when focus leaves textfield +// lost first responder status, so we can't catch when focus leaves textfield // with resignFirstResponder: method overriding. Here we're using // controlTextDidEndEditing (NSTextField's delegate method) to achieve this. -- (void)tfGetFocus:(NSNotification *)aNotif +- (void) tfGetFocus: (NSNotification *)aNotif { id anObject = [aNotif object]; NSString *file = nil; @@ -629,8 +638,8 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; if (anObject != appImageField - && anObject != helpFileField - && anObject != mainNIBField) + && anObject != helpFileField + && anObject != mainNIBField) { // NSLog(@"tfGetFocus: not that textfield"); return; @@ -640,12 +649,12 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; { file = [appImageField stringValue]; - if (![file isEqualToString:@""]) + if (![file isEqualToString: @""]) { - path = [self dirForCategoryKey:PCImages]; - path = [path stringByAppendingPathComponent:file]; - [self setIconViewImage:[[NSImage alloc] - initWithContentsOfFile:path]]; + path = [self dirForCategoryKey: PCImages]; + path = [path stringByAppendingPathComponent: file]; + [self setIconViewImage: [[NSImage alloc] + initWithContentsOfFile: path]]; } activeTextField = appImageField; } @@ -657,41 +666,41 @@ NSString *PCITextFieldGetFocus = @"PCITextFieldGetFocusNotification"; { file = [mainNIBField stringValue]; - if (![file isEqualToString:@""]) + if (![file isEqualToString: @""]) { - path = [projectPath stringByAppendingPathComponent:file]; - [self setIconViewImage:[[NSWorkspace sharedWorkspace] - iconForFile:path]]; + path = [projectPath stringByAppendingPathComponent: file]; + [self setIconViewImage: [[NSWorkspace sharedWorkspace] + iconForFile: path]]; } activeTextField = mainNIBField; } - [setFieldButton setEnabled:YES]; - [clearFieldButton setEnabled:YES]; + [setFieldButton setEnabled: YES]; + [clearFieldButton setEnabled: YES]; } -- (void)controlTextDidEndEditing:(NSNotification *)aNotification +- (void) controlTextDidEndEditing: (NSNotification *)aNotification { NSControl *anObject = [aNotification object]; id target = [anObject target]; SEL action = [anObject action]; if (anObject == appImageField - || anObject == helpFileField - || anObject == mainNIBField) + || anObject == helpFileField + || anObject == mainNIBField) { activeTextField = nil; - [self setIconViewImage:nil]; + [self setIconViewImage: nil]; - [setFieldButton setEnabled:NO]; - [clearFieldButton setEnabled:NO]; + [setFieldButton setEnabled: NO]; + [clearFieldButton setEnabled: NO]; return; } - if ([target respondsToSelector:action]) + if ([target respondsToSelector: action]) { - [target performSelector:action withObject:anObject]; + [target performSelector: action withObject: anObject]; } } diff --git a/Modules/ApplicationProject/PCAppProject.m b/Modules/ApplicationProject/PCAppProject.m index 0564695..a1458e4 100644 --- a/Modules/ApplicationProject/PCAppProject.m +++ b/Modules/ApplicationProject/PCAppProject.m @@ -1,5 +1,5 @@ /* - GNUstep ProjectCenter - http://www.gnustep.org + GNUstep ProjectCenter - http: //www.gnustep.org Copyright (C) 2001-2004 Free Software Foundation @@ -20,7 +20,8 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USAA. + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USAA. */ #include @@ -72,26 +73,26 @@ nil] retain]; rootEntries = [[NSDictionary - dictionaryWithObjects:rootCategories forKeys:rootKeys] retain]; + dictionaryWithObjects: rootCategories forKeys: rootKeys] retain]; } return self; } -- (void)assignInfoDict:(NSMutableDictionary *)dict +- (void)assignInfoDict: (NSMutableDictionary *)dict { infoDict = [dict mutableCopy]; } -- (void)loadInfoFileAtPath:(NSString *)path +- (void)loadInfoFileAtPath: (NSString *)path { NSString *infoFile = nil; - infoFile = [self dirForCategoryKey:PCOtherResources]; - infoFile = [infoFile stringByAppendingPathComponent:@"Info-gnustep.plist"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:infoFile]) + infoFile = [self dirForCategoryKey: PCOtherResources]; + infoFile = [infoFile stringByAppendingPathComponent: @"Info-gnustep.plist"]; + if ([[NSFileManager defaultManager] fileExistsAtPath: infoFile]) { - infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:infoFile]; + infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile: infoFile]; } else { @@ -105,7 +106,7 @@ NSLog (@"PCAppProject: dealloc"); #endif - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(infoDict); RELEASE(projectAttributesView); @@ -138,37 +139,37 @@ - (NSString *)execToolName { - return [NSString stringWithString:@"openapp"]; + return [NSString stringWithString: @"openapp"]; } - (NSArray *)buildTargets { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: @"app", @"debug", @"profile", @"dist", nil]; } - (NSArray *)sourceFileKeys { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: PCClasses, PCHeaders, PCOtherSources, PCSupportingFiles, PCSubprojects, nil]; } - (NSArray *)resourceFileKeys { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil]; } - (NSArray *)otherKeys { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: PCLibraries, PCNonProject, nil]; } - (NSArray *)allowableSubprojectTypes { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: @"Aggregate", @"Bundle", @"Tool", @"Library", @"Framework", nil]; } @@ -182,11 +183,11 @@ // ==== File Handling // ============================================================================ -- (BOOL)removeFiles:(NSArray *)files forKey:(NSString *)key notify:(BOOL)yn +- (BOOL)removeFiles: (NSArray *)files forKey: (NSString *)key notify: (BOOL)yn { NSMutableArray *filesToRemove = [[files mutableCopy] autorelease]; - NSString *mainNibFile = [projectDict objectForKey:PCMainInterfaceFile]; - NSString *appIcon = [projectDict objectForKey:PCAppIcon]; + NSString *mainNibFile = [projectDict objectForKey: PCMainInterfaceFile]; + NSString *appIcon = [projectDict objectForKey: PCAppIcon]; if (!files || !key) { @@ -194,7 +195,7 @@ } // Check for main NIB file - if ([key isEqualToString:PCInterfaces] && [files containsObject:mainNibFile]) + if ([key isEqualToString: PCInterfaces] && [files containsObject: mainNibFile]) { int ret; ret = NSRunAlertPanel(@"Remove", @@ -203,15 +204,15 @@ if (ret == NSAlertAlternateReturn) // Leave { - [filesToRemove removeObject:mainNibFile]; + [filesToRemove removeObject: mainNibFile]; } else { - [self clearMainNib:self]; + [self clearMainNib: self]; } } // Check for application icon files - else if ([key isEqualToString:PCImages] && [files containsObject:appIcon]) + else if ([key isEqualToString: PCImages] && [files containsObject: appIcon]) { int ret; ret = NSRunAlertPanel(@"Remove", @@ -220,55 +221,55 @@ if (ret == NSAlertAlternateReturn) // Leave { - [filesToRemove removeObject:appIcon]; + [filesToRemove removeObject: appIcon]; } else { - [self clearAppIcon:self]; + [self clearAppIcon: self]; } } - return [super removeFiles:filesToRemove forKey:key notify:yn]; + return [super removeFiles: filesToRemove forKey: key notify: yn]; } -- (BOOL)renameFile:(NSString *)fromFile toFile:(NSString *)toFile +- (BOOL)renameFile: (NSString *)fromFile toFile: (NSString *)toFile { - NSString *mainNibFile = [projectDict objectForKey:PCMainInterfaceFile]; - NSString *appIcon = [projectDict objectForKey:PCAppIcon]; + NSString *mainNibFile = [projectDict objectForKey: PCMainInterfaceFile]; + NSString *appIcon = [projectDict objectForKey: PCAppIcon]; NSString *categoryKey = nil; NSString *ff = [fromFile copy]; NSString *tf = [toFile copy]; BOOL success = NO; categoryKey = [self - keyForCategory:[projectBrowser nameOfSelectedRootCategory]]; + keyForCategory: [projectBrowser nameOfSelectedRootCategory]]; // Check for main NIB file - if ([categoryKey isEqualToString:PCInterfaces] - && [fromFile isEqualToString:mainNibFile]) + if ([categoryKey isEqualToString: PCInterfaces] + && [fromFile isEqualToString: mainNibFile]) { - [self clearMainNib:self]; - if ([super renameFile:ff toFile:tf] == YES) + [self clearMainNib: self]; + if ([super renameFile: ff toFile: tf] == YES) { - [self setMainNibWithFileAtPath: - [[self dirForCategoryKey:categoryKey] - stringByAppendingPathComponent:tf]]; + [self setMainNibWithFileAtPath: + [[self dirForCategoryKey: categoryKey] + stringByAppendingPathComponent: tf]]; success = YES; } } // Check for application icon files - else if ([categoryKey isEqualToString:PCImages] - && [fromFile isEqualToString:appIcon]) + else if ([categoryKey isEqualToString: PCImages] + && [fromFile isEqualToString: appIcon]) { - [self clearAppIcon:self]; - if ([super renameFile:ff toFile:tf] == YES) + [self clearAppIcon: self]; + if ([super renameFile: ff toFile: tf] == YES) { - [self setAppIconWithImageAtPath: - [[self dirForCategoryKey:categoryKey] - stringByAppendingPathComponent:tf]]; + [self setAppIconWithImageAtPath: + [[self dirForCategoryKey: categoryKey] + stringByAppendingPathComponent: tf]]; success = YES; } } - else if ([super renameFile:ff toFile:tf] == YES) + else if ([super renameFile: ff toFile: tf] == YES) { success = YES; } @@ -283,74 +284,75 @@ @implementation PCAppProject (GeneratedFiles) -- (void)writeInfoEntry:(NSString *)name forKey:(NSString *)key +- (void)writeInfoEntry: (NSString *)name forKey: (NSString *)key { - id entry = [projectDict objectForKey:key]; + id entry = [projectDict objectForKey: key]; if (entry == nil) { return; } - if ([entry isKindOfClass:[NSString class]] && [entry isEqualToString:@""]) + if ([entry isKindOfClass: [NSString class]] && [entry isEqualToString: @""]) { - [infoDict removeObjectForKey:name]; + [infoDict removeObjectForKey: name]; return; } - if ([entry isKindOfClass:[NSArray class]] && [entry count] <= 0) + if ([entry isKindOfClass: [NSArray class]] && [entry count] <= 0) { - [infoDict removeObjectForKey:name]; + [infoDict removeObjectForKey: name]; return; } - [infoDict setObject:entry forKey:name]; + [infoDict setObject: entry forKey: name]; } - (BOOL)writeInfoFile { NSString *infoFile = nil; - [self writeInfoEntry:@"ApplicationDescription" forKey:PCDescription]; - [self writeInfoEntry:@"ApplicationIcon" forKey:PCAppIcon]; - [self writeInfoEntry:@"ApplicationName" forKey:PCProjectName]; - [self writeInfoEntry:@"ApplicationRelease" forKey:PCRelease]; - [self writeInfoEntry:@"Authors" forKey:PCAuthors]; - [self writeInfoEntry:@"Copyright" forKey:PCCopyright]; - [self writeInfoEntry:@"CopyrightDescription" forKey:PCCopyrightDescription]; - [self writeInfoEntry:@"FullVersionID" forKey:PCRelease]; - [self writeInfoEntry:@"NSExecutable" forKey:PCProjectName]; - [self writeInfoEntry:@"NSIcon" forKey:PCAppIcon]; - [self writeInfoEntry:@"NSMainNibFile" forKey:PCMainInterfaceFile]; - [self writeInfoEntry:@"NSPrincipalClass" forKey:PCPrincipalClass]; - [infoDict setObject:@"Application" forKey:@"NSRole"]; -// [infoDict setObject:[self convertExtensions] forKey:@"NSTypes"]; - [self writeInfoEntry:@"NSTypes" forKey:PCDocumentTypes]; - [self writeInfoEntry:@"URL" forKey:PCURL]; + [self writeInfoEntry: @"ApplicationDescription" forKey: PCDescription]; + [self writeInfoEntry: @"ApplicationIcon" forKey: PCAppIcon]; + [self writeInfoEntry: @"ApplicationName" forKey: PCProjectName]; + [self writeInfoEntry: @"ApplicationRelease" forKey: PCRelease]; + [self writeInfoEntry: @"Authors" forKey: PCAuthors]; + [self writeInfoEntry: @"Copyright" forKey: PCCopyright]; + [self writeInfoEntry: @"CopyrightDescription" forKey: PCCopyrightDescription]; + [self writeInfoEntry: @"FullVersionID" forKey: PCRelease]; + [self writeInfoEntry: @"NSExecutable" forKey: PCProjectName]; + [self writeInfoEntry: @"NSIcon" forKey: PCAppIcon]; + [self writeInfoEntry: @"NSMainNibFile" forKey: PCMainInterfaceFile]; + [self writeInfoEntry: @"NSPrincipalClass" forKey: PCPrincipalClass]; + [self writeInfoEntry: @"GSHelpContentsFile" forKey: PCHelpFile]; + [infoDict setObject: @"Application" forKey: @"NSRole"]; +// [infoDict setObject: [self convertExtensions] forKey: @"NSTypes"]; + [self writeInfoEntry: @"NSTypes" forKey: PCDocumentTypes]; + [self writeInfoEntry: @"URL" forKey: PCURL]; - infoFile = [self dirForCategoryKey:PCOtherResources]; - infoFile = [infoFile stringByAppendingPathComponent:@"Info-gnustep.plist"]; + infoFile = [self dirForCategoryKey: PCOtherResources]; + infoFile = [infoFile stringByAppendingPathComponent: @"Info-gnustep.plist"]; - return [infoDict writeToFile:infoFile atomically:YES]; + return [infoDict writeToFile: infoFile atomically: YES]; } - (NSArray *)convertExtensions { - NSMutableArray *icons = [NSMutableArray arrayWithCapacity:1]; - NSMutableArray *extensions = [NSMutableArray arrayWithCapacity:1]; - NSArray *docIE = [projectDict objectForKey:PCDocumentExtensions]; + NSMutableArray *icons = [NSMutableArray arrayWithCapacity: 1]; + NSMutableArray *extensions = [NSMutableArray arrayWithCapacity: 1]; + NSArray *docIE = [projectDict objectForKey: PCDocumentExtensions]; NSEnumerator *enumerator = [docIE objectEnumerator]; NSDictionary *anObject; NSMutableArray *resArray = [[NSMutableArray alloc] init]; - NSMutableDictionary *tmpDict = [NSMutableDictionary dictionaryWithCapacity:1]; + NSMutableDictionary *tmpDict = [NSMutableDictionary dictionaryWithCapacity: 1]; NSString *ic; NSArray *ex; while ((anObject = [enumerator nextObject])) { - [icons addObject:[anObject objectForKey:@"Icon"]]; - [extensions addObject:[anObject objectForKey:@"Extension"]]; + [icons addObject: [anObject objectForKey: @"Icon"]]; + [extensions addObject: [anObject objectForKey: @"Extension"]]; } // At this point we have 2 arrays; 1 list of icons and 2 list of extensions. @@ -362,18 +364,18 @@ NSMutableDictionary *tdict; NSString *tic; - ic = [icons objectAtIndex:0]; - ex = [NSMutableArray arrayWithObject:[extensions objectAtIndex:0]]; + ic = [icons objectAtIndex: 0]; + ex = [NSMutableArray arrayWithObject: [extensions objectAtIndex: 0]]; for (i = 0; i < [resArray count]; i++) { - tdict = [resArray objectAtIndex:i]; - tic = [tdict objectForKey:@"NSIcon"]; + tdict = [resArray objectAtIndex: i]; + tic = [tdict objectForKey: @"NSIcon"]; - if([tic isEqualToString:ic]) + if([tic isEqualToString: ic]) { - [[tdict objectForKey:@"NSUnixExtensions"] - addObject:[ex objectAtIndex:0]]; + [[tdict objectForKey: @"NSUnixExtensions"] + addObject: [ex objectAtIndex: 0]]; loaded = YES; continue; } @@ -381,15 +383,15 @@ if (!loaded) { - [tmpDict setObject:ic forKey:@"NSIcon"]; - [tmpDict setObject:ex forKey:@"NSUnixExtensions"]; + [tmpDict setObject: ic forKey: @"NSIcon"]; + [tmpDict setObject: ex forKey: @"NSUnixExtensions"]; - [resArray addObject:[tmpDict copy]]; + [resArray addObject: [tmpDict copy]]; } [tmpDict removeAllObjects]; - [icons removeObjectAtIndex:0]; - [extensions removeObjectAtIndex:0]; + [icons removeObjectAtIndex: 0]; + [extensions removeObjectAtIndex: 0]; } return resArray; @@ -410,66 +412,66 @@ [super writeMakefile]; // Save GNUmakefile.preamble - [mf createPreambleForProject:self]; + [mf createPreambleForProject: self]; // Create the new file - [mf createMakefileForProject:projectName]; + [mf createMakefileForProject: projectName]; // Head (Application) - [self appendHead:mf]; + [self appendHead: mf]; // Subprojects - if ([[projectDict objectForKey:PCSubprojects] count] > 0) + if ([[projectDict objectForKey: PCSubprojects] count] > 0) { - [mf appendSubprojects:[projectDict objectForKey:PCSubprojects]]; + [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]; + 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]; + resourceItem = [resources objectAtIndex: j]; if ([[resourceItem pathComponents] count] == 1) { - resourceItem = [NSString stringWithFormat:@"Resources/%@", + resourceItem = [NSString stringWithFormat: @"Resources/%@", resourceItem]; } - [resources replaceObjectAtIndex:j - withObject:resourceItem]; + [resources replaceObjectAtIndex: j + withObject: resourceItem]; } - [mf appendResourceItems:resources]; + [mf appendResourceItems: resources]; [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 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]]; + [mf appendHeaders: [projectDict objectForKey: PCHeaders]]; + [mf appendClasses: [projectDict objectForKey: PCClasses]]; + [mf appendOtherSources: [projectDict objectForKey: PCOtherSources]]; // Tail - [self appendTail:mf]; + [self appendTail: mf]; // Write the new file to disc! - mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"]; + mfl = [projectPath stringByAppendingPathComponent: @"GNUmakefile"]; if ((mfd = [mf encodedMakefile])) { - if ([mfd writeToFile:mfl atomically:YES]) + if ([mfd writeToFile: mfl atomically: YES]) { return YES; } @@ -478,42 +480,42 @@ return NO; } -- (void)appendHead:(PCMakefileFactory *)mff +- (void)appendHead: (PCMakefileFactory *)mff { - NSString *installDir = [projectDict objectForKey:PCInstallDir]; + NSString *installDir = [projectDict objectForKey: PCInstallDir]; - [mff appendString:@"\n#\n# Application\n#\n"]; - [mff appendString:[NSString stringWithFormat:@"VERSION = %@\n", - [projectDict objectForKey:PCRelease]]]; - [mff appendString: - [NSString stringWithFormat:@"PACKAGE_NAME = %@\n", projectName]]; - [mff appendString: - [NSString stringWithFormat:@"APP_NAME = %@\n", projectName]]; + [mff appendString: @"\n#\n# Application\n#\n"]; + [mff appendString: [NSString stringWithFormat: @"VERSION = %@\n", + [projectDict objectForKey: PCRelease]]]; + [mff appendString: + [NSString stringWithFormat: @"PACKAGE_NAME = %@\n", projectName]]; + [mff appendString: + [NSString stringWithFormat: @"APP_NAME = %@\n", projectName]]; - [mff appendString:[NSString stringWithFormat:@"%@_APPLICATION_ICON = %@\n", - projectName, [projectDict objectForKey:PCAppIcon]]]; + [mff appendString: [NSString stringWithFormat: @"%@_APPLICATION_ICON = %@\n", + projectName, [projectDict objectForKey: PCAppIcon]]]; - if ([installDir isEqualToString:@""]) + if ([installDir isEqualToString: @""]) { - [mff appendString: - [NSString stringWithFormat:@"%@_STANDARD_INSTALL = no\n", + [mff appendString: + [NSString stringWithFormat: @"%@_STANDARD_INSTALL = no\n", projectName]]; } else { - [mff appendString: - [NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR = %@\n", + [mff appendString: + [NSString stringWithFormat: @"GNUSTEP_INSTALLATION_DIR = %@\n", installDir]]; } } -- (void)appendTail:(PCMakefileFactory *)mff +- (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)/application.make\n"]; - [mff appendString:@"-include GNUmakefile.postamble\n"]; + [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)/application.make\n"]; + [mff appendString: @"-include GNUmakefile.postamble\n"]; } @end diff --git a/Modules/RenaissanceProject/PCRenaissanceProject.m b/Modules/RenaissanceProject/PCRenaissanceProject.m index 0c99a66..0a554be 100644 --- a/Modules/RenaissanceProject/PCRenaissanceProject.m +++ b/Modules/RenaissanceProject/PCRenaissanceProject.m @@ -1,5 +1,5 @@ /* - GNUstep ProjectCenter - http://www.gnustep.org + GNUstep ProjectCenter - http: //www.gnustep.org Copyright (C) 2001-2004 Free Software Foundation @@ -72,25 +72,25 @@ nil] retain]; rootEntries = [[NSDictionary - dictionaryWithObjects:rootCategories forKeys:rootKeys] retain]; + dictionaryWithObjects: rootCategories forKeys: rootKeys] retain]; } return self; } -- (void)assignInfoDict:(NSMutableDictionary *)dict +- (void)assignInfoDict: (NSMutableDictionary *)dict { infoDict = [dict mutableCopy]; } -- (void)loadInfoFileAtPath:(NSString *)path +- (void)loadInfoFileAtPath: (NSString *)path { NSString *infoFile = nil; - infoFile = [path stringByAppendingPathComponent:@"Info-gnustep.plist"]; - if ([[NSFileManager defaultManager] fileExistsAtPath:infoFile]) + infoFile = [path stringByAppendingPathComponent: @"Info-gnustep.plist"]; + if ([[NSFileManager defaultManager] fileExistsAtPath: infoFile]) { - infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:infoFile]; + infoDict = [[NSMutableDictionary alloc] initWithContentsOfFile: infoFile]; } else { @@ -102,7 +102,7 @@ { NSLog (@"PCRenaissanceProject: dealloc"); - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(infoDict); RELEASE(projectAttributesView); @@ -135,37 +135,37 @@ - (NSString *)execToolName { - return [NSString stringWithString:@"openapp"]; + return [NSString stringWithString: @"openapp"]; } - (NSArray *)buildTargets { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: @"app", @"debug", @"profile", @"dist", nil]; } - (NSArray *)sourceFileKeys { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: PCClasses, PCHeaders, PCOtherSources, PCSupportingFiles, PCSubprojects, nil]; } - (NSArray *)resourceFileKeys { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil]; } - (NSArray *)otherKeys { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: PCLibraries, PCNonProject, nil]; } - (NSArray *)allowableSubprojectTypes { - return [NSArray arrayWithObjects: + return [NSArray arrayWithObjects: @"Aggregate", @"Bundle", @"Tool", @"Library", nil]; } @@ -175,12 +175,12 @@ PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil]; } -- (BOOL)isEditableCategory:(NSString *)category +- (BOOL)isEditableCategory: (NSString *)category { - NSString *key = [self keyForCategory:category]; + NSString *key = [self keyForCategory: category]; - if ([super isEditableCategory:category] - || [key isEqualToString:PCInterfaces]) + if ([super isEditableCategory: category] + || [key isEqualToString: PCInterfaces]) { return YES; } @@ -192,11 +192,11 @@ // ==== File Handling // ============================================================================ -- (BOOL)removeFiles:(NSArray *)files forKey:(NSString *)key notify:(BOOL)yn +- (BOOL)removeFiles: (NSArray *)files forKey: (NSString *)key notify: (BOOL)yn { NSMutableArray *filesToRemove = [[files mutableCopy] autorelease]; - NSString *mainNibFile = [projectDict objectForKey:PCMainInterfaceFile]; - NSString *appIcon = [projectDict objectForKey:PCAppIcon]; + NSString *mainNibFile = [projectDict objectForKey: PCMainInterfaceFile]; + NSString *appIcon = [projectDict objectForKey: PCAppIcon]; if (!files || !key) { @@ -204,7 +204,7 @@ } // Check for main NIB file - if ([key isEqualToString:PCInterfaces] && [files containsObject:mainNibFile]) + if ([key isEqualToString: PCInterfaces] && [files containsObject: mainNibFile]) { int ret; ret = NSRunAlertPanel(@"Remove", @@ -213,15 +213,15 @@ if (ret == NSAlertAlternateReturn) // Leave { - [filesToRemove removeObject:mainNibFile]; + [filesToRemove removeObject: mainNibFile]; } else { - [self clearMainNib:self]; + [self clearMainNib: self]; } } // Check for application icon files - else if ([key isEqualToString:PCImages] && [files containsObject:appIcon]) + else if ([key isEqualToString: PCImages] && [files containsObject: appIcon]) { int ret; ret = NSRunAlertPanel(@"Remove", @@ -230,56 +230,56 @@ if (ret == NSAlertAlternateReturn) // Leave { - [filesToRemove removeObject:appIcon]; + [filesToRemove removeObject: appIcon]; } else { - [self clearAppIcon:self]; + [self clearAppIcon: self]; } } - return [super removeFiles:filesToRemove forKey:key notify:yn]; + return [super removeFiles: filesToRemove forKey: key notify: yn]; } -- (BOOL)renameFile:(NSString *)fromFile toFile:(NSString *)toFile +- (BOOL)renameFile: (NSString *)fromFile toFile: (NSString *)toFile { - NSString *mainNibFile = [projectDict objectForKey:PCMainInterfaceFile]; - NSString *appIcon = [projectDict objectForKey:PCAppIcon]; + NSString *mainNibFile = [projectDict objectForKey: PCMainInterfaceFile]; + NSString *appIcon = [projectDict objectForKey: PCAppIcon]; NSString *categoryKey = nil; NSString *ff = [fromFile copy]; NSString *tf = [toFile copy]; BOOL success = NO; categoryKey = [self - keyForCategory:[projectBrowser nameOfSelectedRootCategory]]; + keyForCategory: [projectBrowser nameOfSelectedRootCategory]]; // Check for main NIB file - if ([categoryKey isEqualToString:PCInterfaces] - && [fromFile isEqualToString:mainNibFile]) + if ([categoryKey isEqualToString: PCInterfaces] + && [fromFile isEqualToString: mainNibFile]) { - [self clearMainNib:self]; - if ([super renameFile:ff toFile:tf] == YES) + [self clearMainNib: self]; + if ([super renameFile: ff toFile: tf] == YES) { - [self setMainNibWithFileAtPath: - [[self dirForCategoryKey:categoryKey] - stringByAppendingPathComponent:tf]]; + [self setMainNibWithFileAtPath: + [[self dirForCategoryKey: categoryKey] + stringByAppendingPathComponent: tf]]; success = YES; } } // Check for application icon files - else if ([categoryKey isEqualToString:PCImages] - && [fromFile isEqualToString:appIcon]) + else if ([categoryKey isEqualToString: PCImages] + && [fromFile isEqualToString: appIcon]) { - [self clearAppIcon:self]; - if ([super renameFile:ff toFile:tf] == YES) + [self clearAppIcon: self]; + if ([super renameFile: ff toFile: tf] == YES) { - [self setAppIconWithImageAtPath: - [[self dirForCategoryKey:categoryKey] - stringByAppendingPathComponent:tf]]; + [self setAppIconWithImageAtPath: + [[self dirForCategoryKey: categoryKey] + stringByAppendingPathComponent: tf]]; success = YES; } } - else if ([super renameFile:ff toFile:tf] == YES) + else if ([super renameFile: ff toFile: tf] == YES) { success = YES; } @@ -294,73 +294,74 @@ @implementation PCRenaissanceProject (GeneratedFiles) -- (void)writeInfoEntry:(NSString *)name forKey:(NSString *)key +- (void)writeInfoEntry: (NSString *)name forKey: (NSString *)key { - id entry = [projectDict objectForKey:key]; + id entry = [projectDict objectForKey: key]; if (entry == nil) { return; } - if ([entry isKindOfClass:[NSString class]] && [entry isEqualToString:@""]) + if ([entry isKindOfClass: [NSString class]] && [entry isEqualToString: @""]) { - [infoDict removeObjectForKey:name]; + [infoDict removeObjectForKey: name]; return; } - if ([entry isKindOfClass:[NSArray class]] && [entry count] <= 0) + if ([entry isKindOfClass: [NSArray class]] && [entry count] <= 0) { - [infoDict removeObjectForKey:name]; + [infoDict removeObjectForKey: name]; return; } - [infoDict setObject:entry forKey:name]; + [infoDict setObject: entry forKey: name]; } - (BOOL)writeInfoFile { NSString *infoFile = nil; - [self writeInfoEntry:@"ApplicationDescription" forKey:PCDescription]; - [self writeInfoEntry:@"ApplicationIcon" forKey:PCAppIcon]; - [self writeInfoEntry:@"ApplicationName" forKey:PCProjectName]; - [self writeInfoEntry:@"ApplicationRelease" forKey:PCRelease]; - [self writeInfoEntry:@"Authors" forKey:PCAuthors]; - [self writeInfoEntry:@"Copyright" forKey:PCCopyright]; - [self writeInfoEntry:@"CopyrightDescription" forKey:PCCopyrightDescription]; - [self writeInfoEntry:@"FullVersionID" forKey:PCRelease]; - [self writeInfoEntry:@"NSExecutable" forKey:PCProjectName]; - [self writeInfoEntry:@"NSIcon" forKey:PCAppIcon]; - [self writeInfoEntry:@"GSMainMarkupFile" forKey:PCMainInterfaceFile]; - [self writeInfoEntry:@"NSPrincipalClass" forKey:PCPrincipalClass]; - [infoDict setObject:@"Application" forKey:@"NSRole"]; - [infoDict setObject:[self convertExtensions] forKey:@"NSTypes"]; - [self writeInfoEntry:@"URL" forKey:PCURL]; + [self writeInfoEntry: @"ApplicationDescription" forKey: PCDescription]; + [self writeInfoEntry: @"ApplicationIcon" forKey: PCAppIcon]; + [self writeInfoEntry: @"ApplicationName" forKey: PCProjectName]; + [self writeInfoEntry: @"ApplicationRelease" forKey: PCRelease]; + [self writeInfoEntry: @"Authors" forKey: PCAuthors]; + [self writeInfoEntry: @"Copyright" forKey: PCCopyright]; + [self writeInfoEntry: @"CopyrightDescription" forKey: PCCopyrightDescription]; + [self writeInfoEntry: @"FullVersionID" forKey: PCRelease]; + [self writeInfoEntry: @"NSExecutable" forKey: PCProjectName]; + [self writeInfoEntry: @"NSIcon" forKey: PCAppIcon]; + [self writeInfoEntry: @"GSMainMarkupFile" forKey: PCMainInterfaceFile]; + [self writeInfoEntry: @"NSPrincipalClass" forKey: PCPrincipalClass]; + [self writeInfoEntry: @"GSHelpContentsFile" forKey: PCHelpFile]; + [infoDict setObject: @"Application" forKey: @"NSRole"]; + [infoDict setObject: [self convertExtensions] forKey: @"NSTypes"]; + [self writeInfoEntry: @"URL" forKey: PCURL]; - infoFile = [self dirForCategoryKey:PCOtherResources]; - infoFile = [infoFile stringByAppendingPathComponent:@"Info-gnustep.plist"]; + infoFile = [self dirForCategoryKey: PCOtherResources]; + infoFile = [infoFile stringByAppendingPathComponent: @"Info-gnustep.plist"]; - return [infoDict writeToFile:infoFile atomically:YES]; + return [infoDict writeToFile: infoFile atomically: YES]; } - (NSArray *)convertExtensions { - NSMutableArray *icons = [NSMutableArray arrayWithCapacity:1]; - NSMutableArray *extensions = [NSMutableArray arrayWithCapacity:1]; - NSArray *docIE = [projectDict objectForKey:PCDocumentExtensions]; + NSMutableArray *icons = [NSMutableArray arrayWithCapacity: 1]; + NSMutableArray *extensions = [NSMutableArray arrayWithCapacity: 1]; + NSArray *docIE = [projectDict objectForKey: PCDocumentExtensions]; NSEnumerator *enumerator = [docIE objectEnumerator]; NSDictionary *anObject; NSMutableArray *resArray = [[NSMutableArray alloc] init]; - NSMutableDictionary *tmpDict = [NSMutableDictionary dictionaryWithCapacity:1]; + NSMutableDictionary *tmpDict = [NSMutableDictionary dictionaryWithCapacity: 1]; NSString *ic; NSArray *ex; while ((anObject = [enumerator nextObject])) { - [icons addObject:[anObject objectForKey:@"Icon"]]; - [extensions addObject:[anObject objectForKey:@"Extension"]]; + [icons addObject: [anObject objectForKey: @"Icon"]]; + [extensions addObject: [anObject objectForKey: @"Extension"]]; } // At this point we have 2 arrays; 1 list of icons and 2 list of extensions. @@ -372,18 +373,18 @@ NSMutableDictionary *tdict; NSString *tic; - ic = [icons objectAtIndex:0]; - ex = [NSMutableArray arrayWithObject:[extensions objectAtIndex:0]]; + ic = [icons objectAtIndex: 0]; + ex = [NSMutableArray arrayWithObject: [extensions objectAtIndex: 0]]; for (i = 0; i < [resArray count]; i++) { - tdict = [resArray objectAtIndex:i]; - tic = [tdict objectForKey:@"NSIcon"]; + tdict = [resArray objectAtIndex: i]; + tic = [tdict objectForKey: @"NSIcon"]; - if([tic isEqualToString:ic]) + if([tic isEqualToString: ic]) { - [[tdict objectForKey:@"NSUnixExtensions"] - addObject:[ex objectAtIndex:0]]; + [[tdict objectForKey: @"NSUnixExtensions"] + addObject: [ex objectAtIndex: 0]]; loaded = YES; continue; } @@ -391,15 +392,15 @@ if (!loaded) { - [tmpDict setObject:ic forKey:@"NSIcon"]; - [tmpDict setObject:ex forKey:@"NSUnixExtensions"]; + [tmpDict setObject: ic forKey: @"NSIcon"]; + [tmpDict setObject: ex forKey: @"NSUnixExtensions"]; - [resArray addObject:[tmpDict copy]]; + [resArray addObject: [tmpDict copy]]; } [tmpDict removeAllObjects]; - [icons removeObjectAtIndex:0]; - [extensions removeObjectAtIndex:0]; + [icons removeObjectAtIndex: 0]; + [extensions removeObjectAtIndex: 0]; } return resArray; @@ -420,56 +421,56 @@ [super writeMakefile]; // Save GNUmakefile.preamble - [mf createPreambleForProject:self]; + [mf createPreambleForProject: self]; // Create the new file - [mf createMakefileForProject:projectName]; + [mf createMakefileForProject: projectName]; // Head (Application) - [self appendHead:mf]; + [self appendHead: mf]; // Subprojects - if ([[projectDict objectForKey:PCSubprojects] count] > 0) + if ([[projectDict objectForKey: PCSubprojects] count] > 0) { - [mf appendSubprojects:[projectDict objectForKey:PCSubprojects]]; + [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]; + 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]; + resourceItem = [resources objectAtIndex: j]; if ([[resourceItem pathComponents] count] == 1) { - resourceItem = [NSString stringWithFormat:@"Resources/%@", + resourceItem = [NSString stringWithFormat: @"Resources/%@", resourceItem]; } - [resources replaceObjectAtIndex:j - withObject:resourceItem]; + [resources replaceObjectAtIndex: j + withObject: resourceItem]; } - [mf appendResourceItems:resources]; + [mf appendResourceItems: resources]; [resources release]; } - [mf appendHeaders:[projectDict objectForKey:PCHeaders]]; - [mf appendClasses:[projectDict objectForKey:PCClasses]]; - [mf appendOtherSources:[projectDict objectForKey:PCOtherSources]]; + [mf appendHeaders: [projectDict objectForKey: PCHeaders]]; + [mf appendClasses: [projectDict objectForKey: PCClasses]]; + [mf appendOtherSources: [projectDict objectForKey: PCOtherSources]]; // Tail - [self appendTail:mf]; + [self appendTail: mf]; // Write the new file to disc! - mfl = [projectPath stringByAppendingPathComponent:@"GNUmakefile"]; + mfl = [projectPath stringByAppendingPathComponent: @"GNUmakefile"]; if ((mfd = [mf encodedMakefile])) { - if ([mfd writeToFile:mfl atomically:YES]) + if ([mfd writeToFile: mfl atomically: YES]) { return YES; } @@ -478,42 +479,42 @@ return NO; } -- (void)appendHead:(PCMakefileFactory *)mff +- (void)appendHead: (PCMakefileFactory *)mff { - NSString *installDir = [projectDict objectForKey:PCInstallDir]; + NSString *installDir = [projectDict objectForKey: PCInstallDir]; - [mff appendString:@"\n#\n# Application\n#\n"]; - [mff appendString:[NSString stringWithFormat:@"VERSION = %@\n", - [projectDict objectForKey:PCRelease]]]; - [mff appendString: - [NSString stringWithFormat:@"PACKAGE_NAME = %@\n", projectName]]; - [mff appendString: - [NSString stringWithFormat:@"APP_NAME = %@\n", projectName]]; + [mff appendString: @"\n#\n# Application\n#\n"]; + [mff appendString: [NSString stringWithFormat: @"VERSION = %@\n", + [projectDict objectForKey: PCRelease]]]; + [mff appendString: + [NSString stringWithFormat: @"PACKAGE_NAME = %@\n", projectName]]; + [mff appendString: + [NSString stringWithFormat: @"APP_NAME = %@\n", projectName]]; - [mff appendString:[NSString stringWithFormat:@"%@_APPLICATION_ICON = %@\n", - projectName, [projectDict objectForKey:PCAppIcon]]]; + [mff appendString: [NSString stringWithFormat: @"%@_APPLICATION_ICON = %@\n", + projectName, [projectDict objectForKey: PCAppIcon]]]; - if ([installDir isEqualToString:@""]) + if ([installDir isEqualToString: @""]) { - [mff appendString: - [NSString stringWithFormat:@"%@_STANDARD_INSTALL = no\n", + [mff appendString: + [NSString stringWithFormat: @"%@_STANDARD_INSTALL = no\n", projectName]]; } else { - [mff appendString: - [NSString stringWithFormat:@"GNUSTEP_INSTALLATION_DIR = %@\n", + [mff appendString: + [NSString stringWithFormat: @"GNUSTEP_INSTALLATION_DIR = %@\n", installDir]]; } } -- (void)appendTail:(PCMakefileFactory *)mff +- (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)/application.make\n"]; - [mff appendString:@"-include GNUmakefile.postamble\n"]; + [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)/application.make\n"]; + [mff appendString: @"-include GNUmakefile.postamble\n"]; } @end diff --git a/PCInfoController.m b/PCInfoController.m index c4559aa..57f7893 100644 --- a/PCInfoController.m +++ b/PCInfoController.m @@ -1,5 +1,5 @@ /* - GNUstep ProjectCenter - http://www.gnustep.org + GNUstep ProjectCenter - http: //www.gnustep.org Copyright (C) 2001 Free Software Foundation @@ -28,23 +28,23 @@ @implementation PCInfoController -- (id)init +- (id) init { if ((self = [super init])) { NSString *file; - file = [[NSBundle mainBundle] pathForResource:@"Info-gnustep" - ofType:@"plist"]; + file = [[NSBundle mainBundle] pathForResource: @"Info-gnustep" + ofType: @"plist"]; - infoDict = [NSDictionary dictionaryWithContentsOfFile:file]; + infoDict = [NSDictionary dictionaryWithContentsOfFile: file]; RETAIN(infoDict); } return self; } -- (void)dealloc +- (void) dealloc { RELEASE(infoDict); @@ -56,17 +56,17 @@ [super dealloc]; } -- (void)showInfoWindow:(id)sender +- (void) showInfoWindow: (id)sender { #if defined(GNUSTEP) if (!infoWindow) { - infoWindow = [[GSInfoPanel alloc] initWithDictionary:infoDict]; + infoWindow = [[GSInfoPanel alloc] initWithDictionary: infoDict]; } - [infoWindow setTitle:@"Info"]; + [infoWindow setTitle: @"Info"]; [infoWindow center]; - [infoWindow makeKeyAndOrderFront:self]; + [infoWindow makeKeyAndOrderFront: self]; #else NSRunAlertPanel(@"Info", @"OPENSTEP has no support for GSInfoPanel",