Re: Better sorting using threads?

2010-03-10 Thread Ken Ferry
On Wed, Mar 10, 2010 at 10:34 PM, Ken Thomases  wrote:

> On Mar 10, 2010, at 11:50 PM, Graham Cox wrote:
>
> > I've got a situation where sorting an array using sort descriptors is
> slow. The number of items being sorted is not enormous - about 2,000 - but
> there could be several sort descriptors and the main string one is using a
> localized and natural numeric comparison. I cache the results and take a lot
> of care only to resort when needed, but that doesn't help on the first run
> through which often takes in the order of 10-20 seconds. The interface that
> displays the results therefore beachballs for this time.
> >
> > I'm considering using threads to help, where a thread is used to perform
> the sort itself, and until the sort has finished the UI can display a busy
> indicator (indeterminate circular progress indicator) next to the selected
> row in the table. This is in the master table of a master-detail interface
> where the detail displays the sorted items selected. While busy the detail
> view can be blank or show the previous arrangement.
> >
> > So my question is, is threading a good solution? While NSMutableArray
> isn't marked as thread-safe, the array in question can be arranged to not be
> used outside of the sorting thread, and only substituted for the returned
> sorted items when complete. Or can array sorting not be done on a thread at
> all?
>
> This is a sensible solution.  NSMutableArray is safe so long as only one
> thread is accessing it at a time.
>

Even more specifically, NSMutableArray is safe so long as either

(1) no thread is mutating the array (but an arbitrary number are accessing
it)
(2) only one thread is accessing the array (and possibly mutating it)

Same deal for NSDictionary, and, for that matter, NSImage.

Also, rest of email, seconded. :-)

-Ken

However, sorting 2000 items should not take 10-20 seconds!  Have you
> profiled to find out what's actually taking the time?


> If a property of the objects has to be massaged into another form before
> the comparison can take place, it can be a performance win to do that
> massaging once for each object before the sort and cache the result.
>  Otherwise, it may end up being performed over and over, each time one
> object is compared to another.  (I wouldn't worry about the localized,
> numeric comparison of strings, though.  I don't think there's a good way to
> preflight those, and I wouldn't think that would be a significant factor in
> the slowness.  But, of course, don't trust my intuition -- measure.)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.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: Better sorting using threads?

2010-03-10 Thread Graham Cox

On 11/03/2010, at 5:34 PM, Ken Thomases wrote:

> However, sorting 2000 items should not take 10-20 seconds!  Have you profiled 
> to find out what's actually taking the time?


Thanks Ken, your response prompted me to question my assumptions, and indeed, 
the culprit was something else entirely. As a result I probably no longer need 
to worry about the sorting time and will stick to doing it synchronously for 
now.

--Graham


___

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: Better sorting using threads?

2010-03-10 Thread Ken Thomases
On Mar 10, 2010, at 11:50 PM, Graham Cox wrote:

> I've got a situation where sorting an array using sort descriptors is slow. 
> The number of items being sorted is not enormous - about 2,000 - but there 
> could be several sort descriptors and the main string one is using a 
> localized and natural numeric comparison. I cache the results and take a lot 
> of care only to resort when needed, but that doesn't help on the first run 
> through which often takes in the order of 10-20 seconds. The interface that 
> displays the results therefore beachballs for this time.
> 
> I'm considering using threads to help, where a thread is used to perform the 
> sort itself, and until the sort has finished the UI can display a busy 
> indicator (indeterminate circular progress indicator) next to the selected 
> row in the table. This is in the master table of a master-detail interface 
> where the detail displays the sorted items selected. While busy the detail 
> view can be blank or show the previous arrangement.
> 
> So my question is, is threading a good solution? While NSMutableArray isn't 
> marked as thread-safe, the array in question can be arranged to not be used 
> outside of the sorting thread, and only substituted for the returned sorted 
> items when complete. Or can array sorting not be done on a thread at all?

This is a sensible solution.  NSMutableArray is safe so long as only one thread 
is accessing it at a time.

However, sorting 2000 items should not take 10-20 seconds!  Have you profiled 
to find out what's actually taking the time?

If a property of the objects has to be massaged into another form before the 
comparison can take place, it can be a performance win to do that massaging 
once for each object before the sort and cache the result.  Otherwise, it may 
end up being performed over and over, each time one object is compared to 
another.  (I wouldn't worry about the localized, numeric comparison of strings, 
though.  I don't think there's a good way to preflight those, and I wouldn't 
think that would be a significant factor in the slowness.  But, of course, 
don't trust my intuition -- measure.)

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

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


Better sorting using threads?

2010-03-10 Thread Graham Cox
I've got a situation where sorting an array using sort descriptors is slow. The 
number of items being sorted is not enormous - about 2,000 - but there could be 
several sort descriptors and the main string one is using a localized and 
natural numeric comparison. I cache the results and take a lot of care only to 
resort when needed, but that doesn't help on the first run through which often 
takes in the order of 10-20 seconds. The interface that displays the results 
therefore beachballs for this time.

I'm considering using threads to help, where a thread is used to perform the 
sort itself, and until the sort has finished the UI can display a busy 
indicator (indeterminate circular progress indicator) next to the selected row 
in the table. This is in the master table of a master-detail interface where 
the detail displays the sorted items selected. While busy the detail view can 
be blank or show the previous arrangement.

So my question is, is threading a good solution? While NSMutableArray isn't 
marked as thread-safe, the array in question can be arranged to not be used 
outside of the sorting thread, and only substituted for the returned sorted 
items when complete. Or can array sorting not be done on a thread at all?

 --Graham


___

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


The Location of the Service Menu

2010-03-10 Thread Steve Cronin
Folks;

I want to provide a service which will open a small HUD for fine-tuning the 
request.
It seems to me that this HUD should open nearby where the context request 
occurred.
I've poked around some and haven't hit anything promising.

As the recipient of the service call  'xyz: userData:error:' how would I best 
determine where the mouse is/was pointing at the time the context menu fired?

Thanks for any thoughts or pointers!
Steve

___

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: Can you obtain the NSRuleEditor localized display?

2010-03-10 Thread John C. Daub
on 3/10/10 6:01 PM, Peter Ammon at pam...@apple.com wrote:

> On Mar 10, 2010, at 11:30 AM, John C. Daub wrote:
> 
>> Can you obtain the localized display of an NSRuleEditor?
>> 
> [...]
> 
>> I can't see any way to extract the actual displayed GUI (post-formatting),
>> other than obtaining the criteria or displayValues myself, obtaining the
>> formattingDictionary myself, and doing all the heavy lifting.
>> 
>> Hoping I may be overlooking something or maybe there's a nice trick I could
>> use. I need to run on 10.5, but if there's a 10.6-and-later-only solution
>> that could be acceptable.
> 
> Sorry, there's no easy way to do this.

That's what I thought. :-(  Bummer.



-- 
John C. Daub }:-)>=
 
"Peace sells... but who's buying?"



___

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: How to debug this error on closing a document?

2010-03-10 Thread Kyle Sluder
On Wed, Mar 10, 2010 at 4:45 PM, Gideon King  wrote:
> Seeing as none of this appears to have anything to do with my code, I am 
> assuming that some notification created somewhere in my application is 
> somehow the cause, but I'm not sure how to track this down.

Run the analyzer first, then if that doesn't turn up any problems use
NSZombieEnabled outside of Instruments.

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

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


Re: Help visualizing something in IB

2010-03-10 Thread Quincey Morris
On Mar 10, 2010, at 15:54, Brian Postow wrote:

> Basically, I want the topView to scroll, but I always want to be able to see 
> the buttonView. So if part of the topView isn't visible because it's been 
> scrolled up, I want the buttonview at the top of the screen.
> 
> I think what I want is to have a sort of topView2 which is the intersection 
> between topView and the contentView of the ScrollView, if that makes more 
> sense...

It makes sense, but it doesn't have much precedent in terms of known Mac 
interfaces. Won't the visual effect be that the buttons appear to float over 
the window content some of the time? But with the weird side effect that the 
image below the buttons will get smaller as you scroll, until ... what? At some 
point does the image view get too small and disappear? When there's not enough 
vertical room to show the whole buttons, do they start scrolling out of the 
window?

It seems awfully ad-hoc, but anyway ...

> In case the backstory helps, I'm writing a plugin for Mozilla. So, the 
> outermost scrollwindow is the firefox "view", and then my plugin is within an 
> HTML frame inside the page, so I'm scrolling around in the firefox window, 
> and whenever my plugin is visible, I want the buttons at the top of it... 

Yeah, that does help a bit.

If you must follow this approach, then I'd suggest you register to get 
frame-changed notifications from topView. That way, you'll know if it moved 
within the window, or if it was resized as a result of the window/enclosing 
view resizing. Also, turn off auto-resizing for subviews of topView.

When you get a notification, examine the geometry of the page, and re-layout 
your subviews appropriately (float the buttons, resize the image, etc). You'll 
then be able to avoid geometry collapse when the visible part of topView gets 
small.

That makes all your subview resizing manual, but it doesn't sound like 
auto-resizing is very useful here anyway.


___

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: Help visualizing something in IB

