Lion: unlocking a document

2012-02-07 Thread Georg Seifert
Hi,

I still have problems with my document saving behavior in Lion. 

If I open a file that my app can only read (CFBundleRoleType = Viewer) the 
state is set to locked. If I unlock it and do some changes, the autosave 
replaces the document file with a native file.

This is really not exactable. Not all data is read from the original (binary) 
file and so I need to keep the original.

Is there any way to prevent this. I would prefer that if the user unlocks the 
document, it actually is duplicated. 

Best
Georg Seifert
___

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


Lion: Lock documents and custom undomanager

2012-02-07 Thread Georg Seifert
Hi,

I have several undomanagers in my app. (I know that is unusual. Think of it as 
if you had a page layout app and every page has its own undo.)

This all works well except if the document is locked. Then the documents 
undomanager knows about this and prevents the change and generates a error. But 
my undomanagers are not in sync with the document. I do not find anything about 
that in the docs. So, is there any way to get the locked state of the document 
or to connect the undomanagers with the document?

Thanks
Georg
___

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: TextEdit - Open Recent - slow

2012-02-07 Thread Gerriet M. Denkmann

On 7 Feb 2012, at 05:46, Jens Alfke wrote:

 On Feb 6, 2012, at 2:12 PM, Gerriet M. Denkmann wrote:
 
 1788 __open  (in libsystem_kernel.dylib) + 10  [0x7fff8b1c9ad2]
 
 Running fs_usage on TextEdit while this is going on might be useful … it’ll 
 show you what files it opened and how long it took.

Here is some output of fs_usage -w:

18:58:13.175205  getattrlist
/Volumes/เม่น/Users/gerriet/Schriften/Massage.rtf   
 0.32   TextEdit.1317
18:58:13.176053  getattrlist
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Agenda.rtf  
   0.39   TextEdit.1317
18:58:13.177119  getattrlist
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv 
   0.78   TextEdit.1317
  0.54   TextEdit.1317  
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Icon
18:58:13.181122  PAGE_IN_FILE  A=0x7fff8ca03000TEXT 
Automator.framework 
   0.09   TextEdit.1317
  0.16   TextEdit.1317  
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Icon
 0.92   TextEdit.1317 1] (R_)  
 /Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Icon
18:58:18.702729  getattrlist/Applications   
 
0.45   TextEdit.1317

It took 5 seconds to read (and process ?) the folder icon.


5 minutes later, it took only 0.8 seconds:

19:06:23.893929  getattrlist
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv 
   0.92   TextEdit.1317
  0.19   TextEdit.1317  
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Icon
  0.12   TextEdit.1317  
/Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Icon
 0.71   TextEdit.1317 1] (R_)  
 /Volumes/เม่น/Users/gerriet/Source/Stuff 10.6.2/ไทย Dict Wv/Icon
19:06:24.611690  getattrlist
/System/Library/CoreServices/Finder.app 
 0.20   TextEdit.1317


But my debug version of TextEdit can do all of the recent docs (including the 
folder icons) in 0.06 seconds.


Kind regards,

Gerriet.




___

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

Using custom controls on top of custom graphics

2012-02-07 Thread Tom Jeffries
I want to use a custom graphic as the main window of a program, and I'm
using custom controls (built with NSButtons on top of NSViews).  I have not
been able to figure out how to make the custom controls appear on top of
the bitmap.  I also want to build custom sliders using a special graphic
for the slider area and for the knob.

Can someone point me to some source code that shows how to do this?

Thanks, Tom Jeffries
___

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


NSCollectionView mouseDown/drag is really slow.

2012-02-07 Thread Robert Monaghan
Hi Everyone,

I have just read all of the posts that I can find about the NSCollectionView 
and selecting an item (or items) for a drag operation. As others have pointed 
out, the selection takes about 1 second for a drag operation to be processed. 
This is a real sore spot when using the NSCollectionView in my app. My beta 
testers are actually logging this as a bug.

Is there a technique that can be done in -mouseDown: to speed up the time for a 
drag operation? Or am I stuck with this?

Thanks!

bob.


___

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: TextEdit - Open Recent - slow

2012-02-07 Thread Kyle Sluder
On Feb 7, 2012, at 4:27 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 18:58:18.702729  getattrlist/Applications 

 0.45   TextEdit.1317
 
 It took 5 seconds to read (and process ?) the folder icon.

