removed PCFindController and PCFileManager+UInterface;PCLogController implemented and used

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/branches/UNSTABLE_0_4@19266 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2004-05-08 11:15:39 +00:00
parent cbcd1df04e
commit a5fa5174c1
26 changed files with 298 additions and 498 deletions

View file

@ -26,6 +26,7 @@ SUBPROJECTS = \
#
ProjectCenter_RESOURCE_FILES = \
Resources/ProjectCenter.gorm \
Resources/LogPanel.gorm \
ProjectCenterInfo.plist \
Images/ProjectCenter.tiff \
Images/ButtonTile.tiff \

View file

@ -28,6 +28,8 @@
#include "ProjectEditor.h"
#include "ProjectDebugger.h"
#include "PCLogController.h"
@interface PCBundleLoader (PrivateLoader)
- (void)loadAdditionalBundlesAt:(NSString *)path;
@ -42,26 +44,25 @@
NSAssert(path,@"No valid bundle path specified!");
#ifdef DEBUG
NSLog([NSString stringWithFormat:@"Loading bundle %@...",path]);
#endif// DEBUG
PCLogInfo(self, @"Loading bundle %@...", path);
if ((bundle = [NSBundle bundleWithPath:path]))
{
[loadedBundles addObject:bundle];
PCLogInfo(self, @"Bundle %@ successfully loaded!", path);
#ifdef DEBUG
NSLog([NSString stringWithFormat:@"Bundle %@ successfully loaded!",path]);
#endif// DEBUG
if (delegate && [delegate respondsToSelector:@selector(bundleLoader: didLoadBundle:)])
if (delegate
&&
[delegate respondsToSelector:@selector(bundleLoader:didLoadBundle:)])
{
[delegate bundleLoader:self didLoadBundle:bundle];
}
}
else
{
NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path);
NSRunAlertPanel(@"Attention!",
@"Could not load %@!",
@"OK",nil,nil,path);
}
}
@ -127,17 +128,16 @@
[[NSUserDefaults standardUserDefaults] synchronize];
}
#ifdef DEBUG
if (![[NSFileManager defaultManager] fileExistsAtPath: path])
{
NSLog([NSString stringWithFormat: @"No third party bundles at %@", path]);
PCLogInfo(self, @"No third party bundles at %@", path);
return;
}
else
{
NSLog([NSString stringWithFormat: @"Loading bundles at %@", path]);
PCLogInfo(self, @"Loading bundles at %@", path);
}
#endif// DEBUG
[self loadBundlesAtPath: path];
}

View file

@ -14,6 +14,8 @@
#include "PCEditorView.h"
#include "ProjectComponent.h"
#include "PCLogController.h"
@implementation PCEditor (UInterface)
- (void)_createWindow
@ -22,7 +24,7 @@
NSRect rect;
float windowWidth;
NSLog(@"PCEditor: _createWindow");
PCLogInfo(self, @"[_createWindow]");
style = NSTitledWindowMask
| NSClosableWindowMask

View file

@ -26,6 +26,8 @@
#include "PCFileCreator.h"
#include "PCProject.h"
#include "PCLogController.h"
@implementation PCFileCreator
static PCFileCreator *_creator = nil;
@ -126,7 +128,7 @@ static NSDictionary *dict = nil;
// A class and possibly a header
files = [NSMutableDictionary dictionaryWithCapacity:2];
// NSLog(@"<%@ %x>: create %@ at %@",[self class],self,type,path);
PCLogStatus(self, @"create %@ at %@", type, path);
bundle = [NSBundle bundleForClass:[self class]];
newFile = [path copy];

View file

@ -1,41 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org
Copyright (C) 2000-2002 Free Software Foundation
Author: Philippe C.D. Robert <probert@siggraph.org>
This file is part of GNUstep.
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#include "PCFileManager.h"
#include "PCProjectManager.h"
#include "PCProject.h"
@interface PCFileManager (UInterface)
- (void)showNewFilePanel;
- (void)closeNewFilePanel:(id)sender;
- (void)createFile:(id)sender;
- (void)newFilePopupChanged:(id)sender;
- (void)_createAddFilesPanel;
- (NSMutableArray *)filesForAdd;
- (void)filesForAddPopupClicked:(id)sender;
@end

View file

