mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-19 17:11:32 +00:00
menu validation and project files saving changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@16671 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d24d3b6317
commit
51d8556e77
8 changed files with 484 additions and 368 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2003-05-08 Serg Stoyan <stoyan@hologr.com>
|
||||
|
||||
* PCMenuController.m:
|
||||
(validateMenuItem:): Update to the current set of menu items.
|
||||
* ProjectCenter_main.m:
|
||||
(createMenu): Set saveFiles: action to "Save Files..." menu item.
|
||||
|
||||
* PCBaseFileTypes/PCBaseFileType.m:
|
||||
(createFileOfType:type:project): Initializing newFile ivar before
|
||||
creating file. Cleanup.
|
||||
|
||||
* PCLib/PCFileManager+UInterface.m:
|
||||
(_initUI): Set spacing between buttons to 8.
|
||||
* PCLib/PCFileManager.m:
|
||||
(showAddFileWindow): Reformatting.
|
||||
* PCLib/PCProject.m:
|
||||
(save): Removed calling to [self saveAllFiles].
|
||||
* PCLib/PCProjectManager.m:
|
||||
(saveProject): Removed saving all files.
|
||||
(saveFiles): Call [activeProject saveAllFiles] added.
|
||||
|
||||
2003-05-07 Serg Stoyan <stoyan@hologr.com>
|
||||
|
||||
* ProjectCenter: Files moved to root directory.
|
||||
|
|
|
@ -129,158 +129,182 @@ descr = [NSString stringWithString:@"Generic GSMarkup File.\n\nThis is the inter
|
|||
return dict;
|
||||
}
|
||||
|
||||
- (NSDictionary *)createFileOfType:(NSString *)type path:(NSString *)path project:(PCProject *)aProject
|
||||
- (NSDictionary *) createFileOfType:(NSString *)type
|
||||
path:(NSString *)path
|
||||
project:(PCProject *)aProject
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *_file;
|
||||
NSString *newFile = nil;
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *_file;
|
||||
NSString *newFile = nil;
|
||||
NSMutableDictionary *files;
|
||||
|
||||
NSBundle *bundle;
|
||||
|
||||
// A class and possibly a header
|
||||
files = [NSMutableDictionary dictionaryWithCapacity:2];
|
||||
|
||||
|
||||
NSLog(@"<%@ %x>: create %@ at %@",[self class],self,type,path);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
if ([type isEqualToString:ObjCClass])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"class" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"m"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"m"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:ObjCClass forKey:newFile];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
|
||||
// Should a header be created as well?
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
if (NSRunAlertPanel(@"Attention!",
|
||||
@"Should %@ be created and inserted into the project?",
|
||||
@"Yes",@"No",nil,[newFile lastPathComponent]))
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"header" ofType:@"template"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:ObjCHeader];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
else if ([type isEqualToString:ObjCNSViewClass])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"nsviewclass" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"m"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"m"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:ObjCNSViewClass forKey:newFile];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
|
||||
// Should a header be created as well?
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
if (NSRunAlertPanel(@"Attention!",
|
||||
@"Should %@ be created and inserted into the project?",
|
||||
@"Yes",@"No",nil,[newFile lastPathComponent]))
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"nsviewheader" ofType:@"template"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:ObjCHeader];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
}
|
||||
}
|
||||
|
||||
bundle = [NSBundle bundleForClass:[self class]];
|
||||
newFile = [path copy];
|
||||
|
||||
/*
|
||||
*
|
||||
* Objective-C Class
|
||||
*/
|
||||
|
||||
else if ([type isEqualToString:CFile])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cfile" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"c"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"c"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:CFile forKey:newFile];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
|
||||
// Should a header be created as well?
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
if (NSRunAlertPanel(@"Attention!",@"Should %@ be created and inserted in the project as well?",@"Yes",@"No",nil,[newFile lastPathComponent])) {
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cheader" ofType:@"template"];
|
||||
if ([type isEqualToString:ObjCClass])
|
||||
{
|
||||
_file = [bundle pathForResource:@"class" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"m"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"m"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:CHeader];
|
||||
[files setObject:ObjCClass forKey:newFile];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
|
||||
// Should a header be created as well?
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
if (NSRunAlertPanel(@"Attention!",
|
||||
@"Should %@ be created and inserted into the project?",
|
||||
@"Yes",@"No",nil,[newFile lastPathComponent]))
|
||||
{
|
||||
_file = [bundle pathForResource:@"header" ofType:@"template"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile
|
||||
withProject:aProject
|
||||
type:ObjCHeader];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Objective-C NSView Subclass
|
||||
*/
|
||||
else if ([type isEqualToString:ObjCNSViewClass])
|
||||
{
|
||||
_file = [bundle pathForResource:@"nsviewclass" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"m"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"m"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:ObjCNSViewClass forKey:newFile];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
|
||||
// Should a header be created as well?
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
if (NSRunAlertPanel(@"Attention!",
|
||||
@"Should %@ be created and inserted into the project?",
|
||||
@"Yes",@"No",nil,[newFile lastPathComponent]))
|
||||
{
|
||||
_file = [bundle pathForResource:@"nsviewheader" ofType:@"template"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile
|
||||
withProject:aProject
|
||||
type:ObjCHeader];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* C File
|
||||
*/
|
||||
else if ([type isEqualToString:CFile])
|
||||
{
|
||||
_file = [bundle pathForResource:@"cfile" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"c"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"c"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:CFile forKey:newFile];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
|
||||
// Should a header be created as well?
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
if (NSRunAlertPanel(@"Attention!",
|
||||
@"Should %@ be created and inserted in the project as well?",
|
||||
@"Yes",@"No",nil,[newFile lastPathComponent])) {
|
||||
_file = [bundle pathForResource:@"cheader" ofType:@"template"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
|
||||
[self replaceTagsInFileAtPath:newFile
|
||||
withProject:aProject
|
||||
type:CHeader];
|
||||
[files setObject:CHeader forKey:newFile];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Objective-C Header
|
||||
*/
|
||||
else if ([type isEqualToString:ObjCHeader])
|
||||
{
|
||||
_file = [bundle pathForResource:@"header" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"h"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* GSMarkup
|
||||
*/
|
||||
else if ([type isEqualToString:GSMarkupFile])
|
||||
{
|
||||
_file = [bundle pathForResource:@"gsmarkup" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"gsmarkup"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"gsmarkup"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:GSMarkupFile forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* C Header
|
||||
*/
|
||||
else if ([type isEqualToString:CHeader])
|
||||
{
|
||||
_file = [bundle pathForResource:@"cheader" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"h"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
[files setObject:CHeader forKey:newFile];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
else if ([type isEqualToString:ObjCHeader])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"header" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"h"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
[files setObject:ObjCHeader forKey:newFile];
|
||||
}
|
||||
|
||||
else if ([type isEqualToString:GSMarkupFile])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"gsmarkup" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"gsmarkup"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"gsmarkup"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[files setObject:GSMarkupFile forKey:newFile];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Objective-C Protocol
|
||||
*/
|
||||
|
||||
else if ([type isEqualToString:CHeader])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"cheader" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"h"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
[files setObject:CHeader forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
else if ([type isEqualToString:ProtocolFile])
|
||||
{
|
||||
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"protocol" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"h"] == NO)
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
[files setObject:ProtocolFile forKey:newFile];
|
||||
}
|
||||
|
||||
{
|
||||
_file = [bundle pathForResource:@"protocol" ofType:@"template"];
|
||||
if ([[path pathExtension] isEqual: @"h"] == NO)
|
||||
{
|
||||
newFile = [path stringByAppendingPathExtension:@"h"];
|
||||
}
|
||||
[fm copyPath:_file toPath:newFile handler:nil];
|
||||
[self replaceTagsInFileAtPath:newFile withProject:aProject type:type];
|
||||
[files setObject:ProtocolFile forKey:newFile];
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify the browser!
|
||||
*/
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"ProjectDictDidChangeNotification" object:self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName:@"ProjectDictDidChangeNotification"
|
||||
object:self];
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
[matrix setAutoresizingMask: (NSViewMinXMargin | NSViewMaxYMargin)];
|
||||
[matrix setTarget:self];
|
||||
[matrix setAction:@selector(buttonsPressed:)];
|
||||
[matrix setIntercellSpacing: NSMakeSize(2,2)];
|
||||
[matrix setIntercellSpacing: NSMakeSize(8,2)];
|
||||
[_c_view addSubview:matrix];
|
||||
RELEASE(matrix);
|
||||
|
||||
|
|
|
@ -103,24 +103,24 @@ static PCFileManager *_mgr = nil;
|
|||
- (void)showAddFileWindow
|
||||
{
|
||||
NSOpenPanel *openPanel;
|
||||
int retval;
|
||||
int retval;
|
||||
|
||||
PCProject *project = nil;
|
||||
NSString *key = nil;
|
||||
NSString *title = nil;
|
||||
NSArray *types = nil;
|
||||
PCProject *project = nil;
|
||||
NSString *key = nil;
|
||||
NSString *title = nil;
|
||||
NSArray *types = nil;
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (delegate &&
|
||||
[delegate respondsToSelector:@selector(fileManagerWillAddFiles:)])
|
||||
{
|
||||
|
||||
if (!(project = [delegate fileManagerWillAddFiles:self]))
|
||||
{
|
||||
return;
|
||||
|
||||
if (!(project = [delegate fileManagerWillAddFiles:self]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
key = [project selectedRootCategory];
|
||||
|
||||
|
@ -135,90 +135,94 @@ static PCFileManager *_mgr = nil;
|
|||
[openPanel setCanChooseFiles:YES];
|
||||
[openPanel setTitle:title];
|
||||
|
||||
retval = [openPanel runModalForDirectory:[ud objectForKey:@"LastOpenDirectory"] file:nil types:types];
|
||||
retval = [openPanel
|
||||
runModalForDirectory:[ud objectForKey:@"LastOpenDirectory"]
|
||||
file:nil
|
||||
types:types];
|
||||
|
||||
if (retval == NSOKButton)
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSString *file;
|
||||
|
||||
[ud setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
|
||||
|
||||
enumerator = [[openPanel filenames] objectEnumerator];
|
||||
while (file = [enumerator nextObject]) {
|
||||
NSString *otherKey;
|
||||
NSString *ext;
|
||||
BOOL ret = NO;
|
||||
NSString *fn;
|
||||
NSString *fileName;
|
||||
NSString *pth;
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSString *file;
|
||||
|
||||
if ([delegate fileManager:self shouldAddFile:file forKey:key])
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
[ud setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
|
||||
|
||||
fileName = [file lastPathComponent];
|
||||
pth = [[project projectPath] stringByAppendingPathComponent:fileName];
|
||||
|
||||
if (![key isEqualToString:PCLibraries])
|
||||
{
|
||||
if (![fm fileExistsAtPath:pth])
|
||||
{
|
||||
[fm copyPath:file toPath:pth handler:nil];
|
||||
}
|
||||
}
|
||||
[project addFile:pth forKey:key];
|
||||
}
|
||||
enumerator = [[openPanel filenames] objectEnumerator];
|
||||
while (file = [enumerator nextObject])
|
||||
{
|
||||
NSString *otherKey;
|
||||
NSString *ext;
|
||||
NSString *fn;
|
||||
NSString *fileName;
|
||||
NSString *pth;
|
||||
BOOL ret = NO;
|
||||
|
||||
if ([key isEqualToString:PCClasses])
|
||||
{
|
||||
otherKey = PCHeaders;
|
||||
ext = [NSString stringWithString:@"h"];
|
||||
if ([delegate fileManager:self shouldAddFile:file forKey:key])
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
fn = [file stringByDeletingPathExtension];
|
||||
fn = [fn stringByAppendingPathExtension:ext];
|
||||
fileName = [file lastPathComponent];
|
||||
pth = [[project projectPath] stringByAppendingPathComponent:fileName];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:fn])
|
||||
{
|
||||
ret = NSRunAlertPanel(@"Adding Header?",
|
||||
@"Should %@ be added to project %@ as well?",
|
||||
@"Yes",@"No",nil,fn,[project projectName]);
|
||||
}
|
||||
}
|
||||
else if ([key isEqualToString:PCHeaders])
|
||||
{
|
||||
otherKey = PCClasses;
|
||||
ext = [NSString stringWithString:@"m"];
|
||||
if (![key isEqualToString:PCLibraries])
|
||||
{
|
||||
if (![fm fileExistsAtPath:pth])
|
||||
{
|
||||
[fm copyPath:file toPath:pth handler:nil];
|
||||
}
|
||||
}
|
||||
[project addFile:pth forKey:key];
|
||||
}
|
||||
|
||||
fn = [file stringByDeletingPathExtension];
|
||||
fn = [fn stringByAppendingPathExtension:ext];
|
||||
if ([key isEqualToString:PCClasses])
|
||||
{
|
||||
otherKey = PCHeaders;
|
||||
ext = [NSString stringWithString:@"h"];
|
||||
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:fn])
|
||||
{
|
||||
ret = NSRunAlertPanel(@"Adding Class?",
|
||||
@"Should %@ be added to project %@ as well?",
|
||||
@"Yes",@"No",nil,fn,[project projectName]);
|
||||
}
|
||||
}
|
||||
fn = [file stringByDeletingPathExtension];
|
||||
fn = [fn stringByAppendingPathExtension:ext];
|
||||
|
||||
if (ret)
|
||||
{
|
||||
if ([delegate fileManager:self shouldAddFile:fn forKey:otherKey])
|
||||
{
|
||||
NSString *pp = [project projectPath];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:fn])
|
||||
{
|
||||
ret = NSRunAlertPanel(@"Adding Header?",
|
||||
@"Should %@ be added to project %@ as well?",
|
||||
@"Yes",@"No",nil,fn,[project projectName]);
|
||||
}
|
||||
}
|
||||
else if ([key isEqualToString:PCHeaders])
|
||||
{
|
||||
otherKey = PCClasses;
|
||||
ext = [NSString stringWithString:@"m"];
|
||||
|
||||
fileName = [fn lastPathComponent];
|
||||
pth = [pp stringByAppendingPathComponent:fileName];
|
||||
fn = [file stringByDeletingPathExtension];
|
||||
fn = [fn stringByAppendingPathExtension:ext];
|
||||
|
||||
/* Only copy the file if it isn't already there */
|
||||
if ([pth isEqual: fn] == NO)
|
||||
[[NSFileManager defaultManager] copyPath:fn toPath:pth handler:nil];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:fn])
|
||||
{
|
||||
ret = NSRunAlertPanel(@"Adding Class?",
|
||||
@"Should %@ be added to project %@ as well?",
|
||||
@"Yes",@"No",nil,fn,[project projectName]);
|
||||
}
|
||||
}
|
||||
|
||||
[project addFile:pth forKey:otherKey];
|
||||
}
|
||||
if (ret)
|
||||
{
|
||||
if ([delegate fileManager:self shouldAddFile:fn forKey:otherKey])
|
||||
{
|
||||
NSString *pp = [project projectPath];
|
||||
|
||||
fileName = [fn lastPathComponent];
|
||||
pth = [pp stringByAppendingPathComponent:fileName];
|
||||
|
||||
/* Only copy the file if it isn't already there */
|
||||
if ([pth isEqual: fn] == NO)
|
||||
[[NSFileManager defaultManager] copyPath:fn toPath:pth handler:nil];
|
||||
|
||||
[project addFile:pth forKey:otherKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showNewFileWindow
|
||||
|
@ -232,13 +236,13 @@ static PCFileManager *_mgr = nil;
|
|||
- (void)buttonsPressed:(id)sender
|
||||
{
|
||||
switch ([[sender selectedCell] tag])
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
[self createFile];
|
||||
break;
|
||||
}
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
[self createFile];
|
||||
break;
|
||||
}
|
||||
[newFileWindow orderOut:self];
|
||||
[newFileName setStringValue:@""];
|
||||
}
|
||||
|
@ -263,49 +267,49 @@ static PCFileManager *_mgr = nil;
|
|||
NSString *fileName = [newFileName stringValue];
|
||||
NSString *fileType = [fileTypePopup titleOfSelectedItem];
|
||||
NSString *key = [[creators objectForKey:fileType] objectForKey:@"ProjectKey"];
|
||||
|
||||
|
||||
if (delegate)
|
||||
{
|
||||
path = [delegate fileManager:self willCreateFile:fileName withKey:key];
|
||||
}
|
||||
{
|
||||
path = [delegate fileManager:self willCreateFile:fileName withKey:key];
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"<%@ %x>: creating file at %@",[self class],self,path);
|
||||
NSLog(@"<%@ %x>: creating file at %@", [self class], self, path);
|
||||
#endif //DEBUG
|
||||
|
||||
// Create file
|
||||
if (path)
|
||||
{
|
||||
NSDictionary *newFiles;
|
||||
id<FileCreator> creator = [[creators objectForKey:fileType] objectForKey:@"Creator"];
|
||||
PCProject *p = [delegate activeProject];
|
||||
{
|
||||
NSDictionary *newFiles;
|
||||
id<FileCreator> creator = [[creators objectForKey:fileType] objectForKey:@"Creator"];
|
||||
PCProject *p = [delegate activeProject];
|
||||
|
||||
if (!creator)
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Could not create %@. The creator is missing!",
|
||||
@"OK",nil,nil,fileName);
|
||||
return;
|
||||
if (!creator)
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Could not create %@. The creator is missing!",
|
||||
@"OK",nil,nil,fileName);
|
||||
return;
|
||||
}
|
||||
|
||||
// Do it finally...
|
||||
newFiles = [creator createFileOfType:fileType path:path project:p];
|
||||
if (delegate
|
||||
&& [delegate respondsToSelector:@selector(fileManager:didCreateFile:withKey:)])
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSString *aFile;
|
||||
|
||||
enumerator = [[newFiles allKeys] objectEnumerator]; // Key: name of file
|
||||
while (aFile = [enumerator nextObject])
|
||||
{
|
||||
NSString *theType = [newFiles objectForKey:aFile];
|
||||
NSString *theKey = [[creators objectForKey:theType] objectForKey:@"ProjectKey"];
|
||||
|
||||
[delegate fileManager:self didCreateFile:aFile withKey:theKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do it finally...
|
||||
newFiles = [creator createFileOfType:fileType path:path project:p];
|
||||
if (delegate
|
||||
&& [delegate respondsToSelector:@selector(fileManager:didCreateFile:withKey:)])
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSString *aFile;
|
||||
|
||||
enumerator = [[newFiles allKeys] objectEnumerator]; // Key: name of file
|
||||
while (aFile = [enumerator nextObject])
|
||||
{
|
||||
NSString *theType = [newFiles objectForKey:aFile];
|
||||
NSString *theKey = [[creators objectForKey:theType] objectForKey:@"ProjectKey"];
|
||||
|
||||
[delegate fileManager:self didCreateFile:aFile withKey:theKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerCreatorsWithObjectsAndKeys:(NSDictionary *)dict
|
||||
|
|
|
@ -497,107 +497,105 @@
|
|||
|
||||
- (BOOL)save
|
||||
{
|
||||
BOOL ret = NO;
|
||||
NSString *file = [[projectPath stringByAppendingPathComponent:projectName] stringByAppendingPathExtension:@"pcproj"];
|
||||
NSString *backup = [file stringByAppendingPathExtension:@"backup"];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSString *keepBackup = [defs objectForKey:KeepBackup];
|
||||
BOOL shouldKeep = [keepBackup isEqualToString:@"YES"];
|
||||
NSString *file = [[projectPath stringByAppendingPathComponent:projectName]
|
||||
stringByAppendingPathExtension:@"pcproj"];
|
||||
NSString *backup = [file stringByAppendingPathExtension:@"backup"];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSString *keepBackup = [defs objectForKey:KeepBackup];
|
||||
BOOL shouldKeep = [keepBackup isEqualToString:@"YES"];
|
||||
BOOL ret = NO;
|
||||
|
||||
if ( shouldKeep == YES && [fm isWritableFileAtPath:backup] ) {
|
||||
ret = [fm removeFileAtPath:backup handler:nil];
|
||||
|
||||
if( ret == NO ) {
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Could not remove the old project backup '%@'!",
|
||||
@"OK",nil,nil,backup);
|
||||
}
|
||||
if ( shouldKeep == YES && [fm isWritableFileAtPath:backup] )
|
||||
{
|
||||
ret = [fm removeFileAtPath:backup handler:nil];
|
||||
if( ret == NO ) {
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Could not remove the old project backup '%@'!",
|
||||
@"OK",nil,nil,backup);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldKeep && [fm isReadableFileAtPath:file])
|
||||
if (shouldKeep && [fm isReadableFileAtPath:file])
|
||||
{
|
||||
ret = [fm copyPath:file toPath:backup handler:nil];
|
||||
|
||||
if( ret == NO )
|
||||
ret = [fm copyPath:file toPath:backup handler:nil];
|
||||
if( ret == NO )
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Could not save the project backup file '%@'!",
|
||||
@"OK",nil,nil,file);
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Could not save the project backup file '%@'!",
|
||||
@"OK",nil,nil,file);
|
||||
}
|
||||
}
|
||||
|
||||
ret = [projectDict writeToFile:file atomically:YES];
|
||||
|
||||
if( ret == YES )
|
||||
ret = [projectDict writeToFile:file atomically:YES];
|
||||
if( ret == YES )
|
||||
{
|
||||
[projectWindow setDocumentEdited:NO];
|
||||
[projectWindow setDocumentEdited:NO];
|
||||
}
|
||||
|
||||
[self saveAllFiles];
|
||||
[self writeMakefile];
|
||||
[self writeMakefile];
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (BOOL)saveAt:(NSString *)projPath
|
||||
{
|
||||
return NO;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)saveFile
|
||||
{
|
||||
return [editorController saveFile];
|
||||
return [editorController saveFile];
|
||||
}
|
||||
|
||||
- (BOOL)saveAllFiles
|
||||
{
|
||||
return [editorController saveAllFiles];
|
||||
return [editorController saveAllFiles];
|
||||
}
|
||||
|
||||
- (BOOL)saveAllFilesIfNeeded
|
||||
{
|
||||
BOOL ret = YES;
|
||||
BOOL ret = YES;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (BOOL)revertFile
|
||||
{
|
||||
return [editorController revertFile];
|
||||
return [editorController revertFile];
|
||||
}
|
||||
|
||||
- (BOOL)writeSpecFile
|
||||
{
|
||||
NSString *name = [projectDict objectForKey:PCProjectName];
|
||||
NSString *specInPath = [projectPath stringByAppendingPathComponent:name];
|
||||
NSMutableString *specIn = [NSMutableString string];
|
||||
NSString *name = [projectDict objectForKey:PCProjectName];
|
||||
NSString *specInPath = [projectPath stringByAppendingPathComponent:name];
|
||||
NSMutableString *specIn = [NSMutableString string];
|
||||
|
||||
if( [[projectDict objectForKey:PCRelease] intValue] < 1 )
|
||||
if( [[projectDict objectForKey:PCRelease] intValue] < 1 )
|
||||
{
|
||||
NSRunAlertPanel(@"Spec Input File Creation!",
|
||||
@"The Release entry seems to be wrong, please fix it!",
|
||||
@"OK",nil,nil);
|
||||
return NO;
|
||||
NSRunAlertPanel(@"Spec Input File Creation!",
|
||||
@"The Release entry seems to be wrong, please fix it!",
|
||||
@"OK",nil,nil);
|
||||
return NO;
|
||||
}
|
||||
|
||||
specInPath = [specInPath stringByAppendingPathExtension:@"spec.in"];
|
||||
specInPath = [specInPath stringByAppendingPathExtension:@"spec.in"];
|
||||
|
||||
[specIn appendString:@"# Automatically generated by ProjectCenter.app\n"];
|
||||
[specIn appendString:@"#\nsummary: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCSummary]];
|
||||
[specIn appendString:@"\nRelease: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCRelease]];
|
||||
[specIn appendString:@"\nCopyright: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCCopyright]];
|
||||
[specIn appendString:@"\nGroup: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCGroup]];
|
||||
[specIn appendString:@"\nSource: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCSource]];
|
||||
[specIn appendString:@"\n\n%description\n\n"];
|
||||
[specIn appendString:[projectDict objectForKey:PCDescription]];
|
||||
[specIn appendString:@"# Automatically generated by ProjectCenter.app\n"];
|
||||
[specIn appendString:@"#\nsummary: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCSummary]];
|
||||
[specIn appendString:@"\nRelease: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCRelease]];
|
||||
[specIn appendString:@"\nCopyright: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCCopyright]];
|
||||
[specIn appendString:@"\nGroup: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCGroup]];
|
||||
[specIn appendString:@"\nSource: "];
|
||||
[specIn appendString:[projectDict objectForKey:PCSource]];
|
||||
[specIn appendString:@"\n\n%description\n\n"];
|
||||
[specIn appendString:[projectDict objectForKey:PCDescription]];
|
||||
|
||||
return [specIn writeToFile:specInPath atomically:YES];
|
||||
return [specIn writeToFile:specInPath atomically:YES];
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -317,28 +317,22 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
|
||||
- (BOOL)saveProject
|
||||
{
|
||||
BOOL ret;
|
||||
BOOL ret;
|
||||
|
||||
if (![self activeProject]) {
|
||||
if (![self activeProject])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Save all files that need to be saved
|
||||
ret = [activeProject saveAllFilesIfNeeded];
|
||||
if( ret == NO ) {
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't save the files for project %@!",
|
||||
@"OK",nil,nil,[activeProject projectName]);
|
||||
}
|
||||
|
||||
// Save PC.project and the makefile!
|
||||
ret = [activeProject save];
|
||||
if( ret == NO ) {
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't save project %@!",
|
||||
@"OK",nil,nil,[activeProject projectName]);
|
||||
// Save PC.project and the makefiles!
|
||||
ret = [activeProject save];
|
||||
if( ret == NO )
|
||||
{
|
||||
NSRunAlertPanel(@"Attention!",
|
||||
@"Couldn't save project %@!",
|
||||
@"OK",nil,nil,[activeProject projectName]);
|
||||
}
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)saveProjectAs:(NSString *)projName
|
||||
|
@ -399,6 +393,7 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
|
|||
|
||||
- (void)saveFiles
|
||||
{
|
||||
[activeProject saveAllFiles];
|
||||
}
|
||||
|
||||
- (void)revertToSaved
|
||||
|
|
|
@ -196,16 +196,16 @@
|
|||
|
||||
- (void)saveProjectAs:(id)sender
|
||||
{
|
||||
NSString *proj;
|
||||
NSString *proj;
|
||||
|
||||
// Show save panel
|
||||
// Show save panel
|
||||
|
||||
[projectManager saveProjectAs:proj];
|
||||
[projectManager saveProjectAs:proj];
|
||||
}
|
||||
|
||||
- (void)saveFiles:(id)sender
|
||||
{
|
||||
[projectManager saveFiles];
|
||||
[projectManager saveFiles];
|
||||
}
|
||||
|
||||
- (void)revertToSaved:(id)sender
|
||||
|
@ -239,7 +239,7 @@
|
|||
|
||||
- (void)newFile:(id)sender
|
||||
{
|
||||
[fileManager showNewFileWindow];
|
||||
[fileManager showNewFileWindow];
|
||||
}
|
||||
|
||||
- (void)openFile:(id)sender
|
||||
|
@ -276,12 +276,12 @@
|
|||
|
||||
- (void)addFile:(id)sender
|
||||
{
|
||||
[fileManager showAddFileWindow];
|
||||
[fileManager showAddFileWindow];
|
||||
}
|
||||
|
||||
- (void)saveFile:(id)sender
|
||||
{
|
||||
[projectManager saveFile];
|
||||
[projectManager saveFile];
|
||||
}
|
||||
|
||||
- (void)revertFile:(id)sender
|
||||
|
@ -323,55 +323,129 @@
|
|||
|
||||
- (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
|
||||
{
|
||||
if ([[projectManager loadedProjects] count] == 0)
|
||||
NSString *menuTitle = [[menuItem menu] title];
|
||||
|
||||
if ([[projectManager loadedProjects] count] == 0)
|
||||
{
|
||||
// File related menu items
|
||||
if ([[menuItem title] isEqualToString:@"New in Project"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Add File"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Remove File"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Save File"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Revert"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Rename"]) return NO;
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Project related menu items
|
||||
if ([[menuItem title] isEqualToString:@"Close"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Save..."]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Save As..."]) 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;
|
||||
}
|
||||
|
||||
// Embedded Project Views
|
||||
if ([[menuItem title] isEqualToString:@"Inspector Panel"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Launch Panel"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Build Panel"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Editor Panel"]) return NO;
|
||||
|
||||
if ([[menuItem title] isEqualToString:@"Run..."]) 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;
|
||||
}
|
||||
}
|
||||
|
||||
// File related menu items
|
||||
if( editorIsKey == NO )
|
||||
// Project related menu items
|
||||
if ([menuTitle isEqualToString: @"Project"]
|
||||
&& [[projectManager activeProject] selectedRootCategory] == nil)
|
||||
{
|
||||
if ([[menuItem title] isEqualToString:@"Save File"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Revert"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Rename"]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Add Files..."]) return NO;
|
||||
if ([[menuItem title] isEqualToString:@"Remove Files..."]) return NO;
|
||||
}
|
||||
|
||||
if ([[menuItem title] isEqualToString:@"Find Next"])
|
||||
// File related menu items
|
||||
if (([menuTitle isEqualToString: @"File"]))
|
||||
{
|
||||
if( ![[[PCTextFinder sharedFinder] findPanel] isVisible] ) return NO;
|
||||
PCEditorController *editor = [[projectManager activeProject] editorController];
|
||||
|
||||
if (![[editor allEditors] count] || editorIsKey == 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:@"Rename"]) return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if ([[menuItem title] isEqualToString:@"Find Previous"])
|
||||
// Find menu items
|
||||
if (editorIsKey == NO && [menuTitle isEqualToString: @"Find"])
|
||||
{
|
||||
if( ![[[PCTextFinder sharedFinder] findPanel] isVisible] ) return NO;
|
||||
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;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)editorDidResignKey:(NSNotification *)aNotification
|
||||
{
|
||||
editorIsKey = NO;
|
||||
}
|
||||
|
||||
- (void)editorDidBecomeKey:(NSNotification *)aNotification
|
||||
{
|
||||
editorIsKey = YES;
|
||||
|
|
|
@ -140,7 +140,7 @@ createMenu()
|
|||
action:@selector(addFile:)
|
||||
keyEquivalent:@"A"];
|
||||
[project addItemWithTitle:@"Save Files..."
|
||||
action:action
|
||||
action:@selector(saveFiles:)
|
||||
keyEquivalent:@"Q"];
|
||||
[project addItemWithTitle:@"Remove Files..."
|
||||
action:@selector(removeFile:)
|
||||
|
@ -264,7 +264,7 @@ createMenu()
|
|||
[edit_find addItemWithTitle:@"Find Next"
|
||||
action:@selector(findNext:)
|
||||
keyEquivalent:@"g"];
|
||||
[edit_find addItemWithTitle:@"Find Previuos"
|
||||
[edit_find addItemWithTitle:@"Find Previous"
|
||||
action:@selector(findPrevious:)
|
||||
keyEquivalent:@"d"];
|
||||
[edit_find addItemWithTitle:@"Enter Selection"
|
||||
|
|
Loading…
Reference in a new issue