This commit was manufactured by cvs2svn to create tag

'pre-header-reorg-20030731'.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/tags/pre-header-reorg-20030731@19148 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
GNUstep Maintainer 2004-04-18 20:07:50 +00:00
parent c97d9d3d2b
commit 36eb35197f
37 changed files with 0 additions and 2844 deletions

View file

@ -1,120 +0,0 @@
#
# GNUmakefile - Generated by ProjectCenter
# Written by Philippe C.D. Robert <probert@siggraph.org>
#
# NOTE: Do NOT change this file -- ProjectCenter maintains it!
#
# Put all of your customisations in GNUmakefile.preamble and
# GNUmakefile.postamble
#
include $(GNUSTEP_MAKEFILES)/common.make
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
#
# Subprojects
#
SUBPROJECTS = \
PCLib \
PCAppProj \
PCGormProj \
PCBundleProj \
PCToolProj \
PCLibProj \
PCBaseFileTypes \
PCRenaissanceProj
#
# Main application
#
PACKAGE_NAME = ProjectCenter
APP_NAME = ProjectCenter
ProjectCenter_APPLICATION_ICON = Images/ProjectCenter.tiff
#
# Additional libraries
#
ADDITIONAL_GUI_LIBS += -lProjectCenter
#
# Resource files
#
ProjectCenter_RESOURCE_FILES = \
ProjectCenterInfo.plist \
Images/ButtonTile.tiff \
Images/FileIcon_.c.tiff \
Images/FileIcon_.h.tiff \
Images/FileIcon_.m.tiff \
Images/FileIcon_rtf.tiff \
Images/ProjectCenter.tiff \
Images/ProjectCenter_add.tiff \
Images/ProjectCenter_build.tiff \
Images/ProjectCenter_clean.tiff \
Images/ProjectCenter_cvs.tiff \
Images/ProjectCenter_debug.tiff \
Images/ProjectCenter_dist.tiff \
Images/ProjectCenter_documentation.tiff \
Images/ProjectCenter_files.tiff \
Images/ProjectCenter_find.tiff \
Images/ProjectCenter_install.tiff \
Images/ProjectCenter_make.tiff \
Images/ProjectCenter_prefs.tiff \
Images/ProjectCenter_profile.tiff \
Images/ProjectCenter_rpm.tiff \
Images/ProjectCenter_run.tiff \
Images/ProjectCenter_settings.tiff \
Images/ProjectCenter_uml.tiff \
Images/Stop.tiff \
PCAppProj/PCAppProj.bundle \
PCGormProj/PCGormProj.bundle \
PCBundleProj/PCBundleProj.bundle \
PCToolProj/PCToolProj.bundle \
PCLibProj/PCLibProj.bundle \
PCBaseFileTypes/PCBaseFileTypes.bundle \
PCRenaissanceProj/PCRenaissanceProj.bundle
#
# Header files
#
ProjectCenter_HEADERS = \
PCAppController.h \
PCFindController.h \
PCInfoController.h \
PCLogController.h \
PCMenuController.h \
PCPrefController.h \
PCPrefController+UInterface.h
#
# Class files
#
ProjectCenter_OBJC_FILES = \
PCAppController.m \
PCFindController.m \
PCInfoController.m \
PCLogController.m \
PCMenuController.m \
PCPrefController.m \
PCPrefController+UInterface.m \
ProjectCenter_main.m
#
# C files
#
ProjectCenter_C_FILES =
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/application.make
-include GNUmakefile.postamble

View file

@ -1,33 +0,0 @@
#
# GNUmakefile.postamble
#
# Copyright (C) 2001 Free Software Foundation, Inc.
#
# Author: Philippe C.D. Robert <probert@siggraph.org>
#
# This file is part of GNUstep
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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 Library General Public
# License along with this library; see the file COPYING.LIB.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
before-all::
# rm -f ProjectCenter
# $(LN_S) . ProjectCenter
after-clean::
# rm -f ProjectCenter
after-uninstall::
rm -rf $(GNUSTEP_SYSTEM_ROOT)/Library/Headers/ProjectCenter

View file

@ -1,71 +0,0 @@
# GNUmakefile.preamble
#
# Copyright (C) 2001 Free Software Foundation, Inc.
#
# Author: Philippe C.D. Robert <probert@siggraph.org>
#
# This file is part of GNUstep
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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.
#
# If you are interested in a warranty or support for this source code,
# contact Scott Christley at scottc@net-community.com
#
# You should have received a copy of the GNU Library General Public
# License along with this library; see the file COPYING.LIB.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Makefile.preamble
#
# Project specific makefile variables, and additional
#
# Do not put any Makefile rules in this file, instead they should
# be put into Makefile.postamble.
#
#
# Flags dealing with compiling and linking
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS += -Wall -Werror
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS += -Wall -Werror
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS += -Wall -Werror
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I./PCLib
# Additional LDFLAGS to pass to the linker
#ADDITIONAL_LDFLAGS +=
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS += -L./PCLib/$(GNUSTEP_OBJ_DIR)
ADDITIONAL_TOOL_LIBS +=
#
# Flags dealing with installing and uninstalling
#
# Additional directories to be created during installation
ADDITIONAL_INSTALL_DIRS +=
#
# Local configuration
#

0
Images/.gitignore vendored Normal file
View file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
Library/.gitignore vendored Normal file
View file

0
Modules/ApplicationProject/.gitignore vendored Normal file
View file

View file

0
Modules/BundleProject/.gitignore vendored Normal file
View file

0
Modules/LibraryProject/.gitignore vendored Normal file
View file

0
Modules/RenaissanceProject/.gitignore vendored Normal file
View file

View file

0
Modules/ToolProject/.gitignore vendored Normal file
View file

View file

@ -1,120 +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.
$Id$
*/
#ifndef _PCAPPCONTROLLER_H
#define _PCAPPCONTROLLER_H
#include <AppKit/AppKit.h>
#include "PCPrefController.h"
#include "PCFindController.h"
#include "PCInfoController.h"
#include "PCLogController.h"
@class PCBundleLoader;
@class PCServer;
@class PCProjectManager;
@class PCFileManager;
@class PCMenuController;
@interface PCAppController : NSObject
{
PCPrefController *prefController;
PCFindController *finder;
PCInfoController *infoController;
PCLogController *logger;
PCProjectManager *projectManager;
PCFileManager *fileManager;
PCMenuController *menuController;
PCBundleLoader *bundleLoader;
PCServer *doServer;
NSConnection *doConnection;
id delegate;
NSMutableDictionary *projectTypes;
}
//============================================================================
//==== Intialization & deallocation
//============================================================================
+ (void)initialize;
- (id)init;
- (void)dealloc;
//============================================================================
//==== Delegate
//============================================================================
- (id)delegate;
- (void)setDelegate:(id)aDelegate;
//============================================================================
//==== Bundle Management
//============================================================================
- (PCBundleLoader *)bundleLoader;
- (PCProjectManager *)projectManager;
- (PCInfoController *)infoController;
- (PCPrefController *)prefController;
- (PCMenuController *)menuController;
- (PCServer *)doServer;
- (PCFindController *)finder;
- (PCLogController *)logger;
- (NSDictionary *)projectTypes;
//============================================================================
//==== Misc...
//============================================================================
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName;
- (void)applicationWillFinishLaunching:(NSNotification *)notification;
- (void)applicationDidFinishLaunching:(NSNotification *)notification;
- (BOOL)applicationShouldTerminate:(id)sender;
- (void)applicationWillTerminate:(NSNotification *)notification;
//============================================================================
//==== Delegate stuff
//============================================================================
- (void)bundleLoader:(id)sender didLoadBundle:(NSBundle *)aBundle;
@end
@interface PCAppController (ProjectRegistration)
- (BOOL)registerProjectCreator:(NSString *)className forKey:(NSString *)aKey;
// Returns YES upon successfully registering a new projecttype.
@end
#endif

View file