Are your running on an SSD? Sounds like possible symptoms of drive death.

--Kyle Sluder
___

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: Difficulty Calling NSTableView's validateDrop: Method for Unit Testing

2012-02-07 Thread Dave Fernandes
tableView:validateDrop:proposedRow:proposedDropOperation: is an 
NSTableViewDataSource method (not an NSTableView method). So whatever class is 
implementing the data source methods is probably the class you want to test 
with your unit test code.

Dave

On 2012-02-06, at 9:22 PM, Mark Szymczyk wrote:

 I'm trying to unit test drag and drop rearranging of items in a table view. 
 In my unit testing code I have an object of a NSDocument subclass.
 
 MyDocument* testDoc;
 
 The NSDocument subclass has a table view outlet.
 
 IBOutlet NSTableView* myTableView;
 
 I start my unit test by creating a mock object that implements the 
 NSDraggingInfo protocol.
 
 id mock = [OCMockObject mockForProtocol:@protocol(NSDraggingInfo)];
 
 I use the mock object as an argument to NSTableView's validateDrop: method, 
 like the following code:
 
 NSDragOperation theDrag = [xyz
   tableView:myTableView
   validateDrop:mock
   proposedRow:1
   proposedDropOperation:NSTableViewDropAbove];
 
 What do I replace xyz with in my call to validateDrop:? I tried supplying 
 testDoc, myTableView, NSDocument, and NSTableView, but they generate syntax 
 errors. I searched Google for examples, but all I found were examples on how 
 to write a validateDrop: method to handle drag and drop in my code. I didn't 
 find any examples of calling validateDrop:.
 
 Mark
 ___
 
 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/dave.fernandes%40utoronto.ca
 
 This email sent to dave.fernan...@utoronto.ca


___

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: Sandbox, 10.6, Core Duo, XCode 4.... where is the entitlement page?

2012-02-07 Thread R
To clarify, I'm developing with XCode 4 on 10.6 and want my app to be
available for Lion users. Do I have to be running Lion to configure
sandbox entitlements?  If so, I have to buy a new machine (using a
core duo)?