@ -1,258 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org
Copyright (C) 2000-2002 Free Software Foundation
Author: Philippe C.D. Robert <probert@siggraph.org>
This file is part of GNUstep.
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#include "PCFileManager+UInterface.h"
#include "PCDefines.h"
#include <AppKit/AppKit.h>
@implementation PCFileManager (UInterface)
// -- "New File in Project" Panel
- (void)showNewFilePanel
{
if (!newFilePanel)
{
if ([NSBundle loadNibNamed:@"NewFile" owner:self] == NO)
{
NSLog(@"PCFileManager: error loading NewFile NIB!");
return;
}
[newFilePanel setFrameAutosaveName:@"NewFile"];
if (![newFilePanel setFrameUsingName: @"NewFile"])
{
[newFilePanel center];
}
[newFilePanel center];
[nfImage setImage:[NSApp applicationIconImage]];
[nfTypePB setRefusesFirstResponder:YES];
[nfTypePB removeAllItems];
[nfTypePB addItemsWithTitles:
[[creators allKeys]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];
[nfTypePB selectItemAtIndex:0];
[nfCancleButton setRefusesFirstResponder:YES];
[nfCreateButton setRefusesFirstResponder:YES];
}
[self newFilePopupChanged:nfTypePB];
[newFilePanel makeKeyAndOrderFront:self];
[nfNameField setStringValue:@""];
[newFilePanel makeFirstResponder:nfNameField];
}
- (void)closeNewFilePanel:(id)sender
{
[newFilePanel orderOut:self];
}
- (void)createFile:(id)sender
{
[self createFile];
[self closeNewFilePanel:self];
}
- (void)newFilePopupChanged:(id)sender
{
NSString *type = [sender titleOfSelectedItem];
if (type)
{
[nfDescriptionTV setString:
[[creators objectForKey:type] objectForKey:@"TypeDescription"]];
}
}
- (void)controlTextDidChange:(NSNotification *)aNotif
{
if ([aNotif object] != nfNameField)
{
return;
}
// TODO: Add check for valid file names
if ([[nfNameField stringValue] length] > 0)
{
[nfCreateButton setEnabled:YES];
}
else
{
[nfCreateButton setEnabled:NO];
}
}
// --- "Add Files..." panel
- (void)_createAddFilesPanel
{
if (addFilesPanel == nil)
{
NSRect fr = NSMakeRect(20,30,160,21);
PCProject *project = [projectManager activeProject];
// File type popup
fileTypePopup = [[NSPopUpButton alloc] initWithFrame:fr pullsDown:NO];
[fileTypePopup setAutoenablesItems:NO];
[fileTypePopup setTarget:self];
[fileTypePopup setAction:@selector(filesForAddPopupClicked:)];
[fileTypePopup addItemsWithTitles:[project rootCategories]];
[fileTypePopup selectItemAtIndex:0];
fileTypeAccessaryView = [[NSBox alloc] init];
[fileTypeAccessaryView setTitle:@"File Types"];
[fileTypeAccessaryView setTitlePosition:NSAtTop];
[fileTypeAccessaryView setBorderType:NSGrooveBorder];
[fileTypeAccessaryView addSubview:fileTypePopup];
[fileTypeAccessaryView sizeToFit];
[fileTypeAccessaryView setAutoresizingMask:NSViewMinXMargin
| NSViewMaxXMargin];
RELEASE(fileTypePopup);
// Panel
addFilesPanel = [NSOpenPanel openPanel];
[addFilesPanel setAllowsMultipleSelection:YES];
[addFilesPanel setCanChooseFiles:YES];
[addFilesPanel setCanChooseDirectories:NO];
[addFilesPanel setDelegate:self];
[addFilesPanel setAccessoryView:fileTypeAccessaryView];
}
}
- (NSMutableArray *)filesForAdd
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *lastOpenDir = [ud objectForKey:@"LastOpenDirectory"];
int retval;
PCProject *project = [projectManager activeProject];
[self _createAddFilesPanel];
[fileTypePopup selectItemWithTitle:[project selectedRootCategory]];
[self filesForAddPopupClicked:self];
if (!lastOpenDir)
{
lastOpenDir = NSHomeDirectory();
}
retval = [addFilesPanel runModalForDirectory:lastOpenDir
file:nil
types:nil];
if (retval == NSOKButton)
{
[ud setObject:[addFilesPanel directory] forKey:@"LastOpenDirectory"];
return [[[addFilesPanel filenames] mutableCopy] autorelease];
}
return nil;
}
- (void)filesForAddPopupClicked:(id)sender
{
NSString *fileType = [fileTypePopup titleOfSelectedItem];
[addFilesPanel setTitle:[NSString stringWithFormat:@"Add %@",fileType]];
[addFilesPanel display];
}
// ============================================================================
// ==== NSOpenPanel and NSSavePanel delegate
// ============================================================================
// If file name already in project -- don't show it!
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
NSFileManager *fileManager = [NSFileManager defaultManager];
PCProject *project = [projectManager activeProject];
NSArray *fileTypes = nil;
NSString *fileType = nil;
NSString *categoryKey = nil;
BOOL isDir;
// NSLog(@"Panel should show %@", filename);
if ([fileManager fileExistsAtPath:filename isDirectory:&isDir] && isDir)
{
return YES;
}
if (sender != addFilesPanel)
{
NSLog(@"Sender is not our panel!");
return YES;
}
if (!(fileType = [fileTypePopup titleOfSelectedItem]))
{
NSLog(@"Selected File type is nil!");
return YES;
}
categoryKey = [project keyForCategory:fileType];
fileTypes = [project fileTypesForCategoryKey:categoryKey];
if (fileTypes == nil)
{
NSLog(@"Project file types is nil! Category: %@", categoryKey);
return YES;
}
// NSLog(@"%@ : %@", fileTypes, [filename pathExtension]);
if (fileTypes && [fileTypes containsObject:[filename pathExtension]])
{
NSString *filePath;
NSString *projectPath;
filePath = [[filename stringByDeletingLastPathComponent]
stringByResolvingSymlinksInPath];
projectPath = [[project projectPath] stringByResolvingSymlinksInPath];
// NSLog(@"Path: %@ | Project path: %@", filePath, projectPath);
if ([filePath isEqualToString:projectPath])
{
return NO;
}
return YES;
}
return NO;
}
// Test if we should accept file name selected or entered
- (BOOL)panel:(id)sender isValidFilename:(NSString *)filename
{
if ([[sender className] isEqualToString:@"NSOpenPanel"])
{
;
}
else if ([[sender className] isEqualToString:@"NSSavePanel"])
{
;
}
return YES;
}
@end

