recycleURLs doesn't enable Put Back or Undo in Finder

2015-01-18 Thread Steve Mills
Is there any way to ensure that NSWorkspace recycleURLs:completionHandler: will 
let the user go to the Finder and Put Back or Undo? I'm very surprised that it 
doesn't work right. Not even NSFileManager's 
trashItemAtURL:resultingItemURL:error: does that. I'm trying it in 10.10.

--
Steve Mills
Drummer, Mac geek


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CVPixelBuffer and Color profiles

2015-01-18 Thread Quincey Morris
On Jan 18, 2015, at 17:22 , Kevin Meaney k...@yvs.eu.com wrote:
 
 How can I make sure that the CGBitmapContext and CVPixelBuffer view the pixel 
 data in the same way from a color matching perspective?

You can attach a color space to the pixel buffer as follows:

CVBufferSetAttachment (pixelBuffer, kCVImageBufferCGColorSpaceKey, …, 
kCVAttachmentMode_ShouldNotPropagate);

Depending on what you do next, I would expect the pixel buffer data to either 
be converted to a destination color space, or to have its color space 
propagated to the destination. (Note that the attachment mode “should not 
propagate” refers to something unrelated, AFAIK. But I’m not an expert on any 
of this.)


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Testing selection with NSArrayController?

2015-01-18 Thread Rick Mann

 On Jan 18, 2015, at 00:26 , Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 On Jan 18, 2015, at 00:10 , Rick Mann rm...@latencyzero.com wrote:
 
 I'm building a view that renders a bunch of objects (a drawing canvas). Some 
 of these render differently if the objects are selected. As I iterate 
 through the list of objects to render, I need to test if each one is 
 selected.
 
 It would be easier to test if each one is in the array controller’s 
 “selectedObjects”.
 
 However, I wouldn’t do that either. Given that the selection status of an 
 object affects its appearance, I’d say it’s better to make it an explicit 
 property of each selectable object. Otherwise, you’re forced to drag the 
 array controller’s API into all of your drawing code.
 
 As far as I’m concerned, an array controller is a piece of glue code, a 
 necessary evil. Any reference to it in code is at best a disappointment, at 
 worst a design failure.

I don't want to make it a feature of the object, because the selection is a 
property of the view(controller). That is, I have multiple views into my model, 
and selecting an object in one view doesn't necessarily mean it's selected 
elsewhere (I'm 99% sure that's what I want). Because in many places bindings 
take care of showing selection, the NSArrayController is the best thing to 
manage the selection.

-- 
Rick Mann
rm...@latencyzero.com



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Testing selection with NSArrayController?

2015-01-18 Thread Rick Mann
I don't see any method for testing if an object is selected, other than to 
first get the index of the object in the backing NSArray, then see if that 
index is in the NSArrayController's selectedIndexes. Is this really the way to 
test to see if an object is selected?

I'm building a view that renders a bunch of objects (a drawing canvas). Some of 
these render differently if the objects are selected. As I iterate through the 
list of objects to render, I need to test if each one is selected.

Am I missing something? Thanks.

-- 
Rick Mann
rm...@latencyzero.com



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Testing selection with NSArrayController?

2015-01-18 Thread Quincey Morris
On Jan 18, 2015, at 00:10 , Rick Mann rm...@latencyzero.com wrote:
 
 I'm building a view that renders a bunch of objects (a drawing canvas). Some 
 of these render differently if the objects are selected. As I iterate through 
 the list of objects to render, I need to test if each one is selected.

It would be easier to test if each one is in the array controller’s 
“selectedObjects”.

However, I wouldn’t do that either. Given that the selection status of an 
object affects its appearance, I’d say it’s better to make it an explicit 
property of each selectable object. Otherwise, you’re forced to drag the array 
controller’s API into all of your drawing code.

As far as I’m concerned, an array controller is a piece of glue code, a 
necessary evil. Any reference to it in code is at best a disappointment, at 
worst a design failure.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

CVPixelBuffer and Color profiles