On Feb 6, 10:54 pm, R r4eem...@gmail.com wrote:
 Ok folks,

 I must be doing something really dumb... but for the life of me, I
 can't find the entitlement screen to configure my app.  I've built
 apps on a Core Duo Intel machine with a 10.6 target and have converted
 over to XCode 4.

 I've read and watched the WWDC 2011 presentations, etc...

 Everything I read shows that Target-Summary should show the
 Entitlements to check/unCheck.

 I can't find any Entitlement page.

 Help -- Ron
 ___

 Cocoa-dev mailing list (cocoa-...@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/cocoa-dev-garchive-...

 This email sent to cocoa-dev-garchive-98...@googlegroups.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

Lion's 'restore windows' vs. app with initial 'login'

2012-02-07 Thread Eric Slosser
I'm looking for a design review here.

I've got an app that has a login step at the beginning.  Until the user has 
logged on, it's inappropriate to display the documents that were open when the 
last user quit.  Lion's 'restore windows' feature happens while my login dialog 
is still open.  I've looked at the slides for the WWDC 2011 session Resume and 
Automatic Termination in Lion and they don't address the concept of an app 
with a startup gateway like a login dialog.

Through experimentation, I found that 'resume' is happening through calls to 
-[MyDocController openDocumentWithContentsOfURL:display:error].  I plan to put 
a check for login there.  If the user hasn't logged in, I'll save the URLs, 
return NULL, and process them later.  When I process them, I can also filter 
out URLs that 'belong' to someone other than the current logged in user.

Is there a better way?
___

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: boundingRectWithSize problem?

2012-02-07 Thread Tony Pollard
Using a temporary Text container/storage/layout seems to fix the problem.  See:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html

The NS(Attributed)String+Geometrics category by Jerry Krinock is also handy:
 https://github.com/jerrykrinock/CategoriesObjC.git

Cheers!

Tony Pollard

On 27 Jan 2012, at 11:26 am, Tony Pollard wrote:

 Good thought Tim,  but for some reason it doesn't work in this case (both on 
 10.6  10.7).
 
 As you would expect, it is size/font sensitive so I can get the same failure 
 result (for the sample text given) with Times-Roman 11 point.  Of the various 
 text samples, it's only 1 in 10,000 or so that don't get their height 
 calculated correctly.
 
 Tony
 
 
 On 26 Jan 2012, at 6:59 pm, Tim Schröder wrote:
 
 I had exactly the same problem and solved it by using the 
 NSStringDrawingUsesDeviceMetrics option instead of 
 NSStringDrawingDisableScreenFontSubstitution.
 
 Tim
 
 Am 25.01.2012 um 16:26 schrieb Tony Pollard:
 
 Hi folks,
 
 I'm having a strange problem with NSAttributedString boundingRectWithSize 
 in getting the needed height for a fixed width.  It works 99% of the time, 
 but it consistently underestimates the height for certain text (by 
 approximately one line).  There doesn't appear to be a pattern for the text 
 that works and the text that fails  (tested on 10.6 and 10.7).
 
 The code is:
 
 NSRect textRect = [attrString boundingRectWithSize:NSMakeSize(300.0, 0.0)   
 // Width 300, any height (max height also 
 fails)
 
 options: NSStringDrawingUsesLineFragmentOrigin |// Needed 
 for multi-line
 
 NSStringDrawingDisableScreenFontSubstitution];
 
 The attributed strings are built from data sources.  Here's one that fails:
 
 Printing description of attrString:
 n. {
  CdctPhraseType = Grammer;
  NSColor = NSCalibratedRGBColorSpace 0.878431 0.0980392 0.160784 1;
  NSFont = LucidaGrande 9.00 pt. P [] (0x50bbd0) fobj=0x50b7b0, spc=2.85;
 }A hopper is a device shaped like a large funnel, in which substances such 
 as grain, coal, animal food, or sand can be stored.{
  CdctPhraseType = Transition;
  NSColor = NSCalibratedRGBColorSpace 0.227451 0.54902 0.258824 1;
  NSFont = LucidaGrande 9.00 pt. P [] (0x50bbd0) fobj=0x50b7b0, spc=2.85;
 }
 {
 }F.ex: Large trailers came along and tipped it into a big hopper.{
  CdctPhraseType = Transition;
  NSColor = NSCalibratedRGBColorSpace 0.227451 0.54902 0.258824 1;
  NSFont = LucidaGrande 9.00 pt. P [] (0x50bbd0) fobj=0x50b7b0, spc=2.85;
 }
 
 The resulting Rect is too short by about 9 pixels.  Anyone had the same 
 problem?
 
 Tony Pollard
 
 
 
 
 ___
 
 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/tim%40timschroeder.net
 
 This email sent to t...@timschroeder.net
 
 
 
 ___
 
 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/tonyp%40neutral.co.uk
 
 This email sent to to...@neutral.co.uk


___

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: Sandbox, 10.6, Core Duo, XCode 4.... where is the entitlement page?

2012-02-07 Thread Sean McBride
On Tue, 7 Feb 2012 09:11:04 -0800, R said:

To clarify, I'm developing with XCode 4 on 10.6 and want my app to be
available for Lion users. Do I have to be running Lion to configure
sandbox entitlements?  If so, I have to buy a new machine (using a
core duo)?

Sounds like a question for the Xcode list.  But Xcode's not doing magic, you 
could do all the stuff with only command line tools too.  You can probably just 
add the .entitlements file to your bundle, and adjust your Info.plist, etc.  
IIRC, the docs talk about this even.

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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: NSCollectionView mouseDown/drag is really slow.

2012-02-07 Thread Lee Ann Rucker

On Feb 7, 2012, at 7:47 AM, Robert Monaghan wrote:

 Hi Everyone,
 
 I have just read all of the posts that I can find about the NSCollectionView 
 and selecting an item (or items) for a drag operation. As others have pointed 
 out, the selection takes about 1 second for a drag operation to be processed. 
 This is a real sore spot when using the NSCollectionView in my app. My beta 
 testers are actually logging this as a bug.
 
 Is there a technique that can be done in -mouseDown: to speed up the time for 
 a drag operation? Or am I stuck with this?
 
 Thanks!