View file

@ -29,7 +29,7 @@
#include "PCProject.h"
#include "PCServer.h"
//#include "PCFileManager+UInterface.h"
#include "PCLogController.h"
@implementation PCFileManager
@ -202,13 +202,13 @@ static PCFileManager *_mgr = nil;
NSString *fileType = [nfTypePB titleOfSelectedItem];
NSString *key = [[creators objectForKey:fileType] objectForKey:@"ProjectKey"];
NSLog(@"FileManager: createFile %@", fileName);
PCLogInfo(self, @"[createFile] %@", fileName);
path = [projectManager fileManager:self
willCreateFile:fileName
withKey:key];
NSLog(@"<%@ %x>: creating file at %@", [self class], self, path);
PCLogInfo(self, @"creating file at %@", path);
// Create file
if (path)
@ -255,7 +255,7 @@ static PCFileManager *_mgr = nil;
{
if ([NSBundle loadNibNamed:@"NewFile" owner:self] == NO)
{
NSLog(@"PCFileManager: error loading NewFile NIB!");
PCLogError(self, @"error loading NewFile NIB!");
return;
}
[newFilePanel setFrameAutosaveName:@"NewFile"];
@ -430,7 +430,7 @@ static PCFileManager *_mgr = nil;
if (!(fileType = [fileTypePopup titleOfSelectedItem]))
{
NSLog(@"Selected File type is nil!");
PCLogWarning(self, @"Selected File type is nil!");
return YES;
}
@ -439,11 +439,11 @@ static PCFileManager *_mgr = nil;
fileTypes = [project fileTypesForCategoryKey:categoryKey];
if (fileTypes == nil)
{
NSLog(@"Project file types is nil! Category: %@", categoryKey);
PCLogWarning(self,
@"Project file types is nil! Category: %@", categoryKey);
return YES;
}
// NSLog(@"%@ : %@", fileTypes, [filename pathExtension]);
if (fileTypes && [fileTypes containsObject:[filename pathExtension]])
{
NSString *filePath;
@ -453,7 +453,6 @@ static PCFileManager *_mgr = nil;
stringByResolvingSymlinksInPath];
projectPath = [[project projectPath] stringByResolvingSymlinksInPath];
// NSLog(@"Path: %@ | Project path: %@", filePath, projectPath);
if ([filePath isEqualToString:projectPath])
{
return NO;

View file

@ -37,6 +37,8 @@
#include "PCProjectLauncher.h"
#include "PCEditor.h"
#include "PCLogController.h"
NSString
*PCProjectDictDidChangeNotification = @"PCProjectDictDidChangeNotification";
NSString
@ -79,11 +81,11 @@ NSString
projectPath = [path copy];
}
NSLog (@"PCProject initWithProjectDictionary");
PCLogStatus(self, @"initWithProjectDictionary");
if (![self assignProjectDict:dict])
{
NSLog(@"<%@ %x>: could not load the project...",[self class],self);
PCLogError(self, @"could not load the project...");
[self autorelease];
return nil;
}
@ -105,7 +107,7 @@ NSString
- (BOOL)close:(id)sender
{
NSLog(@"Closing %@ project", projectName);
PCLogInfo(self, @"Closing %@ project", projectName);
// Project files (GNUmakefile, PC.project etc.)
if (isSubproject == NO && [self isProjectChanged] == YES)
@ -233,7 +235,7 @@ NSString
}
[projectDict setObject:windows forKey:@"PC_WINDOWS"];
NSLog(@"Windows saved");
PCLogInfo(self, @"Windows saved");
return YES;
}
@ -332,7 +334,7 @@ NSString
NSString *_path = [[self projectBrowser] pathOfSelectedFile];
NSString *key = [self keyForCategoryPath:_path];
NSLog(@"PCProject: selected category: %@. key: %@", _path, key);
PCLogInfo(self, @"selected category: %@. key: %@", _path, key);
return key;
}
@ -619,7 +621,7 @@ NSString
return NO;
}
NSLog(@"Complementary files: %@", complementaryFiles);
PCLogInfo(self, @"Complementary files: %@", complementaryFiles);
// Complementaries
if (![fileManager copyFiles:complementaryFiles
intoDirectory:complementaryDir])
@ -718,7 +720,7 @@ NSString
toPath = [[self dirForCategoryKey:selectedCategoryKey]
stringByAppendingPathComponent:toFile];
NSLog(@"PCProject: move %@ to %@", fromPath, toPath);
PCLogInfo(self, @"move %@ to %@", fromPath, toPath);
if ([fm movePath:fromPath toPath:toPath handler:nil] == YES)
{
@ -768,7 +770,7 @@ NSString
[projectDict autorelease];
projectDict = [[NSMutableDictionary alloc] initWithDictionary:aDict];
NSLog (@"PCProject assignProjectDict");
PCLogInfo(self, @"assignProjectDict");
[self setProjectName:[projectDict objectForKey:PCProjectName]];
[self writeMakefile];
@ -1250,8 +1252,6 @@ NSString
NSString *category = nil;
NSString *key = nil;
// NSLog(@"PCP{%@}(keyForCategoryPath:) %@", projectName, categoryPath);
if (categoryPath == nil
|| [categoryPath isEqualToString:@""]
|| [categoryPath isEqualToString:@"/"])
@ -1262,7 +1262,8 @@ NSString
category = [self categoryForCategoryPath:categoryPath];
key = [self keyForCategory:category];
NSLog(@"PCP{%@}(keyForCategoryPath): %@ key:%@", projectName, category, key);
PCLogInfo(self, @"{%@}(keyForCategoryPath): %@ key:%@",
projectName, category, key);
return key;
}