2015-01-18 Thread Kevin Meaney
I would like to have a CVPixelBuffer function that returns the color profile of 
a CVPixelBuffer. I'm using the CVPixelBuffer data as a backing store when I 
create a CGBitmapContext and I would like to provide the appropriate color 
profile when I create the CGBitmapContext. The CVPixelBuffer is created from a 
CVPixelBufferPool which itself is created from an 
AVAssetWriterInputPixelBufferAdaptor.

Since my desire/need for the CVPixelBuffer function that returns a color 
profile that can be used as input for creating a CGBitmapContext is 
unfulfilled. How can I make sure that the CGBitmapContext and CVPixelBuffer 
view the pixel data in the same way from a color matching perspective?

Kevin

Sent from my iPad
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Fast Enumeration and remove elements

2015-01-18 Thread Quincey Morris
On Jan 18, 2015, at 12:45 , Trygve Inda cocoa...@xericdesign.com wrote:
 
 NSMutableDictionary* collection;  // keys are myID, values are MyObject
 
 for (MyObject* object in [[self collection] allValues])
 {
[collection removeObjectForKey:[object myID]];
 }

What Ken said, plus …

— If the collection of values is (as a matter of implementation) mutable, then 
I certainly wouldn’t want to rely on it not changing during the enumeration. If 
it is (as a matter of implementation) immutable, then it’s cost-free to copy. 
So the correct strategy is to copy it.

— It makes me uncomfortable to see you iterating through values, not keys. 
There is no API contract regarding uniqueness of the value objects, in the case 
that different keys refer to the same value object. Furthermore, your loop is 
logically incorrect in that case.

I know that might not matter here. Apparently, in the code fragment you showed, 
1 unique key == 1 unique object. But even if that’s so it seems more correct to 
iterate over “allKeys” instead of “allObjects”.

Also, every time I do something like this, I wonder if it’s semantically 
preferable to use a block enumeration, which for a dictionary would have to be 
‘keysOfEntriesPassingTest:’, followed by ‘removeObjectsForKeys:’. [I’m assuming 
your actual intent is to remove only some of the objects, because otherwise 
you’d use ‘removeAllObjects’ instead of a loop.]

I believe we found out, when the block enumeration API was introduced, that 
these don’t currently do anything particularly optimized, it seems to me that 
we can always hope that there will be such an optimization one day, so that the 
keysOf/remove pattern could be much more efficient for large dictionaries.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Fast Enumeration and remove elements

2015-01-18 Thread Trygve Inda
Apple says:

 It is not safe to remove, replace, or add to a mutable collection’s elements
 while enumerating through it. If you need to modify a collection during
 enumeration, you can either make a copy of the collection and enumerate using
 the copy or collect the information you require during the enumeration and
 apply the changes afterwards. The second pattern is illustrated in Listing 4.

So is this safe...

NSMutableDictionary* collection;  // keys are myID, values are MyObject

for (MyObject* object in [[self collection] allValues])
{
[collection removeObjectForKey:[object myID]];
}

It would seem that this is really enumberating the allValues array which
assuming it is only called once, represents the objects that exist at the
beginning of the for loop and removing them fro the collection dictionary is
safe.

Right?

Trygve




___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Fast Enumeration and remove elements

2015-01-18 Thread Ken Thomases
On Jan 18, 2015, at 2:45 PM, Trygve Inda cocoa...@xericdesign.com wrote:

 So is this safe...
 
 NSMutableDictionary* collection;  // keys are myID, values are MyObject
 
 for (MyObject* object in [[self collection] allValues])
 {
[collection removeObjectForKey:[object myID]];
 }
 
 It would seem that this is really enumberating the allValues array which
 assuming it is only called once, represents the objects that exist at the
 beginning of the for loop and removing them fro the collection dictionary is
 safe.

It is probably safe.  It is very improbable that the -allValues method will 
return a reference to an internal mutable array used by NSMutableDictionary and 
therefore modified if you mutate it.  It is very improbable that 
NSMutableDictionary uses any such mutable array internally.

The fact that the modern declaration of allValue is as a declared property with 
the copy attribute is also a suggestion that it would be safe.

However, none of this is a guarantee that it's safe.  If you want to be 
certain, you can use [[self.collection.allValues copy] autorelease] (omit the 
autorelease under ARC).

Regards,
Ken


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com