2010-03-10 Thread Klaus Backert


On 11 Mar 2010, at 00:54, Brian Postow wrote:

Basically, I want the topView to scroll, but I always want to be  
able to see the buttonView. So if part of the topView isn't visible  
because it's been scrolled up, I want the buttonview at the top of  
the screen.


This looks like you just do *not* want to scroll the part with the  
buttons. Wouldn't this lead to having the buttons outside the scroll  
view, and only having the image inside?


All together like this:
A window with a regular content view, having two subviews:
- your button view
- a regular scroll view with your image view as its one and only subview

Klaus

___

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


How to debug this error on closing a document?

2010-03-10 Thread Gideon King
I have a core data based application, and use the NSPersistentDocument's 
-managedObjectContext to get my managed object context. As far as I can see, I 
do not retain or release it anywhere in my code, but apparently it is getting 
over released when I close my document. My test case is to start my 
application, and then close the document.

I ran it in instruments with zombies, and it only shows two events:

#   CategoryEvent Type  RefCt   Timestamp   Address Size
Responsible Library Responsible Caller
0   NSManagedObjectContext  Malloc  1   00:12.552   0x1008d01f0 
240 AppKit  -[NSPersistentDocument managedObjectContext]
1   NSManagedObjectContext  Zombie  -1  00:26.194   0x1008d01f0 
0   Foundation  -[NSConcreteNotification dealloc]

Seeing as none of this appears to have anything to do with my code, I am 
assuming that some notification created somewhere in my application is somehow 
the cause, but I'm not sure how to track this down.

Any suggestions would be very welcome.


Thanks

Gideon



___

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: Can you obtain the NSRuleEditor localized display?

2010-03-10 Thread Peter Ammon

On Mar 10, 2010, at 11:30 AM, John C. Daub wrote:

> 
> Can you obtain the localized display of an NSRuleEditor?
> 
[...]

> I can't see any way to extract the actual displayed GUI (post-formatting),
> other than obtaining the criteria or displayValues myself, obtaining the
> formattingDictionary myself, and doing all the heavy lifting.
> 
> Hoping I may be overlooking something or maybe there's a nice trick I could
> use. I need to run on 10.5, but if there's a 10.6-and-later-only solution
> that could be acceptable.

Sorry, there's no easy way to do 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSPrintPanel

2010-03-10 Thread danchik
Hello,

Is there a way to access/modify information in the print panel while the dialog 
is up?  

Lets say the task is to modify the currently selected paper size based on the 
available sizes when ever the user changes a printer selection.

Is there a way to be notified of events on the PrintPanel (for example when the 
user picks a printer, or changes number of copies ) (while the print dialog box 
is still up)
and, further, once notified that printer has changed, to change something in 
that dialog (selected paper size for example) programatically while that dialog 
is still up?

So code to bring up a panel is :

//
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSPrintPanel *printPanel = [NSPrintPanel printPanel];

int res = [printPanel runModalWithPrintInfo:printInfo];
// will do actuall printing now ...


is there anything I can subclass or become an observer of before calling 
runModalWithPrintInfo?


I also tried with adding accessory pannel, but the only times I would get 
called were from actions on my own panel or when the panel was going away (to 
save the editing chages) but never when the printer or anything else on the 
print panel changed

Thank You
Dan
___

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


[SOLVED] Re: Custom cell wanted

2010-03-10 Thread Graham Cox

On 11/03/2010, at 1:49 AM, jonat...@mugginsoft.com wrote:

> Not sure if this will prove useful or not.
> 
> Regards
> 
> Jonathan Mitchell


Thanks for this, and to everyone who responded, lots of great solutions! Nice 
to wake up to find a little bit of code I need has written itself - well, sort 
of!

--Graham

 ___

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: Help visualizing something in IB

2010-03-10 Thread Brian Postow

On Mar 10, 2010, at 6:36 PM, Quincey Morris wrote:

> On Mar 10, 2010, at 14:58, Brian Postow wrote:
> 
>> Let say I have three views inside a scrollview with some other content. Top, 
>> buttons and image. buttons and image are both inside top. Top does NOT fill 
>> up the scrollview, however, buttons and image DO fill up top. Top has a 
>> maximum size determined at runtime, but it might not all be visible. The 
>> buttons view is above the image view. The buttons view should have a fixed 
>> height, but stretch width wise. The image view should fill up the topview 
>> and stretch in both directions.
>> 
>> The question is what happens when the window with the scrollview resizes, 
>> and when the scrollview scrolls.
>> 
>> I want whenever any part of the topview is visible, for the buttonview to be 
>> at the top of the visible portion of topView, and I want the imageview to 
>> take up whatever space (if any) is available below it. Even if I'm 
>> scrolling, or resizing the outer window. 
> 
> In the terms you have used, this makes no sense to me. You're saying (in 
> effect) that you don't want topView to scroll, but you put it inside a scroll 
> view, so it's going to scroll.
> 
> It sounds a little bit like you want to move topView outside the scroll view, 
> and use the window resizing delegate method to apportion space to topView and 
> the scroll view according to some rules you devise. Or, use topView and the 
> scroll view as the two panes of a split view, and write split view delegate 
> code to handle the resizing.

Basically, I want the topView to scroll, but I always want to be able to see 
the buttonView. So if part of the topView isn't visible because it's been 
scrolled up, I want the buttonview at the top of the screen.

I think what I want is to have a sort of topView2 which is the intersection 
between topView and the contentView of the ScrollView, if that makes more 
sense...

> 
>> I currently have in IB:
>> TopVew doesn't resize at all, locked top and left.
>> ButtonView resizes width but not height and is locked top left
>> ImageView resizes both,and is locked top bottom left. (probably adding right 
>> wouldn't matter)
> 
> If topView doesn't resize at all, its subviews won't auto-resize, regardless 
> of the options you set. Auto-resizing is dependent on the parent view, not on 
> the window. But based on what you say below, topView clearly *is* resizing.

I'm manually resizing the topView as I resize the window.

> 
> It's a known limitation of autoresizing that when the geometry collapses (by 
> resizing the parent too small), you can't recover the original geometry even 
> when you go back to the original size. It's sort of the layout analog to a 
> divide-by-zero error in numerical computations.
> 

Ok, so you're saying that I just lose there. ok.

In case the backstory helps, I'm writing a plugin for Mozilla. So, the 
outermost scrollwindow is the firefox "view", and then my plugin is within an 
HTML frame inside the page, so I'm scrolling around in the firefox window, and 
whenever my plugin is visible, I want the buttons at the top of it... 

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: Help visualizing something in IB

2010-03-10 Thread Quincey Morris
On Mar 10, 2010, at 14:58, Brian Postow wrote:

> Let say I have three views inside a scrollview with some other content. Top, 
> buttons and image. buttons and image are both inside top. Top does NOT fill 
> up the scrollview, however, buttons and image DO fill up top. Top has a 
> maximum size determined at runtime, but it might not all be visible. The 
> buttons view is above the image view. The buttons view should have a fixed 
> height, but stretch width wise. The image view should fill up the topview and 
> stretch in both directions.
> 
> The question is what happens when the window with the scrollview resizes, and 
> when the scrollview scrolls.
> 
> I want whenever any part of the topview is visible, for the buttonview to be 
> at the top of the visible portion of topView, and I want the imageview to 
> take up whatever space (if any) is available below it. Even if I'm scrolling, 
> or resizing the outer window. 

In the terms you have used, this makes no sense to me. You're saying (in 
effect) that you don't want topView to scroll, but you put it inside a scroll 
view, so it's going to scroll.

It sounds a little bit like you want to move topView outside the scroll view, 
and use the window resizing delegate method to apportion space to topView and 
the scroll view according to some rules you devise. Or, use topView and the 
scroll view as the two panes of a split view, and write split view delegate 
code to handle the resizing.

> I currently have in IB:
> TopVew doesn't resize at all, locked top and left.
> ButtonView resizes width but not height and is locked top left
> ImageView resizes both,and is locked top bottom left. (probably adding right 
> wouldn't matter)

If topView doesn't resize at all, its subviews won't auto-resize, regardless of 
the options you set. Auto-resizing is dependent on the parent view, not on the 
window. But based on what you say below, topView clearly *is* resizing.

Also, keep in mind that auto-resizing flows downwards (parent views resize 
their subviews), but not upwards (changes to subviews never automatically 
resize their parents).

> What's happening is that when I scroll, the whole thing just scrolls, so 
> buttonview goes off the top, and when I make the window too small, the 
> imageview covers the buttonview. It then doesn't UNCOVER it when I make the 
> window bigger or scroll or anything.

It's a known limitation of autoresizing that when the geometry collapses (by 
resizing the parent too small), you can't recover the original geometry even 
when you go back to the original size. It's sort of the layout analog to a 
divide-by-zero error in numerical computations.


___

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: Clickable UILabel - iPhone

2010-03-10 Thread Alex Kac
Or just use a UIButton which has a UILabel in it.

On Mar 10, 2010, at 5:30 PM, Henry McGilton wrote:

