NSLayoutManager didCompleteLayout callback & NSFormFeedCharacter

2011-05-12 Thread Philip Dow
I just submitted the following bug report and wanted to post it here as well to 
see if anyone had a recommended workaround.

NSLayoutManager layoutManager:didCompleteLayoutForTextContainer:atEnd callback 
is never called with atEnd flag set to YES if last character of text is 
NSFormFeedCharacter.

Summary:
The NSLayoutManager callback 
layoutManager:didCompleteLayoutForTextContainer:atEnd: is called as layout is 
completed for each text container in a multipage view. The atEnd flag is set to 
YES when the last text container is layed out. This method is never called with 
the atEnd flag set to YES if the last character in the text is the page break 
(NSFormFeedCharacter) control character.

This is verifiable on Mac OS 10.6.7 through testing with TextEdit source code 
that is included in the Xcode distro.

Steps to Reproduce:
Create a multipage text document in TextEdit with text wrapping enabled. Add a 
page break as the last character in the document and save the document. Next 
time the document is opened, the layout manager callback never occurs with the 
atEnd flag set to YES.

Expected Results:
When the last container is layed out, the atEnd flag should be set to YES.

Actual Results:
The didCompleteLayoutForTextContainer is correctly called a number of times for 
each text container with the atEnd flag set to NO, but it is never finally 
called with the atEnd flag set to YES for the last text container.

~

I'm hoping someone might have some insight into this or a possible workaround. 
I have some code that depends on a correct count of the number of layed out 
pages and that count is determined when layout is completed, as indicated by 
the atEnd flag set to YES.

~Phil___

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: QuickTime Player - like application

2011-05-12 Thread Nick
Thank you
___

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: selectionIndexesForProposedSelection on mouse Up or mouse Down

2011-05-12 Thread Quincey Morris
On May 12, 2011, at 13:42, Brad Stone wrote:

> I'm thinking about the perception of the user.  When I'm in Mail.app, for 
> example, clicking in the outlineView (organized by thread) and I click on a 
> row it feels less responsive because there's a pause before the row 
> highlights (a pause until I release the mouse button).  When I'm in iTunes 
> and the row highlights as soon as the mouse button is down is just feels more 
> responsive.

You're on shaky ground here. You claim to be thinking about the perception of 
"the user" but you subsequently make it clear you're thinking about the 
perception of only one user -- you. :)

Even if you're right, it's not clear that you're doing your users any favors by 
making your outline views behave different from every other outline view in 
every other application.

It's certainly possible that you have a usage case where the default 
NSOutlineView behavior is inappropriate, but if you want to actually do 
something about it, you're probably going to have to start writing custom UI 
code.

> I put in NSLog calls to show me when "proposed" and "didChange" get called.  
> NSTableView's delegate gets called on mouseDown while NSOutlineView on 
> mouseUp.

NSTableView could well be the one that's wrong, not NSOutlineView. Dragging 
something unselected in an outline view doesn't select it, nor (I believe) is 
it supposed to, and every outline view I could find had that deferred behavior, 
even if it didn't permit dragging.

Whether NSTableView is wrong, is working according to an older set of usability 
principles, defaults to an inconsistent compatibility mode,  or is simply 
making a different set of decisions -- that I don't know and don't believe 
there's any API contract about. That's why I was suggesting it's pointless to 
take any action based on the actual implementation.

If you want to pursue this, I'd suggest there are probably 3 steps:

1. Examine the Human Interface Guidelines in detail to find out if the intended 
behavior is spelled out there, and what leeway it gives.

2. Examine the NSTableView and NSOutlineView class references in detail to find 
out if there are any obscure properties, overridable methods or delegate 
methods that can modify the behavior.

3. File a bug report complaining about the difference in behavior between the 
two classes. The response might clarify what's going on, or what's supposed to 
be going on. (I wouldn't try complaining directly about the behavior you don't 
like, because you'll just get a response saying it's behaving "as intended".)

___

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: Read-Write Lock is Available?

2011-05-12 Thread Dave DeLong
There's a simple wrapper around the pthread_rwlock_t here:

http://cocoaheads.byu.edu/wiki/locks

Cheers,

Dave

On May 12, 2011, at 11:23 AM, Bing Li wrote:

> Dear Stephen and Lance,
> 
> I appreciate so much for your reply!
> 
> I am exactly sure if my approach is fine. I plan to protect the data that
> might be used concurrently with read-write locks. In the meantime, the
> concurrency is implemented using NSOperationQueue. Is it OK?
> 
> Best regards,
> Bing
> 
> On Fri, May 13, 2011 at 2:15 AM, Stephen J. Butler > wrote:
> 
>> On Thu, May 12, 2011 at 12:44 PM, Bing Li  wrote:
>>> I am writing concurrent code. I get used to the read-write lock on other
>>> development environment. However, according to the Threading Programming
>>> Guide from apple.com, Cocoa does not support the read-write lock? We can
>> use
>>> it with POSIX threads? Is that true?
>> 
>> It is safe to use POSIX threads RW locks with Cocoa threads.
>> 
>> man pthread_rwlock_init
>> 
> ___
> 
> 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/davedelong%40me.com
> 
> This email sent to davedel...@me.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: selectionIndexesForProposedSelection on mouse Up or mouse Down

2011-05-12 Thread Brad Stone
I'm thinking about the perception of the user.  When I'm in Mail.app, for 
example, clicking in the outlineView (organized by thread) and I click on a row 
it feels less responsive because there's a pause before the row highlights (a 
pause until I release the mouse button).  When I'm in iTunes and the row 
highlights as soon as the mouse button is down is just feels more responsive.

I put in NSLog calls to show me when "proposed" and "didChange" get called.  
NSTableView's delegate gets called on mouseDown while NSOutlineView on mouseUp.

On May 12, 2011, at 2:06 PM, Quincey Morris wrote:

> On May 12, 2011, at 10:05, Brad Stone wrote:
> 
>> For my NSTableView (NSIndexSet *)tableView:(NSTableView *)tableView 
>> selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes 
>> fires on mouseDown and (void)tableViewSelectionDidChange:(NSNotification 
>> *)aNotification fires on mouseUp.
>> 
>> For my NSOutlineView (NSIndexSet *)outlineView:(NSOutlineView *)outlineView 
>> selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes 
>> and (void)outlineViewSelectionDidChange:(NSNotification *)notification fire 
>> only on mouseUp.  
> 
> This can't be true.
> 
> For a start, thinking of the delegate methods as "firing" on mouse events 
> seems like a way to lead yourself astray. There are *various* ways to change 
> a selection, only some of which start at a mouse down event, and the delegate 
> methods are invoked at *various* points in the procedure depending on 
> circumstances, no matter how it starts. (Well, ...DidChange presumably gets 
> invoked only at the end, but what constitutes the end may vary.)
> 
> Specifically, if NSOutlineView's 'selectionIndexesForProposedSelection:...' 
> method wasn't ever called until a mouse up event (after an initial mouse 
> down, I mean), it wouldn't be possible to prevent rows from getting selected 
> while the mouse is being dragged, and it *is* possible to do so.
> 
> There may be specific scenarios where the view decides not to invoke the 
> delegate until mouse up, but that fact just demonstrates the pointlessness of 
> trying to parse the mouse event behavior.
> 
> 

___

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: Read-Write Lock is Available?

2011-05-12 Thread Bing Li
Dear Stephen and Lance,

I appreciate so much for your reply!

I am exactly sure if my approach is fine. I plan to protect the data that
might be used concurrently with read-write locks. In the meantime, the
concurrency is implemented using NSOperationQueue. Is it OK?

Best regards,
Bing

On Fri, May 13, 2011 at 2:15 AM, Stephen J. Butler  wrote:

> On Thu, May 12, 2011 at 12:44 PM, Bing Li  wrote:
> > I am writing concurrent code. I get used to the read-write lock on other
> > development environment. However, according to the Threading Programming
> > Guide from apple.com, Cocoa does not support the read-write lock? We can
> use
> > it with POSIX threads? Is that true?
>
> It is safe to use POSIX threads RW locks with Cocoa threads.
>
> man pthread_rwlock_init
>
___

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: Read-Write Lock is Available?

2011-05-12 Thread Stephen J. Butler
On Thu, May 12, 2011 at 12:44 PM, Bing Li  wrote:
> I am writing concurrent code. I get used to the read-write lock on other
> development environment. However, according to the Threading Programming
> Guide from apple.com, Cocoa does not support the read-write lock? We can use
> it with POSIX threads? Is that true?