@ -1,351 +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.
$Id$
*/
#include "PCAppController.h"
#include "PCMenuController.h"
#include <ProjectCenter/ProjectCenter.h>
#define REL_LIB_PC @"Library/ApplicationSupport/ProjectCenter"
#define ABS_LIB_PC @"/usr/GNUstep/System/Library/ApplicationSupport/ProjectCenter"
@implementation PCAppController
//============================================================================
//==== Intialization & deallocation
//============================================================================
+ (void)initialize
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionary];
NSDictionary *env = [[NSProcessInfo processInfo] environment];
NSString *prefix = [env objectForKey:@"GNUSTEP_SYSTEM_ROOT"];
NSString *_bundlePath;
if (prefix && ![prefix isEqualToString:@""])
{
_bundlePath = [prefix stringByAppendingPathComponent:REL_LIB_PC];
}
else
{
_bundlePath = [NSString stringWithString:ABS_LIB_PC];
}
[defaults setObject:_bundlePath forKey:BundlePaths];
[defaults setObject:@"/usr/bin/vim" forKey:Editor];
[defaults setObject:@"/usr/bin/gdb" forKey:PDebugger];
[defaults setObject:@"/usr/bin/gcc" forKey:Compiler];
[defaults setObject:@"YES" forKey:ExternalEditor];
[defaults setObject:[NSString stringWithFormat:@"%@/ProjectCenterBuildDir",NSTemporaryDirectory()] forKey:RootBuildDirectory];
[defaults setObject:@"YES" forKey:SaveOnQuit];
[defaults setObject:@"YES" forKey:PromptOnClean];
[defaults setObject:@"YES" forKey:PromptOnQuit];
[defaults setObject:@"YES" forKey:AutoSave];
[defaults setObject:@"YES" forKey:KeepBackup];
[defaults setObject:@"120" forKey:AutoSavePeriod];
[defaults setObject:@"NO" forKey:DeleteCacheWhenQuitting];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (id)init
{
if ((self = [super init]))
{
bundleLoader = [[PCBundleLoader alloc] init];
[bundleLoader setDelegate:self];
projectTypes = [[NSMutableDictionary alloc] init];
prefController = [[PCPrefController alloc] init];
finder = [[PCFindController alloc] init];
infoController = [[PCInfoController alloc] init];
logger = [[PCLogController alloc] init];
projectManager = [[PCProjectManager alloc] init];
fileManager = [PCFileManager fileManager];
menuController = [[PCMenuController alloc] init];
[projectManager setDelegate:self];
[fileManager setDelegate:projectManager];
[menuController setAppController:self];
[menuController setFileManager:fileManager];
[menuController setProjectManager:projectManager];
}
return self;
}
- (void)dealloc
{
if (doConnection)
{
[doConnection invalidate];
RELEASE(doConnection);
}
RELEASE(prefController);
RELEASE(finder);
RELEASE(infoController);
RELEASE(logger);
RELEASE(projectManager);
RELEASE(fileManager);
RELEASE(menuController);
RELEASE(bundleLoader);
RELEASE(doServer);
RELEASE(projectTypes);
[super dealloc];
}
//============================================================================
//==== Delegate
//============================================================================
- (id)delegate
{
return delegate;
}
- (void)setDelegate:(id)aDelegate
{
delegate = aDelegate;
}
- (BOOL)respondsToSelector: (SEL)aSelector
{
if (![super respondsToSelector: aSelector])
{
return [menuController respondsToSelector: aSelector];
}
else
{
return YES;
}
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
SEL aSelector = [anInvocation selector];
if ([menuController respondsToSelector: aSelector])
{
[anInvocation invokeWithTarget: menuController];
}
else
{
[super forwardInvocation: anInvocation];
}
}
//============================================================================
//==== Bundle Management
//============================================================================
- (PCBundleLoader *)bundleLoader
{
return bundleLoader;
}
- (PCProjectManager *)projectManager
{
return projectManager;
}
- (PCInfoController *)infoController
{
return infoController;
}
- (PCPrefController *)prefController
{
return prefController;
}
- (PCMenuController *)menuController
{
return menuController;
}
- (PCServer *)doServer
{
return doServer;
}
- (PCFindController *)finder
{
return finder;
}
- (PCLogController *)logger
{
return logger;
}
- (NSDictionary *)projectTypes
{
return projectTypes;
}
//============================================================================
//==== Misc...
//============================================================================
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
{
if ([[fileName pathExtension] isEqualToString:@"pcproj"] == NO)
{
return NO;
}
[NSApp activateIgnoringOtherApps:YES];
return [projectManager openProjectAt:fileName];
}
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
[bundleLoader loadBundles];
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
NSString *h = [[NSProcessInfo processInfo] hostName];
NSString *connectionName = [NSString stringWithFormat:@"ProjectCenter:%@",h];
[logger logMessage:@"Loading additional subsystems..." tag:INFORMATION];
doServer = [[PCServer alloc] init];
NS_DURING
doConnection = [[NSConnection alloc] init];
[doConnection registerName:connectionName];
NS_HANDLER
NSRunAlertPanel(@"Warning!",@"Could not register the DO connection %@",
@"OK",nil,nil,nil,connectionName);
NS_ENDHANDLER
[[NSNotificationCenter defaultCenter] addObserver:doServer
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification
object:doConnection];
[doConnection setDelegate:doServer];
[[NSNotificationCenter defaultCenter] postNotificationName:PCAppDidInitNotification object:nil];
}
- (BOOL)applicationShouldTerminate:(id)sender
{
NSString *poq = [[NSUserDefaults standardUserDefaults] objectForKey:PromptOnQuit];
NSString *soq = [[NSUserDefaults standardUserDefaults] objectForKey:SaveOnQuit];
if( [poq isEqualToString:@"YES"] )
{
if (NSRunAlertPanel(@"Quit!",
@"Do you really want to quit ProjectCenter?",
@"No", @"Yes", nil)) {
return NO;
}
}
if ( [soq isEqualToString:@"YES"] ) {
[projectManager saveAllProjects];
}
[[NSNotificationCenter defaultCenter] postNotificationName:PCAppWillTerminateNotification object:nil];
return YES;
}
- (void)applicationWillTerminate:(NSNotification *)notification
{
if ([[[NSUserDefaults standardUserDefaults] stringForKey:DeleteCacheWhenQuitting] isEqualToString:@"YES"])
{
[[NSFileManager defaultManager] removeFileAtPath:[projectManager rootBuildPath] handler:nil];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
//============================================================================
//==== Delegate stuff
//============================================================================
- (void)bundleLoader:(id)sender didLoadBundle:(NSBundle *)aBundle
{
Class principalClass;
NSAssert(aBundle,@"No valid bundle!");
principalClass = [aBundle principalClass];
if ([principalClass conformsToProtocol:@protocol(ProjectType)])
{
NSString *name = [[principalClass sharedCreator] projectTypeName];
[logger logMessage:[NSString stringWithFormat:@"Project type %@ successfully loaded!",name] tag:INFORMATION];
if ([self registerProjectCreator:NSStringFromClass(principalClass) forKey:name])
{
[menuController addProjectTypeNamed:name];
[logger logMessage:[NSString stringWithFormat:@"Project type %@ successfully registered!",name] tag:INFORMATION];
}
}
else if ([principalClass conformsToProtocol:@protocol(FileCreator)])
{
[fileManager registerCreatorsWithObjectsAndKeys:[[principalClass sharedCreator] creatorDictionary]];
// In objc.h there is already th like (char *)name...
// [logger logMessage:[NSString stringWithFormat:@"FileCreator %@ successfully loaded!",(NSString *)[[principalClass sharedCreator] name]] tag:INFORMATION];
}
}
@end
@implementation PCAppController (ProjectRegistration)
- (BOOL)registerProjectCreator:(NSString *)className forKey:(NSString *)aKey
{
if ([projectTypes objectForKey:aKey])
{
return NO;
}
[projectTypes setObject:className forKey:aKey];
return YES;
}
@end

View file

@ -1,45 +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.
$Id$
*/
#ifndef _PCINFOCONTROLLER_H
#define _PCINFOCONTROLLER_H
#include <AppKit/AppKit.h>
@interface PCInfoController : NSObject
{
id infoWindow;
NSDictionary *infoDict;
}
- (id)init;
- (void)dealloc;
- (void)showInfoWindow:(id)sender;
@end
#endif

View file

@ -1,76 +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.
$Id$
*/
#include "PCInfoController.h"
#include <ProjectCenter/ProjectCenter.h>
@implementation PCInfoController
- (id)init
{
if ((self = [super init])) {
NSString *file;
file = [[NSBundle mainBundle] pathForResource:@"Info-gnustep"
ofType:@"plist"];
infoDict = [NSDictionary dictionaryWithContentsOfFile:file];
RETAIN(infoDict);
}
return self;
}
- (void)dealloc
{
RELEASE(infoDict);
if (infoWindow)
{
RELEASE(infoWindow);
}
[super dealloc];
}
- (void)showInfoWindow:(id)sender
{
#if defined(GNUSTEP)
if (!infoWindow)
{
infoWindow = [[GSInfoPanel alloc] initWithDictionary:infoDict];
}
[infoWindow setTitle:@"Info"];
[infoWindow center];
[infoWindow makeKeyAndOrderFront:self];
#else
NSRunAlertPanel(@"Info",
@"OPENSTEP has no support for GSInfoPanel",
@"OK",nil,nil,nil);
#endif
}
@end

View file

@ -1,43 +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.
$Id$
*/
#ifndef _PCLOGCONTROLLER_H
#define _PCLOGCONTROLLER_H
#include <AppKit/AppKit.h>
#define INFORMATION 0
#define WARNING 1
@interface PCLogController : NSObject
{
}
- (void)logMessage:(NSString *)message tag:(int)tag;
@end
#endif

View file

@ -1,53 +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.
$Id$
*/
#include "PCLogController.h"
@implementation PCLogController
- (void)logMessage:(NSString *)message tag:(int)tag;
{
NSString *_log;
switch (tag)
{
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;
}
// Later we redirect this to our own output.
NSLog(message);
}
@end

View file

@ -1,121 +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.
$Id$
*/
#ifndef _PCMENUCONTROLLER_H
#define _PCMENUCONTROLLER_H
#include <AppKit/AppKit.h>
@class PCProjectManager;
@class PCFileManager;
@class PCAppController;
@interface PCMenuController : NSObject
{
PCProjectManager *projectManager;
PCFileManager *fileManager;
PCAppController *appController;
NSBox *projectTypeAccessaryView;
id projectTypePopup;
BOOL editorIsKey;
}
//============================================================================
//==== Init and free
//============================================================================
- (id)init;
- (void)dealloc;
- (void)setAppController:(id)anObject;
- (void)setFileManager:(id)anObject;
- (void)setProjectManager:(id)anObject;
//============================================================================
//==== Menu stuff
//============================================================================
- (void)addProjectTypeNamed:(NSString *)name;
// Info
- (void)showInfoPanel:(id)sender;
- (void)showPrefWindow:(id)sender;
// Project
- (void)projectOpen:(id)sender;
- (void)projectNew:(id)sender;
- (void)projectSave:(id)sender;
- (void)projectSaveAs:(id)sender;
- (void)projectAddFiles:(id)sender;
- (void)projectSaveFiles:(id)sender;
- (void)projectRemoveFiles:(id)sender;
- (void)projectRevertToSaved:(id)sender;
- (void)projectClose:(id)sender;
// Subproject
- (void)subprojectNew:(id)sender;
- (void)subprojectAdd:(id)sender;
- (void)subprojectRemove:(id)sender;
// File
- (void)fileNew:(id)sender;
- (void)fileOpen:(id)sender;
- (void)fileSave:(id)sender;
- (void)fileSaveAs:(id)sender;
- (void)fileSaveTo:(id)sender;
- (void)fileRevertToSaved:(id)sender;
- (void)fileClose:(id)sender;
- (void)fileOpenQuickly:(id)sender;
- (void)fileRename:(id)sender;
- (void)fileNewUntitled:(id)sender;
// Edit
- (void)findShowPanel:(id)sender;
- (void)findNext:(id)sender;
- (void)findPrevious:(id)sender;
// Tools
- (void)showInspector:(id)sender;
- (void)showEditorPanel:(id)sender;
- (void)showRunPanel:(id)sender;
- (void)showBuildPanel:(id)sender;
- (void)runTarget:(id)sender;
//============================================================================
//==== Delegate stuff
//============================================================================
- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem;
- (void)editorDidResignKey:(NSNotification *)aNotification;
- (void)editorDidBecomeKey:(NSNotification *)aNotification;
@end
#endif

View file

@ -1,626 +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.
$Id$
*/
#include "PCMenuController.h"
#include <ProjectCenter/ProjectCenter.h>
#include "PCAppController.h"
@implementation PCMenuController
- (id)init
{
if ((self = [super init]))
{
NSRect fr = NSMakeRect(20,30,160,20);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(editorDidBecomeKey:)
name:PCEditorDidBecomeKeyNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(editorDidResignKey:)
name:PCEditorDidResignKeyNotification
object:nil];
editorIsKey = NO;
projectTypeAccessaryView = [[NSBox alloc] init];
projectTypePopup = [[NSPopUpButton alloc] initWithFrame:fr pullsDown:NO];
[projectTypePopup setAutoenablesItems: NO];
[projectTypePopup addItemWithTitle:@"No type available!"];
[projectTypeAccessaryView setTitle:@"Project Types"];
[projectTypeAccessaryView setTitlePosition:NSAtTop];
[projectTypeAccessaryView setBorderType:NSGrooveBorder];
[projectTypeAccessaryView addSubview:projectTypePopup];
[projectTypeAccessaryView sizeToFit];
[projectTypeAccessaryView setAutoresizingMask:
NSViewMinXMargin | NSViewMaxXMargin];
RELEASE(projectTypePopup);
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
RELEASE(projectTypeAccessaryView);
[super dealloc];
}
- (void)addProjectTypeNamed:(NSString *)name
{
static BOOL _firstItem = YES;
if (_firstItem)
{
_firstItem = NO;
[projectTypePopup removeItemWithTitle:@"No type available!"];
}
[projectTypePopup addItemWithTitle:name];
[projectTypePopup sizeToFit];
[projectTypeAccessaryView sizeToFit];
}
- (void)setAppController:(id)anObject
{
[appController autorelease];
appController = anObject;
RETAIN(appController);
}
- (void)setFileManager:(id)anObject
{
[fileManager autorelease];
fileManager = anObject;
RETAIN(fileManager);
}
- (void)setProjectManager:(id)anObject
{
[projectManager autorelease];
projectManager = anObject;
RETAIN(projectManager);
}
//============================================================================
//==== Menu stuff
//============================================================================
// Info
- (void)showPrefWindow:(id)sender
{
[[[NSApp delegate] prefController] showPrefWindow:sender];
}
- (void)showInfoPanel:(id)sender
{
[[[NSApp delegate] infoController] showInfoWindow:sender];
}
- (void)showEditorPanel:(id)sender
{
[[projectManager activeProject] showEditorView:self];
}
// Project
- (void)projectOpen:(id)sender
{
NSString *projPath;
NSOpenPanel *openPanel;
int retval;
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:[NSArray arrayWithObjects:@"project",@"pcproj",nil]];
if (retval == NSOKButton)
{
BOOL isDir;
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory]
forKey:@"LastOpenDirectory"];
projPath = [[openPanel filenames] objectAtIndex:0];
if ([[NSFileManager defaultManager] fileExistsAtPath:projPath
isDirectory:&isDir] && !isDir)
{
if (![projectManager openProjectAt:projPath])
{
NSRunAlertPanel(@"Attention!",
@"Couldn't open %@!",
@"OK",nil,nil,
[projPath stringByDeletingLastPathComponent]);
}
}
}
}
- (void)projectNew:(id)sender
{
NSSavePanel *sp;
int runResult;
NSString *dir = nil;
sp = [NSSavePanel savePanel];
[sp setTitle:@"Create new project..."];
[sp setAccessoryView:nil];
[sp setAccessoryView:projectTypeAccessaryView];
dir = [[NSUserDefaults standardUserDefaults] objectForKey:@"LastNewDirectory"];
if( !dir )
{
dir = NSHomeDirectory();
}
runResult = [sp runModalForDirectory:dir file:@""];
if (runResult == NSOKButton)
{
NSString *projectType = [projectTypePopup titleOfSelectedItem];
NSString *className = [[appController projectTypes] objectForKey:projectType];
[[NSUserDefaults standardUserDefaults] setObject:[sp directory]
forKey:@"LastNewDirectory"];
if (![projectManager createProjectOfType:className path:[sp filename]])
{
NSRunAlertPanel(@"Attention!",
@"Failed to create %@!",
@"OK",nil,nil,[sp filename]);
}
}
}
- (void)projectSave:(id)sender
{
[projectManager saveProject];
}
- (void)projectSaveAs:(id)sender
{
NSString *proj = nil;
// Show save panel
NSRunAlertPanel(@"Attention!",
@"This feature is not yet implemented!",
@"OK",nil,nil);
[projectManager saveProjectAs:proj];
}
- (void)projectAddFiles:(id)sender
{
[fileManager showAddFileWindow];
}
- (void)projectSaveFiles:(id)sender
{
[projectManager saveAllFiles];
}
- (void)projectRemoveFiles:(id)sender
{
NSString *fileName = nil;
PCProject *proj = [projectManager activeProject];
NSArray *files = [[proj browserController] selectedFiles];
if ((fileName = [[proj browserController] nameOfSelectedFile]))
{
int ret;
ret = NSRunAlertPanel(@"Remove File!",
@"Really remove %@ in project %@?",
@"Cancel",
@"...from Project only",
@"...from Project and Disk",
files, [proj projectName]);
if (ret == NSAlertAlternateReturn || ret == NSAlertOtherReturn)
{
BOOL flag = (ret == NSAlertOtherReturn) ? YES : NO;
[projectManager removeFilesPermanently:flag];
}
}
}
- (void)projectRevertToSaved:(id)sender
{
[projectManager revertToSaved];
}
- (void)projectClose:(id)sender
{
[projectManager closeProject];
}
// Subproject
- (void)subprojectNew:(id)sender
{
[projectManager newSubproject];
}
- (void)subprojectAdd:(id)sender
{
NSString *proj = nil;
// Show open panel
[projectManager addSubprojectAt:proj];
}
- (void)subprojectRemove:(id)sender
{
[projectManager removeSubproject];
}
// File
- (void)fileOpen:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *filePath;
NSOpenPanel *openPanel;
int retval;
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
retval = [openPanel
runModalForDirectory:[ud objectForKey:@"LastOpenDirectory"]
file:nil
types:nil];
if (retval == NSOKButton)
{
BOOL isDir;
NSFileManager *fm = [NSFileManager defaultManager];
[ud setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
filePath = [[openPanel filenames] objectAtIndex:0];
if (![fm fileExistsAtPath:filePath isDirectory:&isDir] && !isDir)
{
NSRunAlertPanel(@"Attention!",
@"Couldn't open %@!",
@"OK",nil,nil,filePath);
}
else
{
[PCEditorController openFileInEditor:filePath];
}
}
}
- (void)fileNew:(id)sender
{
[fileManager showNewFileWindow];
}
- (void)fileSave:(id)sender
{
[projectManager saveFile];
}
// Not finished
- (void)fileSaveAs:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSSavePanel *savePanel = [NSSavePanel savePanel];;
NSString *oldFilePath = nil;
NSString *newFilePath = nil;
NSString *directory = nil;
int retval = NSOKButton;
oldFilePath =
[[[[projectManager activeProject] editorController] activeEditor] path];
[savePanel setTitle: @"Save As..."];
while (![directory isEqualToString: [projectManager projectPath]]
&& retval != NSCancelButton)
{
retval = [savePanel
runModalForDirectory:[projectManager projectPath]
file:[projectManager selectedFileName]];
directory = [savePanel directory];
}
if (retval == NSOKButton)
{
[ud setObject:directory forKey:@"LastOpenDirectory"];
newFilePath = [savePanel filename];
if (![projectManager saveFileAs:newFilePath])
{
NSRunAlertPanel(@"Attention!",
@"Couldn't save file as\n%@!",
@"OK",nil,nil,newFilePath);
}
else
{
PCProject *project = [projectManager activeProject];
NSString *category = [[[project rootCategories] allKeysForObject:PCNonProject] objectAtIndex:0];
[projectManager closeFile];
[project addFile:newFilePath forKey:PCNonProject];
[project browserDidClickFile:[newFilePath lastPathComponent]
category:category];
}
}
}
- (void)fileSaveTo:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *filePath = [projectManager selectedFileName];
NSSavePanel *savePanel = [NSSavePanel savePanel];;
int retval;
[savePanel setTitle: @"Save To..."];
retval = [savePanel runModalForDirectory:[projectManager projectPath]
file:filePath];
if (retval == NSOKButton)
{
[ud setObject:[savePanel directory] forKey:@"LastOpenDirectory"];
filePath = [savePanel filename];
if (![projectManager saveFileTo:filePath])
{
NSRunAlertPanel(@"Attention!",
@"Couldn't save file to\n%@!",
@"OK",nil,nil,filePath);
}
}
}
- (void)fileRevertToSaved:(id)sender
{
[projectManager revertFileToSaved];
}
- (void)fileClose:(id)sender
{
[projectManager closeFile];
}
- (void)fileOpenQuickly:(id)sender
{
NSRunAlertPanel(@"PCMenuController: Sorry!",
@"This feature is not finished yet",
@"OK",nil,nil);
}
- (void)fileRename:(id)sender
{
/* NSString *proj = nil;
// Show Inspector panel with "File Attributes" section
[projectManager renameFileTo:proj];*/
NSRunAlertPanel(@"PCMenuController: Sorry!",
@"This feature is not finished yet",
@"OK",nil,nil);
}
- (void)fileNewUntitled:(id)sender
{
NSRunAlertPanel(@"PCMenuController: Sorry!",
@"This feature is not finished yet",
@"OK",nil,nil);
}
// Edit
- (void)findShowPanel:(id)sender
{
[[PCTextFinder sharedFinder] showFindPanel:self];
}
- (void)findNext:(id)sender
{
[[PCTextFinder sharedFinder] findNext:self];
}
- (void)findPrevious:(id)sender
{
[[PCTextFinder sharedFinder] findPrevious:self];
}
// Tools
- (void)showInspector:(id)sender
{
[projectManager showInspectorForProject:[projectManager activeProject]];
}
- (void)showRunPanel:(id)sender
{
[[projectManager activeProject] showRunView:self];
}
- (void)showBuildPanel:(id)sender
{
[[projectManager activeProject] showBuildView:self];
}
- (void)runTarget:(id)sender
{
[[projectManager activeProject] runSelectedTarget:self];
}
//============================================================================
//==== Delegate stuff
//============================================================================
- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
{
NSString *menuTitle = [[menuItem menu] title];
PCProject *aProject = [projectManager activeProject];
NSResponder *firstResponder = [[NSApp keyWindow] firstResponder];
if ([[projectManager loadedProjects] count] == 0)
{
// Project related menu items
if ([menuTitle isEqualToString: @"Project"])
{
if ([[menuItem title] isEqualToString:@"Save"]) return NO;
if ([[menuItem title] isEqualToString:@"Save As..."]) return NO;
if ([[menuItem title] isEqualToString:@"Add Files..."]) return NO;
if ([[menuItem title] isEqualToString:@"Save Files..."]) return NO;
if ([[menuItem title] isEqualToString:@"Remove Files..."]) return NO;
if ([[menuItem title] isEqualToString:@"Close"]) return NO;
}
// File related menu items
if ([menuTitle isEqualToString: @"File"])
{
if ([[menuItem title] isEqualToString:@"New in Project"]) return NO;
if ([[menuItem title] isEqualToString:@"Save"]) return NO;
if ([[menuItem title] isEqualToString:@"Save As..."]) return NO;
if ([[menuItem title] isEqualToString:@"Save To..."]) return NO;
if ([[menuItem title] isEqualToString:@"Revert to Saved"]) return NO;
if ([[menuItem title] isEqualToString:@"Close"]) return NO;
if ([[menuItem title] isEqualToString:@"Open Quickly..."]) return NO;
if ([[menuItem title] isEqualToString:@"Rename"]) return NO;
if ([[menuItem title] isEqualToString:@"New Untitled"]) return NO;
}
// Tools menu items
if ([menuTitle isEqualToString: @"Tools"])
{
if ([[menuItem title] isEqualToString:@"Inspector..."]) return NO;
if ([[menuItem title] isEqualToString:@"Hide Tool Bar"]) return NO;
}
if ([menuTitle isEqualToString: @"Project Build"])
{
if ([[menuItem title] isEqualToString:@"Show Panel..."]) return NO;
if ([[menuItem title] isEqualToString:@"Build"]) return NO;
if ([[menuItem title] isEqualToString:@"Stop Build"]) return NO;
if ([[menuItem title] isEqualToString:@"Clean"]) return NO;
if ([[menuItem title] isEqualToString:@"Next Error"]) return NO;
if ([[menuItem title] isEqualToString:@"Previous Error"]) return NO;
}
if ([menuTitle isEqualToString: @"Project Find"])
{
if ([[menuItem title] isEqualToString:@"Show Panel..."]) return NO;
if ([[menuItem title] isEqualToString:@"Find Preferences"]) return NO;
if ([[menuItem title] isEqualToString:@"Find Definitions"]) return NO;
if ([[menuItem title] isEqualToString:@"Find Text"]) return NO;
if ([[menuItem title] isEqualToString:@"Find Regular Expr"]) return NO;
if ([[menuItem title] isEqualToString:@"Next match"]) return NO;
if ([[menuItem title] isEqualToString:@"Previous match"]) return NO;
}
if ([menuTitle isEqualToString: @"Loaded Files"])
{
if ([[menuItem title] isEqualToString:@"Show Panel..."]) return NO;
if ([[menuItem title] isEqualToString:@"Sort by Time Viewed"]) return NO;
if ([[menuItem title] isEqualToString:@"Sort by Name"]) return NO;
if ([[menuItem title] isEqualToString:@"Next File"]) return NO;
if ([[menuItem title] isEqualToString:@"Previous File"]) return NO;
}
if ([menuTitle isEqualToString: @"Launcher"])
{
if ([[menuItem title] isEqualToString:@"Show Panel..."]) return NO;
if ([[menuItem title] isEqualToString:@"Run"]) return NO;
if ([[menuItem title] isEqualToString:@"Debug"]) return NO;
}
if ([menuTitle isEqualToString: @"Indexer"])
{
if ([[menuItem title] isEqualToString:@"Show Panel..."]) return NO;
if ([[menuItem title] isEqualToString:@"Purge Indices"]) return NO;
if ([[menuItem title] isEqualToString:@"Index Subproject"]) return NO;
if ([[menuItem title] isEqualToString:@"Index File"]) return NO;
}
return YES;
}
// Project related menu items
if ([menuTitle isEqualToString: @"Project"]
&& [aProject selectedRootCategory] == nil)
{
if ([[menuItem title] isEqualToString:@"Add Files..."]) return NO;
if ([[menuItem title] isEqualToString:@"Remove Files..."]) return NO;
}
// File related menu items
if (([menuTitle isEqualToString: @"File"]))
{
if (![[firstResponder className] isEqualToString: @"PCEditorView"])
{
if ([[menuItem title] isEqualToString:@"Save"]) return NO;
if ([[menuItem title] isEqualToString:@"Save As..."]) return NO;
if ([[menuItem title] isEqualToString:@"Save To..."]) return NO;
if ([[menuItem title] isEqualToString:@"Revert to Saved"]) return NO;
if ([[menuItem title] isEqualToString:@"Close"]) return NO;
if ([[menuItem title] isEqualToString:@"Rename"]) return NO;
}
}
// Find menu items
if (editorIsKey == NO && [menuTitle isEqualToString: @"Find"])
{
if (![[[PCTextFinder sharedFinder] findPanel] isVisible])
{
if ([[menuItem title] isEqualToString:@"Find Next"]) return NO;
if ([[menuItem title] isEqualToString:@"Find Previous"]) return NO;
}
if ([[menuItem title] isEqualToString:@"Enter Selection"]) return NO;
if ([[menuItem title] isEqualToString:@"Jump to Selection"]) return NO;
if ([[menuItem title] isEqualToString:@"Line Number..."]) return NO;
if ([[menuItem title] isEqualToString:@"Man Page"]) return NO;
}
return YES;
}
- (void)editorDidResignKey:(NSNotification *)aNotification
{
editorIsKey = NO;
}
- (void)editorDidBecomeKey:(NSNotification *)aNotification
{
editorIsKey = YES;
}
@end