> 
> On Mar 9, 2010, at 9:25 PM, Sasikumar JP wrote:
> 
>> Hi,
>> I am new to the Cocoa Programming.  I am working on my first iPhone app. I 
>> want to present the data in tableview, there user can click the url or user 
>> name in the text.
>> 
>> I have customized the table view cell and displayed the text in UILabel. Not 
>> sure how to enable the clickable link for the required string( like userName 
>> and url).
>> 
>> Eg:
>> Hello "John", You can download the app from "http://www.apple.com";  
>> 
>> => I want to enable the clickable link for quoted string
>> 
>> I have tried with UITextView. But it enables the link only for URL and Phone 
>> Number. I dont know how to enable the link for userName in the text.
>> 
>> I have seen this feature in some of the twitter 
>> client(Twitterriffic,Echofon), not sure how to implement this.
>> 
>> Your help is highly appreciated 
> 
> 
> A UILabel is a sub-class of UIView.But its userInteractionEnabled 
> property is NO by default.
> So just do [myLabel setUserInteractionEnabled: YES];
> 
>Cheers,
>. . . . . . . .Henry
> 
> 
> ___
> 
> 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/alex%40webis.net
> 
> This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc.

"You cannot build a reputation on what you intend to do." 
-- Liz Smith




___

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: Clickable UILabel - iPhone

2010-03-10 Thread Henry McGilton

On Mar 9, 2010, at 9:25 PM, Sasikumar JP wrote:

> Hi,
>  I am new to the Cocoa Programming.  I am working on my first iPhone app. I 
> want to present the data in tableview, there user can click the url or user 
> name in the text.
> 
> I have customized the table view cell and displayed the text in UILabel. Not 
> sure how to enable the clickable link for the required string( like userName 
> and url).
> 
> Eg:
> Hello "John", You can download the app from "http://www.apple.com";  
> 
> => I want to enable the clickable link for quoted string
> 
> I have tried with UITextView. But it enables the link only for URL and Phone 
> Number. I dont know how to enable the link for userName in the text.
> 
> I have seen this feature in some of the twitter 
> client(Twitterriffic,Echofon), not sure how to implement this.
> 
> Your help is highly appreciated 


A UILabel is a sub-class of UIView.But its userInteractionEnabled property 
is NO by default.
So just do [myLabel setUserInteractionEnabled: YES];

Cheers,
. . . . . . . .Henry


___

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: Possible leak?

2010-03-10 Thread Laurent Daudelin
Ah, that was it! Thanks!

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

On Mar 10, 2010, at 14:24, Thomas Clement wrote:

> Do you call CFRelease() on the returned host object?
> If not, you should.
> 
> Regards,
> Thomas
> 
> On Mar 10, 2010, at 10:56 PM, Laurent Daudelin wrote:
> 
>> I didn't redefine the macro but for support of older OS X versions, I'm 
>> currently using LLVM GCC 4.2. Maybe that's why?
>> 
>> 
>> 
>> 
>> -Laurent.
>> -- 
>> Laurent Daudelin
>> AIM/iChat/Skype:LaurentDaudelin  
>> http://nemesys.dyndns.org
>> Logiciels Nemesys Software   
>> laurent.daude...@gmail.com
>> Photo Gallery Store: 
>> http://laurentdaudelin.shutterbugstorefront.com/g/galleries
>> 
>> On Mar 10, 2010, at 13:17, Ken Ferry wrote:
>> 
>>> File a bug with the static analyzer that it should not do this.  :-)  I'm 
>>> not sure what's wrong here, because clang already knows about assert, 
>>> unless you redefined the macro.
>>> 
>>> See .
>>> 
>>> -Ken
>>> 
>>> On Wed, Mar 10, 2010 at 12:09 PM, Laurent Daudelin 
>>>  wrote:
>>> Just ran the build analyzer on my code and the analyzer flagged this as a 
>>> possible leak:
>>> 
>>>  host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName);
>>>  assert(host != NULL);
>>> 
>>> saying that on the "assert(host != NULL)" line, there was a potential leak 
>>> of the object allocated just above. How would one deal with that?
>>> 
>>> -Laurent.
>>> --
>>> Laurent Daudelin
>>> AIM/iChat/Skype:LaurentDaudelin 
>>> http://nemesys.dyndns.org
>>> Logiciels Nemesys Software  
>>> laurent.daude...@gmail.com
>>> Photo Gallery Store: 
>>> http://laurentdaudelin.shutterbugstorefront.com/g/galleries
>>> 
>>> ___
>>> 
>>> 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/kenferry%40gmail.com
>>> 
>>> This email sent to kenfe...@gmail.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/thomascl%40free.fr
>> 
>> This email sent to thoma...@free.fr
>> 
> 

___

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: Accessing the contextual menu of a QTMovieView?

2010-03-10 Thread Kevin Wojniak
Have you tried subclassing QTMovieView and overriding menuForEvent: ?


On Mar 10, 2010, at 2:29 PM, John C. Randolph wrote:

> I'd like to add an item to the menu that comes up when you right-click on a 
> QTMovieView. I want to copy the URL of the movie it's showing into the 
> pasteboard.  I'm not finding any obvious API to get hold of that menu.  Any 
> suggestions?
> 
> Thanks,
> 
> -jcr
> 
> ___
> 
> 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/kainjow%40kainjow.com
> 
> This email sent to kain...@kainjow.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: UIImageView animationImages problem

2010-03-10 Thread banane
Patrick - I'm so glad you posted this.

I'm writing a game (and have it working!) where the array of
imageviews is different each user choice. It loads the array with
UIImageViews (and does ImageNamed, which I guess I should change...).
the problem with the animation is that it's variable for each user
choice, so from 1 element in the array to 8. The UIImageView animation
has a "duration" parameter that then displays it speeded up or (if the
user choice is 8) slowed down (if the choice is 1). Last night someoen
suggested I do simple imageviews with transitions instead of
animation. Besides getting dirty with CGAnimation, I'm not sure what
my choices are.

Anna

On Wed, Mar 10, 2010 at 10:40 AM, David Duncan  wrote:
> On Mar 10, 2010, at 6:56 AM, patrick machielse wrote:
>
>> - Animate individual parts of the screen by code. Less (or no) code <> 
>> resource separation, labor intensive.
>
>
> There is no need to remove the code/resource separation to do parts of your 
> animation in code. You would build a system that took instructions from a 
> resource file and built the views necessary and applied the animations 
> dictated by the resource. You can build a generic animation system in this 
> manner and potentially save considerable amounts of memory. Granted, doing so 
> is not necessarily a trivial exercise.
> --
> David Duncan
> Apple DTS Animation and Printing
>
> ___
>
> 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/banane%40gmail.com
>
> This email sent to ban...@gmail.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


Group Table View Edit Mode Animation - iPhone

2010-03-10 Thread Sasikumar JP
Hi,
I am working an iPhone app. when my Group Table View enter in to the 
Edit Mode,i want to add few more sections/rows dynamically with the animation. 

In the iPhone Contact application, user data modify screen has feature. when 
this screen enters in to the edit mode, it adds few more sections dynamically 
with animation. 

how to implement this feature. 


Thanks
Sasikumar


___

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


Clickable UILabel - iPhone

2010-03-10 Thread Sasikumar JP
Hi,
  I am new to the Cocoa Programming.  I am working on my first iPhone app. I 
want to present the data in tableview, there user can click the url or user 
name in the text.

I have customized the table view cell and displayed the text in UILabel. Not 
sure how to enable the clickable link for the required string( like userName 
and url).

Eg:
Hello "John", You can download the app from "http://www.apple.com";  

=> I want to enable the clickable link for quoted string

I have tried with UITextView. But it enables the link only for URL and Phone 
Number. I dont know how to enable the link for userName in the text.

I have seen this feature in some of the twitter client(Twitterriffic,Echofon), 
not sure how to implement this.

Your help is highly appreciated 

Thanks
Sasikumar JP___

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


Help visualizing something in IB

2010-03-10 Thread Brian Postow
I'm having trouble visualizing something.

Let say I have three views inside a scrollview with some other content. Top, 
buttons and image. buttons and image are both inside top. Top does NOT fill up 
the scrollview, however, buttons and image DO fill up top. Top has a maximum 
size determined at runtime, but it might not all be visible. The buttons view 
is above the image view. The buttons view should have a fixed height, but 
stretch width wise. The image view should fill up the topview and stretch in 
both directions.

The question is what happens when the window with the scrollview resizes, and 
when the scrollview scrolls.

I want whenever any part of the topview is visible, for the buttonview to be at 
the top of the visible portion of topView, and I want the imageview to take up 
whatever space (if any) is available below it. Even if I'm scrolling, or 
resizing the outer window. 