It is safe to use POSIX threads RW locks with Cocoa threads.

man pthread_rwlock_init
___

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: Read-Write Lock is Available?

2011-05-12 Thread lbland
hi-

On May 12, 2011, at 1:44 PM, Bing Li wrote:

> I am writing concurrent code. I get used to the read-write lock on other
> development environment. However, according to the Threading Programming
> Guide from apple.com, Cocoa does not support the read-write lock? We can use
> it with POSIX threads? Is that true?

have you looked at the mutex variable, or NSLock? Also, the darwin mail list 
may be better for you.

Are your threads in a single process or not? ... that can make a difference in 
the answer ...

thanks!-

-lance

___

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: selectionIndexesForProposedSelection on mouse Up or mouse Down

2011-05-12 Thread Quincey Morris
On May 12, 2011, at 10:05, Brad Stone wrote:

> For my NSTableView (NSIndexSet *)tableView:(NSTableView *)tableView 
> selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes 
> fires on mouseDown and (void)tableViewSelectionDidChange:(NSNotification 
> *)aNotification fires on mouseUp.
> 
> For my NSOutlineView (NSIndexSet *)outlineView:(NSOutlineView *)outlineView 
> selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes 
> and (void)outlineViewSelectionDidChange:(NSNotification *)notification fire 
> only on mouseUp.  

This can't be true.

For a start, thinking of the delegate methods as "firing" on mouse events seems 
like a way to lead yourself astray. There are *various* ways to change a 
selection, only some of which start at a mouse down event, and the delegate 
methods are invoked at *various* points in the procedure depending on 
circumstances, no matter how it starts. (Well, ...DidChange presumably gets 
invoked only at the end, but what constitutes the end may vary.)

Specifically, if NSOutlineView's 'selectionIndexesForProposedSelection:...' 
method wasn't ever called until a mouse up event (after an initial mouse down, 
I mean), it wouldn't be possible to prevent rows from getting selected while 
the mouse is being dragged, and it *is* possible to do so.

There may be specific scenarios where the view decides not to invoke the 
delegate until mouse up, but that fact just demonstrates the pointlessness of 
trying to parse the mouse event behavior.


___

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


Read-Write Lock is Available?

2011-05-12 Thread Bing Li
Dear all,

I am writing concurrent code. I get used to the read-write lock on other
development environment. However, according to the Threading Programming
Guide from apple.com, Cocoa does not support the read-write lock? We can use
it with POSIX threads? Is that true?

Thanks so much!
Bing
___

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


selectionIndexesForProposedSelection on mouse Up or mouse Down

2011-05-12 Thread Brad Stone
For my NSTableView (NSIndexSet *)tableView:(NSTableView *)tableView 
selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes 
fires on mouseDown and (void)tableViewSelectionDidChange:(NSNotification 
*)aNotification fires on mouseUp.

For my NSOutlineView (NSIndexSet *)outlineView:(NSOutlineView *)outlineView 
selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes and 
(void)outlineViewSelectionDidChange:(NSNotification *)notification fire only on 
mouseUp.  

Is this normal behavior?

I would prefer the NSOutlineView fire on mouseDown like the NSTableView.  Is 
there a way to change that?

(In Mail.app, if you organize by thread selection happens on mouseUp but in 
iTunes, the podcast outlineView selects on 
mouseDown).___

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: Moving windows from one NIB to another(solved)

2011-05-12 Thread Vyacheslav Karamov

loadNibNamed saved me :)

12-May-11 15:14, Vyacheslav Karamov пишет:

Hi All!

I have to support pretty large project which has all windows in a 
single NIB.
I tried to create another NIB and then moved some windows from 
Main.NIB to it.

But application fails to load.

I suggest that app couldn't load one of the panels at start, but I 
have no idea which steps I need to do.



Thank you in advance,
Vyacheslav.
___

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/ubuntulist%40yandex.ru

This email sent to ubuntul...@yandex.ru




___

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


Moving windows from one NIB to another

2011-05-12 Thread Vyacheslav Karamov

Hi All!

I have to support pretty large project which has all windows in a single 
NIB.
I tried to create another NIB and then moved some windows from Main.NIB 
to it.

But application fails to load.

I suggest that app couldn't load one of the panels at start, but I have 
no idea which steps I need to do.



Thank you in advance,
Vyacheslav.
___

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