I've done a lot of digging into it and haven't found anything; NSCollectionView 
does all the processing in a loop triggered by mouseDown: instead of doing the 
mouseDragged:/mouseUp: approach, and replicating the entire mouseDown: in a 
subclass is not really viable. It is better in Lion and the users who filed 
bugs against my app in Snow Leopard seem happy with Lion.


___

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: NSCollectionView mouseDown/drag is really slow.

2012-02-07 Thread Robert Monaghan
Hi Lee Ann,

Thanks for the info.. I was going to ask you if you had done any more digging.
Heheh, my users are mostly using Lion, too.

I guess more bug reports with Apple is the way to go on this.

bob.

On Feb 7, 2012, at 7:52 PM, Lee Ann Rucker wrote:

 
 On Feb 7, 2012, at 7:47 AM, Robert Monaghan wrote:
 
 Hi Everyone,
 
 I have just read all of the posts that I can find about the NSCollectionView 
 and selecting an item (or items) for a drag operation. As others have 
 pointed out, the selection takes about 1 second for a drag operation to be 
 processed. This is a real sore spot when using the NSCollectionView in my 
 app. My beta testers are actually logging this as a bug.
 
 Is there a technique that can be done in -mouseDown: to speed up the time 
 for a drag operation? Or am I stuck with this?
 
 Thanks!
 
 I've done a lot of digging into it and haven't found anything; 
 NSCollectionView does all the processing in a loop triggered by mouseDown: 
 instead of doing the mouseDragged:/mouseUp: approach, and replicating the 
 entire mouseDown: in a subclass is not really viable. It is better in Lion 
 and the users who filed bugs against my app in Snow Leopard seem happy with 
 Lion.
 


___

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: Lion's 'restore windows' vs. app with initial 'login'

2012-02-07 Thread Quincey Morris
On Feb 7, 2012, at 09:27 , Eric Slosser wrote:

 I've got an app that has a login step at the beginning.  Until the user has 
 logged on, it's inappropriate to display the documents that were open when 
 the last user quit.  Lion's 'restore windows' feature happens while my login 
 dialog is still open.  I've looked at the slides for the WWDC 2011 session 
 Resume and Automatic Termination in Lion and they don't address the concept 
 of an app with a startup gateway like a login dialog.
 
 Through experimentation, I found that 'resume' is happening through calls to 
 -[MyDocController openDocumentWithContentsOfURL:display:error].  I plan to 
 put a check for login there.  If the user hasn't logged in, I'll save the 
 URLs, return NULL, and process them later.  When I process them, I can also 
 filter out URLs that 'belong' to someone other than the current logged in 
 user.

'openDocumentWithContentsOfURL:display:error:' is deprecated in Lion, so it's 
surprising that it's being called instead of 
'openDocumentWithContentsOfURL:display:completionHandler:', and maybe you can't 
rely on it being called in future updates.

An alternative approach might be to override 
'restoreDocumentWindowWithIdentifier:state:completionHandler:' (not documented 
anywhere except the NSWindowRestoration.h header file, but discussed in the 
WWDC video). I believe you're allowed to defer the calling of the completion 
handler, so could either ask for the login in this method, or add the 
parameters to a queue and deal with them after a login.

It's not clear whether deferring one completion handler also defers invocation 
of the above method for additional windows, or if you'll get a series of 
invocations that all need to be deferred, but I guess it doesn't matter 
provided you're prepared to queue as many as arrive.

Also, you have to call the completion handler *eventually*, so if login fails 
(in the sense that you give up after repeated attempts), you should probably 
invoke the completion handlers with nil window parameters, then quit the 
application, since AFAIK there's no way to restart the restoration process 
later in the app's existing lifetime.

I dunno, though. Maybe this is abusing the resume mechanism too.


___

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: Difficulty Calling NSTableView's validateDrop: Method for Unit Testing

2012-02-07 Thread Mark Szymczyk
I found a solution. The solution was to create a second mock object that 
implements the NSTableViewDataSource protocol and use that mock object to call 
validateDrop:.

Mark
___

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: Lion's 'restore windows' vs. app with initial 'login'

2012-02-07 Thread Lee Ann Rucker