View file

@ -29,6 +29,8 @@
#include "PCProjectEditor.h"
#include "PCProjectBrowser.h"
#include "PCLogController.h"
NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
@implementation PCProjectBrowser
@ -130,7 +132,7 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
[columnMatrix deselectAllCells];
}
NSLog(@"NSPB {setPath}: %@", path);
PCLogInfo(self, @"[setPath]: %@", path);
return [browser setPath:path];
}
@ -198,7 +200,8 @@ NSString *PCBrowserDidSetPathNotification = @"PCBrowserDidSetPathNotification";
stringByAppendingPathComponent:fileName];
}
NSLog(@"NSPB {click:} category: %@ filePath: %@", category, filePath);
PCLogInfo(self, @"[click] category: %@ filePath: %@",
category, filePath);
if ([project isEditableCategory:category]
|| [sp isEditableCategory:category])

View file

@ -29,6 +29,8 @@
#include "PCSplitView.h"
#include "PCButton.h"
#include "PCLogController.h"
#include <AppKit/AppKit.h>
#ifndef IMAGE
@ -356,7 +358,7 @@
{
NSAssert(aProject, @"No project specified!");
NSLog (@"PCProjectBuilder: initWithProject %@", [aProject projectName]);
PCLogInfo(self, @"initWithProject %@", [aProject projectName]);
if ((self = [super init]))
{
@ -494,7 +496,7 @@
// "waitpid 7045, result -1, error No child processes" is printed.
if (makeTask)
{
NSLog(@"task will terminate");
PCLogStatus(self, @"task will terminate");
[makeTask terminate];
return YES;
}

View file

@ -16,6 +16,8 @@
#include "PCEditorView.h"
#include "ProjectComponent.h"
#include "PCLogController.h"
NSString *PCEditorDidOpenNotification =
@"PCEditorDidOpenNotification";
NSString *PCEditorDidCloseNotification =
@ -106,7 +108,7 @@ NSString *PCEditorDidResignActiveNotification =
if (ret == NO)
{
NSLog(@"Could not open %@ using %@",path,app);
PCLogError(self, @"Could not open %@ using %@", path, app);
}
return nil;
@ -149,7 +151,7 @@ NSString *PCEditorDidResignActiveNotification =
if ((self = [super init]))
{
NSLog(@"PCProjectEditor: init");
PCLogStatus(self, @"[init]");
project = aProject;
componentView = nil;
editorsDict = [[NSMutableDictionary alloc] init];
@ -482,7 +484,7 @@ NSString *PCEditorDidResignActiveNotification =
if (categoryPath)
{
NSLog(@"PCPE: set browser path: %@", categoryPath);
PCLogInfo(self, @"set browser path: %@", categoryPath);
[[project projectBrowser] setPath:categoryPath];
}
}

View file

@ -29,6 +29,8 @@
#include "PCProjectWindow.h"
#include "PCProjectInspector.h"
#include "PCLogController.h"
@implementation PCFileNameField
- (void)setEditableField:(BOOL)yn
@ -146,7 +148,7 @@
{
if ([NSBundle loadNibNamed:@"ProjectInspector" owner:self] == NO)
{
NSLog(@"PCProjectInspector: error loading NIB file!");
PCLogError(self, @"error loading NIB file!");
return NO;
}
@ -296,8 +298,8 @@
project = [projectManager activeProject];
projectDict = [project projectDict];
NSLog (@"Active projectChanged to %@",
[[project projectDict] objectForKey:PCProjectName]);
PCLogStatus(self, @"Active projectChanged to %@",
[[project projectDict] objectForKey:PCProjectName]);
[inspectorPanel setTitle: [NSString stringWithFormat:
@"%@ - Project Inspector", [project projectName]]];
@ -366,7 +368,7 @@
if ([NSBundle loadNibNamed:@"BuildAttributes" owner:self] == NO)
{
NSLog(@"PCProjectInspector: error loading BuildAttributes NIB file!");
PCLogError(self, @"error loading BuildAttributes NIB file!");
return;
}
@ -493,8 +495,6 @@
{
NSString *value = [searchOrderTF stringValue];
NSLog(@"OTF:%@", value);
[searchItems addObject:value];
[searchOrderTF setStringValue:@""];
[self syncSearchOrder];
@ -533,7 +533,7 @@
if ([NSBundle loadNibNamed:@"ProjectDescription" owner:self] == NO)
{
NSLog(@"PCProjectInspector: error loading ProjectDescription NIB file!");
PCLogError(self, @"error loading ProjectDescription NIB file!");
return;
}
@ -668,7 +668,7 @@
if ([NSBundle loadNibNamed:@"FileAttributes" owner:self] == NO)
{
NSLog(@"PCProjectInspector: error loading ProjectDescription NIB file!");
PCLogError(self, @"error loading ProjectDescription NIB file!");
return;
}
@ -724,8 +724,8 @@
return;
}
NSLog(@"PCProjectInspector: file name changed from: %@ to: %@",
fileName, [fileNameField stringValue]);
PCLogInfo(self, @"file name changed from: %@ to: %@",
fileName, [fileNameField stringValue]);
if ([project renameFile:fileName toFile:[fileNameField stringValue]] == NO)
{

View file

@ -28,6 +28,8 @@
#include "PCProjectManager.h"
#include "PCButton.h"
#include "PCLogController.h"
#include <AppKit/AppKit.h>
#ifndef NOTIFICATION_CENTER
@ -315,7 +317,7 @@ enum {
// "waitpid 7045, result -1, error No child processes" is printed.
if (launchTask)
{
NSLog(@"task will terminate");
PCLogStatus(self, @"task will terminate");
[launchTask terminate];
return;
}

View file

@ -7,6 +7,8 @@
#include "PCProjectEditor.h"
#include "PCEditor.h"
#include "PCLogController.h"
#include "PCProjectLoadedFiles.h"
@implementation PCProjectLoadedFiles
@ -191,7 +193,7 @@
- (void)doubleClick:(id)sender
{
// TODO: Open separate editor window for file
NSLog(@"ProjectLoadedFiles doubleClick received");
PCLogInfo(self, @"ProjectLoadedFiles doubleClick received");
}
// ===========================================================================
@ -209,7 +211,7 @@
return;
}
NSLog(@"PCProjectLoadedFiles: project %@", [project projectName]);
PCLogInfo(self, @"File did open in project %@", [project projectName]);
filePath = [editor path];
@ -224,7 +226,7 @@
row = [[self editedFilesRep] indexOfObject:filePath];
[filesList selectRow:row byExtendingSelection:NO];
NSLog(@"PCProjectLoadedFiles: fileDidOpen.END");
PCLogInfo(self, @"fileDidOpen.END");
}
- (void)fileDidClose:(NSNotification *)aNotif
@ -234,7 +236,7 @@
if ([editor projectEditor] != [project projectEditor])
{
NSLog(@"File from other project closed");
PCLogWarning(self, @"File from other project closed");
return;
}

View file

@ -43,6 +43,8 @@
#include "ProjectType.h"
#include "ProjectBuilder.h"
#include "PCLogController.h"
#define SavePeriodDCN @"SavePeriodDidChangeNotification"
NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
@ -150,7 +152,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
- (NSDictionary *)preferencesDict
{
NSLog(@"Getting preferencesDict");
return [prefController preferencesDict];
}
@ -418,7 +419,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
if ((project = [projectCreator openProjectAt:aPath]))
{
NSLog (@"Project %@ loaded as %@", [projectCreator projectTypeName]);
PCLogStatus(self, @"Project %@ loaded as %@",
[project projectName], [projectCreator projectTypeName]);
return project;
}
@ -555,7 +557,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
return NO;
}
NSLog(@"PCPM: save root project: %@", [rootProject projectName]);
PCLogInfo(self, @"save root project: %@", [rootProject projectName]);
// Save PC.project and the makefiles!
if ([rootProject save] == NO)
@ -580,7 +582,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
files = [fileManager filesForAdd];
NSLog(@"PCPM {addProjectFiles} %@", files);
PCLogInfo(self, @"[addProjectFiles] %@", files);
// No files was selected
if (!files)
@ -646,9 +648,9 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
project = activeProject;
}
NSLog(@"%@: %@ from %@", removeString, files, directory);
NSLog(@"PCPM(removeProjectFiles):%@ KEY:%@ bPath:%@",
[activeProject projectName], categoryKey, bPath);
PCLogInfo(self, @"%@: %@ from %@", removeString, files, directory);
PCLogInfo(self, @"[removeProjectFiles]:%@ KEY:%@ bPath:%@",
[activeProject projectName], categoryKey, bPath);
if (files)
{
@ -767,7 +769,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
PCProject *project = nil;
NSEnumerator *enumerator = [loadedProjects objectEnumerator];
NSLog(@"ProjectManager: loaded %i projects", [loadedProjects count]);
PCLogInfo(self, @"loaded %i projects", [loadedProjects count]);
while ([loadedProjects count] > 0)
{
@ -950,13 +952,13 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
// --- New
- (BOOL)newSubproject
{
NSLog (@"newSubproject");
PCLogInfo(self, @"newSubproject");
if (!nsPanel)
{
if ([NSBundle loadNibNamed:@"NewSubproject" owner:self] == NO)
{
NSLog(@"PCProjectManager: error loading NewSubproject NIB!");
PCLogError(self, @"error loading NewSubproject NIB!");
return NO;
}
@ -1012,8 +1014,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
spPath = [[activeProject projectPath] stringByAppendingPathComponent:spName];
NSLog(@"ProjectManager: creating subproject with type %@ at path %@",
spType, spPath);
PCLogInfo(self, @"creating subproject with type %@ at path %@",
spType, spPath);
// Create subproject
subproject = [self createProjectOfType:spType path:spPath];

View file

@ -37,6 +37,8 @@
#include "PCProjectWindow.h"
#include "PCLogController.h"
@implementation PCProjectWindow
// ============================================================================
@ -84,7 +86,6 @@
[_c_view addSubview:toolbarView];
RELEASE(toolbarView);
// buildButton = [[PCButton alloc] initWithFrame: NSMakeRect(8,397,43,43)];
buildButton = [[PCButton alloc] initWithFrame: NSMakeRect(0,5,43,43)];
[buildButton setRefusesFirstResponder:YES];
[buildButton setTitle: @"Build"];
@ -93,12 +94,10 @@
[buildButton setAction: @selector(showProjectBuild:)];
[buildButton setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
[buildButton setButtonType: NSMomentaryPushButton];
// [_c_view addSubview: buildButton];
[toolbarView addSubview: buildButton];
[buildButton setShowTooltip:YES];
RELEASE (buildButton);
// launchButton = [[PCButton alloc] initWithFrame: NSMakeRect(52,397,43,43)];
launchButton = [[PCButton alloc] initWithFrame: NSMakeRect(44,5,43,43)];
[launchButton setRefusesFirstResponder:YES];
[launchButton setTitle: @"Launch/Debug"];
@ -107,12 +106,10 @@
[launchButton setAction: @selector(showProjectLaunch:)];
[launchButton setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
[launchButton setButtonType: NSMomentaryPushButton];
// [_c_view addSubview: launchButton];
[toolbarView addSubview: launchButton];
[launchButton setShowTooltip:YES];
RELEASE (launchButton);
// editorButton = [[PCButton alloc] initWithFrame: NSMakeRect(96,397,43,43)];
editorButton = [[PCButton alloc] initWithFrame: NSMakeRect(88,5,43,43)];
[editorButton setRefusesFirstResponder:YES];
[editorButton setTitle: @"Editor"];
@ -121,12 +118,10 @@
[editorButton setAction: @selector(showProjectEditor:)];
[editorButton setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
[editorButton setButtonType: NSMomentaryPushButton];
// [_c_view addSubview: editorButton];
[toolbarView addSubview: editorButton];
[editorButton setShowTooltip:YES];
RELEASE (editorButton);
// findButton = [[PCButton alloc] initWithFrame: NSMakeRect(140,397,43,43)];
findButton = [[PCButton alloc] initWithFrame: NSMakeRect(132,5,43,43)];
[findButton setRefusesFirstResponder:YES];
[findButton setTitle: @"Find"];
@ -135,21 +130,18 @@
[findButton setAction: @selector(showFindView:)];
[findButton setAutoresizingMask: (NSViewMaxXMargin | NSViewMinYMargin)];
[findButton setButtonType: NSMomentaryPushButton];
// [_c_view addSubview: findButton];
[toolbarView addSubview: findButton];
[findButton setShowTooltip:YES];
RELEASE (findButton);
// inspectorButton = [[PCButton alloc] initWithFrame: NSMakeRect(184,397,43,43)];
inspectorButton = [[PCButton alloc] initWithFrame: NSMakeRect(176,5,43,43)];
[inspectorButton setRefusesFirstResponder:YES];
[inspectorButton setTitle: @"Inspector"];
[inspectorButton setImage: IMAGE(@"Inspector")];
[inspectorButton setTarget: project];
[inspectorButton setAction: @selector(showInspector:)];
[inspectorButton setTarget: [project projectManager]];
[inspectorButton setAction: @selector(showProjectInspector:)];
[inspectorButton setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)];
[inspectorButton setButtonType: NSMomentaryPushButton];
// [_c_view addSubview: inspectorButton];
[toolbarView addSubview: inspectorButton];
[inspectorButton setShowTooltip:YES];
RELEASE (inspectorButton);
@ -158,17 +150,14 @@
/*
* File icon and title
*/
// fileIcon = [[NSImageView alloc] initWithFrame: NSMakeRect (504,391,48,48)];
fileIcon = [[NSImageView alloc] initWithFrame: NSMakeRect (496,0,48,48)];
[fileIcon setRefusesFirstResponder:YES];
[fileIcon setAutoresizingMask: (NSViewMinXMargin | NSViewMinYMargin)];
[fileIcon setImage: IMAGE (@"projectSuitcase")];
// [_c_view addSubview: fileIcon];
[toolbarView addSubview: fileIcon];
RELEASE (fileIcon);
fileIconTitle = [[NSTextField alloc]
// initWithFrame: NSMakeRect (316,395,180,21)];
initWithFrame: NSMakeRect (308,4,180,21)];
[fileIconTitle setAutoresizingMask: (NSViewMinXMargin
| NSViewMinYMargin
@ -178,7 +167,6 @@
[fileIconTitle setDrawsBackground: NO];
[fileIconTitle setAlignment:NSRightTextAlignment];
[fileIconTitle setBezeled:NO];
// [_c_view addSubview: fileIconTitle];
[toolbarView addSubview: fileIconTitle];
RELEASE (fileIconTitle);
@ -205,24 +193,21 @@
/*
* Vertical split view
*/
/* if (![[prefsDict objectForKey:@"SeparateLoadedFiles"] isEqualToString:@"YES"])
{*/
rect = [[projectWindow contentView] frame];
if (h_split)
{
rect.size.height = 130;
}
else
{
rect.size.height -= 64;
rect.size.width -= 16;
rect.origin.x += 8;
rect.origin.y = 0;
}
v_split = [[PCSplitView alloc] initWithFrame:rect];
[v_split setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[v_split setVertical:YES];
// }
rect = [[projectWindow contentView] frame];
if (h_split)
{
rect.size.height = 130;
}
else
{
rect.size.height -= 64;
rect.size.width -= 16;
rect.origin.x += 8;
rect.origin.y = 0;
}
v_split = [[PCSplitView alloc] initWithFrame:rect];
[v_split setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
[v_split setVertical:YES];
/*
* File Browser
@ -307,10 +292,10 @@
pcWindows = [[project projectDict] objectForKey:@"PC_WINDOWS"];
windowFrame = [pcWindows objectForKey:@"ProjectWindow"];
NSLog(@"PCProjectWindow: window frame %@", windowFrame);
PCLogInfo(self, @"window frame %@", windowFrame);
if (windowFrame != nil)
{
NSLog(@"PCProjectWindow: set frame from project");
PCLogStatus(self, @"PCProjectWindow: set frame from project");
[projectWindow setFrameFromString:windowFrame];
}
else if (![projectWindow setFrameUsingName: @"ProjectWindow"])
@ -740,7 +725,7 @@
- (void)makeKeyAndOrderFront:(id)sender
{
NSLog(@"PCPW: makeKeyAndOrderFront sender: %@", [sender className]);
PCLogInfo(self, @"makeKeyAndOrderFront sender: %@", [sender className]);
[projectWindow makeKeyAndOrderFront:nil];
}

View file

@ -27,8 +27,8 @@
#include <AppKit/AppKit.h>
#include "PCPrefController.h"
#include "PCInfoController.h"
#include "PCPrefController.h"
#include "PCLogController.h"
@class PCServer;

View file

@ -61,7 +61,8 @@
[defaults setObject:@"YES" forKey:ExternalEditor];
[defaults setObject:@"YES" forKey:ExternalDebugger];
[defaults setObject:[NSString stringWithFormat:@"%@/PCBuildDir",NSTemporaryDirectory()] forKey:RootBuildDirectory];
[defaults setObject:[NSString stringWithFormat:@"%@/PCBuildDir",NSTemporaryDirectory()]
forKey:RootBuildDirectory];
[defaults setObject:@"YES" forKey:SaveOnQuit];
[defaults setObject:@"YES" forKey:PromptOnClean];
@ -81,7 +82,7 @@
{
infoController = [[PCInfoController alloc] init];
prefController = [[PCPrefController alloc] init];
logController = [[PCLogController alloc] init];
logController = [PCLogController sharedLogController];
projectManager = [[PCProjectManager alloc] init];
[projectManager setDelegate:self];
@ -178,11 +179,10 @@
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
NSString *h = [[NSProcessInfo processInfo] hostName];
NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter:%@",h];
NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter"];
[logController
logMessage:@"Loading additional subsystems..." tag:INFORMATION];
logMessage:@"Loading additional subsystems..." withTag:INFO sender:self];
doServer = [[PCServer alloc] init];
@ -193,8 +193,10 @@
NS_HANDLER
NSRunAlertPanel(@"Warning!",@"Could not register the DO connection %@",
@"OK",nil,nil,nil,connectionName);
NSRunAlertPanel(@"Warning!",
@"Could not register the DO connection %@",
@"OK",nil,nil,nil,
connectionName);
NS_ENDHANDLER
[[NSNotificationCenter defaultCenter] addObserver:doServer

View file

@ -1,36 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org
Copyright (C) 2001 Free Software Foundation
Author: Philippe C.D. Robert <probert@siggraph.org>
This file is part of GNUstep.
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#ifndef _PCFINDCONTROLLER_H
#define _PCFINDCONTROLLER_H
#include <AppKit/AppKit.h>
@interface PCFindController : NSObject
{
}
@end
#endif

View file

@ -1,29 +0,0 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org
Copyright (C) 2001 Free Software Foundation
Author: Philippe C.D. Robert <probert@siggraph.org>
This file is part of GNUstep.
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#include "PCFindController.h"
@implementation PCFindController
@end

View file

@ -27,14 +27,37 @@
#include <AppKit/AppKit.h>
#define INFORMATION 0
#define WARNING 1
#define INFO 0
#define STATUS 1
#define WARNING 2
#define ERROR 3
// --- Functions
void
PCLog(id sender, int tag, NSString* format, va_list args);
void
PCLogInfo(id sender, NSString* format, ...);
void
PCLogStatus(id sender, NSString* format, ...);
void
PCLogWarning(id sender, NSString* format, ...);
void
PCLogError(id sender, NSString* format, ...);
@interface PCLogController : NSObject
{
IBOutlet NSPanel *panel;
IBOutlet NSTextView *textView;
NSMutableDictionary *textAttributes;
}
- (void)logMessage:(NSString *)message tag:(int)tag;
+ (PCLogController *)sharedLogController;
- (void)showLogPanel;
- (void)logMessage:(NSString *)message withTag:(int)tag sender:(id)sender;
- (void)putMessageOnScreen:(NSAttributedString *)message;
@end

View file

@ -24,28 +24,157 @@
#include "PCLogController.h"
void
PCLog(id sender, int tag, NSString* format, va_list args)
{
[[PCLogController sharedLogController]
logMessage:[NSString stringWithFormat:format arguments: args]
withTag:tag
sender:sender];
}
void
PCLogInfo(id sender, NSString* format, ...)
{
va_list ap;
va_start(ap, format);
PCLog(sender, INFO, format, ap);
va_end(ap);
}
void
PCLogStatus(id sender, NSString* format, ...)
{
va_list ap;
va_start(ap, format);
PCLog(sender, STATUS, format, ap);
va_end(ap);
}
void
PCLogWarning(id sender, NSString* format, ...)
{
va_list ap;
va_start(ap, format);
PCLog(sender, WARNING, format, ap);
va_end(ap);
}
void
PCLogError(id sender, NSString* format, ...)
{
va_list ap;
va_start(ap, format);
PCLog(sender, ERROR, format, ap);
va_end(ap);
}
@implementation PCLogController
- (void)logMessage:(NSString *)message tag:(int)tag;
// ===========================================================================
// ==== Class methods
// ===========================================================================
static PCLogController *_logCtrllr = nil;
+ (PCLogController *)sharedLogController
{
NSString *_log;
switch (tag)
if (!_logCtrllr)
{
case 0:
_log = [NSString stringWithFormat:@"Information from <%@: %x - %x>: %@",[self class],self,[NSThread currentThread],message];
break;
case 1:
_log = [NSString stringWithFormat:@"Warning from <%@: %x - %x>: %@",[self class],self,[NSThread currentThread],message];
break;
default:
break;
_logCtrllr = [[PCLogController alloc] init];
}
// Later we redirect this to our own output.
NSLog(message);
return _logCtrllr;
}
// ===========================================================================
// ==== Init and free
// ===========================================================================
- (id)init
{
NSFont *font = nil;
if (!(self = [super init]))
{
return nil;
}
if ([NSBundle loadNibNamed:@"LogPanel" owner:self] == NO)
{
NSLog(@"PCLogController[init]: error loading NIB file!");
return nil;
}
font = [NSFont userFixedPitchFontOfSize: 10.0];
textAttributes =
[NSMutableDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
[textAttributes retain];
return self;
}
- (void)dealloc
{
NSLog(@"PCLogController: dealloc");
RELEASE(textAttributes);
}
- (void)showLogPanel
{
[panel orderFront:self];
}
- (void)logMessage:(NSString *)text withTag:(int)tag sender:(id)sender;
{
NSString *messageText = nil;
NSAttributedString *message = nil;
messageText =
[NSString stringWithFormat:@" %@: %@\n",[sender className],text];
switch (tag)
{
case INFO:
[textAttributes
setObject:[NSColor colorWithDeviceRed:.0 green:.0 blue:.0 alpha:1.0]
forKey:NSForegroundColorAttributeName];
break;
case STATUS:
[textAttributes
setObject:[NSColor colorWithDeviceRed:.0 green:.35 blue:.0 alpha:1.0]
forKey:NSForegroundColorAttributeName];
break;
case WARNING:
[textAttributes
setObject:[NSColor colorWithDeviceRed:.56 green:.45 blue:.0 alpha:1.0]
forKey:NSForegroundColorAttributeName];
break;
case ERROR:
[textAttributes
setObject:[NSColor colorWithDeviceRed:.63 green:.0 blue:.0 alpha:1.0]
forKey:NSForegroundColorAttributeName];
break;
default:
break;
}
message = [[NSAttributedString alloc] initWithString:messageText
attributes:textAttributes];
[self putMessageOnScreen:message];
}
- (void)putMessageOnScreen:(NSAttributedString *)message
{
[[textView textStorage] appendAttributedString:message];
[textView scrollRangeToVisible:NSMakeRange([[textView string] length], 0)];
}
@end

View file

@ -56,6 +56,7 @@
// Info
- (void)showInfoPanel:(id)sender;
- (void)showPrefWindow:(id)sender;
- (void)showLogPanel:(id)sender;
// Project
- (void)projectOpen:(id)sender;

View file

@ -87,6 +87,11 @@
[[[projectManager activeProject] projectWindow] showProjectEditor:self];
}
- (void)showLogPanel:(id)sender
{
[[appController logController] showLogPanel];
}
// Project
- (void)projectOpen:(id)sender
{

View file

@ -183,7 +183,8 @@
"loadedFilesSortByTime:",
"loadedFilesSortByName:",
"loadedFilesNextFile:",
"loadedFilesPreviousFile:"
"loadedFilesPreviousFile:",
"showLogPanel:"
);
Outlets = (
);