I currently have in IB:
TopVew doesn't resize at all, locked top and left.
ButtonView resizes width but not height and is locked top left
ImageView resizes both,and is locked top bottom left. (probably adding right 
wouldn't matter)

What's happening is that when I scroll, the whole thing just scrolls, so 
buttonview goes off the top, and when I make the window too small, the 
imageview covers the buttonview. It then doesn't UNCOVER it when I make the 
window bigger or scroll or anything.

Is there something simple that I'm missing here? 

thanks.

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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


Accessing the contextual menu of a QTMovieView?

2010-03-10 Thread John C. Randolph
I'd like to add an item to the menu that comes up when you right-click  
on a QTMovieView. I want to copy the URL of the movie it's showing  
into the pasteboard.  I'm not finding any obvious API to get hold of  
that menu.  Any suggestions?


Thanks,

-jcr

___

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: Possible leak?

2010-03-10 Thread Thomas Clement

Do you call CFRelease() on the returned host object?
If not, you should.

Regards,
Thomas

On Mar 10, 2010, at 10:56 PM, Laurent Daudelin wrote:

I didn't redefine the macro but for support of older OS X versions,  
I'm currently using LLVM GCC 4.2. Maybe that's why?





-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

On Mar 10, 2010, at 13:17, Ken Ferry wrote:

File a bug with the static analyzer that it should not do  
this.  :-)  I'm not sure what's wrong here, because clang already  
knows about assert, unless you redefined the macro.


See .


-Ken

On Wed, Mar 10, 2010 at 12:09 PM, Laurent Daudelin > wrote:
Just ran the build analyzer on my code and the analyzer flagged  
this as a possible leak:


  host = CFHostCreateWithName(kCFAllocatorDefault,  
(CFStringRef)hostName);

  assert(host != NULL);

saying that on the "assert(host != NULL)" line, there was a  
potential leak of the object allocated just above. How would one  
deal with that?


-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys  
Software  laurent.daude...@gmail.com

Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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/kenferry%40gmail.com

This email sent to kenfe...@gmail.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/thomascl%40free.fr

This email sent to thoma...@free.fr



___

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: Possible leak?

2010-03-10 Thread Laurent Daudelin
I didn't redefine the macro but for support of older OS X versions, I'm 
currently using LLVM GCC 4.2. Maybe that's why?




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

On Mar 10, 2010, at 13:17, Ken Ferry wrote:

> File a bug with the static analyzer that it should not do this.  :-)  I'm not 
> sure what's wrong here, because clang already knows about assert, unless you 
> redefined the macro.
> 
> See .
> 
> -Ken
> 
> On Wed, Mar 10, 2010 at 12:09 PM, Laurent Daudelin 
>  wrote:
> Just ran the build analyzer on my code and the analyzer flagged this as a 
> possible leak:
> 
>host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName);
>assert(host != NULL);
> 
> saying that on the "assert(host != NULL)" line, there was a potential leak of 
> the object allocated just above. How would one deal with that?
> 
> -Laurent.
> --
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin 
> http://nemesys.dyndns.org
> Logiciels Nemesys Software  
> laurent.daude...@gmail.com
> Photo Gallery Store: 
> http://laurentdaudelin.shutterbugstorefront.com/g/galleries
> 
> ___
> 
> 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/kenferry%40gmail.com
> 
> This email sent to kenfe...@gmail.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: Possible leak?

2010-03-10 Thread Ken Ferry
File a bug with the static analyzer that it should not do this.  :-)  I'm
not sure what's wrong here, because clang already knows about assert, unless
you redefined the macro.

See .

-Ken

On Wed, Mar 10, 2010 at 12:09 PM, Laurent Daudelin <
laurent.daude...@gmail.com> wrote:

> Just ran the build analyzer on my code and the analyzer flagged this as a
> possible leak:
>
>host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName);
>assert(host != NULL);
>
> saying that on the "assert(host != NULL)" line, there was a potential leak
> of the object allocated just above. How would one deal with that?
>
> -Laurent.
> --
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin
> http://nemesys.dyndns.org
> Logiciels Nemesys Software
> laurent.daude...@gmail.com
> Photo Gallery Store:
> http://laurentdaudelin.shutterbugstorefront.com/g/galleries
>
> ___
>
> 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/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.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: CAKeyframeAnimation and NSView frame property

2010-03-10 Thread David Duncan
On Mar 10, 2010, at 12:35 PM, Mazen M. Abdel-Rahman wrote:

> I had another question about core animation.  I am trying to animate my 
> view's frame size so that it gets smaller - and then in the same animation 
> goes back to the same size.  I was able to get it to succesfully animate to a 
> smaller size - but am having difficulty with getting to work using 
> CAKeyFrameAnimation.  I tried doing it in a group - but when I try to change 
> the alpha value nothing happens to the frame size.  I tried to follow some 
> examples Apple had - but to no avail.  The view that I am calling this code 
> on is layer backed (set in interface builder).


The frame is not real, it is a property derived from the position, bounds.size, 
transform and anchorPoint properties. If you want to animate the "frame" of a 
layer, then you need to animate the position and bounds.size instead.
--
David Duncan
Apple DTS Animation and Printing

___

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 bounds of a glyph

2010-03-10 Thread Philip White

On Mar 10, 2010, at 12:42 PM, David wrote:

> Phillip -- Have you made any progress on this?  I am trying to draw glyphs 
> onto an NSBitmapImageRep using drawGlyphsForGlyphRange:atPoint: and having 
> similar problems.  In my case the symptoms are that underline and 
> strikethrough are not being drawn correctly.
> 
> Right now, my guess is that some component of the text system is confused 
> about where the baseline should be.  That's the angle I am pursuing right now.
> 
> David


Hi David,
I gave up using the drawGlyphsForGlyphRange: method as I just couldn't 
figure why it was drawing the glyphs were it was. I'm getting decent results 
now using NSBezierPath's appendBezierPathWithGlyph:inFont:. I set up the text 
system as though I were going to use NSLayoutManager to draw it. I use 
boundingRectForGlyphRange: to help size my font to fit the image width I want 
and then use glyphAtIndex: to get the glyph I want to draw.

If you decide to go this route you could add the underline and 
strikethrough manually to the bezier path without much difficulty.

I use the ascender and descender font metrics to determine where to 
start drawing the bezier path relative to image origin. You could also use 
these metrics to determine where to draw your marks.

-Philip
___

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


CAKeyframeAnimation and NSView frame property

2010-03-10 Thread Mazen M. Abdel-Rahman
Hi All,

I had another question about core animation.  I am trying to animate my view's 
frame size so that it gets smaller - and then in the same animation goes back 
to the same size.  I was able to get it to succesfully animate to a smaller 
size - but am having difficulty with getting to work using CAKeyFrameAnimation. 
 I tried doing it in a group - but when I try to change the alpha value nothing 
happens to the frame size.  I tried to follow some examples Apple had - but to 
no avail.  The view that I am calling this code on is layer backed (set in 
interface builder).

Thanks,
Mazen Abdel-Rahman

Below is my code:

NSRect newFrame = [[subViewController view] frame];
NSRect oldFrame = [[subViewController view] frame];

newFrame.size.width = newFrame.size.width - 30;

[NSAnimationContext beginGrouping];

CAKeyframeAnimation * anim = [CAKeyframeAnimation animation];

[anim setKeyPath:@"frame"];

NSArray * frameValues = [NSArray arrayWithObjects:
[NSValue 
valueWithRect:oldFrame],
[NSValue 
valueWithRect:newFrame],
[NSValue 
valueWithRect:oldFrame], nil];

[anim setValues:frameValues];

NSArray * times = [NSArray arrayWithObjects:
   [NSNumber numberWithFloat:0.0f],
   [NSNumber numberWithFloat:0.8f],
   [NSNumber numberWithFloat:1.0f],nil];

[anim setKeyTimes:times];

CABasicAnimation *alphaAnim = [CABasicAnimation 
animationWithKeyPath:@"alphaValue"];
[alphaAnim setFromValue:[NSNumber numberWithFloat:0.0f]];
[alphaAnim setToValue:[NSNumber numberWithFloat:1.0f]];

CAAnimationGroup * group= [CAAnimationGroup animation];
[group setAnimations:[NSArray arrayWithObjects:anim,alphaAnim,nil]];


NSDictionary * dict = [NSDictionary dictionaryWithObject:group 
forKey:@"alphaValue"];

[[subViewController view] setAnimations:dict];

[[[subViewController view]animator] setAlphaValue:1.0];

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

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


Possible leak?

2010-03-10 Thread Laurent Daudelin
Just ran the build analyzer on my code and the analyzer flagged this as a 
possible leak:

host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName);
assert(host != NULL);

saying that on the "assert(host != NULL)" line, there was a potential leak of 
the object allocated just above. How would one deal with that?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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: NSScroller and Periodic Events

2010-03-10 Thread Kyle Sluder
On Wed, Mar 10, 2010 at 11:20 AM, Abhinay Kartik Reddyreddy
 wrote:
> In case i should not use periodic events, how is an idle time task handled in 
> cocoa...?? In carbon i would say WaitNextEvent and if the return was null i 
> would perform my idle time task. Is there any design pattern for idle 
> time tasks??

The typical answer is "don't use them." Use a background thread or a
runloop source instead.

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

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


Can you obtain the NSRuleEditor localized display?

2010-03-10 Thread John C. Daub

Can you obtain the localized display of an NSRuleEditor?

