| 1 | diff -uw macclipboard-gimp-0.7.orig/Makefile macclipboard-gimp-0.7/Makefile |
| 2 | --- Makefile 2004-07-24 03:38:03.000000000 -0600 |
| 3 | +++ Makefile 2012-05-28 18:19:34.000000000 -0600 |
| 4 | @@ -1,15 +1,17 @@ |
| 5 | -linkflags = -fnext-runtime -framework Cocoa -framework Carbon |
| 6 | +linkflags = -framework Cocoa -framework Carbon |
| 7 | + |
| 8 | +GIMPTOOL = gimptool-2.0 |
| 9 | |
| 10 | all : macclipboard |
| 11 | |
| 12 | macclipboard : macclipboard.m clipboard_xfer.h |
| 13 | - gcc -I/sw/include `gimptool-2.0 --cflags` `gimptool-2.0 --libs` $(linkflags) macclipboard.m -o macclipboard |
| 14 | + gcc `$(GIMPTOOL) --cflags` `$(GIMPTOOL) --libs` $(LDFLAGS) $(CFLAGS) $(linkflags) macclipboard.m -o macclipboard |
| 15 | |
| 16 | install : macclipboard |
| 17 | - cp -p macclipboard $(HOME)/.gimp-2.0/plug-ins/ |
| 18 | + $(GIMPTOOL) --install-bin macclipboard |
| 19 | |
| 20 | uninstall : |
| 21 | - rm -f $(HOME)/.gimp-2.0/plug-ins/macclipboard |
| 22 | + $(GIMPTOOL) --uninstall-bin macclipboard |
| 23 | |
| 24 | clean : |
| 25 | rm -f macclipboard |
| 26 | diff -uw macclipboard-gimp-0.7.orig/macclipboard.m macclipboard-gimp-0.7/macclipboard.m |
| 27 | --- macclipboard.m 2004-11-30 20:01:46.000000000 -0700 |
| 28 | +++ macclipboard.m 2012-05-28 17:45:04.000000000 -0600 |
| 29 | @@ -32,7 +32,8 @@ |
| 30 | /* |
| 31 | The Mac clipboard ('pasteboard' or 'scrap') can contain data in multiple |
| 32 | formats. The least common denominator for graphic data is 'PICT', a QuickDraw |
| 33 | -picture. |
| 34 | +picture. However, QuickDraw, and by extension PICT, have been depricated and |
| 35 | +aren't available under 64-bit code. |
| 36 | |
| 37 | Cocoa apps prefer TIFF, which also lets us transfer alpha channel data |
| 38 | relatively reliably. When we post a TIFF, Cocoa does PICT translation for us. |
| 39 | @@ -69,7 +70,18 @@ |
| 40 | /* #include "config.h" */ |
| 41 | |
| 42 | #import <Cocoa/Cocoa.h> |
| 43 | +#ifdef __LP64__ |
| 44 | +#define HAVE_QD_HEADERS 0 |
| 45 | +#else |
| 46 | +#ifdef __MAC_10_7 |
| 47 | +#define HAVE_QD_HEADERS 0 |
| 48 | +#else |
| 49 | +#define HAVE_QD_HEADERS 1 |
| 50 | +#endif |
| 51 | +#endif |
| 52 | +#if HAVE_QD_HEADERS |
| 53 | #include <Carbon/Carbon.h> |
| 54 | +#endif |
| 55 | |
| 56 | #include <sys/types.h> |
| 57 | #include <sys/stat.h> |
| 58 | @@ -117,7 +129,7 @@ |
| 59 | static gboolean clipboard_paste_service (gboolean interactive, |
| 60 | NSString *service); |
| 61 | |
| 62 | - |
| 63 | +#if HAVE_QD_HEADERS |
| 64 | /* PICT bits */ |
| 65 | static gboolean clipboard_offscreen_pict (PicHandle pic, |
| 66 | guchar fill, |
| 67 | @@ -143,6 +155,7 @@ |
| 68 | gint32 drawable_ID, |
| 69 | NSData *data, |
| 70 | gint32 *image_out); |
| 71 | +#endif |
| 72 | |
| 73 | /* Other image types */ |
| 74 | static gboolean clipboard_paste_bitmap (gboolean interactive, |
| 75 | @@ -173,8 +186,10 @@ |
| 76 | gint32 drawable_ID, |
| 77 | NSData *data); |
| 78 | |
| 79 | +#if HAVE_QD_HEADERS |
| 80 | static gint32 clipboard_load_pict (gboolean interactive, |
| 81 | gchar *filename); |
| 82 | +#endif |
| 83 | |
| 84 | GimpPlugInInfo PLUG_IN_INFO = |
| 85 | { |
| 86 | @@ -291,6 +306,7 @@ |
| 87 | 1, 0, |
| 88 | copy_args, NULL); |
| 89 | |
| 90 | +#if HAVE_QD_HEADERS |
| 91 | gimp_install_procedure ("file_pict_load", |
| 92 | "Loads files of Macintosh PICT file format", |
| 93 | "Loads files of Macintosh PICT file format", |
| 94 | @@ -308,6 +324,7 @@ |
| 95 | "pict", |
| 96 | "", |
| 97 | ""); |
| 98 | +#endif |
| 99 | } |
| 100 | |
| 101 | static void |
| 102 | @@ -324,7 +341,7 @@ |
| 103 | int interactive = (GIMP_RUN_INTERACTIVE==run_mode); |
| 104 | int ok = FALSE; |
| 105 | |
| 106 | - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
| 107 | + NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
| 108 | |
| 109 | *nreturn_vals = 1; |
| 110 | *return_vals = values; |
| 111 | @@ -348,6 +365,7 @@ |
| 112 | ok = clipboard_paste_service (interactive, @"Grab/Selection"); |
| 113 | else if (strcmp (name, "plug_in_clipboard_grab_timed") == 0) |
| 114 | ok = clipboard_paste_service (interactive, @"Grab/Timed Screen"); |
| 115 | +#if HAVE_QD_HEADERS |
| 116 | else if (strcmp (name, "file_pict_load") == 0) |
| 117 | { |
| 118 | gint32 image = clipboard_load_pict (interactive, param[1].data.d_string); |
| 119 | @@ -362,12 +380,13 @@ |
| 120 | else |
| 121 | { |
| 122 | values[0].data.d_status = GIMP_PDB_CALLING_ERROR; |
| 123 | - [pool release]; |
| 124 | + [pool drain]; |
| 125 | return; |
| 126 | } |
| 127 | +#endif |
| 128 | |
| 129 | values[0].data.d_status = ok ? GIMP_PDB_SUCCESS : GIMP_PDB_EXECUTION_ERROR; |
| 130 | - [pool release]; |
| 131 | + [pool drain]; |
| 132 | } |
| 133 | |
| 134 | /* |
| 135 | @@ -523,10 +542,13 @@ |
| 136 | { |
| 137 | [board setData: [bitmap TIFFRepresentation] forType: NSTIFFPboardType]; |
| 138 | |
| 139 | +#if HAVE_QD_HEADERS |
| 140 | /* Force conversion to PICT before we leave */ |
| 141 | [board types]; |
| 142 | [board dataForType: NSPICTPboardType]; |
| 143 | +#endif |
| 144 | } |
| 145 | + [bitmap release]; |
| 146 | |
| 147 | return TRUE; |
| 148 | } |
| 149 | @@ -553,7 +575,7 @@ |
| 150 | { |
| 151 | NSApplication *app = [NSApplication sharedApplication]; |
| 152 | [app registerServicesMenuSendTypes: nil |
| 153 | - returnTypes: [NSArray arrayWithObjects: NSTIFFPboardType, nil]]; |
| 154 | + returnTypes: [NSArray arrayWithObject: NSTIFFPboardType]]; |
| 155 | |
| 156 | NSPasteboard *board = [NSPasteboard pasteboardWithUniqueName]; |
| 157 | |
| 158 | @@ -561,13 +583,10 @@ |
| 159 | if (NSPerformService(service, board)) |
| 160 | return clipboard_paste_board (interactive, IMAGE_NONE, IMAGE_NONE, board); |
| 161 | |
| 162 | - g_message (_("Couldn't run system service %s"), [service cString]); |
| 163 | + g_message (_("Couldn't run system service %s"), [service UTF8String]); |
| 164 | return FALSE; |
| 165 | } |
| 166 | |
| 167 | - |
| 168 | - |
| 169 | - |
| 170 | /* |
| 171 | * Find pasteable image(s) from a given pasteboard and um... paste them. |
| 172 | */ |
| 173 | @@ -582,7 +601,9 @@ |
| 174 | NSString *type = [board availableTypeFromArray: |
| 175 | [NSArray arrayWithObjects: |
| 176 | NSTIFFPboardType, |
| 177 | +#if HAVE_QD_HEADERS |
| 178 | NSPICTPboardType, |
| 179 | +#endif |
| 180 | NSRTFDPboardType, |
| 181 | nil]]; |
| 182 | if (type == nil) |
| 183 | @@ -601,8 +622,10 @@ |
| 184 | if ([type isEqualToString: NSTIFFPboardType]) |
| 185 | return clipboard_paste_bitmap (interactive, image_ID, drawable_ID, |
| 186 | [NSBitmapImageRep imageRepWithData: data], NULL); |
| 187 | +#if HAVE_QD_HEADERS |
| 188 | else if ([type isEqualToString: NSPICTPboardType]) |
| 189 | return clipboard_paste_pict (interactive, image_ID, drawable_ID, data, NULL); |
| 190 | +#endif |
| 191 | else if ([type isEqualToString: NSRTFDPboardType]) |
| 192 | return clipboard_paste_rtfd (interactive, image_ID, drawable_ID, data); |
| 193 | |
| 194 | @@ -610,7 +633,7 @@ |
| 195 | return FALSE; |
| 196 | } |
| 197 | |
| 198 | - |
| 199 | +#if HAVE_QD_HEADERS |
| 200 | /* |
| 201 | * Render a given PICT into a newly created offscreen 32-bit graphics |
| 202 | * world, returning some handy information about the bits. |
| 203 | @@ -825,6 +848,7 @@ |
| 204 | |
| 205 | return retval; |
| 206 | } |
| 207 | +#endif |
| 208 | |
| 209 | static gboolean |
| 210 | clipboard_paste_image (gboolean interactive, |
| 211 | @@ -975,7 +999,7 @@ |
| 212 | if (channels != (3 + alpha)) |
| 213 | { |
| 214 | g_message (_("Don't understand %d-channel image in RGB image (%s; alpha: %s)"), |
| 215 | - channels, [colorSpace cString], alpha ? "yes" : "no"); |
| 216 | + channels, [colorSpace UTF8String], alpha ? "yes" : "no"); |
| 217 | return FALSE; |
| 218 | } |
| 219 | } |
| 220 | @@ -986,10 +1010,11 @@ |
| 221 | if (channels != (1 + alpha)) |
| 222 | { |
| 223 | g_message (_("Don't understand %d-channel image in grayscale image (%s; alpha: %s)"), |
| 224 | - channels, [colorSpace cString], alpha ? "yes" : "no"); |
| 225 | + channels, [colorSpace UTF8String], alpha ? "yes" : "no"); |
| 226 | return FALSE; |
| 227 | } |
| 228 | } |
| 229 | + /* Apparently black color spaces are depricated in Snow Leopard and later*/ |
| 230 | else if ([colorSpace isEqualToString: NSCalibratedBlackColorSpace] || |
| 231 | [colorSpace isEqualToString: NSDeviceBlackColorSpace]) |
| 232 | { |
| 233 | @@ -997,13 +1022,13 @@ |
| 234 | if (channels != (1 + alpha)) |
| 235 | { |
| 236 | g_message (_("Don't understand %d-channel image in grayscale image (%s; alpha: %s)"), |
| 237 | - channels, [colorSpace cString], alpha ? "yes" : "no"); |
| 238 | + channels, [colorSpace UTF8String], alpha ? "yes" : "no"); |
| 239 | return FALSE; |
| 240 | } |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | - g_message (_("Unknown colorspace! %s"), [colorSpace cString]); |
| 245 | + g_message (_("Unknown colorspace! %s"), [colorSpace UTF8String]); |
| 246 | return FALSE; |
| 247 | } |
| 248 | |
| 249 | @@ -1132,7 +1157,7 @@ |
| 250 | [item regularFileContents]], NULL)) |
| 251 | numCopied++; |
| 252 | else |
| 253 | - NSLog (@"Not a TIFF: %s", [item filename]); |
| 254 | + NSLog (@"Not a TIFF: %@", [item filename]); |
| 255 | } |
| 256 | } |
| 257 | if (numCopied == 0) |
| 258 | @@ -1154,6 +1179,7 @@ |
| 259 | return FALSE; |
| 260 | } |
| 261 | |
| 262 | +#if HAVE_QD_HEADERS |
| 263 | static gint32 |
| 264 | clipboard_load_pict (gboolean interactive, |
| 265 | gchar *filename) |
| 266 | @@ -1181,3 +1207,5 @@ |
| 267 | g_message ("Could not open file %s", filename); |
| 268 | return -1; |
| 269 | } |
| 270 | +#endif |
| 271 | + |