On Feb 7, 2012, at 11:09 AM, Quincey Morris wrote:

 On Feb 7, 2012, at 09:27 , Eric Slosser wrote:
 
 I've got an app that has a login step at the beginning.  Until the user has 
 logged on, it's inappropriate to display the documents that were open when 
 the last user quit.  Lion's 'restore windows' feature happens while my login 
 dialog is still open.  I've looked at the slides for the WWDC 2011 session 
 Resume and Automatic Termination in Lion and they don't address the 
 concept of an app with a startup gateway like a login dialog.
 
 Through experimentation, I found that 'resume' is happening through calls to 
 -[MyDocController openDocumentWithContentsOfURL:display:error].  I plan to 
 put a check for login there.  If the user hasn't logged in, I'll save the 
 URLs, return NULL, and process them later.  When I process them, I can also 
 filter out URLs that 'belong' to someone other than the current logged in 
 user.
 
 'openDocumentWithContentsOfURL:display:error:' is deprecated in Lion, so it's 
 surprising that it's being called instead of 
 'openDocumentWithContentsOfURL:display:completionHandler:', and maybe you 
 can't rely on it being called in future updates.

If you subclass the old one and not the new one, the old one gets called. If 
you subclass both, only the new one gets called.


___

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: Problem with CoreData

2012-02-07 Thread Laurent Daudelin
Never mind. Wrong use of a relationship caused the problem.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On Feb 7, 2012, at 12:48, Laurent Daudelin wrote:

 Hello.
 
 I have a very simple model with a table and some attributes in it. For some 
 reason, I have an NSDate attribute that I want to use for a sort descriptor. 
 The problem I'm having is that when I have my NSFetchedResultsController 
 fetches the database, the NSDate attribute of all my fetched objects is 
 always the current date, or now. When I look at the table in the database 
 directly, I see there are different values for this attribute. There isn't 
 any trick or manipulation behind the scene, my subclass of NSManagedObject 
 just declares the properties that are in the table, nothing more, nothing 
 less. I then added an NSString and basically the same thing is happening: 
 when I look at the attribute in the table in the database, there are values 
 for this string but when I fetch with my NSFetchedResultsController, all the 
 strings are nil.
 
 Has anybody ever seen this? What am I missing?
 
 Thanks in advance for any pointer, help or info!
 
 -Laurent.


___

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: Problem with CoreData

2012-02-07 Thread Fritz Anderson
On 7 Feb 2012, at 2:48 PM, Laurent Daudelin wrote:

 I have a very simple model with a table and some attributes in it. For some 
 reason, I have an NSDate attribute that I want to use for a sort descriptor. 
 The problem I'm having is that when I have my NSFetchedResultsController 
 fetches the database, the NSDate attribute of all my fetched objects is 
 always the current date, or now. When I look at the table in the database 
 directly, I see there are different values for this attribute. There isn't 
 any trick or manipulation behind the scene, my subclass of NSManagedObject 
 just declares the properties that are in the table, nothing more, nothing 
 less. I then added an NSString and basically the same thing is happening: 
 when I look at the attribute in the table in the database, there are values 
 for this string but when I fetch with my NSFetchedResultsController, all the 
 strings are nil.

iOS or Mac? What project template did you start with? 

Are you building the Core Data stack yourself? If Mac, are you using a 
persistent document?

How are you initializing the fetched-results controller?

Have you verified that all the objects coming back from your fetches have 
different objectIDs?

You say your managed-object subclass declares properties for all the entity's 
(I think you mean entity when you say table) attributes, but did you also 
specify @dynamic for the properties?

Try instantiating a new project (for whatever your platform is) that you'll 
throw away, so you can see how the various setups are done. An iOS 
master-detail application that uses Core Data will demonstrate both the 
Core-Data stack initialization and how to set up the fetched-results controller.

— F


___

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: TextEdit - Open Recent - slow

2012-02-07 Thread Jens Alfke

On Feb 7, 2012, at 7:46 AM, Kyle Sluder wrote:

 Are your running on an SSD? Sounds like possible symptoms of drive death.

Was about to say the same thing. I was getting weird lockups like this 
(generally to pref files); then it progressed to random disk issues at startup 
that required up to 20 minutes of fsck before the system would boot; then the 
disk stopped being bootable at all. I replaced the SSD with one from another 
vendor and haven’t had any trouble since [knock wood].

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

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

Re: Using custom controls on top of custom graphics

2012-02-07 Thread Jens Alfke