I have an NSRuleEditor displaying my rule setup. The app has functionality
where it provides a text summary of the search rules that generated the
results. When I call -[NSRuleEditor displayValuesForRow:], that returns the
actual display value objects, which is expected. Of course, NSRuleEditor has
magical voodoo where if you set a -formattingDictionary those displayValues
will be magically translated according to the -formattingDictionary when the
values are displayed in the GUI. I have set a formatting dictionary on my
NSRuleEditor, and in the GUI presentation of things everything looks right
as as I'd expect.

What I'm wanting is to obtain the magically formatted values the GUI is
actually displaying, so when the app is running in English my summary string
is "name contains foo", and when the app is running in Japanese I get "お名前
は「foo」が入っている" ("name foo contains").

I can't see any way to extract the actual displayed GUI (post-formatting),
other than obtaining the criteria or displayValues myself, obtaining the
formattingDictionary myself, and doing all the heavy lifting.

Hoping I may be overlooking something or maybe there's a nice trick I could
use. I need to run on 10.5, but if there's a 10.6-and-later-only solution
that could be acceptable.

Thank you.

-- 
John C. Daub }:-)>=
 
"We live thinking we will never die. We die thinking we had never lived.
Cut it out." -- Jason Becker



___

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


NSScroller and Periodic Events

2010-03-10 Thread Abhinay Kartik Reddyreddy
Hi all,

I have an application which uses periodic events to do some computation. The 
app works fine as long as i dont use a scrollbar. the moment i click a 
scrollbar it raises exception. The scroller is trying to start periodic events 
inside [NSScroller trackScrollButtons:]. since the app has already started 
periodic events, the scroller complains... Is there a workqround for this or i 
should refrain from using periodic events.??

In case i should not use periodic events, how is an idle time task handled in 
cocoa...?? In carbon i would say WaitNextEvent and if the return was null i 
would perform my idle time task. Is there any design pattern for idle time 
tasks??

Thanks,
Abhinay.___

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: Proper control for a list of actions

2010-03-10 Thread Dave DeLong
OK, following up:

I've spent a couple days playing with NSRuleEditor, and I've found some stuff 
out:

It appears to only be useful for a static tree of information (unless I 
dynamically modify the tree as rows are added and removed).  I've come to this 
conclusion based on my tests, due primarily to this observation:

I created a node-style class to represent the possible *options* of the editor 
(not the final tree).  One of these options presented an NSTokenField.  I found 
that if I added a row to the rule editor that displays the tokenfield, and then 
add a second row (also with a tokenfield), the tokenfield from the first row 
disappears and jumps to the second row.

I understand why this is happening: the rule editor was using the same node 
object for both rows, which isn't how NSPredicateEditor behaves.  
NSPredicateEditor uses row templates, and then duplicates the template it needs 
for a particular row.  I'm looking for the same sort of behavior, except I 
don't want it for predicates.

I suppose I could create a whole bunch of NSPredicateEditorRowTemplate 
subclasses for each possible action (which is fine with me) and use a predicate 
editor, but how could I get around the (apparent) NSExpression dependency?  
Some of my actions are just single items (like "Stop evaluating rules"), that 
don't have a left or right expression.  Some may have more than one expression 
(like an "Other..." option that when selected, displays a textfield).

And suggestions on how to proceed?

Thanks,

Dave

On Mar 8, 2010, at 12:12 PM, Dave DeLong wrote:

> Hi everyone,
> 
> I'm recreating a rules interface (ie, under these conditions, perform those 
> actions).  I have an NSPredicateEditor in place for the conditions portion, 
> and it's working great.  However, I'm wondering what would be most 
> appropriate to use for the actions area.
> 
> My initial reaction would be "NSRuleEditor", except I'm not sure how I'd 
> integrate it.  The documentation for NSRuleEditor is full of stuff about 
> criteria and whatnot, and I'm not really sure how that applies.  If I could 
> get it to work, I think NSRuleEditor would be the best option because of the 
> visual consistency between it and the predicate editor.
> 
> My next reaction would be to use an NSPredicateEditor, but disallow compound 
> predicates (except for the initial "AND").   I'm familiar with 
> NSPredicateEditor, so this (I think) would be the "easiest" option.  It also 
> (obviously) has the advantage of visual consistency with the other predicate 
> editor.
> 
> I then thought I could build one using an NSTableView, but that seems overly 
> complex and overkill, and it wouldn't necessarily be visually consistent with 
> the predicate editor (without some serious graphics work).
> 
> So:  Is NSRuleEditor the thing to use?  If so, how?
> 
> Thanks,
> 
> Dave


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

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

Re: Determining bounds of a glyph

2010-03-10 Thread David
Phillip -- Have you made any progress on this?  I am trying to draw  
glyphs onto an NSBitmapImageRep using drawGlyphsForGlyphRange:atPoint:  
and having similar problems.  In my case the symptoms are that  
underline and strikethrough are not being drawn correctly.


Right now, my guess is that some component of the text system is  
confused about where the baseline should be.  That's the angle I am  
pursuing right now.


David

On Mar 8, 2010, at 9:12 PM, Philip White wrote:

Sorry, that's not a very good subject title. Here's what I'm giving  
myself a headache trying to do:


For a fixed-pitch font I want to generate images of various glyphs  
for use in OpenGL. I may be generating large numbers of such images  
so I don't want to use the NSString/NSAttributedString convenience  
drawing methods. I want each image to have the same dimensions and  
have the glyphs correctly positioned in them such that if I draw the  
images immediately next to each other they will be correctly laid out.


Here's some of what I've tried.
I figure the image size needs to have the proportions (in terms of  
the font)
	width = maximum advancement (which should be the same advancement  
for all glyphs)

height = font ascender + absolute value of font descender

I'm not interested in laying out more than one line so I figure I  
needn't concern myself with the leading.


My first problem is that for a given image size with the above  
proportions, I'm not sure how to exactly size the font correctly. I  
tried using the following, starting with a font size I know to be  
smaller than I want:


	//set the textStorage to a test string. Fonts we are using are  
fixed width so it doesn't matter what
	[textStorage addAttribute:NSFontAttributeName value:font  
range:NSMakeRange(0,[textStorage length])];
	[textStorage replaceCharactersInRange:NSMakeRange(0,[textStorage  
length]) withString:@"w"];


	NSRect bounds = [layoutManager boundingRectForGlyphRange: 
[layoutManager glyphRangeForTextContainer:textContainer]


 inTextContainer:textContainer];
float multiplier = imageWidth/bounds.size.width;

	font = [[NSFontManager sharedFontManager] convertFont:font toSize: 
[font pointSize]*multiplier];
	[textStorage addAttribute:NSFontAttributeName value:font  
range:NSMakeRange(0,[textStorage length])];


However, when I draw the glyph with Courier as the font, it doesn't  
fit vertically, though it looks sized correctly horizontally. When I  
draw it with Monaco, there seems to be excess vertical space, though  
maybe Monaco has an especially tall glyph that I don't know about.


My next problem is how to draw it correctly. I'm having the best  
luck drawing the glyph with an NSBezierPath but that seems  
unnecessary to me. With NSBezierPath I start by positioning using  
the moveTo: method, setting the location to (0,  
imageHeight*abs(descender)/(ascender+abs(descender)), then getting  
the glyph from the layout manager and adding that to the path. This  
seems to position glyphs pretty consistently.


However, if I used NSLayoutManager's  
drawGlyphsForGlyphRange:atPoint: using the point (0,0), the vertical  
placement of the glyphs is all crazy, way up high out mainly out of  
the image. I figure that the leading is shifting it up but sending  
the "leading" message to an NSFont representing courier reports a  
leading of zero, so why the shift there?. Also, Courier and Monaco  
are positioned on very different baselines using this method.


Sorry that was so long. What metrics am I missing here? What don't I  
understand about how the layout manager positions glyphs vertically  
relative to the point you give it? And how do I correctly size my  
image to contain the glyph?


Oh man, I've got to stop working on this now, I'm going to have  
glyph nightmares tonight…


Many thanks,
 Philip White

P.S. I'm doing all of my drawing into an  
NSBitmapImageRep___


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/_david_%40gmx.com

This email sent to _dav...@gmx.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: UIImageView animationImages problem

2010-03-10 Thread David Duncan
On Mar 10, 2010, at 6:56 AM, patrick machielse wrote:

> - Animate individual parts of the screen by code. Less (or no) code <> 
> resource separation, labor intensive.


There is no need to remove the code/resource separation to do parts of your 
animation in code. You would build a system that took instructions from a 
resource file and built the views necessary and applied the animations dictated 
by the resource. You can build a generic animation system in this manner and 
potentially save considerable amounts of memory. Granted, doing so is not 
necessarily a trivial exercise.
--
David Duncan
Apple DTS Animation and Printing

___

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: Custom cell wanted

2010-03-10 Thread Keith Blount
Apologies all for the mis-titled e-mail. Resending for the sake of the archives.
---

This is the relevant part of my cell subclass:

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if(hasCount)
{
NSString * number = [NSString stringWithFormat:@"%i", count];
// Use the current font point size as a guide for the count font size
CGFloat pointSize = [[self font] pointSize];
// Create attributes for drawing the count.
NSDictionary* attributes = [[NSDictionaryalloc] 
initWithObjectsAndKeys:[NSFontnonNilFontWithName:@"Helvetica-Bold"size:pointSize],
 NSFontAttributeName,
 (countTextColor!= nil? countTextColor: [NSColorwhiteColor]), 
NSForegroundColorAttributeName,
 nil];
NSSize numSize = [number sizeWithAttributes:attributes];
// Compute the dimensions of the count rectangle.
NSInteger cellWidth = MAX(numSize.width + 6, 20.0);
NSRect countFrame;
CGFloat rightPadding = 5.0;
NSDivideRect(cellFrame, &countFrame, &cellFrame, cellWidth+rightPadding, 
NSMaxXEdge);
countFrame.size.width -= rightPadding;
if([selfdrawsBackground])
{
[[selfbackgroundColor] set];
NSRectFill(cellFrame);
}
countFrame.origin.y += 1;
countFrame.size.height -= 2;
CGFloat radius = numSize.height / 2;
NSBezierPath * roundedRect = [NSBezierPath bezierPathWithRoundedRect:countFrame 
cornerRadius:radius];
[(countBackgroundColor!= nil? countBackgroundColor: [NSColorgrayColor]) set];
[roundedRect fill];
// Draw the count in the rounded rectangle we just created.
//NSPoint point = NSMakePoint(NSMidX(countFrame) - numSize.width / 2.0f,  
NSMidY(countFrame) - numSize.height / 2.0f );
NSPoint point = NSMakePoint(countFrame.origin.x + 
(countFrame.size.width-numSize.width)/2.0,
countFrame.origin.y + (countFrame.size.height-numSize.height)/2.0);
[number drawAtPoint:point withAttributes:attributes];
[attributes release];
}