View file

@ -1,104 +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.
$Id$
*/
#ifndef _PCPREFCONTROLLER_H
#define _PCPREFCONTROLLER_H
#include <AppKit/AppKit.h>
@interface PCPrefController : NSObject
{
id prefWindow;
id prefPopup;
id prefEmptyView;
id prefBuildingView;
id prefMiscView;
id prefEditingView;
id prefSavingView;
id prefInterfaceView;
id tabMatrix;
id successField;
id failureField;
id autoSaveField;
id saveAutomatically;
id keepBackup;
id saveOnQuit;
id useExternalEditor;
id promptWhenQuit;
id promptOnClean;
id editorField;
id debuggerField;
id compilerField;
id bundlePathField;
id separateBuilder;
id separateLauncher;
id separateEditor;
NSMutableDictionary *preferencesDict;
}
- (id)init;
- (void)dealloc;
- (void)showPrefWindow:(id)sender;
- (void)popupChanged:(id)sender;
- (void)setSuccessSound:(id)sender;
- (void)setFailureSound:(id)sender;
- (void)setPromptOnClean:(id)sender;
- (void)setSaveAutomatically:(id)sender;
- (void)setKeepBackup:(id)sender;
- (void)setSavePeriod:(id)sender;
- (void)setSaveOnQuit:(id)sender;
- (void)setUseExternalEditor:(id)sender;
- (void)setEditor:(id)sender;
- (void)setCompiler:(id)sender;
- (void)setDebugger:(id)sender;
- (void)setBundlePath:(id)sender;
- (void)promptWhenQuitting:(id)sender;
- (void)setTabBehaviour:(id)sender;
- (NSDictionary *)preferencesDict;
- (NSString *)selectFileWithTypes:(NSArray *)types;
@end
extern NSString *SavePeriodDidChangeNotification;
#endif

