Fix recognizing subproject files

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@19740 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2004-07-15 22:00:50 +00:00
parent f8b0c67d51
commit cbf3861dce
7 changed files with 118 additions and 85 deletions

View file

@ -1,3 +1,17 @@
2004-07-15 Serg Stoyan <stoyan255@ukr.net>
* Library/PCProject.m:
(projectFileForFile:forKey:): Fix recognizing of subproject files.
* Library/PCProjectManager.m:
(addProjectFiles):ditto.
2004-07-14 Serg Stoyan <stoyan255@ukr.net>
* Library/PCButton.m: PCButtonCell removed.
(initWithFrame:): [self setCell:] removed. [_cell setGradientType:]
added.
2004-07-04 Serg Stoyan <stoyan255@ukr.net>
* Library/PCProject.m:

View file

@ -32,6 +32,8 @@
*/
@interface PCButton : NSButton
{
NSString *_toolTipText;
NSTrackingRectTag tRectTag;
NSTimer *ttTimer;
NSWindow *ttWindow;
@ -46,14 +48,4 @@
@end
/*
* Button Cell
*/
@interface PCButtonCell : NSButtonCell
{
NSImage *tile;
}
@end
#endif

View file

@ -30,7 +30,7 @@
- (id)initWithFrame:(NSRect)frameRect
{
self = [super initWithFrame:frameRect];
[self setCell:[[PCButtonCell alloc] init]];
[_cell setGradientType:NSGradientConvexWeak];
[self setImagePosition:NSImageOnly];
[self setFont:[NSFont systemFontOfSize: 10.0]];
@ -168,6 +168,11 @@
// NSLog (@"-- invalidate");
[ttTimer invalidate];
ttTimer = nil;
if (ttWindow && [ttWindow isVisible])
{
[ttWindow orderOut:self];
}
}
}
@ -195,78 +200,91 @@
}
}
@end
//
// Tool Tips
//
@implementation PCButtonCell
- (id)init
- (void)_invalidateToolTip:(NSTimer *)timer
{
self = [super init];
tile = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle]
pathForImageResource:@"ButtonTile"]];
[timer invalidate];
timer = nil;
return self;
}
- (void)dealloc
{
RELEASE(tile);
[super dealloc];
}
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
[super drawInteriorWithFrame: cellFrame inView: controlView];
if (!_cell.is_highlighted)
if (ttWindow && [ttWindow isVisible])
{
NSPoint position;
NSImage *imageToDisplay;
unsigned mask = 0;
if ([controlView isFlipped])
{
position = NSMakePoint(cellFrame.origin.x+1,
cellFrame.size.height-2);
}
else
{
position = NSMakePoint(1, 2);
}
// Tile
[tile compositeToPoint:position
operation:NSCompositeSourceOver];
if (_cell.state)
mask = _showAltStateMask;
// Image
[_cell_image setBackgroundColor:[NSColor clearColor]];
[_altImage setBackgroundColor:[NSColor clearColor]];
if (mask & NSContentsCellMask)
{
imageToDisplay = _altImage;
}
else
{
imageToDisplay = _cell_image;
}
position.x = (cellFrame.size.width - [_cell_image size].width)/2;
position.y = (cellFrame.size.height - [_cell_image size].height)/2;
if (_cell.is_disabled)
{
[_cell_image dissolveToPoint:position fraction:0.5];
}
else
{
[imageToDisplay compositeToPoint:position
operation:NSCompositeSourceOver];
}
[ttWindow orderOut:self];
}
}
- (NSToolTipTag) addToolTipRect: (NSRect)aRect
owner: (id)anObject
userData: (void *)data
{
SEL ownerSelector = @selector(view:stringForToolTip:point:userData:);
/* if (aRect == NSZeroRect)
{
return;
}*/
if (![anObject respondsToSelector:ownerSelector]
&& ![anObject isKindOfClass:[NSString class]])
{
return;
}
tRectTag = [[self superview] addTrackingRect:aRect
owner:self
userData:data
assumeInside:NO];
[[self window] setAcceptsMouseMovedEvents:YES];
if (ttTimer == nil)
{
ttTimer = [NSTimer
scheduledTimerWithTimeInterval:0.5
target:self
selector:@selector(showTooltip:)
userInfo:nil
repeats:YES];
}
return 0;
}
- (void) removeAllToolTips
{
}
- (void) removeToolTip: (NSToolTipTag)tag
{
}
- (void) setToolTip: (NSString *)string
{
ASSIGN(_toolTipText, string);
if (string == nil)
{
_hasTooltip = NO;
if (ttTimer != nil)
{
}
}
if (_hasTooltip)
{
tRectTag = [[self superview] addTrackingRect:[self frame]
owner:self
userData:nil
assumeInside:NO];
[[self window] setAcceptsMouseMovedEvents:YES];
}
}
- (NSString *) toolTip
{
return _toolTipText;
}
@end

View file

@ -623,11 +623,20 @@ NSString
NSMutableString *projectFile = nil;
NSString *path = nil;
NSRange pathRange;
NSRange slashRange;
path = [file stringByDeletingLastPathComponent];
pathRange = [path rangeOfString:projectPath];
if (pathRange.length)
{
slashRange.location = pathRange.length;
slashRange.length = 1;
}
if (pathRange.length
&& slashRange.location != [path length]
&& [[path substringWithRange:slashRange] isEqualToString:@"/"])
{
pathRange.length++;
projectFile = [NSMutableString stringWithString:file];

View file

@ -722,8 +722,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
NSString *category = [[project projectBrowser] nameOfSelectedCategory];
NSString *categoryKey = [activeProject keyForCategory:category];
NSMutableArray *files = nil;
NSString *path = nil;
NSRange pathRange;
NSString *file = nil;
NSString *projectFile = nil;
files = [fileManager filesForAdd];
@ -736,10 +736,11 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
return NO;
}
path = [[files objectAtIndex:0] stringByDeletingLastPathComponent];
pathRange = [path rangeOfString:[activeProject projectPath]];
file = [[files objectAtIndex:0] lastPathComponent];
projectFile = [activeProject projectFileFromFile:[files objectAtIndex:0]
forKey:categoryKey];
if (pathRange.length)
if (![projectFile isEqualToString:file])
{
[activeProject addFiles:files forKey:categoryKey notify:YES];
}

View file

@ -720,12 +720,11 @@
PCProject *changedProject = [notifObject objectForKey:@"Project"];
if (changedProject != project
&& changedProject != [project activeSubproject]
&& [changedProject superProject] != [project activeSubproject])
&& changedProject != [project activeSubproject])
{
return;
}
[self setTitle];
// TODO: if window isn't visible and "edited" attribute set, after ordering