[superdrawInteriorWithFrame:cellFrame inView:controlView];
}


Note the NSBezierPath method is from Andreas Meyer's category because I support 
10.4, so could be replaced with the equivalent 10.5 AppKit method. The 
accessors it uses (hasCount, count etc) should all be fairly straightforward, 
and nonNilFontForFont: just returns the system or user font if the font passed 
in is nil. (I would have included the whole class but it's long and does a lot 
more than you need, including handling centring vertically, drawing icons and 
labels and so on.)

I set the countBackgroundColor in -willDisplayCell depending on whether the 
outline has the focus or not. I set it to [NSColor 
colorWithCalibratedWhite:0.604 alpha:1.0] if the outline view doesn't have the 
focus or [NSColor colorWithCalibratedRed:0.51 green:0.592 blue:0.741 alpha:1.0] 
if it does (which closely matches the colour in Mail).

All the best,
Keith

-

Message: 13
Date: Thu, 11 Mar 2010 01:35:34 +1100
From: Graham Cox 
Subject: Custom cell wanted
To: Cocoa-Dev List 
Message-ID: 
Content-Type: text/plain; charset=us-ascii

Hi,

I need a custom cell for a table/outline view that is exactly like Mail's 
'unread' count - the grey lozenge with a number in it. It's probably only a few 
hours work but maybe someone has already done it and would be willing to share?

--Graham


  
___

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: Cocoa-dev Digest, Vol 7, Issue 287

2010-03-10 Thread Keith Blount
This is the relevant part of my cell subclass:

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if(hasCount)
{
NSString * number = [NSString stringWithFormat:@"%i", count];
// Use the current font point size as a guide for the count font size
CGFloat pointSize = [[self font] pointSize];
// Create attributes for drawing the count.
NSDictionary* attributes = [[NSDictionaryalloc] 
initWithObjectsAndKeys:[NSFontnonNilFontWithName:@"Helvetica-Bold"size:pointSize],
 NSFontAttributeName,
 (countTextColor!= nil? countTextColor: [NSColorwhiteColor]), 
NSForegroundColorAttributeName,
 nil];
NSSize numSize = [number sizeWithAttributes:attributes];
// Compute the dimensions of the count rectangle.
NSInteger cellWidth = MAX(numSize.width + 6, 20.0);
NSRect countFrame;
CGFloat rightPadding = 5.0;
NSDivideRect(cellFrame, &countFrame, &cellFrame, cellWidth+rightPadding, 
NSMaxXEdge);
countFrame.size.width -= rightPadding;
if([selfdrawsBackground])
{
[[selfbackgroundColor] set];
NSRectFill(cellFrame);
}
countFrame.origin.y += 1;
countFrame.size.height -= 2;
CGFloat radius = numSize.height / 2;
NSBezierPath * roundedRect = [NSBezierPath bezierPathWithRoundedRect:countFrame 
cornerRadius:radius];
[(countBackgroundColor!= nil? countBackgroundColor: [NSColorgrayColor]) set];
[roundedRect fill];
// Draw the count in the rounded rectangle we just created.
//NSPoint point = NSMakePoint(NSMidX(countFrame) - numSize.width / 2.0f,  
NSMidY(countFrame) - numSize.height / 2.0f );
NSPoint point = NSMakePoint(countFrame.origin.x + 
(countFrame.size.width-numSize.width)/2.0,
countFrame.origin.y + (countFrame.size.height-numSize.height)/2.0);
[number drawAtPoint:point withAttributes:attributes];
[attributes release];
}

[superdrawInteriorWithFrame:cellFrame inView:controlView];
}


Note the NSBezierPath method is from Andreas Meyer's category because I support 
10.4, so could be replaced with the equivalent 10.5 AppKit method. The 
accessors it uses (hasCount, count etc) should all be fairly straightforward, 
and nonNilFontForFont: just returns the system or user font if the font passed 
in is nil. (I would have included the whole class but it's long and does a lot 
more than you need, including handling centring vertically, drawing icons and 
labels and so on.)

I set the countBackgroundColor in -willDisplayCell depending on whether the 
outline has the focus or not. I set it to [NSColor 
colorWithCalibratedWhite:0.604 alpha:1.0] if the outline view doesn't have the 
focus or [NSColor colorWithCalibratedRed:0.51 green:0.592 blue:0.741 alpha:1.0] 
if it does (which closely matches the colour in Mail).

All the best,
Keith

-

Message: 13
Date: Thu, 11 Mar 2010 01:35:34 +1100
From: Graham Cox 
Subject: Custom cell wanted
To: Cocoa-Dev List 
Message-ID: 
Content-Type: text/plain; charset=us-ascii

Hi,

I need a custom cell for a table/outline view that is exactly like Mail's 
'unread' count - the grey lozenge with a number in it. It's probably only a few 
hours work but maybe someone has already done it and would be willing to share?

--Graham


  
___

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


Core Animation vs. Basic Cocoa Graphics

2010-03-10 Thread Mazen M. Abdel-Rahman
Hi All,

I was able to write a simple calendar view that uses basic cocoa graphics to 
draw directly on the view (NSBezierPath, etc.).  I actually use several 
different paths for drawing the calendar (it's a weekly calendar) to allow 
different horizontal line widths (hour, half hour, etc.).  The calendar view is 
inside a scroll view - and is actually about 3 times longer than the view 
window.   The main problem is that the scrolling is not smooth - and my 
assumption is that it's because the NSBezier stroke functions  have to be 
constantly called to render the calendar.

For something as relatively simple as this would moving to core animation - 
i.e. trying to render the calendar on a layer instead (I am still trying to 
learn core animation) add performance benefits?  And would it allow for 
smoother scrolling?

Thanks,
Mazen Abdel-Rahman
___

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: How to get NSPathControl to resize programatically? (Solved..)

2010-03-10 Thread Robert Monaghan
I figured out how to get the NSPathControl to "resize" after changing an 
NSPathComponentCell URL.
I realize that the description I gave is vague, so here is a better 
explanation..

I am changing the URL of a NSPathComponent in the middle of NSPathControl's 
overall URL.
By making the change, I was hoping that the imagery would adjust itself after I 
made the change.
This turned out to not be the case.

Here is what I discovered:

NSPathComponentCell contains its "fragment" of the path. If you have a path 
like:
/Users/myhome/Movies/Summer/MyMovie.mov
and you want to change "Summer" to "Winter", you would find the NSComponentCell 
and make the URL change.
(ie: /Users/myhome/Movies/Summer becomes /Users/myhome/Movies/Winter)
The problem is that NSPathControl still sees the original path with "Summer".

I found that I had to iterate through the rest of the NSPathComponentCells in 
NSPathControl, and update each of the subsequent NSComponentCell objects with 
the new URL fragments.
I then took the last URL fragment, and then updated NSPathControl with the 
newly changed URL.

That no only re-drew the artwork, but also correctly updated the URL path in 
NSPathControl.

A lot of work, but thats what it took.

bob..


On Mar 9, 2010, at 12:57 PM, Robert Monaghan wrote:

> Yeah, I did.. that didn't work either.
> Tried:
> [myPathControl sizeToFit];
> 
> bob.
> 
> On Mar 9, 2010, at 12:33 PM, Sean McBride wrote:
> 
>> On Tue, 9 Mar 2010 12:26:14 -0800, Robert Monaghan said:
>> 
>>> I am changing the NSURL of a path, that drives NSPathControl.
>>> If I edit the path so that the new text element of that path is longer
>>> or shorter than the original path,
>>> I would need to have NSPathControl redraw itself..
>> 
>> Did you try "sizeToFit"?
>> 
>> -- 
>> 
>> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/bob%40gluetools.com
> 
> This email sent to b...@gluetools.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: Custom cell wanted

2010-03-10 Thread Dave DeLong
Alex Rozanski's PXSourceList has them:  http://github.com/Perspx/PXSourceList

There was one here: http://th30z.netsons.org/2008/12/cocoa-sidebar-with-badges/ 
but the website appears to be having issues.  Maybe it'll be back a bit later.  
:)

