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> 2004-07-04 Serg Stoyan <stoyan255@ukr.net>
* Library/PCProject.m: * Library/PCProject.m:

View file

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

View file

@ -30,7 +30,7 @@
- (id)initWithFrame:(NSRect)frameRect - (id)initWithFrame:(NSRect)frameRect
{ {
self = [super initWithFrame:frameRect]; self = [super initWithFrame:frameRect];
[self setCell:[[PCButtonCell alloc] init]]; [_cell setGradientType:NSGradientConvexWeak];
[self setImagePosition:NSImageOnly]; [self setImagePosition:NSImageOnly];
[self setFont:[NSFont systemFontOfSize: 10.0]]; [self setFont:[NSFont systemFontOfSize: 10.0]];
@ -168,6 +168,11 @@
// NSLog (@"-- invalidate"); // NSLog (@"-- invalidate");
[ttTimer invalidate]; [ttTimer invalidate];
ttTimer = nil; ttTimer = nil;
if (ttWindow && [ttWindow isVisible])
{
[ttWindow orderOut:self];
}
} }
} }
@ -195,78 +200,91 @@
} }
} }
@end //
// Tool Tips
//
@implementation PCButtonCell - (void)_invalidateToolTip:(NSTimer *)timer
- (id)init
{ {
self = [super init]; [timer invalidate];
tile = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] timer = nil;
pathForImageResource:@"ButtonTile"]];
return self; if (ttWindow && [ttWindow isVisible])
}
- (void)dealloc
{
RELEASE(tile);
[super dealloc];
}
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
[super drawInteriorWithFrame: cellFrame inView: controlView];
if (!_cell.is_highlighted)
{ {
NSPoint position; [ttWindow orderOut:self];
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];
}
} }
} }
- (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 @end

View file

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

View file

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

View file

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