View file

@ -1,480 +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.
$Id$
*/
#include "PCPrefController.h"
#include "PCPrefController+UInterface.h"
#include <ProjectCenter/ProjectCenter.h>
NSString *SavePeriodDidChangeNotification = @"SavePeriodDidChangeNotification";
@implementation PCPrefController
- (id)init
{
if ((self = [super init])) {
NSDictionary *prefs;
// The prefs from the defaults
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
preferencesDict = [[NSMutableDictionary alloc] initWithDictionary:prefs];
}
return self;
}
- (void)dealloc
{
RELEASE(preferencesDict);
RELEASE(prefWindow);
RELEASE(prefBuildingView);
RELEASE(prefMiscView);
RELEASE(prefEditingView);
RELEASE(prefSavingView);
[[NSUserDefaults standardUserDefaults] synchronize];
[super dealloc];
}
- (void) showPrefWindow: (id)sender
{
NSDictionary *prefs;
NSString *val;
if (!prefWindow)
{
id view;
[self _initUI];
// The popup and selected view
[prefPopup removeAllItems];
[prefPopup addItemWithTitle: @"Building"];
[prefPopup addItemWithTitle: @"Saving"];
[prefPopup addItemWithTitle: @"Editing"];
[prefPopup addItemWithTitle: @"Miscellaneous"];
[prefPopup addItemWithTitle: @"Interface"];
[prefPopup selectItemWithTitle: @"Building"];
view = [prefBuildingView retain];
[(NSBox *)prefEmptyView setContentView: view];
[prefEmptyView display];
}
prefs = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
[preferencesDict addEntriesFromDictionary: prefs];
// Fill in the defaults
// Building
[successField setStringValue:
(val = [preferencesDict objectForKey: SuccessSound]) ? val : @""];
[failureField setStringValue:
(val = [preferencesDict objectForKey: FailureSound]) ? val : @""];
[promptOnClean setState:
([[preferencesDict objectForKey: PromptOnClean]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
// Saving
[saveOnQuit setState:
([[preferencesDict objectForKey: SaveOnQuit]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
[saveAutomatically setState:
([[preferencesDict objectForKey: AutoSave]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
[keepBackup setState:
([[preferencesDict objectForKey: KeepBackup]
isEqualToString: @"YES"]) ? NSOnState : NSOffState];
[autoSaveField setStringValue:
(val = [preferencesDict objectForKey: AutoSavePeriod]) ? val : @"120"];
// Editing
if([[preferencesDict objectForKey: TabBehaviour] isEqualToString:@"Tab"])
{
[tabMatrix selectCellAtRow: 0 column: 0];
}
else if([[preferencesDict objectForKey: TabBehaviour] isEqualToString:@"Sp2"])
{
[tabMatrix selectCellAtRow: 1 column: 0];
}
else if([[preferencesDict objectForKey: TabBehaviour] isEqualToString:@"Sp4"])
{
[tabMatrix selectCellAtRow: 0 column: 1];
}
else if([[preferencesDict objectForKey: TabBehaviour] isEqualToString:@"Sp8"])
{
[tabMatrix selectCellAtRow: 1 column: 1];
}
// Miscellaneous
[compilerField setStringValue:
(val = [preferencesDict objectForKey: Compiler]) ? val : @""];
[debuggerField setStringValue:
(val = [preferencesDict objectForKey: PDebugger]) ? val : @""];
[editorField setStringValue:
(val = [preferencesDict objectForKey: Editor]) ? val : @""];
[bundlePathField setStringValue:
(val = [preferencesDict objectForKey: BundlePaths]) ? val : @""];
// Interface
[separateBuilder setState:
([[preferencesDict objectForKey: SeparateBuilder]
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
[separateLauncher setState:
([[preferencesDict objectForKey: SeparateLauncher]
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
[separateEditor setState:
([[preferencesDict objectForKey: SeparateEditor]
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
[promptWhenQuit setState:
([[preferencesDict objectForKey: PromptOnQuit]
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
[useExternalEditor setState:
([[preferencesDict objectForKey: ExternalEditor]
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
if (![prefWindow isVisible])
{
[prefWindow setFrameUsingName: @"Preferences"];
}
[prefWindow makeKeyAndOrderFront: self];
}
- (void)popupChanged:(id)sender
{
NSView *view = nil;
switch ([sender indexOfSelectedItem])
{
case 0:
view = prefBuildingView;
break;
case 1:
view = prefSavingView;
break;
case 2:
view = prefEditingView;
break;
case 3:
view = prefMiscView;
break;
case 4:
view = prefInterfaceView;
break;
}
[(NSBox *)prefEmptyView setContentView:view];
[prefEmptyView display];
}
- (void)setSuccessSound:(id)sender
{
NSArray *types = [NSArray arrayWithObjects:@"snd",@"au",nil];
NSString *path = [self selectFileWithTypes:types];
if (path) {
[successField setStringValue: path];
[[NSUserDefaults standardUserDefaults] setObject:path forKey:SuccessSound];
[preferencesDict setObject:path forKey:SuccessSound];
}
}
- (void)setFailureSound:(id)sender
{
NSString *path = [self selectFileWithTypes:[NSArray arrayWithObjects:@"snd",@"au",nil]];
if (path) {
[failureField setStringValue:path];
[[NSUserDefaults standardUserDefaults] setObject:path forKey:FailureSound];
[preferencesDict setObject:path forKey:FailureSound];
}
}
- (void)setPromptOnClean:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:PromptOnClean];
break;
case 1:
[def setObject:@"YES" forKey:PromptOnClean];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:PromptOnClean]
forKey:PromptOnClean];
}
- (void)setSaveAutomatically:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:AutoSave];
break;
case 1:
[def setObject:@"YES" forKey:AutoSave];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:AutoSave] forKey:AutoSave];
}
- (void)setKeepBackup:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:KeepBackup];
break;
case 1:
[def setObject:@"YES" forKey:KeepBackup];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:KeepBackup]
forKey:KeepBackup];
}
- (void)setSavePeriod:(id)sender
{
NSString *periodString = [autoSaveField stringValue];
if (periodString == nil || [periodString isEqualToString:@""]) {
periodString = [NSString stringWithString:@"300"];
}
[[NSUserDefaults standardUserDefaults] setObject:periodString
forKey:AutoSavePeriod];
[preferencesDict setObject:periodString forKey:AutoSavePeriod];
[[NSNotificationCenter defaultCenter] postNotificationName:SavePeriodDidChangeNotification object:periodString];
}
- (void)setSaveOnQuit:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:SaveOnQuit];
break;
case 1:
[def setObject:@"YES" forKey:SaveOnQuit];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:SaveOnQuit]
forKey:SaveOnQuit];
}
- (void)setUseExternalEditor:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:ExternalEditor];
break;
case 1:
[def setObject:@"YES" forKey:ExternalEditor];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:ExternalEditor]
forKey:ExternalEditor];
}
- (void)setEditor:(id)sender
{
NSString *path = [editorField stringValue];
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Editor];
[preferencesDict setObject:path forKey:Editor];
}
}
- (void)setCompiler:(id)sender
{
NSString *path = [compilerField stringValue];
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Compiler];
[preferencesDict setObject:path forKey:Compiler];
}
}
- (void)setDebugger:(id)sender
{
NSString *path = [debuggerField stringValue];
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:PDebugger];
[preferencesDict setObject:path forKey:PDebugger];
}
}
- (void)setBundlePath:(id)sender
{
NSString *path = [bundlePathField stringValue];
if (path) {
[[NSUserDefaults standardUserDefaults] setObject:path forKey:BundlePaths];
[preferencesDict setObject:path forKey:BundlePaths];
}
}
- (void)promptWhenQuitting:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] state]) {
case 0:
[def setObject:@"NO" forKey:PromptOnQuit];
break;
case 1:
[def setObject:@"YES" forKey:PromptOnQuit];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:PromptOnQuit]
forKey:PromptOnQuit];
}
- (void)setTabBehaviour:(id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
switch ([[sender selectedCell] tag])
{
case 0:
// [PCEditorView setTabBehaviour:PCTabTab];
[def setObject:@"Tab" forKey:TabBehaviour];
break;
case 1:
// [PCEditorView setTabBehaviour:PCTab2Sp];
[def setObject:@"Sp2" forKey:TabBehaviour];
break;
case 2:
// [PCEditorView setTabBehaviour:PCTab4Sp];
[def setObject:@"Sp4" forKey:TabBehaviour];
break;
case 3:
// [PCEditorView setTabBehaviour:PCTab8Sp];
[def setObject:@"Sp8" forKey:TabBehaviour];
break;
}
[def synchronize];
[preferencesDict setObject:[def objectForKey:TabBehaviour]
forKey:TabBehaviour];
}
- (void)setDisplayPanels: (id)sender
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
NSString *key = nil;
if (sender == separateBuilder)
{
key = [NSString stringWithString: SeparateBuilder];
}
else if (sender == separateLauncher)
{
key = [NSString stringWithString: SeparateLauncher];
}
else if (sender == separateEditor)
{
key = [NSString stringWithString: SeparateEditor];
}
switch ([sender state])
{
case NSOffState:
[def setObject: @"NO" forKey: key];
break;
case NSOnState:
[def setObject:@"YES" forKey: key];
break;
}
[def synchronize];
[preferencesDict setObject: [def objectForKey: key]
forKey: key];
}
- (NSDictionary *)preferencesDict
{
return preferencesDict;
}
- (NSString *)selectFileWithTypes:(NSArray *)types
{
NSString *file = nil;
NSOpenPanel *openPanel;
int retval;
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[def objectForKey:@"LastOpenDirectory"] file:nil types:types];
if (retval == NSOKButton)
{
[def setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
file = [[openPanel filenames] objectAtIndex:0];
}
return file;
}
@end

