Data link implementation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20045 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2004-09-12 04:26:21 +00:00
parent 2f09829409
commit 7f67994c98
8 changed files with 130 additions and 36 deletions

View file

@ -1,3 +1,13 @@
2004-09-12 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/NSDataLinkPanel.h: Added new attributes.
* Source/NSDataLinkPanel.m: Implemented some
methods.
* Panels/English.lproj/GSDataLinkPanel.gorm: Updated
graphics and added link to new ivar.
* Source/NSDataLink.m:
* Source/NSDataLinkManager.m: Code cleanup.
2004-09-11 Gregory John Casamento <greg_casamento@yahoo.com> 2004-09-11 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSCell.m: Reverted previous change. * Source/NSCell.m: Reverted previous change.

View file

@ -42,7 +42,7 @@
@interface NSDataLinkPanel : NSPanel <NSCoding> @interface NSDataLinkPanel : NSPanel <NSCoding>
{ {
// Attributes // Outlets
id _sourceField; id _sourceField;
id _lastUpdateField; id _lastUpdateField;
id _openSourceButton; id _openSourceButton;
@ -50,6 +50,12 @@
id _breakLinkButton; id _breakLinkButton;
id _breakAllLinksButton; id _breakAllLinksButton;
id _updateModeButton; id _updateModeButton;
// Attributes
NSDataLinkManager *_currentDataLinkManager;
NSDataLink *_currentDataLink;
BOOL _multipleSelection;
NSView *_accessoryView;
} }
// //

View file

@ -165,7 +165,8 @@
_updateDestinationButton, _updateDestinationButton,
_openSourceButton, _openSourceButton,
_lastUpdateField, _lastUpdateField,
_sourceField _sourceField,
_updateView
); );
Super = NSPanel; Super = NSPanel;
}; };

Binary file not shown.

View file

@ -89,7 +89,8 @@
} }
- (void)writeToPasteboard:(NSPasteboard *)pasteboard - (void)writeToPasteboard:(NSPasteboard *)pasteboard
{} {
}
// //
// Information about the Link // Information about the Link

View file

