mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 17:01:18 +00:00
Datalink and connector improvements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20662 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5a9c710034
commit
d8aeb282ab
6 changed files with 93 additions and 89 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2005-02-05 15:42 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSDataLinkManager.h: Moved NSDataLinkManager delegate
|
||||||
|
methods to an informal protocol NSDataLinkManagerDelegate.
|
||||||
|
* Source/Functions.m: Implemented NSFrameLinkRect() to draw the frames
|
||||||
|
around source and destination links.
|
||||||
|
* Source/NSBundleAdditions.m: Modified -description method in
|
||||||
|
NSNibConnector to display the source, destination and label for the
|
||||||
|
connection. This makes it easier to debug.
|
||||||
|
* Source/NSDataLink.m: Implemented a few private methods.
|
||||||
|
* Source/NSDataLinkManager.m: Implemented -breakAllLinks.
|
||||||
|
|
||||||
2005-02-03 10:54 Alexander Malmberg <alexander@malmberg.org>
|
2005-02-03 10:54 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSImage.m (min, max): Rename to ...
|
* Source/NSImage.m (min, max): Rename to ...
|
||||||
|
|
|
@ -101,10 +101,13 @@
|
||||||
- (NSDataLink *)destinationLinkWithSelection:(NSSelection *)destSel;
|
- (NSDataLink *)destinationLinkWithSelection:(NSSelection *)destSel;
|
||||||
- (void)setLinkOutlinesVisible:(BOOL)flag;
|
- (void)setLinkOutlinesVisible:(BOOL)flag;
|
||||||
- (NSEnumerator *)sourceLinkEnumerator;
|
- (NSEnumerator *)sourceLinkEnumerator;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Methods Implemented by the Delegate
|
// Methods Implemented by the Delegate
|
||||||
//
|
//
|
||||||
|
@interface NSObject (NSDataLinkManagerDelegate)
|
||||||
- (BOOL)copyToPasteboard:(NSPasteboard *)pasteboard
|
- (BOOL)copyToPasteboard:(NSPasteboard *)pasteboard
|
||||||
at:(NSSelection *)selection
|
at:(NSSelection *)selection
|
||||||
cheapCopyAllowed:(BOOL)flag;
|
cheapCopyAllowed:(BOOL)flag;
|
||||||
|
@ -126,15 +129,9 @@
|
||||||
at:(NSSelection *)selection;
|
at:(NSSelection *)selection;
|
||||||
- (BOOL)showSelection:(NSSelection *)selection;
|
- (BOOL)showSelection:(NSSelection *)selection;
|
||||||
- (NSWindow *)windowForSelection:(NSSelection *)selection;
|
- (NSWindow *)windowForSelection:(NSSelection *)selection;
|
||||||
|
|
||||||
//
|
|
||||||
// NSCoding protocol
|
|
||||||
//
|
|
||||||
- (void)encodeWithCoder: (NSCoder *)aCoder;
|
|
||||||
- initWithCoder: (NSCoder *)aDecoder;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw a Distinctive Outline around Linked Data
|
// Draw a Distinctive Outline around Linked Data
|
||||||
//
|
//
|
||||||
|
|
|
@ -776,19 +776,27 @@ NSDrawWindowBackground(NSRect aRect)
|
||||||
NSRectFill(aRect);
|
NSRectFill(aRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
NSFrameLinkRect(NSRect aRect, BOOL isDestination)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
float
|
||||||
NSLinkFrameThickness(void)
|
NSLinkFrameThickness(void)
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
return 1.5;
|
return 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSFrameLinkRect(NSRect aRect, BOOL isDestination)
|
||||||
|
{
|
||||||
|
if (isDestination)
|
||||||
|
{
|
||||||
|
[[NSColor redColor] set];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[[NSColor greenColor] set];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSFrameRectWithWidth(aRect, NSLinkFrameThickness());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NSConvertGlobalToWindowNumber(int globalNum, unsigned int *winNum)
|
NSConvertGlobalToWindowNumber(int globalNum, unsigned int *winNum)
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,6 +134,16 @@
|
||||||
ASSIGN(_src, anObject);
|
ASSIGN(_src, anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)description
|
||||||
|
{
|
||||||
|
NSString *desc = [NSString stringWithFormat: @"<%@ src=%@ dst=%@ label=%@>",
|
||||||
|
[super description],
|
||||||
|
[self source],
|
||||||
|
[self destination],
|
||||||
|
[self label]];
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSNibControlConnector
|
@implementation NSNibControlConnector
|
||||||
|
|
|
@ -27,6 +27,27 @@
|
||||||
#include "AppKit/NSDataLink.h"
|
#include "AppKit/NSDataLink.h"
|
||||||
#include "AppKit/NSDataLinkManager.h"
|
#include "AppKit/NSDataLinkManager.h"
|
||||||
|
|
||||||
|
@interface NSDataLink (Private)
|
||||||
|
- (void) setLastUpdateTime: (NSDate *)date;
|
||||||
|
- (void) setSourceFilename: (NSString *)src;
|
||||||
|
- (void) setDestinationFilename: (NSString *)src;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSDataLink (Private)
|
||||||
|
- (void) setLastUpdateTime: (NSDate *)date
|
||||||
|
{
|
||||||
|
ASSIGN(lastUpdateTime, date);
|
||||||
|
}
|
||||||
|
- (void) setSourceFilename: (NSString *)src
|
||||||
|
{
|
||||||
|
ASSIGN(sourceFilename,src);
|
||||||
|
}
|
||||||
|
- (void) setDestinationFilename: (NSString *)dst
|
||||||
|
{
|
||||||
|
ASSIGN(destinationFilename, dst);
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation NSDataLink
|
@implementation NSDataLink
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "AppKit/NSDataLinkManager.h"
|
#include <Foundation/NSDictionary.h>
|
||||||
|
#include <Foundation/NSEnumerator.h>
|
||||||
|
#include <AppKit/NSDataLinkManager.h>
|
||||||
|
#include <AppKit/NSDataLink.h>
|
||||||
|
|
||||||
@implementation NSDataLinkManager
|
@implementation NSDataLinkManager
|
||||||
|
|
||||||
|
@ -99,7 +102,19 @@
|
||||||
|
|
||||||
- (void)breakAllLinks
|
- (void)breakAllLinks
|
||||||
{
|
{
|
||||||
NSLog(@"Break all links.");
|
NSEnumerator *en = [self destinationLinkEnumerator];
|
||||||
|
id obj = nil;
|
||||||
|
|
||||||
|
while((obj = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
[obj break];
|
||||||
|
}
|
||||||
|
|
||||||
|
en = [self sourceLinkEnumerator];
|
||||||
|
while((obj = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
[obj break];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)writeLinksToPasteboard:(NSPasteboard *)pasteboard
|
- (void)writeLinksToPasteboard:(NSPasteboard *)pasteboard
|
||||||
|
@ -181,12 +196,23 @@
|
||||||
|
|
||||||
- (NSEnumerator *)destinationLinkEnumerator
|
- (NSEnumerator *)destinationLinkEnumerator
|
||||||
{
|
{
|
||||||
return nil;
|
return [destinationLinks keyEnumerator];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDataLink *)destinationLinkWithSelection:(NSSelection *)destSel
|
- (NSDataLink *)destinationLinkWithSelection:(NSSelection *)destSel
|
||||||
{
|
{
|
||||||
return nil;
|
NSEnumerator *en = [self destinationLinkEnumerator];
|
||||||
|
id obj = nil;
|
||||||
|
|
||||||
|
while((obj = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if([obj destinationSelection] == destSel)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setLinkOutlinesVisible:(BOOL)flag
|
- (void)setLinkOutlinesVisible:(BOOL)flag
|
||||||
|
@ -196,77 +222,7 @@
|
||||||
|
|
||||||
- (NSEnumerator *)sourceLinkEnumerator
|
- (NSEnumerator *)sourceLinkEnumerator
|
||||||
{
|
{
|
||||||
return nil;
|
return [sourceLinks keyEnumerator];
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Methods Implemented by the Delegate
|
|
||||||
//
|
|
||||||
- (BOOL)copyToPasteboard:(NSPasteboard *)pasteboard
|
|
||||||
at:(NSSelection *)selection
|
|
||||||
cheapCopyAllowed:(BOOL)flag
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dataLinkManager:(NSDataLinkManager *)sender
|
|
||||||
didBreakLink:(NSDataLink *)link
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)dataLinkManager:(NSDataLinkManager *)sender
|
|
||||||
isUpdateNeededForLink:(NSDataLink *)link
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dataLinkManager:(NSDataLinkManager *)sender
|
|
||||||
startTrackingLink:(NSDataLink *)link
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dataLinkManager:(NSDataLinkManager *)sender
|
|
||||||
stopTrackingLink:(NSDataLink *)link
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dataLinkManagerCloseDocument:(NSDataLinkManager *)sender
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dataLinkManagerDidEditLinks:(NSDataLinkManager *)sender
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dataLinkManagerRedrawLinkOutlines:(NSDataLinkManager *)sender
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)dataLinkManagerTracksLinksIndividually:(NSDataLinkManager *)sender
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)importFile:(NSString *)filename
|
|
||||||
at:(NSSelection *)selection
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)pasteFromPasteboard:(NSPasteboard *)pasteboard
|
|
||||||
at:(NSSelection *)selection
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)showSelection:(NSSelection *)selection
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSWindow *)windowForSelection:(NSSelection *)selection
|
|
||||||
{
|
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue