From 6781fde41fbbe8cefd2f2baedac7310552a458a2 Mon Sep 17 00:00:00 2001 From: Sergii Stoian Date: Thu, 1 Jul 2004 11:36:33 +0000 Subject: [PATCH] PCProject bugfixes git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@19661 72102866-910b-0410-8b05-ffd578937521 --- Library/PCBuildPanel.m | 12 +++---- Library/PCEditor.m | 2 +- Library/PCFileManager.m | 4 +-- Library/PCLaunchPanel.m | 8 ++--- Library/PCProject.h | 4 +-- Library/PCProject.m | 62 +++++++++++++++++----------------- Library/PCProjectBrowser.m | 15 +++----- Library/PCProjectBuilder.m | 6 ++-- Library/PCProjectInspector.m | 4 +-- Library/PCProjectLauncher.m | 2 +- Library/PCProjectLoadedFiles.m | 4 +-- Library/PCProjectManager.m | 22 ++++++------ Library/PCProjectWindow.m | 10 +++--- 13 files changed, 74 insertions(+), 81 deletions(-) diff --git a/Library/PCBuildPanel.m b/Library/PCBuildPanel.m index 153869d..543823f 100644 --- a/Library/PCBuildPanel.m +++ b/Library/PCBuildPanel.m @@ -104,19 +104,19 @@ [contentBox display]; } - PCLogInfo(self, @"orderFront: %@ -> %@", - builderView, [builderView superview]); +/* PCLogInfo(self, @"orderFront: %@ -> %@", + builderView, [builderView superview]);*/ [super orderFront:self]; } - (void)close { - PCLogInfo(self, @"close: %@", [contentBox contentView]); +// PCLogInfo(self, @"close: %@", [contentBox contentView]); [contentBox setContentView:emptyBox]; - PCLogInfo(self, @"close: %@", [contentBox contentView]); +// PCLogInfo(self, @"close: %@", [contentBox contentView]); [super close]; } @@ -132,8 +132,8 @@ currentProject = rootProject; - PCLogInfo(self, @"activeProjectDidChange to: %@", - [rootProject projectName]); +/* PCLogInfo(self, @"activeProjectDidChange to: %@", + [rootProject projectName]);*/ if (!rootProject) { diff --git a/Library/PCEditor.m b/Library/PCEditor.m index ffcecc9..eddd2f3 100644 --- a/Library/PCEditor.m +++ b/Library/PCEditor.m @@ -38,7 +38,7 @@ NSRect rect; float windowWidth; - PCLogInfo(self, @"[_createWindow]"); +// PCLogInfo(self, @"[_createWindow]"); style = NSTitledWindowMask | NSClosableWindowMask diff --git a/Library/PCFileManager.m b/Library/PCFileManager.m index 5f8028a..3d22a18 100644 --- a/Library/PCFileManager.m +++ b/Library/PCFileManager.m @@ -209,13 +209,13 @@ static PCFileManager *_mgr = nil; NSDictionary *theCreator = [creators objectForKey:fileType]; NSString *key = [theCreator objectForKey:@"ProjectKey"]; - PCLogInfo(self, @"[createFile] %@", fileName); +// PCLogInfo(self, @"[createFile] %@", fileName); path = [projectManager fileManager:self willCreateFile:fileName withKey:key]; - PCLogInfo(self, @"creating file at %@", path); +// PCLogInfo(self, @"creating file at %@", path); // Create file if (path) diff --git a/Library/PCLaunchPanel.m b/Library/PCLaunchPanel.m index 364df75..8d0103b 100644 --- a/Library/PCLaunchPanel.m +++ b/Library/PCLaunchPanel.m @@ -104,19 +104,19 @@ [contentBox display]; } - PCLogInfo(self, @"orderFront: %@ -> %@", - launcherView, [launcherView superview]); +/* PCLogInfo(self, @"orderFront: %@ -> %@", + launcherView, [launcherView superview]);*/ [super orderFront:self]; } - (void)close { - PCLogInfo(self, @"close: %@", [contentBox contentView]); +// PCLogInfo(self, @"close: %@", [contentBox contentView]); [contentBox setContentView:emptyBox]; - PCLogInfo(self, @"close: %@", [contentBox contentView]); +// PCLogInfo(self, @"close: %@", [contentBox contentView]); [super close]; } diff --git a/Library/PCProject.h b/Library/PCProject.h index a1d73da..4c894d5 100644 --- a/Library/PCProject.h +++ b/Library/PCProject.h @@ -210,9 +210,9 @@ extern NSString *PCProjectDictDidSaveNotification; - (BOOL)hasChildrenAtCategoryPath:(NSString *)keyPath; - (NSString *)rootCategoryForCategoryPath:(NSString *)categoryPath; -- (NSString *)categoryForCategoryPath:(NSString *)categoryPath; +//- (NSString *)categoryForCategoryPath:(NSString *)categoryPath; - (NSString *)keyForRootCategoryInCategoryPath:(NSString *)categoryPath; -- (NSString *)keyForCategoryPath:(NSString *)categoryPath; +//- (NSString *)keyForCategoryPath:(NSString *)categoryPath; @end diff --git a/Library/PCProject.m b/Library/PCProject.m index 1197f64..9dac44a 100644 --- a/Library/PCProject.m +++ b/Library/PCProject.m @@ -127,7 +127,7 @@ NSString - (BOOL)close:(id)sender { - PCLogInfo(self, @"Closing %@ project", projectName); +// PCLogInfo(self, @"Closing %@ project", projectName); // Save visible windows and panels positions to project dictionary if (isSubproject == NO) @@ -283,7 +283,7 @@ NSString [projectFileDict setObject:windows forKey:@"PC_WINDOWS"]; [projectFileDict writeToFile:projectFile atomically:YES]; - PCLogInfo(self, @"Windows and geometries saved"); +// PCLogInfo(self, @"Windows and geometries saved"); return YES; } @@ -688,7 +688,7 @@ NSString complementaryDir = [self dirForCategoryKey:complementaryKey]; } - PCLogInfo(self, @"{%@} {addAndCopyFiles} %@", projectName, fileList); +// PCLogInfo(self, @"{%@} {addAndCopyFiles} %@", projectName, fileList); // Validate files while ((file = [fileEnum nextObject])) @@ -711,7 +711,7 @@ NSString } } - PCLogInfo(self, @"{addAndCopyFiles} %@", fileList); +// PCLogInfo(self, @"{addAndCopyFiles} %@", fileList); // Copy files if (![key isEqualToString:PCLibraries]) // Don't copy libraries @@ -724,7 +724,7 @@ NSString return NO; } - PCLogInfo(self, @"Complementary files: %@", complementaryFiles); +// PCLogInfo(self, @"Complementary files: %@", complementaryFiles); // Complementaries if (![fileManager copyFiles:complementaryFiles intoDirectory:complementaryDir]) @@ -835,8 +835,8 @@ NSString } } - PCLogInfo(self, @"{%@} move %@ to %@ category: %@", - projectName, fromPath, toPath, selectedCategory); +/* PCLogInfo(self, @"{%@} move %@ to %@ category: %@", + projectName, fromPath, toPath, selectedCategory);*/ if ([fm movePath:fromPath toPath:toPath handler:nil] == YES) { @@ -951,8 +951,14 @@ NSString // Key - the uppercase names located in PC.roject, e.g. "CLASS_FILES" - (NSString *)keyForCategory:(NSString *)category { - int index = [rootCategories indexOfObject:category]; + int index = -1; + if (![rootCategories containsObject:category]) + { + return nil; + } + + index = [rootCategories indexOfObject:category]; return [rootKeys objectAtIndex:index]; } @@ -1145,8 +1151,8 @@ NSString // Subproject in project but not loaded if ([[projectDict objectForKey:PCSubprojects] containsObject:name]) { - PCLogInfo(self, @"{%@}Searching for loaded subproject: %@", - projectName, name); +/* PCLogInfo(self, @"{%@}Searching for loaded subproject: %@", + projectName, name);*/ // Search for subproject with name among loaded subprojects for (i = 0; i < count; i++) { @@ -1165,8 +1171,8 @@ NSString spFile = [projectPath stringByAppendingPathComponent:name]; spFile = [spFile stringByAppendingPathExtension:@"subproj"]; spFile = [spFile stringByAppendingPathComponent:@"PC.project"]; - PCLogInfo(self, @"Not found! Load subproject: %@ at path: %@", - name, spFile); +/* PCLogInfo(self, @"Not found! Load subproject: %@ at path: %@", + name, spFile);*/ sp = [projectManager loadProjectAt:spFile]; if (sp) { @@ -1249,8 +1255,8 @@ NSString pathArray = [categoryPath componentsSeparatedByString:@"/"]; - PCLogInfo(self, @"{%@}{contentAtCategoryPath:} %@", - projectName, categoryPath); +/* PCLogInfo(self, @"{%@}{contentAtCategoryPath:} %@", + projectName, categoryPath);*/ // Click on /Category if ([pathArray count] == 2) @@ -1302,22 +1308,16 @@ NSString return [activeProject hasChildrenAtCategoryPath:categoryPath]; } - PCLogInfo(self, @"{%@} hasChildrenAtCategoryPath: %@", - [self projectName], categoryPath); - listEntry = [[categoryPath componentsSeparatedByString:@"/"] lastObject]; if ([rootCategories containsObject:listEntry]) { return YES; } - - category = [projectBrowser nameOfSelectedCategory]; - categoryKey = [self keyForCategory:category]; - if ([categoryKey isEqualToString:PCSubprojects] - && [[projectDict objectForKey:PCSubprojects] containsObject:listEntry]) - { - return YES; - } + + if ([[projectDict objectForKey:PCSubprojects] containsObject:listEntry]) + { + return YES; + } return NO; } @@ -1336,7 +1336,7 @@ NSString return [pathComponents objectAtIndex:1]; } -- (NSString *)categoryForCategoryPath:(NSString *)categoryPath +/*- (NSString *)categoryForCategoryPath:(NSString *)categoryPath { NSString *category = nil; NSString *key = nil; @@ -1375,7 +1375,7 @@ NSString } return category; -} +}*/ - (NSString *)keyForRootCategoryInCategoryPath:(NSString *)categoryPath { @@ -1392,16 +1392,16 @@ NSString category = [self rootCategoryForCategoryPath:categoryPath]; key = [self keyForCategory:category]; - PCLogInfo(self, @"{%@}(keyForRootCategoryInCategoryPath): %@ key:%@", - projectName, categoryPath, key); +/* PCLogInfo(self, @"{%@}(keyForRootCategoryInCategoryPath): %@ key:%@", + projectName, categoryPath, key);*/ return key; } -- (NSString *)keyForCategoryPath:(NSString *)categoryPath +/*- (NSString *)keyForCategoryPath:(NSString *)categoryPath { return [self keyForCategory:[self categoryForCategoryPath:categoryPath]]; -} +}*/ @end diff --git a/Library/PCProjectBrowser.m b/Library/PCProjectBrowser.m index 2f11379..b6e00f8 100644 --- a/Library/PCProjectBrowser.m +++ b/Library/PCProjectBrowser.m @@ -57,6 +57,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification"; [browser setTarget:self]; [browser setAction:@selector(click:)]; [browser setDoubleAction:@selector(doubleClick:)]; + [browser setRefusesFirstResponder:YES]; [browser loadColumnZero]; [[NSNotificationCenter defaultCenter] @@ -236,15 +237,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification"; return YES; } - // HACK!!! NSBrowser needs fixing!!! - while ((selectedColumn = [browser selectedColumn]) >= 0) - { - columnMatrix = [browser matrixInColumn:selectedColumn]; - [columnMatrix deselectAllCells]; - } - // End of HACK - - PCLogInfo(self, @"[setPath]: %@", path); +// PCLogInfo(self, @"[setPath]: %@", path); res = [browser setPath:path]; @@ -340,8 +333,8 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification"; filePath = [activeProject dirForCategoryKey:key]; filePath = [filePath stringByAppendingPathComponent:fileName]; - PCLogInfo(self, @"[click] category: %@ filePath: %@", - category, filePath); +/* PCLogInfo(self, @"[click] category: %@ filePath: %@", + category, filePath);*/ if ([activeProject isEditableCategory:category] && [fm fileExistsAtPath:filePath isDirectory:&isDir] && !isDir) diff --git a/Library/PCProjectBuilder.m b/Library/PCProjectBuilder.m index 82583ef..34ea0e3 100644 --- a/Library/PCProjectBuilder.m +++ b/Library/PCProjectBuilder.m @@ -357,7 +357,7 @@ { NSAssert(aProject, @"No project specified!"); - PCLogInfo(self, @"initWithProject %@", [aProject projectName]); +// PCLogInfo(self, @"initWithProject %@", [aProject projectName]); if ((self = [super init])) { @@ -390,8 +390,8 @@ [buildArgs release]; [makePath release]; - PCLogInfo(self, @"componentView RC: %i", [componentView retainCount]); - PCLogInfo(self, @"RC: %i", [self retainCount]); +// PCLogInfo(self, @"componentView RC: %i", [componentView retainCount]); +// PCLogInfo(self, @"RC: %i", [self retainCount]); [componentView release]; [super dealloc]; diff --git a/Library/PCProjectInspector.m b/Library/PCProjectInspector.m index adaad86..4862145 100644 --- a/Library/PCProjectInspector.m +++ b/Library/PCProjectInspector.m @@ -774,8 +774,8 @@ return; } - PCLogInfo(self, @"{%@} file name changed from: %@ to: %@", - [project projectName], fileName, [fileNameField stringValue]); +/* PCLogInfo(self, @"{%@} file name changed from: %@ to: %@", + [project projectName], fileName, [fileNameField stringValue]);*/ if ([project renameFile:fileName toFile:[fileNameField stringValue]] == NO) { diff --git a/Library/PCProjectLauncher.m b/Library/PCProjectLauncher.m index c26f309..a7d74cf 100644 --- a/Library/PCProjectLauncher.m +++ b/Library/PCProjectLauncher.m @@ -245,7 +245,7 @@ enum { fp = [fp stringByAppendingPathComponent:pn]; fp = [fp stringByAppendingPathComponent:dp]; - PCLogInfo(self, @"debug: %@", fp); +// PCLogInfo(self, @"debug: %@", fp); if ([fm isExecutableFileAtPath:fp] == NO) { diff --git a/Library/PCProjectLoadedFiles.m b/Library/PCProjectLoadedFiles.m index 059890d..b187105 100644 --- a/Library/PCProjectLoadedFiles.m +++ b/Library/PCProjectLoadedFiles.m @@ -226,7 +226,7 @@ - (void)doubleClick:(id)sender { // TODO: Open separate editor window for file - PCLogInfo(self, @"ProjectLoadedFiles doubleClick received"); +// PCLogInfo(self, @"ProjectLoadedFiles doubleClick received"); } // =========================================================================== @@ -245,7 +245,7 @@ return; } - PCLogInfo(self, @"File did open in project %@", [project projectName]); +// PCLogInfo(self, @"File did open in project %@", [project projectName]); filePath = [editor path]; diff --git a/Library/PCProjectManager.m b/Library/PCProjectManager.m index 0151ce5..9b96931 100644 --- a/Library/PCProjectManager.m +++ b/Library/PCProjectManager.m @@ -366,7 +366,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; { NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; - PCLogInfo(self, @"saveAllProjectsIfNeeded"); +// PCLogInfo(self, @"saveAllProjectsIfNeeded"); // If this method was called not by NSTimer, check if we should save projects if ([[defs objectForKey:SaveOnQuit] isEqualToString:@"YES"]) @@ -702,7 +702,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; return NO; } - PCLogInfo(self, @"save root project: %@", [rootProject projectName]); +// PCLogInfo(self, @"save root project: %@", [rootProject projectName]); // Save PC.project and the makefiles! if ([rootProject save] == NO) @@ -725,8 +725,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; files = [fileManager filesForAdd]; - PCLogInfo(self, @"[addProjectFiles] %@ to category: %@ of project %@", - files, categoryKey, [activeProject projectName]); +/* PCLogInfo(self, @"[addProjectFiles] %@ to category: %@ of project %@", + files, categoryKey, [activeProject projectName]);*/ // No files was selected if (!files) @@ -772,9 +772,9 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; project = activeProject; } - PCLogInfo(self, @"%@: %@ from %@", removeString, files, directory); +/* PCLogInfo(self, @"%@: %@ from %@", removeString, files, directory); PCLogInfo(self, @"[removeProjectFiles]:%@ KEY:%@", - [activeProject projectName], categoryKey); + [activeProject projectName], categoryKey);*/ if (files) { @@ -905,7 +905,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; NSEnumerator *enumerator = [loadedProjects objectEnumerator]; NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; - PCLogInfo(self, @"loaded %i projects", [loadedProjects count]); +// PCLogInfo(self, @"loaded %i projects", [loadedProjects count]); while ([loadedProjects count] > 0) { @@ -1093,7 +1093,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; - (BOOL)newSubproject { - PCLogInfo(self, @"newSubproject"); +// PCLogInfo(self, @"newSubproject"); if (!nsPanel) { @@ -1192,7 +1192,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; [subproject setSuperProject:activeProject]; [subproject setProjectManager:self]; - PCLogInfo(self, @"{createSubproject} add to %@", [activeProject projectName]); +// PCLogInfo(self, @"{createSubproject} add to %@", [activeProject projectName]); [activeProject addSubproject:subproject]; return subproject; @@ -1240,7 +1240,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; } } - PCLogInfo(self, @"{addSubproject} %@", files); +// PCLogInfo(self, @"{addSubproject} %@", files); if (![fileManager copyFiles:files intoDirectory:[activeProject projectPath]]) @@ -1255,7 +1255,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange"; spDict = [NSDictionary dictionaryWithContentsOfFile:pcProject]; spName = [spDict objectForKey:PCProjectName]; - PCLogInfo(self, @"{addSubproject} dir: %@ file: %@", spDir, pcProject); +// PCLogInfo(self, @"{addSubproject} dir: %@ file: %@", spDir, pcProject); [activeProject addSubprojectWithName:spName]; } diff --git a/Library/PCProjectWindow.m b/Library/PCProjectWindow.m index c88a7a0..adb4e41 100644 --- a/Library/PCProjectWindow.m +++ b/Library/PCProjectWindow.m @@ -266,7 +266,7 @@ pcWindows = [[project projectDict] objectForKey:@"PC_WINDOWS"]; windowFrame = [pcWindows objectForKey:@"ProjectWindow"]; - PCLogInfo(self, @"window frame %@", windowFrame); +// PCLogInfo(self, @"window frame %@", windowFrame); if (windowFrame != nil) { PCLogStatus(self, @"PCProjectWindow: set frame from project"); @@ -547,7 +547,7 @@ NSPanel *panel = [[project projectManager] loadedFilesPanel]; NSScrollView *componentView = [[project projectLoadedFiles] componentView]; - PCLogInfo(self, @"showProjectLoadedFiles"); +// PCLogInfo(self, @"showProjectLoadedFiles"); if ([self hasLoadedFilesView]) { @@ -840,7 +840,7 @@ - (void)makeKeyAndOrderFront:(id)sender { - PCLogInfo(self, @"makeKeyAndOrderFront sender: %@", [sender className]); +// PCLogInfo(self, @"makeKeyAndOrderFront sender: %@", [sender className]); [projectWindow makeKeyAndOrderFront:nil]; } @@ -896,8 +896,8 @@ [projectWindow makeMainWindow]; // [projectWindow makeFirstResponder:(NSResponder *)firstResponder]; - PCLogInfo(self, @"windowDidBecomeKey: activeSubproject %@", - [[project activeSubproject] projectName]); +/* PCLogInfo(self, @"windowDidBecomeKey: activeSubproject %@", + [[project activeSubproject] projectName]);*/ if ([[project projectManager] rootActiveProject] != project) {