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:
Robert Slover 2001-01-06 16:26:01 +00:00
parent f7ac48ff59
commit de3d438171
3 changed files with 36 additions and 20 deletions

View file

@ -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;

View file

@ -599,6 +599,11 @@
}
- (void)addFile:(NSString *)file forKey:(NSString *)type
{
[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]];
@ -623,6 +628,15 @@
// Synchronise the makefile!
[self writeMakefile];
if (yn) {
NSFileManager *manager = [NSFileManager defaultManager];
NSString *destination = [[self projectPath] stringByAppendingPathComponent:newFile];
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

View file

@ -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];