0
ProjectCenter/.gitignore vendored Normal file
View file

0
ProjectCenter/Images/.gitignore vendored Normal file
View file

View file

@ -1,44 +0,0 @@
{
NSIcon = "ProjectCenter.tiff";
NSRole = "Editor";
NSTypes = (
{
NSUnixExtensions = ( "project" );
NSIcon = "ProjectCenter.tiff";
},
{
NSUnixExtensions = ( "pcproj" );
NSIcon = "ProjectCenter.tiff";
},
{
NSUnixExtensions = ( "m" );
NSIcon = "FileIcon_.m.tiff";
},
{
NSUnixExtensions = ( "h" );
NSIcon = "FileIcon_.h.tiff";
},
{
NSUnixExtensions = ( "c" );
NSIcon = "FileIcon_.c.tiff";
}
);
NOTE = "Automatically generated, do not edit!";
ApplicationName = "ProjectCenter";
ApplicationDescription = "GNUstep IDE";
ApplicationIcon = "ProjectCenter.tiff";
ApplicationRelease = "0.3.5";
FullVersionID = "ProjectCenter 0.3.5";
Authors = (
"Philippe C.D. Robert <probert@siggraph.org>",
"Serg Stoyan <stoyan@on.com.ua>",
"David Ayers <d.ayers@inode.at>",
"Richard Frith-Macdonald <rfm@gnu.org>",
"Nicola Pero <n.pero@mi.flashnet.it>",
"Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>",
"Adam Fedor <fedor@gnu.org>");
URL = "See http://www.gnustep.org/";
Copyright = "Copyright (C) 1999 - 2003 Free Software Foundation";
CopyrightDescription = "Released under the GNU General Public License 2.0";
}

