Re: Determining an inter-application drag source
A fragile way would be to see what other drag types are being put on the pasteboard. I imagine Finder has some esoteric old types for backwards compatibility and I would guess that Aperture has some image types that the Finder wouldn't normally use (except maybe for picture clippings) But as Steve said, why should it matter? Matt Gough On 25 Mar 2010, at 23:22:54, Steve Christensen wrote: I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
I apparently didn't hit reply-all on my response to Steve. I wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Other programs require different bits of extra work to at least provide the user some extra information about how things will or won't be updated. iPhoto fortunately provides some extra information in the pasteboard that distinguish itself, but Lightroom does not. In my case, because I know the possible sources are (mostly) limited to a few programs, I have some other work arounds I might try. For example, testing to see if the applications are open and then querying their databases directly to see if they manage that particular file. None of this kind of thing failsafe, however. But let me add: I'm not even sure why the apparent argument is that it theoretically it shouldn't matter. Why is the pure abstraction that we don't need to know the source of the information? We get that information when the drag is within our own application -- why should inter-application be any different. Sure in most cases that's probably fine, but aren't exceptions the rule the programming? In my case I suppose that one could argue it's the failure of these digital asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to their assets. Maybe they should be aware that if they're handing a path to a file they're managing, that they might need to do some updates later on. But, regardless of whether that should be the case, it isn't. Jeffrey On Mar 26, 2010, at 7:59 AM, Matt Gough wrote: A fragile way would be to see what other drag types are being put on the pasteboard. I imagine Finder has some esoteric old types for backwards compatibility and I would guess that Aperture has some image types that the Finder wouldn't normally use (except maybe for picture clippings) But as Steve said, why should it matter? Matt Gough On 25 Mar 2010, at 23:22:54, Steve Christensen wrote: I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Can you check the path to the file and see if it’s inside the iPhoto library? (IIRC, the root of the library is a bundle with a specific filename extension.) —JEns___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
I wouldn't say that there has been any argument over whether or not knowing the drag source is a good thing; we were simply asking why you needed to know. You could have just as easily made a bad assumption about something else and were trying to fix it in the drag. And if you would like to see a new OS or application feature, file a bug at http://bugreport.apple.com/. Just grousing about it here will not effect change within Apple. On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote: I apparently didn't hit reply-all on my response to Steve. I wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Other programs require different bits of extra work to at least provide the user some extra information about how things will or won't be updated. iPhoto fortunately provides some extra information in the pasteboard that distinguish itself, but Lightroom does not. In my case, because I know the possible sources are (mostly) limited to a few programs, I have some other work arounds I might try. For example, testing to see if the applications are open and then querying their databases directly to see if they manage that particular file. None of this kind of thing failsafe, however. But let me add: I'm not even sure why the apparent argument is that it theoretically it shouldn't matter. Why is the pure abstraction that we don't need to know the source of the information? We get that information when the drag is within our own application -- why should inter- application be any different. Sure in most cases that's probably fine, but aren't exceptions the rule the programming? In my case I suppose that one could argue it's the failure of these digital asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to their assets. Maybe they should be aware that if they're handing a path to a file they're managing, that they might need to do some updates later on. But, regardless of whether that should be the case, it isn't. Jeffrey On Mar 26, 2010, at 7:59 AM, Matt Gough wrote: A fragile way would be to see what other drag types are being put on the pasteboard. I imagine Finder has some esoteric old types for backwards compatibility and I would guess that Aperture has some image types that the Finder wouldn't normally use (except maybe for picture clippings) But as Steve said, why should it matter? Matt Gough On 25 Mar 2010, at 23:22:54, Steve Christensen wrote: I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
On Mar 26, 2010, at 10:23 AM, Jens Alfke wrote: On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Can you check the path to the file and see if it’s inside the iPhoto library? (IIRC, the root of the library is a bundle with a specific filename extension.) They actually don't have to be inside the library bundle... there's an Advanced preference to not copy the original into the library.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
Gotcha -- sorry if I read into that a bit much. I haven't complained this as a missing feature here at all yet -- I was actually still under the impression that there was a mechanism to determine the drag source that I didn't know about. As the consensus appears to be that there isn't, I will file a bug report. Jeffrey On Mar 26, 2010, at 10:28 AM, Steve Christensen wrote: I wouldn't say that there has been any argument over whether or not knowing the drag source is a good thing; we were simply asking why you needed to know. You could have just as easily made a bad assumption about something else and were trying to fix it in the drag. And if you would like to see a new OS or application feature, file a bug at http://bugreport.apple.com/. Just grousing about it here will not effect change within Apple. On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote: I apparently didn't hit reply-all on my response to Steve. I wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Other programs require different bits of extra work to at least provide the user some extra information about how things will or won't be updated. iPhoto fortunately provides some extra information in the pasteboard that distinguish itself, but Lightroom does not. In my case, because I know the possible sources are (mostly) limited to a few programs, I have some other work arounds I might try. For example, testing to see if the applications are open and then querying their databases directly to see if they manage that particular file. None of this kind of thing failsafe, however. But let me add: I'm not even sure why the apparent argument is that it theoretically it shouldn't matter. Why is the pure abstraction that we don't need to know the source of the information? We get that information when the drag is within our own application -- why should inter-application be any different. Sure in most cases that's probably fine, but aren't exceptions the rule the programming? In my case I suppose that one could argue it's the failure of these digital asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to their assets. Maybe they should be aware that if they're handing a path to a file they're managing, that they might need to do some updates later on. But, regardless of whether that should be the case, it isn't. Jeffrey On Mar 26, 2010, at 7:59 AM, Matt Gough wrote: A fragile way would be to see what other drag types are being put on the pasteboard. I imagine Finder has some esoteric old types for backwards compatibility and I would guess that Aperture has some image types that the Finder wouldn't normally use (except maybe for picture clippings) But as Steve said, why should it matter? Matt Gough On 25 Mar 2010, at 23:22:54, Steve Christensen wrote: I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
On Mar 26, 2010, at 7:40 AM, Jeffrey J. Early wrote: They actually don't have to be inside the library bundle... there's an Advanced preference to not copy the original into the library. In that case, the image file would be visible to other apps. So I might have dragged the photo from the Finder into your app, even though it belongs to an iPhoto library. It doesn’t seem that checking the source of the drag is going to be a reliable indication of whether it belongs to iPhoto. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
On 26 Mar 2010, at 14:43, Jeffrey J. Early wrote: Gotcha -- sorry if I read into that a bit much. I haven't complained this as a missing feature here at all yet -- I was actually still under the impression that there was a mechanism to determine the drag source that I didn't know about. As the consensus appears to be that there isn't, I will file a bug report. I think you're slightly misunderstanding -draggingSource. It gives you a reference to the object initiating the drag, if that drag was within your app. Would you like it to somehow return a reference to the initiating object *from the other application* somehow? That's pretty much impossible without things getting rather messy. It seems to me that perhaps you want an additional -draggingApplication method which would return an instance of NSRunningApplication. Jeffrey On Mar 26, 2010, at 10:28 AM, Steve Christensen wrote: I wouldn't say that there has been any argument over whether or not knowing the drag source is a good thing; we were simply asking why you needed to know. You could have just as easily made a bad assumption about something else and were trying to fix it in the drag. And if you would like to see a new OS or application feature, file a bug at http://bugreport.apple.com/. Just grousing about it here will not effect change within Apple. On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote: I apparently didn't hit reply-all on my response to Steve. I wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Other programs require different bits of extra work to at least provide the user some extra information about how things will or won't be updated. iPhoto fortunately provides some extra information in the pasteboard that distinguish itself, but Lightroom does not. In my case, because I know the possible sources are (mostly) limited to a few programs, I have some other work arounds I might try. For example, testing to see if the applications are open and then querying their databases directly to see if they manage that particular file. None of this kind of thing failsafe, however. But let me add: I'm not even sure why the apparent argument is that it theoretically it shouldn't matter. Why is the pure abstraction that we don't need to know the source of the information? We get that information when the drag is within our own application -- why should inter-application be any different. Sure in most cases that's probably fine, but aren't exceptions the rule the programming? In my case I suppose that one could argue it's the failure of these digital asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to their assets. Maybe they should be aware that if they're handing a path to a file they're managing, that they might need to do some updates later on. But, regardless of whether that should be the case, it isn't. Jeffrey On Mar 26, 2010, at 7:59 AM, Matt Gough wrote: A fragile way would be to see what other drag types are being put on the pasteboard. I imagine Finder has some esoteric old types for backwards compatibility and I would guess that Aperture has some image types that the Finder wouldn't normally use (except maybe for picture clippings) But as Steve said, why should it matter? Matt Gough On 25 Mar 2010, at 23:22:54, Steve Christensen wrote: I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator
Re: Determining an inter-application drag source
On Mar 26, 2010, at 11:31 AM, Jens Alfke wrote: On Mar 26, 2010, at 7:40 AM, Jeffrey J. Early wrote: They actually don't have to be inside the library bundle... there's an Advanced preference to not copy the original into the library. In that case, the image file would be visible to other apps. So I might have dragged the photo from the Finder into your app, even though it belongs to an iPhoto library. It doesn’t seem that checking the source of the drag is going to be a reliable indication of whether it belongs to iPhoto. Excellent point -- thanks. That does prove I'll need a more robust method like querying the iPhoto database directly. On Mar 26, 2010, at 11:41 AM, Mike Abdullah wrote: I think you're slightly misunderstanding -draggingSource. It gives you a reference to the object initiating the drag, if that drag was within your app. Would you like it to somehow return a reference to the initiating object *from the other application* somehow? That's pretty much impossible without things getting rather messy. It seems to me that perhaps you want an additional -draggingApplication method which would return an instance of NSRunningApplication. No, I think the -draggingSource property should return nil as it does now. It wouldn't at all make sense to get a pointer to an object in other application's memory space. I was originally just hoping to somehow get the application bundle identifier, but as an extension to NSDraggingInfo your solution makes more sense. Abstractly, we're passing around references to model objects on the pasteboard -- and the applications represent controllers and views. If we make changes to those objects, we want the controllers to know about those changes. This generally isn't a problem for things like text documents which are re-read each time the user opens them in a application. But for these programs that keep proprietary databases as caches of the model objects, they should probably be using something like FSEvents to check if the files are changing, sort of equivalent to KVO in this case. Regardless, Jens is right: I need a more robust solution.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
Well, other than saying one could argue it's the failure of these digital asset managers... to suggest that there are missing features. :) And having a nil dragSource makes sense if the source and destination for the drag are in different processes. The drag source is an object (type id), so its value only has meaning in the scope of the source process' address space. On Mar 26, 2010, at 7:43 AM, Jeffrey J. Early wrote: Gotcha -- sorry if I read into that a bit much. I haven't complained this as a missing feature here at all yet -- I was actually still under the impression that there was a mechanism to determine the drag source that I didn't know about. As the consensus appears to be that there isn't, I will file a bug report. Jeffrey On Mar 26, 2010, at 10:28 AM, Steve Christensen wrote: I wouldn't say that there has been any argument over whether or not knowing the drag source is a good thing; we were simply asking why you needed to know. You could have just as easily made a bad assumption about something else and were trying to fix it in the drag. And if you would like to see a new OS or application feature, file a bug at http://bugreport.apple.com/. Just grousing about it here will not effect change within Apple. On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote: I apparently didn't hit reply-all on my response to Steve. I wrote: When a user drags a photo from iPhoto to my application I need to be able to update iPhoto's database (via ScriptingBridge) with changes that are made while in my program. Other programs require different bits of extra work to at least provide the user some extra information about how things will or won't be updated. iPhoto fortunately provides some extra information in the pasteboard that distinguish itself, but Lightroom does not. In my case, because I know the possible sources are (mostly) limited to a few programs, I have some other work arounds I might try. For example, testing to see if the applications are open and then querying their databases directly to see if they manage that particular file. None of this kind of thing failsafe, however. But let me add: I'm not even sure why the apparent argument is that it theoretically it shouldn't matter. Why is the pure abstraction that we don't need to know the source of the information? We get that information when the drag is within our own application -- why should inter-application be any different. Sure in most cases that's probably fine, but aren't exceptions the rule the programming? In my case I suppose that one could argue it's the failure of these digital asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to their assets. Maybe they should be aware that if they're handing a path to a file they're managing, that they might need to do some updates later on. But, regardless of whether that should be the case, it isn't. Jeffrey On Mar 26, 2010, at 7:59 AM, Matt Gough wrote: A fragile way would be to see what other drag types are being put on the pasteboard. I imagine Finder has some esoteric old types for backwards compatibility and I would guess that Aperture has some image types that the Finder wouldn't normally use (except maybe for picture clippings) But as Steve said, why should it matter? Matt Gough On 25 Mar 2010, at 23:22:54, Steve Christensen wrote: I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining an inter-application drag source
I'm curious why you need to know where the drag originated since it generally shouldn't matter. Do you have to do some extra work in one case? And what happens if you see a drag from another application? On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote: Is there any way to determine the source of a drag operation outside your own application? For example, if I'm set to receive NSFilenamesPboardType, then I'd like to distinguish between the Finder and Aperture as drag sources. I had thought I'd seen a solution to this at one point, but can't seem to find anything. The draggingSource in NSDraggingInfo is set to nil when the source is an external application. The pasteboard doesn't seem to guarantee any that information, although some sources will occasionally have unique pasteboard types that might distinguish them, but only as an exception. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com