On Feb 7, 2012, at 7:42 AM, Tom Jeffries wrote:

 I want to use a custom graphic as the main window of a program,

In other words, you have a root view covering the whole window that draws the 
custom graphic in its frame?

 and I'm
 using custom controls (built with NSButtons on top of NSViews).  I have not
 been able to figure out how to make the custom controls appear on top of
 the bitmap.  

Make the views non-opaque by overriding -isOpaque to return NO.

 I also want to build custom sliders using a special graphic
 for the slider area and for the knob.

You’ll have to implement that from scratch, or maybe find a 3rd party open 
source control. NSSlider definitely can’t be customized that way.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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


[MEET] CocoaHeadsNYC this Thursday

2012-02-07 Thread Andy Lee
When: Thursday, February 9, 2012, 6:30-8:00 PM, followed by pizza at Patsy's.

Who: Natalie Podrazik and David Jacobs

What: Natalie and David will discuss a Metrics library (Starwatch) for iOS 
they've been working on. They'll demo their code, discuss why they chose to 
write their own, what the alternatives were, and dive into the code (which will 
be open sourced shortly).

Where: Google, 76 9th Ave, New York, NY 10011

You might want to arrive a few minutes early in case there's a line at the 
security desk.

See http://www.cocoaheadsnyc.org/meeting/ for a map and directions to the 
room.

Hope you can make it!

--Andy

___

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: TextEdit - Open Recent - slow

2012-02-07 Thread Gerriet M. Denkmann

On 7 Feb 2012, at 22:46, Kyle Sluder wrote:

 On Feb 7, 2012, at 4:27 AM, Gerriet M. Denkmann gerr...@mdenkmann.de 
 wrote:
 
 18:58:18.702729  getattrlist/Applications
 
 0.45   TextEdit.1317
 
 It took 5 seconds to read (and process ?) the folder icon.
 
 Are your running on an SSD? Sounds like possible symptoms of drive death.

No. Just a normal hard disk.

And also: when I use my debug version of TextEdit (from 
/Developer/Examples/TextEdit) I have never seen any delay in displaying the 
Open Recent menu.
Also: other apps, having the same two recent files (with icons) never show any 
delay.

Kind regards,

Gerriet.




___

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: Animating NSSplitView collapse/uncollapse

2012-02-07 Thread Luc Van Bogaert
On 06 Feb 2012, at 09:29, Martin Hewitson wrote:

 Hi Luc,
 
 Attached is a split view controller which I think does what you want, or at 
 least should enough to go on. This is cobbled together from various examples 
 I found on the web. The code is experimental and probably needs some cleaning 
 up.
 

Thanks Martin, I will have a look at this.

Meanwhile, I think I have found a working solution of myself, although it 
certainly needs more testing. This code animates both views at either side of 
the divider, it works for horizontal or vertical split views and also works for 
collapsed subiews.

Here, I'm temporarily disabling autoresize both before and after changing the 
view frames, when the original size and target size are zero.  Also, I'm 
disabling delegate interference during animation. The 'dividerPosition' 
parameter is calculated in another instance method 'toggleSubviewAtIndex:' 
which is called  from my window controller. This involves storing the original 
size of the subviews in a dictionary ivar before the subview is hidden, so it 
can be restored when it is revealed later. Also, it handles collapsed 
subviews separately by first setting their frame size and origin to zero before 
calling the animation method.   

