Permalink
Browse files

LinkBack 1.0.2 from <http://linkbackproject.org/files/LinkBack-102.zip>

  • Loading branch information...
1 parent a6bc51c commit fcc2958a0cc7c22524f296769f6bd0a5bff26416 @tjw tjw committed May 18, 2010
View
@@ -1,16 +1,55 @@
-{\rtf1\mac\ansicpg10000\cocoartf809
-{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;}
-{\colortbl;\red255\green255\blue255;}
-{\info}\margl1440\margr1440\vieww9000\viewh8400\viewkind0
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
-
-\f0\b\fs24 \cf0 LinkBack Release Notes\
-
-\f1\b0 \
-LinkBack: \
-\
-LinkBack: version number included in linkback data \
-\
-LiveSketch: SKTGraphicView.m:1067 -- LiveSketch did not declare the LinkBackPboardType during a copy operation. This did not cause incorrect behavior, but it was technically incorrect.\
- \
-1.0alpha -- initial public release}
+{\rtf1 \mac \ansicpg437 \cocoartf102 {\fonttbl {\f0 \fnil \fcharset77 Times New Roman{\*\falt Times}
+;}
+{\f1 \fnil \fcharset77 Helvetica-Bold{\*\falt Helvetica}
+;}
+{\f2 \fnil \fcharset77 Helvetica;}
+{\f3 \fnil \fcharset77 LucidaGrande{\*\falt Lucida Grande}
+;}
+}
+{\colortbl ;\red0 \green0 \blue0 ;}
+{\stylesheet {\s3 \nisusnoteplacement0 \nisusreferencestyle7 {\*\nsmpltxt Some text goes here so you can see what your style will look like.}
+\f3 footnote text;}
+{\s4 \nisusnoteplacement1 \nisusreferencestyle9 {\*\nsmpltxt Sample text for Foot/End Notes Style}
+\f3 endnote text;}
+}
+\deftab720 \defformat \viewkind1 \viewzk1 {\*\nisuswindow \x70 \y232 \w741 \h638 }
+\nshwinv0 \nshwpg1 \hyphauto0 \ftnnar \endnotes \aendnotes \aftnnar \fet2 \ftnbj \paperw12240 \paperh15840 \margl1440 \margr1440 \margt1440 \margb1440 \gutter0 \pgnstart1 \nocolbal \sectd \sbknone \cols1 \ltrsect \colbalsxn0 \marglsxn1440 \margrsxn1440 \margtsxn1440 \margbsxn1440 \guttersxn0 \headery720 \footery720 \pgnstarts1 \pgnrestart \pgndec \sxnstarts1 \sxnrestart \sxndec {\header \par }
+{\footer \par }
+{\pard \ql \sb0 \sa0 \sl240 \slmult1 \ilvl0 \li0 \lin0 \fi0 \ri0 \rin0 {\f1 \fs24 \b \cf1 LinkBack Release Notes\par
+\f2 \b0 \par
+\b LINKBACK 102:\par
+\b0 \par
+\b LinkBack:\b0 LinkBack has several helper methods to make it easier for you to add a menu item in clients to edit LinkBack content. Two functions and one method provide the localized string for the menu name. You should place the menu at the bottom of your edit menu with a separator before it. Make your validateMenuItem: set the menu title based on the current selection. You should set your title based on the number of LinkBack items selected:\par
+\par
+}
+}
+{\pard \ql \sb0 \sa0 \sl240 \slmult1 \ilvl0 \li0 \lin0 \fi0 \ri0 \rin0 \tqc \tx2520 \tx4820 {\f2 \fs24 \b0 \cf1 \tab \b LINKBACK \par
+}
+}
+{\pard \ql \sb0 \sa0 \sl240 \slmult1 \ilvl0 \li0 \lin0 \fi0 \ri0 \rin0 \tqc \tx2520 \tx4300 {\f2 \fs24 \b \cf1 \tab ITEMS SELECTED\tab USE METHOD/FUNCTION\par
+\b0 \tab 0\tab LinkBackEditNoneMenuTitle() \par
+\tab 1\tab [linkbackdata linkBackMenuTitle] ;\par
+\tab > 1\tab LinkBackEditMultipleMenuTitle()\par
+}
+}
+{\pard \ql \sb0 \sa0 \sl240 \slmult1 \ilvl0 \li0 \lin0 \fi0 \ri0 \rin0 {\f2 \fs24 \b0 \cf1 \par
+When the user chooses this menu item, your code should request edits for any selected LinkBack items. If no LinkBack items are selected, be sure to disable the menu. \par
+\par
+See Document.m in TextEdit+LinkBack for an example of how to do all this.\par
+\par
+\b LinkBack:\b0 LinkBack now includes the name of the application and an optional ACTION NAME in the data you place on the keyboard. You can provide the action name or use one of the two standard action names defined in LinkBack.h. This action name will be used to construct the LinkBack menu name in client applications. If you use one of the standard names, (Edit or Refresh) it will be localized.\par
+\par
+\b LinkBack:\b0 Added a new NSDictionary category with methods for creating and accessing the linkback data you create to put on the pasteboard. You can still use the original functions to create linkback data, but using these methods will give you access to more information about the LinkBack including the source application, action name, source URL and so on.\par
+\par
+\b LiveSketch:\b0 now includes Linkback information in its application dictionary. Will be used by LinkBack in the future.\par
+\par
+\b TextEdit+LinkBack:\b0 now includes support for the an Edit LinkBack Items menu. See Document.m -validateMenuItem: and -editLinkBackItems: for examples of how to do this.\par
+\par
+\b LINKBACK 101\b0 \par
+LinkBack: version number included in linkback data \par
+\par
+LiveSketch: SKTGraphicView.m:1067 -- LiveSketch did not declare the LinkBackPboardType during a copy operation. This did not cause incorrect behavior, but it was technically incorrect.\par
+ \par
+1.0alpha -- initial public release}
+}
+}
@@ -853,6 +853,10 @@
<string>lskt</string>
<key>CFBundleVersion</key>
<string>alpha.01</string>
+ <key>LinkBackApplicationURL</key>
+ <string>http://www.linkbackproject.org</string>
+ <key>LinkBackVersion</key>
+ <string>A</string>
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>NSMainNibFile</key>
@@ -0,0 +1,5 @@
+"_EditPattern" = "%@ in %@" ;
+"_EditMultiple" = "Edit LinkBack Items" ;
+"_EditNone" = "Edit LinkBack Item" ;
+"_Edit" = "Edit" ;
+"_Refresh" = "Refresh" ;
View
@@ -9,15 +9,15 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
- <string>com.yourcompany.yourcocoaframework</string>
+ <string>org.linkbackproject.LinkBack</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.0</string>
+ <string>102</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
View
@@ -39,22 +39,51 @@
// Use this pasteboard type to put LinkBack data to the pasteboard. Use MakeLinkBackData() to create the data.
extern NSString* LinkBackPboardType ;
-// LinkBack data keys. These are used in a LiveLInk object, which is currently a dictionary. Do not depend on these values. They are public for testing purposes only.
-extern NSString* LinkBackServerNameKey ;
-extern NSString* LinkBackServerBundleIdentifierKey ;
-extern NSString* LinkBackVersionKey ;
-extern NSString* LinkBackApplicationDataKey ;
+// Default Action Names. These will be localized for you automatically.
+extern NSString* LinkBackEditActionName ;
+extern NSString* LinkBackRefreshActionName ;
//
// Support Functions
//
+NSString* LinkBackUniqueItemKey() ;
+NSString* LinkBackEditMultipleMenuTitle() ;
+NSString* LinkBackEditNoneMenuTitle() ;
+//
+// Deprecated Support Functions -- use LinkBack Data Category instead
+//
id MakeLinkBackData(NSString* serverName, id appData) ;
id LinkBackGetAppData(id linkBackData) ;
-
BOOL LinkBackDataBelongsToActiveApplication(id data) ;
-NSString* LinkBackUniqueItemKey() ;
+//
+// LinkBack Data Category
+//
+
+// Use these methods to create and access linkback data objects. You can also use the helper functions above.
+
+@interface NSDictionary (LinkBackData)
+
++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData ;
+
++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData suggestedRefreshRate:(NSTimeInterval)rate ;
+
++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData actionName:(NSString*)action suggestedRefreshRate:(NSTimeInterval)rate ;
+
+- (BOOL)linkBackDataBelongsToActiveApplication ;
+
+- (id)linkBackAppData ;
+- (NSString*)linkBackSourceApplicationName ;
+- (NSString*)linkBackActionName ;
+- (NSString*)linkBackVersion ;
+- (NSURL*)linkBackApplicationURL ;
+
+- (NSTimeInterval)linkBackSuggestedRefreshRate ;
+
+- (NSString*)linkBackEditMenuTitle ;
+
+@end
//
// Delegate Protocols
View
@@ -39,31 +39,30 @@
NSString* LinkBackPboardType = @"LinkBackData" ;
// LinkBack data keys. These are used in a LinkBack object, which is currently a dictionary. Do not depend on these values. They are public for testing purposes only.
+NSString* LinkBackServerActionKey = @"serverActionKey" ;
+NSString* LinkBackServerApplicationNameKey = @"serverAppName" ;
NSString* LinkBackServerNameKey = @"serverName" ;
NSString* LinkBackServerBundleIdentifierKey = @"bundleId" ;
NSString* LinkBackVersionKey = @"version" ;
NSString* LinkBackApplicationDataKey = @"appData" ;
+NSString* LinkBackSuggestedRefreshKey = @"refresh" ;
+NSString* LinkBackApplicationURLKey = @"ApplicationURL" ;
+
+NSString* LinkBackEditActionName = @"_Edit" ;
+NSString* LinkBackRefreshActionName = @"_Refresh" ;
// ...........................................................................
// Support Functions
//
id MakeLinkBackData(NSString* serverName, id appData)
{
- NSMutableDictionary* ret = [[NSMutableDictionary alloc] init] ;
- NSString* bundleId = [[NSBundle mainBundle] bundleIdentifier] ;
- id version = @"A" ;
-
- [ret setObject: bundleId forKey: LinkBackServerBundleIdentifierKey];
- [ret setObject: serverName forKey: LinkBackServerNameKey] ;
- [ret setObject: version forKey: LinkBackVersionKey] ;
- [ret setObject: appData forKey: LinkBackApplicationDataKey] ;
- return [ret autorelease] ;
+ return [NSDictionary linkBackDataWithServerName: serverName appData: appData] ;
}
id LinkBackGetAppData(id LinkBackData)
{
- return [LinkBackData objectForKey: LinkBackApplicationDataKey] ;
+ return [LinkBackData linkBackAppData] ;
}
NSString* LinkBackUniqueItemKey()
@@ -76,12 +75,126 @@ id LinkBackGetAppData(id LinkBackData)
}
BOOL LinkBackDataBelongsToActiveApplication(id data)
+{
+ return [data linkBackDataBelongsToActiveApplication] ;
+}
+
+NSString* LinkBackEditMultipleMenuTitle()
+{
+ NSBundle* bundle = [NSBundle bundleForClass: [LinkBack class]] ;
+ NSString* ret = [bundle localizedStringForKey: @"_EditMultiple" value: @"Edit LinkBack Items" table: @"Localized"] ;
+ return ret ;
+}
+
+NSString* LinkBackEditNoneMenuTitle()
+{
+ NSBundle* bundle = [NSBundle bundleForClass: [LinkBack class]] ;
+ NSString* ret = [bundle localizedStringForKey: @"_EditNone" value: @"Edit LinkBack Item" table: @"Localized"] ;
+ return ret ;
+}
+
+// ...........................................................................
+// LinkBack Data Category
+//
+
+// Use these methods to create and access linkback data objects. You can also use the helper functions above.
+
+@implementation NSDictionary (LinkBackData)
+
++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData
+{
+ return [self linkBackDataWithServerName: serverName appData: appData actionName: nil suggestedRefreshRate: 0];
+}
+
++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData suggestedRefreshRate:(NSTimeInterval)rate
+{
+ return [self linkBackDataWithServerName: serverName appData: appData actionName: LinkBackRefreshActionName suggestedRefreshRate: rate] ;
+}
+
++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData actionName:(NSString*)action suggestedRefreshRate:(NSTimeInterval)rate ;
+{
+ NSDictionary* appInfo = [[NSBundle mainBundle] infoDictionary] ;
+
+ NSMutableDictionary* ret = [[NSMutableDictionary alloc] init] ;
+ NSString* bundleId = [[NSBundle mainBundle] bundleIdentifier] ;
+ NSString* url = [appInfo objectForKey: @"LinkBackApplicationURL"] ;
+ NSString* appName = [[[NSWorkspace sharedWorkspace] activeApplication] objectForKey: @"NSApplicationName"] ;
+ id version = @"A" ;
+
+ if (nil==serverName) [NSException raise: NSInvalidArgumentException format: @"LinkBack Data cannot be created without a server name."] ;
+
+ // callback information
+ [ret setObject: bundleId forKey: LinkBackServerBundleIdentifierKey];
+ [ret setObject: serverName forKey: LinkBackServerNameKey] ;
+ [ret setObject: version forKey: LinkBackVersionKey] ;
+
+ // additional information
+ if (appName) [ret setObject: appName forKey: LinkBackServerApplicationNameKey] ;
+ if (action) [ret setObject: action forKey: LinkBackServerActionKey] ;
+ if (appData) [ret setObject: appData forKey: LinkBackApplicationDataKey] ;
+ if (url) [ret setObject: url forKey: LinkBackApplicationURLKey] ;
+ [ret setObject: [NSNumber numberWithFloat: rate] forKey: LinkBackSuggestedRefreshKey] ;
+
+ return [ret autorelease] ;
+}
+
+- (BOOL)linkBackDataBelongsToActiveApplication
{
NSString* bundleId = [[NSBundle mainBundle] bundleIdentifier] ;
- NSString* dataId = ([data isKindOfClass: [NSDictionary class]]) ? [data objectForKey: LinkBackServerBundleIdentifierKey] : nil ;
+ NSString* dataId = [self objectForKey: LinkBackServerBundleIdentifierKey] ;
return (dataId && [dataId isEqualToString: bundleId]) ;
}
+- (id)linkBackAppData
+{
+ return [self objectForKey: LinkBackApplicationDataKey] ;
+}
+
+- (NSString*)linkBackSourceApplicationName
+{
+ return [self objectForKey: LinkBackServerApplicationNameKey] ;
+}
+
+- (NSString*)linkBackActionName
+{
+ NSBundle* bundle = [NSBundle bundleForClass: [LinkBack class]] ;
+ NSString* ret = [self objectForKey: LinkBackServerActionKey] ;
+ if (nil==ret) ret = LinkBackEditActionName ;
+
+ ret = [bundle localizedStringForKey: ret value: ret table: @"Localized"] ;
+ return ret ;
+}
+
+- (NSString*)linkBackEditMenuTitle
+{
+ NSBundle* bundle = [NSBundle bundleForClass: [LinkBack class]] ;
+ NSString* appName = [self linkBackSourceApplicationName] ;
+ NSString* action = [self linkBackActionName] ;
+ NSString* ret = [bundle localizedStringForKey: @"_EditPattern" value: @"%@ in %@" table: @"Localized"] ;
+ ret = [NSString stringWithFormat: ret, action, appName] ;
+ return ret ;
+}
+
+- (NSString*)linkBackVersion
+{
+ return [self objectForKey: LinkBackVersionKey] ;
+}
+
+- (NSTimeInterval)linkBackSuggestedRefreshRate
+{
+ id obj = [self objectForKey: LinkBackSuggestedRefreshKey] ;
+ return (obj) ? [obj floatValue] : 0 ;
+}
+
+- (NSURL*)linkBackApplicationURL
+{
+ id obj = [self objectForKey: LinkBackApplicationURLKey] ;
+ if (obj) obj = [NSURL URLWithString: obj] ;
+ return obj ;
+}
+
+@end
+
// ...........................................................................
// LinkBackServer
//
@@ -114,6 +114,7 @@
children = (
8DC2EF5A0486A6940098B216,
089C1666FE841158C02AAC07,
+ 20E80E6307F2116B0060ED13,
);
isa = PBXGroup;
name = Resources;
@@ -258,6 +259,31 @@
settings = {
};
};
+ 20E80E6307F2116B0060ED13 = {
+ children = (
+ 20E80E6407F2116B0060ED13,
+ );
+ isa = PBXVariantGroup;
+ name = Localized.strings;
+ path = "";
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 20E80E6407F2116B0060ED13 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = text.plist.strings;
+ name = English;
+ path = English.lproj/Localized.strings;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 20E80E6507F2116B0060ED13 = {
+ fileRef = 20E80E6307F2116B0060ED13;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
//200
//201
//202
@@ -340,6 +366,7 @@
buildActionMask = 2147483647;
files = (
8DC2EF530486A6940098B216,
+ 20E80E6507F2116B0060ED13,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
Oops, something went wrong.

0 comments on commit fcc2958

Please sign in to comment.