@ -98,31 +98,40 @@
} }
- (void)breakAllLinks - (void)breakAllLinks
{} {
NSLog(@"Break all links.");
}
- (void)writeLinksToPasteboard:(NSPasteboard *)pasteboard - (void)writeLinksToPasteboard:(NSPasteboard *)pasteboard
{} {
}
// //
// Informing the Link Manager of Document Status // Informing the Link Manager of Document Status
// //
- (void)noteDocumentClosed - (void)noteDocumentClosed
{} {
}
- (void)noteDocumentEdited - (void)noteDocumentEdited
{} {
}
- (void)noteDocumentReverted - (void)noteDocumentReverted
{} {
}
- (void)noteDocumentSaved - (void)noteDocumentSaved
{} {
}
- (void)noteDocumentSavedAs:(NSString *)path - (void)noteDocumentSavedAs:(NSString *)path
{} {
}
- (void)noteDocumentSavedTo:(NSString *)path - (void)noteDocumentSavedTo:(NSString *)path
{} {
}
// //
// Getting and Setting Information about the Link Manager // Getting and Setting Information about the Link Manager
@ -202,7 +211,8 @@ cheapCopyAllowed:(BOOL)flag
- (void)dataLinkManager:(NSDataLinkManager *)sender - (void)dataLinkManager:(NSDataLinkManager *)sender
didBreakLink:(NSDataLink *)link didBreakLink:(NSDataLink *)link
{} {
}
- (BOOL)dataLinkManager:(NSDataLinkManager *)sender - (BOOL)dataLinkManager:(NSDataLinkManager *)sender
isUpdateNeededForLink:(NSDataLink *)link isUpdateNeededForLink:(NSDataLink *)link
@ -212,20 +222,25 @@ cheapCopyAllowed:(BOOL)flag
- (void)dataLinkManager:(NSDataLinkManager *)sender - (void)dataLinkManager:(NSDataLinkManager *)sender
startTrackingLink:(NSDataLink *)link startTrackingLink:(NSDataLink *)link
{} {
}
- (void)dataLinkManager:(NSDataLinkManager *)sender - (void)dataLinkManager:(NSDataLinkManager *)sender
stopTrackingLink:(NSDataLink *)link stopTrackingLink:(NSDataLink *)link
{} {
}
- (void)dataLinkManagerCloseDocument:(NSDataLinkManager *)sender - (void)dataLinkManagerCloseDocument:(NSDataLinkManager *)sender
{} {
}
- (void)dataLinkManagerDidEditLinks:(NSDataLinkManager *)sender - (void)dataLinkManagerDidEditLinks:(NSDataLinkManager *)sender
{} {
}
- (void)dataLinkManagerRedrawLinkOutlines:(NSDataLinkManager *)sender - (void)dataLinkManagerRedrawLinkOutlines:(NSDataLinkManager *)sender
{} {
}
- (BOOL)dataLinkManagerTracksLinksIndividually:(NSDataLinkManager *)sender - (BOOL)dataLinkManagerTracksLinksIndividually:(NSDataLinkManager *)sender
{ {

View file

@ -1,9 +1,10 @@
/** <title>NSDataLinkPanel</title> /** <title>NSDataLinkPanel</title>
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996, 2003, 2004 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg_casamento@yahoo.com>
Author: Scott Christley <scottc@net-community.com> Author: Scott Christley <scottc@net-community.com>
Date: 1996 Date: 1996, 2003, 2004
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -25,6 +26,9 @@
#include "config.h" #include "config.h"
#include "AppKit/NSDataLinkPanel.h" #include "AppKit/NSDataLinkPanel.h"
#include "AppKit/NSDataLinkManager.h"
#include "AppKit/NSDataLink.h"
#include "AppKit/NSView.h"
#include "AppKit/NSNibLoading.h" #include "AppKit/NSNibLoading.h"
#include "GSGuiPrivate.h" #include "GSGuiPrivate.h"
@ -77,6 +81,10 @@ static NSDataLinkPanel *_sharedDataLinkPanel;
@implementation NSApplication (NSDataLinkPanel) @implementation NSApplication (NSDataLinkPanel)
/**
* Order the data link panel to the front. If it has not already
* been instantiated, instantiate it.
*/
- (void) orderFrontDataLinkPanel: sender - (void) orderFrontDataLinkPanel: sender
{ {
NSDataLinkPanel *dataLinkPanel = [NSDataLinkPanel sharedDataLinkPanel]; NSDataLinkPanel *dataLinkPanel = [NSDataLinkPanel sharedDataLinkPanel];
@ -91,9 +99,6 @@ static NSDataLinkPanel *_sharedDataLinkPanel;
@implementation NSDataLinkPanel @implementation NSDataLinkPanel
//
// Class methods
//
+ (void)initialize + (void)initialize
{ {
if (self == [NSDataLinkPanel class]) if (self == [NSDataLinkPanel class])
@ -103,92 +108,148 @@ static NSDataLinkPanel *_sharedDataLinkPanel;
} }
} }
// /**
// Initializing * Initializes and returns the shared panel.
// */
+ (NSDataLinkPanel *)sharedDataLinkPanel + (NSDataLinkPanel *)sharedDataLinkPanel
{ {
if(_sharedDataLinkPanel == nil) if(_sharedDataLinkPanel == nil)
{ {
id controller = [[GSDataLinkPanelController alloc] init]; id controller = [[GSDataLinkPanelController alloc] init];
_sharedDataLinkPanel = [controller panel]; _sharedDataLinkPanel = [controller panel];
[_sharedDataLinkPanel setDelegate: controller];
} }
NSLog(@"%@",_sharedDataLinkPanel); NSLog(@"%@",_sharedDataLinkPanel);
return _sharedDataLinkPanel; return _sharedDataLinkPanel;
} }
// /**
// Keeping the Panel Up to Date * Get the currently selected array of links and thier respective managers.
// * Return the whether or not multiple links are selected in flag.
*/
+ (void)getLink:(NSDataLink **)link + (void)getLink:(NSDataLink **)link
manager:(NSDataLinkManager **)linkManager manager:(NSDataLinkManager **)linkManager
isMultiple:(BOOL *)flag isMultiple:(BOOL *)flag
{ {
[[NSDataLinkPanel sharedDataLinkPanel]
getLink: link
manager: linkManager
isMultiple: flag];
} }
/**
* Set the currently selected array of links and their respective managers.
* If all of the given links should be selected flag should be YES.
*/
+ (void)setLink:(NSDataLink *)link + (void)setLink:(NSDataLink *)link
manager:(NSDataLinkManager *)linkManager manager:(NSDataLinkManager *)linkManager
isMultiple:(BOOL)flag isMultiple:(BOOL)flag
{ {
[[NSDataLinkPanel sharedDataLinkPanel]
setLink: link
manager: linkManager
isMultiple: flag];
} }
// //
// Instance methods // Instance methods
// //
// /**
// Keeping the Panel Up to Date * Get the currently selected array of links and thier respective managers.
// * Return the whether or not multiple links are selected in flag.
*/
- (void)getLink:(NSDataLink **)link - (void)getLink:(NSDataLink **)link
manager:(NSDataLinkManager **)linkManager manager:(NSDataLinkManager **)linkManager
isMultiple:(BOOL *)flag isMultiple:(BOOL *)flag
{ {
ASSIGN(*link, _currentDataLink);
ASSIGN(*linkManager, _currentDataLinkManager);
*flag = _multipleSelection;
} }
/**
* Set the currently selected array of links and their respective managers.
* If all of the given links should be selected flag should be YES.
*/
- (void)setLink:(NSDataLink *)link - (void)setLink:(NSDataLink *)link
manager:(NSDataLinkManager *)linkManager manager:(NSDataLinkManager *)linkManager
isMultiple:(BOOL)flag isMultiple:(BOOL)flag
{ {
ASSIGN(_currentDataLink, link);
ASSIGN(_currentDataLinkManager, linkManager);
_multipleSelection = flag;
} }
// //
// Customizing the Panel // Customizing the Panel
// //
/**
* Add an accessory view to the panel.
*/
- (NSView *)accessoryView - (NSView *)accessoryView
{ {
// not yet implemented.
return nil; return nil;
} }
/**
* Get the accessory view.
*/
- (void)setAccessoryView:(NSView *)aView - (void)setAccessoryView:(NSView *)aView
{ {
// not yet implemented.
} }
// //
// Responding to User Input // Responding to User Input
// //
/**
* Called when the user presses the Break All Links button.
* Invokes breakAllLinks on the current link manager.
*/
- (void)pickedBreakAllLinks:(id)sender - (void)pickedBreakAllLinks:(id)sender
{ {
NSLog(@"Break all links..."); [_currentDataLinkManager breakAllLinks];
} }
/**
* Called when the user presses the Break button.
* Invokes break on the current link.
*/
- (void)pickedBreakLink:(id)sender - (void)pickedBreakLink:(id)sender
{ {
NSLog(@"Break link..."); [_currentDataLink break];
} }
/**
* Called when the user presses the Open Source button.
* Invokes openSource on the current link.
*/
- (void)pickedOpenSource:(id)sender - (void)pickedOpenSource:(id)sender
{ {
NSLog(@"Open Source..."); [_currentDataLink openSource];
} }
/**
* Called when the Update Destination button
* Invokes updateDestination on the current link.
*/
- (void)pickedUpdateDestination:(id)sender - (void)pickedUpdateDestination:(id)sender
{ {
NSLog(@"Update destination..."); [_currentDataLink updateDestination];
} }
/**
* Called when the user selects an update mode from the pull down.
* Invokes setUpdateMode: on the current link.
*/
- (void)pickedUpdateMode:(id)sender - (void)pickedUpdateMode:(id)sender
{ {
NSLog(@"Update mode.."); NSDataLinkUpdateMode mode = (NSDataLinkUpdateMode)[sender tag];
[_currentDataLink setUpdateMode: mode];
} }
// //