- (void)animateDividerToPosition:(CGFloat)dividerPosition
{
NSView *view0 = [[self subviews] objectAtIndex:0];
NSView *view1 = [[self subviews] objectAtIndex:1];
NSRect view0Rect = [view0 frame];
NSRect view1Rect = [view1 frame];
NSRect overalRect = [self frame];
CGFloat dividerSize = [self dividerThickness];

BOOL view0AutoResizes = [view0 autoresizesSubviews];
BOOL view1AutoResizes = [view1 autoresizesSubviews];

if ([self isVertical]) {
// disable autoresizing if *current* view size = zero
[view0 setAutoresizesSubviews:view0AutoResizes  view0Rect.size.width 
 0];
[view1 setAutoresizesSubviews:view1AutoResizes  view1Rect.size.width 
 0];
// set subviews target size
view0Rect.origin.x = MIN(0, dividerPosition);
view0Rect.size.width = MAX(0, dividerPosition);
view1Rect.origin.x = MAX(0, dividerPosition + dividerSize);
view1Rect.size.width = MAX(0, overalRect.size.width - 
view0Rect.size.width - dividerSize);
// disable autoresizing if *target* view size = zero
if (view0Rect.size.width = 0)
[view0 setAutoresizesSubviews:NO];
if (view1Rect.size.width = 0)
[view1 setAutoresizesSubviews:NO];
} else {
// disable autoresizing if *current* view size = zero
[view0 setAutoresizesSubviews:view0AutoResizes  view0Rect.size.height 
 0];
[view1 setAutoresizesSubviews:view1AutoResizes  view1Rect.size.height 
 0];
// set subviews target size
view0Rect.origin.y = MIN(0, dividerPosition);
view0Rect.size.height = MAX(0, dividerPosition);
view1Rect.origin.y = MAX(0, dividerPosition + dividerSize);
view1Rect.size.height = MAX(0, overalRect.size.height - 
view0Rect.size.height - dividerSize);
// disable autoresizing if *target* view size = zero
if (view0Rect.size.height = 0)
[view0 setAutoresizesSubviews:NO];
if (view1Rect.size.height = 0)
[view1 setAutoresizesSubviews:NO];
}

// make sure views are visible after previous collapse
[view0 setHidden:NO];
[view1 setHidden:NO];

// disable delegate interference
id delegate = [self delegate];
[self setDelegate:nil];

[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.25f];
[[NSAnimationContext currentContext] setCompletionHandler:^(void) {
[view0 setAutoresizesSubviews:view0AutoResizes];
[view1 setAutoresizesSubviews:view1AutoResizes];
[self setDelegate:delegate];
[self setAnimating:NO];
}];
[[view0 animator] setFrame: view0Rect];
[[view1 animator] setFrame: view1Rect];
[NSAnimationContext endGrouping];
}
 
___

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


How to get bookmarks data for non-existing files

2012-02-07 Thread Gerriet M. Denkmann
 This works fine (usually):
BOOL isStale;
NSError *outError;
NSURL *url =[ NSURL URLByResolvingBookmarkData: 
bookmarksData 

options:options 

relativeToURL:  nil 

bookmarkDataIsStale:isStale 
error:  
outError
];
But when the referenced file does NOT exist, url will be nil and NSError just 
tells me: File does not exist.
But I would like to know what the (now non-existing) filename has been.

How?


Kind regards,

Gerriet.


___

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: How to get bookmarks data for non-existing files

2012-02-07 Thread Quincey Morris
On Feb 7, 2012, at 22:58 , Gerriet M. Denkmann wrote:

 This works fine (usually):
   BOOL isStale;
   NSError *outError;
   NSURL *url =[ NSURL URLByResolvingBookmarkData: 
 bookmarksData 
   
 options:options 
   
 relativeToURL:  nil 
   
 bookmarkDataIsStale:isStale 
   error:  
 outError
   ];
 But when the referenced file does NOT exist, url will be nil and NSError just 
 tells me: File does not exist.
 But I would like to know what the (now non-existing) filename has been.
 
 How?

Did you try +[NSURL resourceValuesForKeys:fromBookmarkData:]?


___

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: How to get bookmarks data for non-existing files

2012-02-07 Thread Gerriet M. Denkmann

On 8 Feb 2012, at 14:30, Quincey Morris wrote:

 On Feb 7, 2012, at 22:58 , Gerriet M. Denkmann wrote:
 
 This works fine (usually):
  BOOL isStale;
  NSError *outError;
  NSURL *url =[ NSURL URLByResolvingBookmarkData: 
 bookmarksData 
  
 options:options 
  
 relativeToURL:  nil 
  
 bookmarkDataIsStale:isStale 
  error:  
 outError
  ];
 But when the referenced file does NOT exist, url will be nil and NSError 
 just tells me: File does not exist.
 But I would like to know what the (now non-existing) filename has been.
 
 How?
 
 Did you try +[NSURL resourceValuesForKeys:fromBookmarkData:]?

I had not. Right now I am trying it. But what keys to use? So far I got 
NSURLNameKey but there is more to get.
Is there a list of usable keys somewhere?

Gerriet.
 


___

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