Cheers,

Dave DeLong

On Mar 10, 2010, at 7:35 AM, Graham Cox wrote:

> Hi,
> 
> I need a custom cell for a table/outline view that is exactly like Mail's 
> 'unread' count - the grey lozenge with a number in it. It's probably only a 
> few hours work but maybe someone has already done it and would be willing to 
> share?
> 
> --Graham


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

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

Re: UIImageView animationImages problem

2010-03-10 Thread patrick machielse
Op 9 mrt 2010, om 21:21 heeft David Duncan het volgende geschreven:

> In part this is decoding the image (if they haven't been previously decoded). 
> Are you using +imageNamed: or +imageWithContentsOfFile: to load the images?

I'm using imageWithContentsOfFile:. Mainly this is because I need to manage a 
fair number of images, and the search algorithm used by imageNamed: won't work 
with the way my resources are organized inside the main bundle. 

>> Is there a better solution to get animationImages to work reliably? Am I 
>> doing something wrong? Can I force loading of my UIImage array 'by hand'?
> 
> If you can spare the memory, you might just use +imageNamed: instead. Overall 
> however, I generally recommend against using animationImages for fullscreen 
> animations as the memory requirements grow rather quickly. I would generally 
> recommend that you break your animations down into constituent pieces and do 
> the animation in a combination of cycling images and code to move the views 
> presenting the animation.

That's just going to be too labor intensive I'm afraid. It would mean I'd have 
to work in close coordination with the artist who is creating the animations. 
And if we later want to add (sell) more animations, there would be more coding 
required, instead of just packaging up resources. To give an impression: 
initially I will need to add ~ 30 animations.

As far as I can see, there would be three methods of displaying animations:

- Run a movie file inside a view. Easiest but not possible at the moment.
- Use frames in .animationImages. Not memory efficient, no audio, fiddly about 
preloading images.
- Animate individual parts of the screen by code. Less (or no) code <> resource 
separation, labor intensive.

I think I'll have to make do with animationImages for now.

patrick___

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: Custom cell wanted

2010-03-10 Thread jonat...@mugginsoft.com

On 10 Mar 2010, at 14:35, Graham Cox wrote:

> Hi,
> 
> I need a custom cell for a table/outline view that is exactly like Mail's 
> 'unread' count - the grey lozenge with a number in it. It's probably only a 
> few hours work but maybe someone has already done it and would be willing to 
> share?
> 
Graham

Not sure if this will prove useful or not.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com

//
//  MGSCapsuleTextCell.h
// 
//
//  Created by Jonathan on 21/06/2008.
//  Copyright 2008 Mugginsoft. All rights reserved.
//

#import 


@interface MGSCapsuleTextCell : NSTextFieldCell {
BOOL _capsuleHasShadow;
BOOL _sizeCapsuleToFit;
}

@property BOOL capsuleHasShadow;
@property BOOL sizeCapsuleToFit;
@end

//
//  MGSCapsuleTextCell.m
// 
//
//  Created by Jonathan on 21/06/2008.
//  Copyright 2008 Mugginsoft. All rights reserved.
//

#import "MGSCapsuleTextCell.h"
//#import "MGSImageAndTextCell.h"

#define kMinCapsuleWidth 20

@implementation MGSCapsuleTextCell

@synthesize capsuleHasShadow = _capsuleHasShadow;
@synthesize sizeCapsuleToFit = _sizeCapsuleToFit;

/*

init

*/
- (id)init
{
if ((self = [super init])) {
_capsuleHasShadow = NO; 
_sizeCapsuleToFit = NO;
}
return self;
}
/*

init with coder

*/
- (id)initWithCoder:(NSCoder *)decoder
{
self = [super initWithCoder:decoder];
if (self) {
_capsuleHasShadow = NO; 
_sizeCapsuleToFit = YES;
}
return self;
}

// 
---
//  drawWithFrame:inView:
// 
---
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{   

#pragma unused(controlView)

NSString *stringValue = [self stringValue];

// Use the current font point size as a guide for the count font size
float pointSize = [[self font] pointSize];
NSColor *fontColor = [self textColor];
NSColor *capsuleColor = [self backgroundColor];

// Create attributes for drawing the string.
/*NSDictionary * attributes = [[NSDictionary alloc] 
initWithObjectsAndKeys:[NSFont boldSystemFontOfSize:pointSize],
 
NSFontAttributeName,
 fontColor,
 
NSForegroundColorAttributeName,
 nil];*/
NSDictionary * attributes = [[NSDictionary alloc] 
initWithObjectsAndKeys:[NSFont fontWithName:@"Helvetica-Bold" size:pointSize],
 
NSFontAttributeName,
 fontColor,
 
NSForegroundColorAttributeName,
 nil];
NSSize stringSize = [stringValue sizeWithAttributes:attributes];

// Compute the dimensions of the capsule rectangle.
int cellWidth = cellFrame.size.width;
if (_sizeCapsuleToFit) {
cellWidth = MAX(stringSize.width + 6, stringSize.height + 1) + 
1;
}

if (cellWidth < kMinCapsuleWidth) {
cellWidth = kMinCapsuleWidth;
}

NSRect capsuleFrame;

// frame centre x
CGFloat centreX = cellFrame.origin.x + cellFrame.size.width/2;

// align left or right
NSTextAlignment alignment = [self alignment];
if (alignment == NSRightTextAlignment) {
NSDivideRect(cellFrame, &capsuleFrame, &cellFrame, cellWidth + 
4, NSMaxXEdge);
} else {
NSDivideRect(cellFrame, &capsuleFrame, &cellFrame, cellWidth + 
4, NSMinXEdge);
}

// align centre
if ([self alignment] == NSCenterTextAlignment) {
capsuleFrame.origin.x = centreX - capsuleFrame.size.width/2;
}

CGFloat heightDelta = capsuleFrame.size.height - stringSize.height - 2;
capsuleFrame.size.height =  stringSize.height + 2;
capsuleFrame.origin.y += heightDelta/2;

if ([self drawsBackground])
{
[[self backgroundColor] set];
NSRectFill(capsuleFrame);
}


// if the  capsule is not full size there is insufficient room to 
display it properly.
// so don't.
if (capsuleFrame.size.width >= kMinCapsuleWidth) {

if (_capsuleHasShadow) {
// prepare to receive shadow
[[NSGraphicsContext currentContext] saveGraphicsState];

 

Custom cell wanted

2010-03-10 Thread Graham Cox
Hi,

I need a custom cell for a table/outline view that is exactly like Mail's 
'unread' count - the grey lozenge with a number in it. It's probably only a few 
hours work but maybe someone has already done it and would be willing to share?

--Graham___

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: Uninitialized rectangle??

2010-03-10 Thread fabian
For the records: the dummy view did the trick. Thank you!

F.

On Thu, Mar 4, 2010 at 11:24 PM, fabian  wrote:

> On Thu, Mar 4, 2010 at 8:10 PM, Steven Degutis 
> wrote:
>
>> NSStatusItem's -view and -setView: methods are related to your own custom
>> view, and have nothing to do with the view it internally uses. Thus, it
>> initially has no view until you give it one. So, giving it a dummy view via
>> [statusItem setView: [[[NSView alloc] init] autorelease] ] is going to allow
>> you to access that view's -window and thus the -frame of the NSWindow. Keep
>> in mind though that this is a hack, and also usually very unnecessary and
>> bad and against the HIG in the first place.
>>
>> -Steven
>>
>
> Well, I'm kind of desperate, so I'll give it a try. And file a radar.
> Thanks.
>
> F.
>
>
> On Thu, Mar 4, 2010 at 2:01 PM, fabian  wrote:
>
>> On Thu, Mar 4, 2010 at 7:47 PM, Steven Degutis 
>> wrote:
>>
>>> Right. Have you tried the solution I proposed in the /very first reply/
>>> to this thread?
>>>
>>> -Steven
>>>
>>>
>> Actually, no. I don't have 10.5.8, so I would have to send it to one of
>> the end-users to try, and I feel hesitant to bother a customer without
>> having a clue _why_ the changes made to the code would make any difference.
>> I did send you a reply, though, asking why you think feeding a dummy view to
>> the status item would give better results. I'm not questioning your
>> suggestion, I'd just like to hear the arguments for it before proceeding.
>>
>>
>>>
>>> On Thu, Mar 4, 2010 at 1:05 PM, fabian  wrote:
>>>
 On Thu, Mar 4, 2010 at 6:50 PM, Steven Degutis <
 steven.degu...@gmail.com> wrote:

> Are you sure that your NSStatusBar or NSStatusItem instances are nil,
> and not just what's returned from -view? I see no reason that it should be
> nil, and no proof that it is. (To be fair, I only skimmed this mess of a
> thread.)
>
> -Steven
>

 No, I'm not. It just boiled down to this assumption along the way
 somehow. Perhaps to make the thread less messy :)

 But you are absolutely right: all I know for sure is that whatever is
 returned from [view frame] is causing the "unitialized rectangle" assertion
 failure.



>  On Thu, Mar 4, 2010 at 12:05 PM, fabian wrote:
>
>>  On Thu, Mar 4, 2010 at 5:28 PM, Jens Alfke 
>> wrote:
>>
>> >
>> > On Mar 4, 2010, at 12:42 AM, fabian wrote:
>> >
>> > > Right. But why should it matter? The system status bar is not in
>> the nib.
>> > Just curious about what is going on behind the scenes...
>> >
>> > The status bar is in the menu bar, and the menu bar is in the same
>> nib as
>> > your app controller. The status bar probably initializes itself in
>> an
>> > -awakeFromNib method. Whether that method runs before or after your
>> > -awakeFromNib method is completely unpredictable.
>> >
>> > > I can see why it's a bad thing in theory, but I haven't had any
>> problems
>> > with this approach.
>> >
>> > Are you prepared to have your app crash and burn on launch for every
>> user
>> > that installs some upcoming OS revision (perhaps even a minor
>> update)? I'm
>> > serious; this happens. Doing things that shouldn't work, just
>> because they
>> > do work at the moment, is asking for trouble since the underlying
>> behavior
>> > of the system frameworks can change in the future.
>> >
>> > (This is especially painful if you're not on the expen$ive Apple
>> developer
>> > plans that get you access to OS betas, because that means you won't
>> get a
>> > chance to find any of these crashes before your customers do.
>> Instead you
>> > find yourself frantically debugging on the day the new OS comes out,
>> while
>> > your mailbox fills up with crash reports and complaints.)
>> >
>> > > Anyway, back to subject. Perhaps a better approach than using
>> timers,
>> > guesswork and voodoo, would be to check the validity of the frame
>> rect and,
>> > if it's zero or garbage, make my own rectangle.
>> >
>> > Um, no. Check whether the status bar is nil before you ask for its
>> frame,
>> > instead of working around the aftermath of calling a struct accessor
>> on nil.
>> > But doing this is still a hack, for the reason I described above.
>> It's
>> > pretty clear that you shouldn't be doing anything with NSStatusBar
>> in an
>> > -awakeFromNib method in the main nib.
>> >
>> > —Jens
>>
>>
>> But this is not in -awakeFromNib. That's the whole problem :)
>>
>> It's in -applicationDidFinishLaunching. Which works great on all
>> systems (as
>> far as I know), except for on 10.5.8 where NSStatusBar is still nil at
>> this
>> point. That's what I'm trying to find a work-around for.
>> _

Required overrides for NSAtomicStore subclass

2010-03-10 Thread Gideon King
In the documentation, it says that I have to override:

type
identifier
setIdentifier
metadata
metadataForPersistentStoreWithURL:error:
setMetadata:forPersistentStoreWithURL:error:

from NSPersistentStore in addition to the overrides for NSAtomicStore, but the 
CustomAtomicStoreSubclass example doesn't implement the metadata method at all, 
and the documentation says that the NSPersistentStore provides a default 
implementation of identifier.

So I have some questions:

1. Do I actually need to override identifier and setIdentifier in my subclass, 
or is it OK for me to just rely on the default implementation I inherit from 
NSPersistentStore? From the documentation, it sounds as if the default 
implementation would be sufficient.

2. Do I actually need to override the metadata method, given the fact that the 
example code doesn't? It appears to be able to call the superclass methods OK, 
and the documentation of NSAtomicStore says that it implements a default 
dictionary of metadata, and I just have to ensure that it is saved. Sounds as 
if the default implementation should be sufficient.

3. It appears that I have to write the metadata out to file with the rest of 
the data for the application. Our application is cross platform, and it is 
possible that the file may be read and altered on the Windows version. If it 
was written back again without the metadata, what would the impact of that be? 
Actually there would be other cases where third party utilities could create 
one of our files, and they would not know what to write into the metadata. 
Could I just ask the atomic store for its metadata without using setMetadata, 
and get back a value that I could use (and subsequently store)?

Thanks

Gideon





___

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: Bison/Yacc with Objective-C ?

2010-03-10 Thread F van der Meeren

On 10 Mar 2010, at 12:48, Timothy Stafford Larkin wrote:

> You don't need to change the file extension, just a build setting. Change 
> "Compile Sources As" from "According to file type" to "Objective C".

I find that confusing, especially when you have multiple yacc files to maintain.
Some of them are in C, some in ObjC, C++, etc
With the file-extention you see without opening what kind of language it uses.

Filip

> 
> Also, I've found that "@" as in @"String Constant" produces Bison confusion. 
> I use a #define so that I can write AT"String Constant".
> 
> Tim Larkin
> Abstract Tools
> 
> On Mar 9, 2010, at 6:33 PM, Graham Cox wrote:
> 
>> 
>> On 10/03/2010, at 9:00 AM, Thomas Wetmore wrote:
>> 
>>> Yacc (and Bison) convert yacc files into C files. Instead I would like to 
>>> generate Objective-C files so I can use Cocoa containers classes and 
>>> NSString to get Unicode for free. I do see that bison can generate C++ 
>>> instead of C. Does anyone know whether there is any version of yacc or 
>>> bison that has been modified to generate Objective-C? Or if there is any 
>>> other parser generator available that can generate Objective-C.
>> 
>> 
>> I haven't tried it, so this might be nonsense, but I think that YACC simply 
>> copies the emitted code from the source file to the final C file. That means 
>> that could be Objective-C code - you'd only need to change the file 
>> extension from .c to .m to compile it. As long as the emitted code is the 
>> only Objective-C and therefore not required to be parsed by YACC, I reckon 
>> it ought to work.
>> 
>> --Graham
>> 
>> 
>> ___
>> 
>> 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/tsl1%40cornell.edu
>> 
>> This email sent to t...@cornell.edu
> 
> ___
> 
> 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/filip%40code2develop.com
> 
> This email sent to fi...@code2develop.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: Bison/Yacc with Objective-C ?

2010-03-10 Thread Timothy Stafford Larkin
You don't need to change the file extension, just a build setting. Change 
"Compile Sources As" from "According to file type" to "Objective C".

Also, I've found that "@" as in @"String Constant" produces Bison confusion. I 
use a #define so that I can write AT"String Constant".

Tim Larkin
Abstract Tools

On Mar 9, 2010, at 6:33 PM, Graham Cox wrote:

> 
> On 10/03/2010, at 9:00 AM, Thomas Wetmore wrote:
> 
>> Yacc (and Bison) convert yacc files into C files. Instead I would like to 
>> generate Objective-C files so I can use Cocoa containers classes and 
>> NSString to get Unicode for free. I do see that bison can generate C++ 
>> instead of C. Does anyone know whether there is any version of yacc or bison 
>> that has been modified to generate Objective-C? Or if there is any other 
>> parser generator available that can generate Objective-C.
> 
> 
> I haven't tried it, so this might be nonsense, but I think that YACC simply 
> copies the emitted code from the source file to the final C file. That means 
> that could be Objective-C code - you'd only need to change the file extension 
> from .c to .m to compile it. As long as the emitted code is the only 
> Objective-C and therefore not required to be parsed by YACC, I reckon it 
> ought to work.
> 
> --Graham
> 
> 
> ___
> 
> 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/tsl1%40cornell.edu
> 
> This email sent to t...@cornell.edu

___

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: Using a NSTextField inside a NSMenuItem?

2010-03-10 Thread jonat...@mugginsoft.com

On 10 Mar 2010, at 01:01, Robert Monaghan wrote:

> Hi Everyone,
> 
> Another Question:
> How does one make a NSTextField work inside an NSMenuItem? (For 10.5/10.6)
> 
> I can place the NSTextField into a View that I've created in a NIB file, and 
> have added it to the NSMenuItem
> using setView:
> It shows up perfectly, and I can pre-populate the text field using a 
> setStringValue call.
> 
> However, NSControlTextDidEndEditingNotification (as well as the other 
> NSTextField notifications) do not work,
> nor can I get any results back from the user. Doing a stringValue on the 
> Textfield only returns the original data
> from the setStringValue call that I did when I attached the view to the 
> NSMenuItem.
> 
> What am I missing?
> 
This is a non standard menu configuration.
You may not have a field editor available to handle the NSTextField text 
processing.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.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


[Meet] Amsterdam CocoaHeads

2010-03-10 Thread Cathy Shive
Hi!

The Amsterdam CocoaHeads group will be meeting tonight, March 10, from 7-9PM.  
Klass Pieter Annema will be presenting Cappuccino and Objective-J. 
http://cappuccino.org/

Directions and other info can be found here:
http://groups.google.com/group/cocoaheads-amsterdam/web/next-meeting-wednesday-march-10-2010?hl=en_US

Hope to see you there!
Cathy


___

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