View file

@ -1,557 +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.
$Id$
*/
#include <AppKit/AppKit.h>
#include <ProjectCenter/PCDefines.h>
#include"PCAppController.h"
void createMenu();
int main(int argc, const char **argv)
{
#ifdef GNUSTEP_BASE_VERSION
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
PCAppController *controller;
[NSApplication sharedApplication];
createMenu();
controller = [[PCAppController alloc] init];
[NSApp setDelegate:controller];
RELEASE(pool);
#endif
return NSApplicationMain (argc, argv);
}
void
createMenu()
{
NSMenu *menu;
NSMenu *info;
NSMenu *project;
#ifdef ENABLE_SUBPROJECTS
NSMenu *subprojects;
#endif
NSMenu *file;
#ifdef ENABLE_ALL_FILE_OPERATIONS
NSMenu *file_view;
#endif
NSMenu *edit;
NSMenu *edit_find;
NSMenu *edit_undo;
NSMenu *edit_indent;
NSMenu *format;
NSMenu *format_text;
NSMenu *tools;
NSMenu *tools_build;
#ifdef ENABLE_PROJECTFIND
NSMenu *tools_find;
#endif
#ifdef ENABLE_LOADEDFILES
NSMenu *tools_files;
#endif
NSMenu *tools_launcher;
#ifdef ENABLE_INDEXER
NSMenu *tools_indexer;
#endif
NSMenu *windows;
NSMenu *services;
SEL action = @selector(method:);
menu = [[NSMenu alloc] initWithTitle: @"ProjectCenter"];
/*
* The main menu
*/
[menu addItemWithTitle:@"Info" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Project" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"File" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Edit" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Format" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Tools" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Windows" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Print..." action:action keyEquivalent:@"p"];
[menu addItemWithTitle:@"Services" action:action keyEquivalent:@""];
[menu addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"h"];
[menu addItemWithTitle:@"Quit" action:@selector(terminate:)
keyEquivalent:@"q"];
/*
* Info submenu
*/
info = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:info forItem:[menu itemWithTitle:@"Info"]];
[info addItemWithTitle:@"Info Panel..."
action:@selector(showInfoPanel:)
keyEquivalent:@""];
[info addItemWithTitle:@"Preferences..."
action:@selector(showPrefWindow:)
keyEquivalent:@""];
[info addItemWithTitle:@"Help"
action:action
keyEquivalent:@"?"];
/*
* Project submenu
*/
project = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:project forItem:[menu itemWithTitle:@"Project"]];
[project addItemWithTitle:@"Open..."
action:@selector(projectOpen:)
keyEquivalent:@"O"];
[project addItemWithTitle:@"New..."
action:@selector(projectNew:)
keyEquivalent:@"N"];
[project addItemWithTitle:@"Save"
action:@selector(projectSave:)
keyEquivalent:@"S"];
[project addItemWithTitle:@"Save As..."
action:@selector(projectSaveAs:)
keyEquivalent:@""];
[project addItemWithTitle:@"Add Files..."
action:@selector(projectAddFiles:)
keyEquivalent:@"A"];
[project addItemWithTitle:@"Save Files..."
action:@selector(projectSaveFiles:)
keyEquivalent:@"Q"];
[project addItemWithTitle:@"Remove Files..."
action:@selector(projectRemoveFiles:)
keyEquivalent:@"r"];
#ifdef ENABLE_SUBPROJECTS
[project addItemWithTitle:@"Subprojects"
action:action
keyEquivalent:@""];
#endif
[project addItemWithTitle:@"Close"
action:@selector(projectClose:)
keyEquivalent:@""];
#ifdef ENABLE_SUBPROJECTS
subprojects = [[[NSMenu alloc] init] autorelease];
[project setSubmenu:subprojects
forItem:[project itemWithTitle:@"Subprojects"]];
[subprojects addItemWithTitle:@"New..."
action:@selector(newSubproject:)
keyEquivalent:@""];
[subprojects addItemWithTitle:@"Add..."
action:@selector(addSubproject:)
keyEquivalent:@""];
[subprojects addItemWithTitle:@"Remove..."
action:@selector(removeSubproject:)
keyEquivalent:@""];
#endif
/*
* File submenu
*/
file = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:file forItem:[menu itemWithTitle:@"File"]];
[file addItemWithTitle:@"Open..."
action:@selector(fileOpen:)
keyEquivalent:@"o"];
[file addItemWithTitle:@"New in Project"
action:@selector(fileNew:)
keyEquivalent:@"n"];
[file addItemWithTitle:@"Save"
action:@selector(fileSave:)
keyEquivalent:@"s"];
[file addItemWithTitle:@"Save As..."
action:@selector(fileSaveAs:)
keyEquivalent:@""];
[file addItemWithTitle:@"Save To..."
action:@selector(fileSaveTo:)
keyEquivalent:@""];
[file addItemWithTitle:@"Revert to Saved"
action:@selector(fileRevertToSaved:)
keyEquivalent:@"u"];
[file addItemWithTitle:@"Close"
action:@selector(fileClose:)
keyEquivalent:@"W"];
#ifdef ENABLE_ALL_FILE_OPERATIONS
[file addItemWithTitle:@"View"
action:action
keyEquivalent:@""];
[file addItemWithTitle:@"Open Quickly..."
action:@selector(fileOpenQuickly:)
keyEquivalent:@"D"];
[file addItemWithTitle:@"Rename"
action:@selector(fileRename:)
keyEquivalent:@""];
[file addItemWithTitle:@"New Untitled"
action:@selector(fileNewUntitled:)
keyEquivalent:@""];
file_view = [[[NSMenu alloc] init] autorelease];
[file setSubmenu:file_view
forItem:[file itemWithTitle:@"View"]];
[file_view addItemWithTitle:@"Split"
action:action
keyEquivalent:@"2"];
[file_view addItemWithTitle:@"Maximize"
action:action
keyEquivalent:@"1"];
[file_view addItemWithTitle:@"Tear Off"
action:action
keyEquivalent:@"T"];
#endif
/*
* Edit submenu
*/
edit = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:edit forItem:[menu itemWithTitle:@"Edit"]];
[edit addItemWithTitle:@"Cut"
action:@selector(cut:)
keyEquivalent:@"x"];
[edit addItemWithTitle:@"Copy"
action:@selector(copy:)
keyEquivalent:@"c"];
[edit addItemWithTitle:@"Paste"
action:@selector(paste:)
keyEquivalent:@"v"];
[edit addItemWithTitle:@"Delete"
action:@selector(delete:)
keyEquivalent:@""];
[edit addItemWithTitle:@"Select All"
action:@selector(selectAll:)
keyEquivalent:@"a"];
[edit addItemWithTitle:@"Find"
action:action
keyEquivalent:@""];
[edit addItemWithTitle:@"Undo"
action:action
keyEquivalent:@""];
[edit addItemWithTitle:@"Indentation"
action:action
keyEquivalent:@""];
[edit addItemWithTitle:@"Spelling..."
action:action
keyEquivalent:@""];
[edit addItemWithTitle:@"Check Spelling"
action:action
keyEquivalent:@";"];
// Find
edit_find = [[[NSMenu alloc] init] autorelease];
[edit setSubmenu:edit_find
forItem:[edit itemWithTitle:@"Find"]];
[edit_find addItemWithTitle:@"Find Panel..."
action:@selector(findShowPanel:)
keyEquivalent:@"f"];
[edit_find addItemWithTitle:@"Find Next"
action:@selector(findNext:)
keyEquivalent:@"g"];
[edit_find addItemWithTitle:@"Find Previous"
action:@selector(findPrevious:)
keyEquivalent:@"d"];
[edit_find addItemWithTitle:@"Enter Selection"
action:action
keyEquivalent:@"e"];
[edit_find addItemWithTitle:@"Jump to Selection"
action:action
keyEquivalent:@"j"];
[edit_find addItemWithTitle:@"Line Number..."
action:action
keyEquivalent:@"I"];
[edit_find addItemWithTitle:@"Man Page"
action:action
keyEquivalent:@"M"];
// Undo
edit_undo = [[[NSMenu alloc] init] autorelease];
[edit setSubmenu:edit_undo
forItem:[edit itemWithTitle:@"Undo"]];
[edit_undo addItemWithTitle:@"Undo"
action:action
keyEquivalent:@"z"];
[edit_undo addItemWithTitle:@"Redo"
action:action
keyEquivalent:@"Z"];
[edit_undo addItemWithTitle:@"Undo Region"
action:action
keyEquivalent:@""];
// Indentation
edit_indent = [[[NSMenu alloc] init] autorelease];
[edit setSubmenu:edit_indent
forItem:[edit itemWithTitle:@"Indentation"]];
[edit_indent addItemWithTitle:@"Indent"
action:action
keyEquivalent:@"i"];
[edit_indent addItemWithTitle:@"Shift Left"
action:action
keyEquivalent:@"["];
[edit_indent addItemWithTitle:@"Shift Right"
action:action
keyEquivalent:@"]"];
[edit_indent addItemWithTitle:@"Compress Whitesapce"
action:action
keyEquivalent:@"{"];
[edit_indent addItemWithTitle:@"Expand Message Expression"
action:action
keyEquivalent:@"}"];
/*
* Format submenu
*/
format = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:format
forItem:[menu itemWithTitle:@"Format"]];
[format addItemWithTitle:@"Font"
action:action
keyEquivalent:@""];
[format addItemWithTitle:@"Text"
action:action
keyEquivalent:@""];
[format addItemWithTitle:@"Make Rich Text"
action:action
keyEquivalent:@"R"];
[format addItemWithTitle:@"Show All Characters"
action:action
keyEquivalent:@""];
[format addItemWithTitle:@"Page Layout..."
action:action
keyEquivalent:@"P"];
// Font
[format setSubmenu:[[NSFontManager sharedFontManager] fontMenu: YES]
forItem:[format itemWithTitle:@"Font"]];
// Text
format_text = [[[NSMenu alloc] init] autorelease];
[format setSubmenu:format_text
forItem:[format itemWithTitle:@"Text"]];
[format_text addItemWithTitle:@"Align Left"
action:action
keyEquivalent:@""];
[format_text addItemWithTitle:@"Center"
action:action
keyEquivalent:@""];
[format_text addItemWithTitle:@"Align Right"
action:action
keyEquivalent:@""];
[format_text addItemWithTitle:@"Show Ruler"
action:action
keyEquivalent:@""];
[format_text addItemWithTitle:@"Copy Ruler"
action:action
keyEquivalent:@""];
[format_text addItemWithTitle:@"Paste Ruler"
action:action
keyEquivalent:@""];
/*
* Tools submenu
*/
tools = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:tools forItem:[menu itemWithTitle:@"Tools"]];
// probert: either use a NSToolbar or remove that!
#ifdef ENABLE_TOOLBAR
[tools addItemWithTitle:@"Hide Tool Bar"
action:action
keyEquivalent:@""];
#endif
[tools addItemWithTitle:@"Inspector..."
action:@selector(showInspector:)
keyEquivalent:@""];
#ifdef ENABLE_LOADEDPROJECTS
[tools addItemWithTitle:@"Loaded Projects..."
action:action
keyEquivalent:@""];
#endif
[tools addItemWithTitle:@"Project Build"
action:action
keyEquivalent:@""];
#ifdef ENABLE_PROJECTFIND
[tools addItemWithTitle:@"Project Find"
action:action
keyEquivalent:@""];
#endif
#ifdef ENABLE_LOADEDFILES
[tools addItemWithTitle:@"Loaded Files"
action:action
keyEquivalent:@""];
#endif
[tools addItemWithTitle:@"Launcher"
action:action
keyEquivalent:@""];
#ifdef ENABLE_INDEXER
[tools addItemWithTitle:@"Indexer"
action:action
keyEquivalent:@""];
#endif
// Project Build
tools_build = [[[NSMenu alloc] init] autorelease];
[tools setSubmenu:tools_build
forItem:[tools itemWithTitle:@"Project Build"]];
[tools_build addItemWithTitle:@"Show Panel..."
action:@selector(showBuildPanel:)
keyEquivalent:@""];
[tools_build addItemWithTitle:@"Build"
action:action
keyEquivalent:@"B"];
[tools_build addItemWithTitle:@"Stop Build"
action:action
keyEquivalent:@"/"];
[tools_build addItemWithTitle:@"Clean"
action:action
keyEquivalent:@""];
[tools_build addItemWithTitle:@"Next Error"
action:action
keyEquivalent:@">"];
[tools_build addItemWithTitle:@"Previous Error"
action:action
keyEquivalent:@"<"];
// Project Find
#ifdef ENABLE_PROJECTFIND
tools_find = [[[NSMenu alloc] init] autorelease];
[tools setSubmenu:tools_find
forItem:[tools itemWithTitle:@"Project Find"]];
[tools_find addItemWithTitle:@"Show Panel..."
action:action
keyEquivalent:@"F"];
[tools_find addItemWithTitle:@"Find References"
action:action
keyEquivalent:@"0"];
[tools_find addItemWithTitle:@"Find Definitions"
action:action
keyEquivalent:@"9"];
[tools_find addItemWithTitle:@"Find Text"
action:action
keyEquivalent:@"8"];
[tools_find addItemWithTitle:@"Find Regular Expr"
action:action
keyEquivalent:@"7"];
[tools_find addItemWithTitle:@"Next match"
action:action
keyEquivalent:@""];
[tools_find addItemWithTitle:@"Previuos match"
action:action
keyEquivalent:@""];
#endif
// Loaded Files
#ifdef ENABLE_LOADEDFILES
tools_files = [[[NSMenu alloc] init] autorelease];
[tools setSubmenu:tools_files
forItem:[tools itemWithTitle:@"Loaded Files"]];
[tools_files addItemWithTitle:@"Show Panel..."
action:action
keyEquivalent:@"L"];
[tools_files addItemWithTitle:@"Sort by Time Viewed"
action:action
keyEquivalent:@""];
[tools_files addItemWithTitle:@"Sort by Name"
action:action
keyEquivalent:@""];
[tools_files addItemWithTitle:@"Next File"
action:action
keyEquivalent:@"+"];
[tools_files addItemWithTitle:@"Previuos File"
action:action
keyEquivalent:@"_"];
#endif
// Launcher
tools_launcher = [[[NSMenu alloc] init] autorelease];
[tools setSubmenu:tools_launcher
forItem:[tools itemWithTitle:@"Launcher"]];
[tools_launcher addItemWithTitle:@"Show Panel..."
action:@selector(showRunPanel:)
keyEquivalent:@""];
[tools_launcher addItemWithTitle:@"Run"
action:@selector(runTarget:)
keyEquivalent:@""];
[tools_launcher addItemWithTitle:@"Debug"
action:action
keyEquivalent:@""];
#ifdef ENABLE_INDEXER
// Indexer
tools_indexer = [[[NSMenu alloc] init] autorelease];
[tools setSubmenu:tools_indexer
forItem:[tools itemWithTitle:@"Indexer"]];
[tools_indexer addItemWithTitle:@"Show Panel..."
action:action
keyEquivalent:@""];
[tools_indexer addItemWithTitle:@"Purge Indices"
action:action
keyEquivalent:@""];
[tools_indexer addItemWithTitle:@"Index Subproject"
action:action
keyEquivalent:@"|"];
[tools_indexer addItemWithTitle:@"Index File"
action:action
keyEquivalent:@"*"];
#endif
/*
* Windows submenu
*/
windows = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:windows forItem:[menu itemWithTitle:@"Windows"]];
[windows addItemWithTitle:@"Arrange in Front"
action:@selector(arrangeInFront:)
keyEquivalent:@""];
[windows addItemWithTitle:@"Miniaturize Window"
action:@selector(performMiniaturize:)
keyEquivalent:@"m"];
[windows addItemWithTitle:@"Close Window"
action:@selector(performClose:)
keyEquivalent:@"w"];
/*
* Services submenu
*/
services = [[[NSMenu alloc] init] autorelease];
[menu setSubmenu:services forItem:[menu itemWithTitle:@"Services"]];
[[NSApplication sharedApplication] setWindowsMenu: windows];
[[NSApplication sharedApplication] setServicesMenu: services];
[[NSApplication sharedApplication] setMainMenu:menu];
}