mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-19 01:51:09 +00:00
minor bugfix in the editor textview and new method to copy files into proj
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@8477 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f7ac48ff59
commit
de3d438171
3 changed files with 36 additions and 20 deletions
|
@ -188,6 +188,8 @@ static NSString * const PCLibraryVar = @"LIBRARY_VAR";
|
|||
// Returns YES if type is a valid key and file is not contained in the project already
|
||||
|
||||
- (void)addFile:(NSString *)file forKey:(NSString *)key;
|
||||
- (void)addFile:(NSString *)file forKey:(NSString *)key copy:(BOOL)yn;
|
||||
|
||||
- (void)removeFile:(NSString *)file forKey:(NSString *)key;
|
||||
- (BOOL)removeSelectedFilePermanently:(BOOL)yn;
|
||||
- (void)renameFile:(NSString *)aFile;
|
||||
|
|
|
@ -600,29 +600,43 @@
|
|||
|
||||
- (void)addFile:(NSString *)file forKey:(NSString *)type
|
||||
{
|
||||
NSMutableArray *files = [NSMutableArray arrayWithArray:[projectDict objectForKey:type]];
|
||||
NSMutableString *newFile = [NSMutableString stringWithString:[file lastPathComponent]];
|
||||
|
||||
if ([type isEqualToString:PCLibraries]) {
|
||||
[newFile deleteCharactersInRange:NSMakeRange(0,3)];
|
||||
newFile = [newFile stringByDeletingPathExtension];
|
||||
}
|
||||
|
||||
if ([files containsObject:newFile]) {
|
||||
NSRunAlertPanel(@"Attention!",@"The file %@ is already part of this project!",@"OK",nil,nil,newFile);
|
||||
return;
|
||||
}
|
||||
[self addFile:file forKey:type copy:NO];
|
||||
}
|
||||
|
||||
- (void)addFile:(NSString *)file forKey:(NSString *)type copy:(BOOL)yn
|
||||
{
|
||||
NSMutableArray *files = [NSMutableArray arrayWithArray:[projectDict objectForKey:type]];
|
||||
NSMutableString *newFile = [NSMutableString stringWithString:[file lastPathComponent]];
|
||||
|
||||
if ([type isEqualToString:PCLibraries]) {
|
||||
[newFile deleteCharactersInRange:NSMakeRange(0,3)];
|
||||
newFile = [newFile stringByDeletingPathExtension];
|
||||
}
|
||||
|
||||
if ([files containsObject:newFile]) {
|
||||
NSRunAlertPanel(@"Attention!",@"The file %@ is already part of this project!",@"OK",nil,nil,newFile);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"<%@ %x>: adding file %@ for key %@",[self class],self,newFile,type);
|
||||
NSLog(@"<%@ %x>: adding file %@ for key %@",[self class],self,newFile,type);
|
||||
#endif DEBUG
|
||||
|
||||
// Add the new file
|
||||
[files addObject:newFile];
|
||||
[projectDict setObject:files forKey:type];
|
||||
|
||||
// Synchronise the makefile!
|
||||
[self writeMakefile];
|
||||
|
||||
if (yn) {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSString *destination = [[self projectPath] stringByAppendingPathComponent:newFile];
|
||||
|
||||
// Add the new file
|
||||
[files addObject:newFile];
|
||||
[projectDict setObject:files forKey:type];
|
||||
|
||||
// Synchronise the makefile!
|
||||
[self writeMakefile];
|
||||
if (![manager copyPath:file toPath:destination handler:nil]) {
|
||||
NSRunAlertPanel(@"Attention!",@"The file %@ could not be copied to %@!",@"OK",nil,nil,newFile,destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeFile:(NSString *)file forKey:(NSString *)key
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
|
||||
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect (-1,-1,514,322)];
|
||||
[scrollView setDocumentView:textView];
|
||||
[textView setMinSize:NSMakeSize(0.0,[scrollView contentSize].height)];
|
||||
//[textView setMinSize:NSMakeSize(0.0,[scrollView contentSize].height)];
|
||||
[[textView textContainer] setContainerSize:NSMakeSize([scrollView contentSize].width,1e7)];
|
||||
[scrollView setHasHorizontalScroller: YES];
|
||||
[scrollView setHasVerticalScroller: YES];
|
||||
|
|
Loading…
Reference in a new issue