The principle of the iTunes Syncing?

2009-09-30 Thread James
Hi all,
   Now I am developing an cocoa application. One of the app's function is to 
synchronize the audio and video files to the iPod/iPhone. The function is same
as the iTunes Syncing function.
   So I want to know about the principle of the iTunes Syncing. And is there
any framework to implement the Syncing function?
   I have refered to the developer.apple.com and other BBS. But there is little
infomation about the principle of iTunes Syncing.
   Could anyone point me some clues about it?
   Thanks in advance!
James
___

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: The principle of the iTunes Syncing?

2009-09-30 Thread Kyle Sluder
2009/9/29 James ldl0313...@163.com:
   Now I am developing an cocoa application. One of the app's function is to
 synchronize the audio and video files to the iPod/iPhone. The function is same
 as the iTunes Syncing function.

You have no access to the user's iTunes or iPod libraries.

   So I want to know about the principle of the iTunes Syncing. And is there
 any framework to implement the Syncing function?

No.  You will have to implement your own syncing functionality over
the air (WiFi or cellular).  The SDK does not give access to syncing
over the wire with iTunes.

Please file bugs about this at http://bugreport.apple.com.  We would
all benefit from access to at least over-the-wire syncing.

--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


Nib Loading Crash on Tiger only

2009-09-30 Thread Steve Cronin

Folks;

I have converted to using SL; XC3.2; IB 3.2.
I have an app with a deployment target of 10.4
There are no IB warnings; the dev target is IB 3.2

Things have been working reasonably well but now when I test on a  
Tiger I crash immediately

Leopard and Snow Leopard are fine

2009-09-30 01:34:18.529 XYZ[8852] An uncaught exception was raised
2009-09-30 01:34:18.530 XYZ[8852] *** -[NSKeyedUnarchiver  
decodeObjectForKey:]: cannot decode object of class (NSCoreUIImageRep)
2009-09-30 01:34:18.530 XYZ[8852] *** Uncaught exception:  
NSInvalidUnarchiveOperationException *** -[NSKeyedUnarchiver  
decodeObjectForKey:]: cannot decode object of class (NSCoreUIImageRep)


I'm using .xib files but I don't what I should even be looking for.

What is this trying to tell me?
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: Nib Loading Crash on Tiger only

2009-09-30 Thread Graham Cox


On 30/09/2009, at 4:45 PM, Steve Cronin wrote:


I'm using .xib files but I don't what I should even be looking for.

What is this trying to tell me?



Looks like your nib contains a Leopard-only class, and therefore it  
can't dearchive it on Tiger. Seems to be some sort of private image  
rep class - are you using an image templae only available on Leopard?


Have you set the deployment target for the nib file in IB? That might  
pick up what the problem is.


--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: Nib Loading Crash on Tiger only

2009-09-30 Thread Kyle Sluder
Check your IB compatibility settings.  Looks like you've archived an
image into your nib that doesn't exist on Tiger.

--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: Nib Loading Crash on Tiger only

2009-09-30 Thread Steve Cronin

Kyle * Graham;

The IB Info says:
Deployment Target: 10.4
Development Target: IB 3.2

There are no error or warnings!

What should I be looking at?
Steve



On Sep 30, 2009, at 1:56 AM, Kyle Sluder wrote:


Check your IB compatibility settings.  Looks like you've archived an
image into your nib that doesn't exist on Tiger.

--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: The principle of the iTunes Syncing?

2009-09-30 Thread Jens Alfke


On Sep 29, 2009, at 11:30 PM, Kyle Sluder wrote:


2009/9/29 James ldl0313...@163.com:
  Now I am developing an cocoa application. One of the app's  
function is to
synchronize the audio and video files to the iPod/iPhone. The  
function is same

as the iTunes Syncing function.


You have no access to the user's iTunes or iPod libraries.


It's possible, though quite difficult, for a desktop app to access the  
music library on an iPod. There are 3rd party apps such as PodWorks  
and Senuti that do it. From what I've heard, I believe it would take a  
lot of frustrating work to implement similar functionality, especially  
since Apple has lately begun encrypting the library database file on  
the iPod.


For the iPod Touch and iPhone, it's pretty much impossible. The older  
iPods mount as dumb hard-drives, but iPhone OS devices use a custom  
protocol over USB, which Apple has locked down as tightly as they can  
to discourage messing with the phone's OS and apps.


An app running on an iPhone (or iPod Touch) can look at the device's  
music library using the media framework, and can play tracks, but has  
no ability to modify the library at all. So syncing is not possible.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Does Core Data have reserved Entity names?

2009-09-30 Thread Alex Reynolds
After I added an Entity called Object, I get the following message  
when executing my application on the iPhone:


objc[4219]: Class Object is implemented in both /usr/lib/ 
libobjc.A.dylib and /var/mobile/Applications/BFDFC14C-DB60-44BB-8118- 
D2AAB39E2EE6/MyApp.app/MyApp. One of the two will be used. Which one  
is undefined.


Is Object a reserved name for a Core Data Entity on an iPhone? I  
don't see this message when I execute my application on the Simulator.


Thanks,
Alex
___

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: Static Analyzer Question

2009-09-30 Thread Gerriet M. Denkmann


On 30 Sep 2009, at 09:13, Greg Parker gpar...@apple.com wrote:


The static analyzer tries to enforce Cocoa's memory management
convention, where the retain-edness of the return value depends on the
name of the method. By that convention, if the method name contains
new or copy or alloc then the return value is retained and the
caller is expected to release it; otherwise the return value is
autoreleased and the caller is not expected to release it.


I had a similar problem with the static analyzer:

+(NSSet *)keyPathsForValuesAffectingCanCopyRsrcFork

There is a Copy in the name of the method, but the real name (as  
should be considered by clang) is:

 +keyPathsForValuesAffectingKey

The copy is just part of the Key. This is a bit confusing. Maybe  
Clang should be told about method names which contain a Key in it's  
name.


Kind regards,

Gerriet.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Nib Loading Crash on Tiger only -- SOLVED (well made gone...)

2009-09-30 Thread Steve Cronin

Folks;

I opened the .xib file in a text editor -searched for 'NSCoreUIImageRep'

I found one instance (thankfully) and by 'reading' the text was able  
to determine that it was a matrix of 2 radio buttons.


I removed the offending matrix and re-instantiated a fresh one.
I monitored the .xib text as I re-sized it but was unable to generate  
a 'NSCoreUIImageRep' again.

Compiled - deployed to Tiger - works fine….

I dunno, my gut tells me that there is some way thru resize and cell  
spacing that IB 3.2 will use a 'NSCoreUIImageRep' but I gotta move on…

Never was any IB warnings or errors….

Maybe this will help someone else…

Thanks Graham and Kyle for the assist,
Steve


On Sep 30, 2009, at 1:56 AM, Kyle Sluder wrote:


Check your IB compatibility settings.  Looks like you've archived an
image into your nib that doesn't exist on Tiger.

--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


Displaying a string with Core Animation

2009-09-30 Thread Gabriel Zachmann
I am at a loss at how to display a single string at the bottom left in  
a view with core animation.
The view is actually a ScreensaverView, and the string is a status  
message that should be always in front of the other layer(s).
The other layer contains just an image; the layer gets removed at some  
point, at which I add another layer to the main layer (this  
transaction is animated).


Right now I tried this:

// make the view layer-backed and become the delegate for the layer
self.wantsLayer = YES;
mainLayer_ = self.layer;
mainLayer_.name = @mainLayer;
mainLayer_.zPosition = 0.0;
mainLayer_.delegate = self;
[mainLayer_ setNeedsDisplay];

Then, I create one layer containing the image and add it to the  
mainLayer.


Eventually, the method drawRect: of my screensaverview gets called,  
where I render the string like so:


[[NSColor blackColor] set];
NSRectFill(rects);

NSMutableAttributedString * str = [[NSMutableAttributedString  
alloc] initWithString: mesg];

...
NSShadow * shadow1 = [[NSShadow alloc] init];
...
[str addAttribute: NSShadowAttributeName value: shadow1 range:  
NSMakeRange(0, [str length])];

[str drawAtPoint: NSMakePoint(0,0)];

This sort of works, EXCEPT that the string is always behind the image!
I tried to set the zPosition of my image sub-layer to either +1.0 or  
-1.0, to no avail.


I also tried to make my view layer hosted and add a CATextLayer with  
the string property set to my message string (and font and fontSize).

But that never gets displayed.

Any help will be highly appreciated.

Best regards,
Gabriel.




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: Does Core Data have reserved Entity names?

2009-09-30 Thread Mike Abdullah
This doesn't sound directly like a Core Data problem as such. Note how  
the message mentions nothing about entities, but instead is  
complaining you've got two separate classes with the same name. So you  
should be fine to have an entity named Object but don't make the  
classname that. Call it ARObject or something.


On 30 Sep 2009, at 08:53, Alex Reynolds wrote:

After I added an Entity called Object, I get the following message  
when executing my application on the iPhone:


objc[4219]: Class Object is implemented in both /usr/lib/ 
libobjc.A.dylib and /var/mobile/Applications/BFDFC14C-DB60-44BB-8118- 
D2AAB39E2EE6/MyApp.app/MyApp. One of the two will be used. Which one  
is undefined.


Is Object a reserved name for a Core Data Entity on an iPhone? I  
don't see this message when I execute my application on the Simulator.


Thanks,
Alex
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.net


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator 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


NSTimer and modal panels

2009-09-30 Thread Gabriel Zachmann

Sorry for asking again about NSTimers.

My question is: I've got a modal panel (a config sheet in a  
screensaver) with a text field, and when I enter some text there one  
of my methods, -changeSomething: say, gets called.


Is changeSomething executed in a different thread than my main code?

I am asking, because I would like to manipulate some timers, e.g.,  
invalidate a timer that I've set up in the init method, and install a  
new one.


Thanks a lot in advance.

Best regards,
Gabriel.




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: Does Core Data have reserved Entity names?

2009-09-30 Thread I. Savant

On Sep 30, 2009, at 3:53 AM, Alex Reynolds wrote:

After I added an Entity called Object, I get the following message  
when executing my application on the iPhone:


objc[4219]: Class Object is implemented in both /usr/lib/ 
libobjc.A.dylib and /var/mobile/Applications/BFDFC14C-DB60-44BB-8118- 
D2AAB39E2EE6/MyApp.app/MyApp. One of the two will be used. Which one  
is undefined.


  Object is the original root class in Objective-C. ObjC allows  
multiple root classes but Apple's implementation uses NSObject. It  
appears Object is still available somewhere, though.


  I remember reading about it years ago but I can only find  
references to this fact and not a clear statement of the fact itself.  
Hate it when that happens.


  Whatever the answer, the simple solution is to change your entity's  
name.


--
I.S.


___

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: NSTimer and modal panels

2009-09-30 Thread Ken Thomases

On Sep 30, 2009, at 6:01 AM, Gabriel Zachmann wrote:

My question is: I've got a modal panel (a config sheet in a  
screensaver) with a text field, and when I enter some text there one  
of my methods, -changeSomething: say, gets called.


Is changeSomething executed in a different thread than my main code?


All GUI events and action methods are executed on the main thread.

You're being a bit paranoid regarding threads.  Multi-threaded  
programming is a mine field, so it's good to be wary about embarking  
on that, yourself.  However, exactly because it's so tricky, the Cocoa  
frameworks are not going to just arbitrarily invoke your code on some  
random thread.  If the frameworks do something like that, you can be  
assured there will be warnings about it in the relevant  
documentation.  Otherwise, frankly, none of us could make a move for  
fear of stepping on a mine.


Cheers,
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


Re: Temporarily disabling all input events while non-blocking animations are playing

2009-09-30 Thread Oleg Krupnov
Let me answer my own question myself, because I have found a
(seemingly) good way -- using run loops in NSEventTrackingRunLoopMode
mode, like the [NSView dragImage] does.

// end date to make sure the run loop will be endless in case of a
program mistake
NSDate* endDate = [NSDate dateWithTimeIntervalSinceNow:5.0];
// some exit flag set somewhere else
m_someExitFlag = false;
do
{
[[NSRunLoop currentRunLoop] runMode:NSEventTrackingRunLoopMode
beforeDate:endDate];
}
while ([(NSDate*)[NSDate date] compare:endDate] == NSOrderedAscending
 !m_someExitFlag);


On Thu, Aug 27, 2009 at 3:35 PM, Oleg Krupnov oleg.krup...@gmail.com wrote:
 Hi,

 I'd like my app to block while an animation is playing. Normally, I
 would simply use a blocking animation, but now I have two short
 animations playing simultaneously, so I have to make them both
 non-blocking. How do I block the app in this case? Basically I'd like
 to prevent the user from (inadvertently) interacting with the app
 while the animations are in progress, because the app may go into an
 invalid state.

 Thanks!

___

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 tell if NSArrayController has a selected CoreData instance?

2009-09-30 Thread Timothy Reaves
 On Sep 29, 2009, at 7:10 AM, Timothy Reaves
 trea...@silverfieldstech.com
   wrote:

 What makes you think you can?  Logically, you shouldn't be
 able.  I'd
 imagine selectedObjects is always going to return an index set; it'd
 just be empty with no selection.  I did try comparing it to
 NSNoSelectionMarker just in case, and that doesn't work.


 Perhaps instead of imagining it would be more helpful to read the
 documentation. -[NSObjectController selectedObjects] returns the
 actual objects.

 You also don't seem to understand how bindings work. Even if -
 selectedObjects did return an NSIndexPath, it's a KVO-compliant
 property and therefore perfectly suitable for binding to.

 --Kyle Sluder

 I mixed up selectedIndexes.  So, yes, it does return objects. 
However, it does not in fact return the actual objects.  It returns
proxies.  Which is what I said in my original post.  So even if there
are no selected objects, you get back a non-empty array.

 You've read some documentation I haven't;  contrary to your
statement, I do understand KVO.  What I don't understand is what key
I would bind to to determine if that core data proxy is a proxy of a
real object, or not?  Which is the actual subject of the post.  How
to determine if the selected object returned from selection,
selectedObjects, etc., is a proxy or not.

 Kyle, I appreciate your expertise.



___

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 tell if NSArrayController has a selected CoreData instance?

2009-09-30 Thread Mike Abdullah


On 30 Sep 2009, at 13:31, Timothy Reaves wrote:


On Sep 29, 2009, at 7:10 AM, Timothy Reaves
trea...@silverfieldstech.com

wrote:



   What makes you think you can?  Logically, you shouldn't be
able.  I'd
imagine selectedObjects is always going to return an index set; it'd
just be empty with no selection.  I did try comparing it to
NSNoSelectionMarker just in case, and that doesn't work.



Perhaps instead of imagining it would be more helpful to read the
documentation. -[NSObjectController selectedObjects] returns the
actual objects.

You also don't seem to understand how bindings work. Even if -
selectedObjects did return an NSIndexPath, it's a KVO-compliant
property and therefore perfectly suitable for binding to.

--Kyle Sluder


I mixed up selectedIndexes.  So, yes, it does return objects.
However, it does not in fact return the actual objects.  It returns
proxies.  Which is what I said in my original post.  So even if there
are no selected objects, you get back a non-empty array.


-[NSArrayController selectedObjects] does not return proxies, it  
returns the real thing. On the other hand:
-[NSArrayController selection] returns a proxy that represents the  
overall selection
NSTreeController uses proxies to represent its tree structure. On  
10.5+ this is exposed as NSTreeNode.


I think there is some confusion here between these things.
___

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


properties attributes misunderstanding

2009-09-30 Thread Colin Howarth

Hi,

I have a class


@interface Ray : NSObject {

...
NSBezierPath*path;
...
}
@property (copy)NSBezierPath*path;
@end


an instance of which is accessed in another class:


- (void)drawRect:(NSRect)rect
{
NSBezierPath*temporaryPathPointerWhichIsSupposedToBeDifferent;
...
temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path];
	[temporaryPathPointerWhichIsSupposedToBeDifferent  
transformUsingAffineTransform: aVeryLongDescriptiveTransformName];

[temporaryPathPointerWhichIsSupposedToBeDifferent stroke];
...
}


I thought the (copy) attribute would mean that  
temporaryPathPointerWhichIsSupposedToBeDifferent would be, well, a  
copy of the original path instance (which conforms to the NSCopying  
protocol). Of course, the compiler doesn't care what *I* think should  
happen, and applies the transform to path (which is identical to  
temporaryPathPointerWhichIsSupposedToBeDifferent).


It works if I do:

temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path copy];

instead.

Why isn't it doing what I think it should do though?


Thanks,


colin
___

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: properties attributes misunderstanding

2009-09-30 Thread Sherm Pendley
On Wed, Sep 30, 2009 at 9:02 AM, Colin Howarth co...@howarth.de wrote:

 I thought the (copy) attribute would mean that
 temporaryPathPointerWhichIsSupposedToBeDifferent would be, well, a copy of
 the original path instance (which conforms to the NSCopying protocol).

That's not what (copy) does. The copy is made when you use foo.path =
bar - the setter will make a copy of bar, rather than sending a
retain message to the original.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: properties attributes misunderstanding

2009-09-30 Thread Roland King

Other way around. The copy happens when you *set* the property.

So ray.path = OriginalPathPointerYouStartedWith;

will copy OriginalPathPointerYouStartedWith and then set ray's member  
variable to that copy. However when you READ the property, it just  
returns what's in the member variable over and over again.


If you wanted it to return a copy you could if you wish write your own  
accessor


-(NSBezierPath*)path
{
return( [ [ path copy ] autorelease ] );
}

which would copy it when it's accessed and give the accessor its own  
one to play with. So it would be copied when you set it, and then  
copied when you returned it. I'm not totally sure how much I like  
that, it feels a little semantically wrong to me but in the context of  
your class that might make sense. Were I really going to do that I may  
not use a property at all and might have a method which is called


(NSBezierPath*)copyPath

which explicitly returns a copy of the path because that's clear.

On 30-Sep-2009, at 9:02 PM, Colin Howarth wrote:


Hi,

I have a class


@interface Ray : NSObject {

...
NSBezierPath*path;
...
}
@property (copy)NSBezierPath*path;
@end


an instance of which is accessed in another class:


- (void)drawRect:(NSRect)rect
{
NSBezierPath*temporaryPathPointerWhichIsSupposedToBeDifferent;
...
temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path];
	[temporaryPathPointerWhichIsSupposedToBeDifferent  
transformUsingAffineTransform: aVeryLongDescriptiveTransformName];

[temporaryPathPointerWhichIsSupposedToBeDifferent stroke];
...
}


I thought the (copy) attribute would mean that  
temporaryPathPointerWhichIsSupposedToBeDifferent would be, well, a  
copy of the original path instance (which conforms to the NSCopying  
protocol). Of course, the compiler doesn't care what *I* think  
should happen, and applies the transform to path (which is identical  
to temporaryPathPointerWhichIsSupposedToBeDifferent).


It works if I do:

temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path copy];

instead.

Why isn't it doing what I think it should do though?


Thanks,


colin
___

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/rols%40rols.org

This email sent to r...@rols.org


___

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: properties attributes misunderstanding

2009-09-30 Thread Colin Howarth

Thanks Sherm, and Roland.

All clear. :-)

I'll leave it with

path = [ray.path copy]; // I don't do retain count stuff :-)

for now.


But I'm left wondering, from a clean coding and/or language design  
point of view, is it *obvious* that the copy attribute would apply to  
setting as opposed to reading? Sometimes you want the actual object  
(ie. the reference or pointer to it) and sometimes you want a copy of  
it (ie. a new reference / pointer).


I suppose I still have the procedural call by reference / call by  
value idea in the back of my mind. There (in C) you get a copy 'by  
default',



(Sorry if I mix up terms, I mostly learnt OO in perl, with a bit of  
Modula-2/Oberon lurking in the background and C and asm ever-present.  
Can't stand C++ or java though.)




colin



On 30 Sep, 2009, at 15:16, Roland King wrote:


Other way around. The copy happens when you *set* the property.

So ray.path = OriginalPathPointerYouStartedWith;

will copy OriginalPathPointerYouStartedWith and then set ray's  
member variable to that copy. However when you READ the property, it  
just returns what's in the member variable over and over again.


If you wanted it to return a copy you could if you wish write your  
own accessor


-(NSBezierPath*)path
{
return( [ [ path copy ] autorelease ] );
}

which would copy it when it's accessed and give the accessor its own  
one to play with. So it would be copied when you set it, and then  
copied when you returned it. I'm not totally sure how much I like  
that, it feels a little semantically wrong to me but in the context  
of your class that might make sense. Were I really going to do that  
I may not use a property at all and might have a method which is  
called


(NSBezierPath*)copyPath

which explicitly returns a copy of the path because that's clear.

On 30-Sep-2009, at 9:02 PM, Colin Howarth wrote:


Hi,

I have a class


@interface Ray : NSObject {

...
NSBezierPath*path;
...
}
@property (copy)NSBezierPath*path;
@end


an instance of which is accessed in another class:


- (void)drawRect:(NSRect)rect
{
NSBezierPath*temporaryPathPointerWhichIsSupposedToBeDifferent;
...
temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path];
	[temporaryPathPointerWhichIsSupposedToBeDifferent  
transformUsingAffineTransform: aVeryLongDescriptiveTransformName];

[temporaryPathPointerWhichIsSupposedToBeDifferent stroke];
...
}


I thought the (copy) attribute would mean that  
temporaryPathPointerWhichIsSupposedToBeDifferent would be, well, a  
copy of the original path instance (which conforms to the NSCopying  
protocol). Of course, the compiler doesn't care what *I* think  
should happen, and applies the transform to path (which is  
identical to temporaryPathPointerWhichIsSupposedToBeDifferent).


It works if I do:

temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path copy];

instead.

Why isn't it doing what I think it should do though?


Thanks,


colin
___

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/rols%40rols.org

This email sent to r...@rols.org




___

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: NSTableColumn value binding + keypath over a relationship

2009-09-30 Thread Bryan Matteson


I'm going to take a stab in the dark and predict that you *don't*  
have rearranges content automatically checked for the array  
controller,


I do.


and that checking it will cause the error message to go away.


It does not.


Try unchecking it.
http://stackoverflow.com/questions/1028700/core-data-strange-bindings-error-on-re-opening-a-document-help

- Bryan
___

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


NSRunLoop method - configureAsServer alternative in 10.6.1?

2009-09-30 Thread Nick Rogers

Hi,
When I use [[NSRunLoop currentRunLoop] configureAsServer]; after  
creating a service using NSConnection, it works.
But -configureAsServer is declared as deprecated with no alternative  
suggested.

I tried removing it and the code doesn't work.

server code snippet: (doesn't work)

MYMessageServer   *server = self;// here self is in instance of  
MyMessageServer class

NSConnection  *defaultConnection;
[[NSNotificationCenter defaultCenter] addObserver:server
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification
object:nil];
defaultConnection = [NSConnection  
serviceConnectionWithName:@MyCompanyName.MyProductName.serverFull  
rootObject:server];

[defaultConnection addRunLoop:[NSRunLoop currentRunLoop]];
// not doing [[NSRunLoop currentRunLoop] run]; here as its the main  
thread.


Client code snippet:
server = [[NSConnection  
rootProxyForConnectionWithRegisteredName 
:@MyCompanyName.MyProductName.serverFull host:nil] retain];

server is nil after the above line is executed.

Where can I find a simple implementation?
Or what changes to make to the above code?

Thanks,
Nick

___

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: NSTableColumn value binding + keypath over a relationship

2009-09-30 Thread Stamenkovic Florijan

On Sep 30, 2009, at 10:22, Bryan Matteson wrote:



I'm going to take a stab in the dark and predict that you *don't*  
have rearranges content automatically checked for the array  
controller,


I do.


and that checking it will cause the error message to go away.


It does not.


Try unchecking it.


I tried it, did not help.

Besides, I need automatic resorting (automatic at least from the  
user's point of view), and this is the cleanest way of doing it.



http://stackoverflow.com/questions/1028700/core-data-strange-bindings-error-on-re-opening-a-document-help


Similar behavior (not the same), and I am not getting any formatter  
related Console messages that are mentioned on that thread. I could be  
messing things up some other way though. Will try to isolate the issue.


F
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Displaying a string with Core Animation

2009-09-30 Thread Jens Alfke


On Sep 30, 2009, at 3:41 AM, Gabriel Zachmann wrote:


This sort of works, EXCEPT that the string is always behind the image!
I tried to set the zPosition of my image sub-layer to either +1.0 or  
-1.0, to no avail.


I think layers are always drawn in front of the view's own content.

I also tried to make my view layer hosted and add a CATextLayer with  
the string property set to my message string (and font and fontSize).

But that never gets displayed.


That's the way I would do it. Something must be wrong with the way you  
set up the text layer; maybe its coordinates put it outside the view's  
bounds.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTimer and modal panels

2009-09-30 Thread Jens Alfke


On Sep 30, 2009, at 5:03 AM, Ken Thomases wrote:

However, exactly because it's so tricky, the Cocoa frameworks are  
not going to just arbitrarily invoke your code on some random thread.


Yup. Generally, the only time your code will run on a secondary thread  
is if

— You create an NSThread
— You call -performSelectorOnBackgroundThread:
— You use an NSOperationQueue to schedule concurrent NSOperations
— You use the new Grand Central Dispatch features in 10.6

Otherwise the main thread's runloop is going to cooperatively schedule  
all of the user events, timers, notifications and asynchronous  
delegate callbacks.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Dynamic NSArrayContent changing [was: NSTableColumn value binding]

2009-09-30 Thread Stamenkovic Florijan


On Sep 30, 2009, at 10:36, Bryan Matteson wrote:


May also want to look at this.
http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg31802.html
It seems to be very possible that it may be a bug, but it's also a  
common coding mistake as well.


Hope it works itself out.


Bryan,

I looked into it. The problem described relates to  
willChangeValueForKey not being called, thus violating KVO. This is  
not the problem I have.


Further investigation seems to suggest that it is an action of mine  
that triggers this. And not even the workaround that I have been using  
fixes it. Actually, completely removing the table column in question  
does not fix it. The problem is elsewhere, but I have a lead...


I dynamically change the content set / array of my array controller as  
a user preference changes. The situation is that there is a user  
preference for see all notes. If it's value is YES, then I bind my  
array controller's array content to another array controller that  
simply fetches all Notes. if it is NO, then I bind my array  
controller's set to NSTreeController.selection.items (where selection  
is a Group, and items the Notes it relates to)... It seems that this  
change is causing this to happen...


Here is some extra weirdness... The error is exhibited only when I  
shift back to not viewing all notes. So, when I first start up the  
app, I can drag and drop no problem, regardless if viewing all notes  
or the notes from the selected group. If I shift from seeing group  
notes to seeing all, also no problem. Only when shifting from seeing  
all to seeing selected group notes do I get this problem.


Perhaps I am not allowed to this, or need to do it differently? Here  
is the code for the change... I will experiment with it... It is a  
setter for a property bound to  
NSUserDefaultsController.values.viewingAllNotesPref


-(void)setViewingAllNotes:(NSNumber*)newValue
{
// assign the new value
id oldValue = viewingAllNotes;
viewingAllNotes = [newValue copy];
[oldValue release];

// react appropriately

if([viewingAllNotes boolValue]){

		// cache and then remove the current selection of the groups  
controller
		lastSelectedGroupsIndexPaths = [[groupsController  
selectionIndexPaths] retain];

[groupsController setSelectionIndexPaths:nil];

// re-direct the bindings of the notesController
[notesController unbind:@contentSet];
[notesController bind:@contentArray
 toObject:allNotesController
  withKeyPath:@arrangedObjects
  options:nil];

}else{

		// restore and then release the last selection of the groups  
controller
		[groupsController  
setSelectionIndexPaths:lastSelectedGroupsIndexPaths];

[lastSelectedGroupsIndexPaths release];
lastSelectedGroupsIndexPaths = nil;

// re-direct the bindings of the notesController
[notesController unbind:@contentArray];
[notesController bind:@contentSet
 toObject:groupsController
  withKeyPath:@selection.items
	  options:[NSDictionary dictionaryWithObject:[NSNumber  
numberWithBool:YES]


  
forKey:NSDeletesObjectsOnRemoveBindingsOption]];
}
}


___

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: NSTextField, drawing the text offset to the right in the field

2009-09-30 Thread Matt Neuburg
Although, to be clear, you *can* do this is in code, just not the way you
were doing it. You have to make sure you're talking to this instance at the
right moment, i.e. before the window appear but after the instance (the text
field) has been assembled by the nib. That moment, of course, is
awakeFromNib.

So, in awakeFromNib, instantiate the cell (you know, alloc-init etc.) and
set the textfield's cell - not its cell class, its *cell* - to that cell
instance:

[theTextField setCell: theCell];

If you do this in the text field's own awakeFromNib, then *all* text field's
of this class will adopt the custom cell.

[self setCell: theCell];

Or you can do it from elsewhere to specify that just *particular* text
fields should adopt the custom cell.

m.

On Tue, 29 Sep 2009 20:06:08 -0600, jon trambl...@mac.com said:
ahh,  that was it,   thanks a lot,   that made perfect sense once i
looked inside IB
I was also surprised that IB knew about my custom cell class...

I was thinking code code code...   and i just needed that shove in the
correct direction...
you made my day,  after a very long day...

On Sep 29, 2009, at 7:58 PM, Kyle Sluder wrote:

 +setCellClass: just tells the view Hey next time you initialize
 yourself, make a cell of this class.  Since your ImageTextField
 instance was created inside of IB, this is never going to happen.
 Instead you need to change the class of the cell from within IB, under
 the Identity inspector.  It might be helpful to switch to the
 hierarchical view so you can get easy access to the text field's cell.


-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: NSRunLoop method - configureAsServer alternative in 10.6.1?

2009-09-30 Thread Christopher Kane
It was actually deprecated in 10.5 according to the header, and the  
10.5 release notes explain:


Deprecated NSRunLoop API
The  -configureAsServer  method is deprecated in 10.5.  It never did  
anything, so there was never a point in calling it in Mac OS X.



Since time immemorial the implementation looked like this:

- (void)configureAsServer {
}

So any apparently beneficial effect of calling it was entirely  
coincidental.



Chris Kane
Cocoa Frameworks, Apple


On Sep 30, 2009, at 7:23 AM, Nick Rogers wrote:


Hi,
When I use [[NSRunLoop currentRunLoop] configureAsServer]; after  
creating a service using NSConnection, it works.
But -configureAsServer is declared as deprecated with no alternative  
suggested.

I tried removing it and the code doesn't work.

server code snippet: (doesn't work)

MYMessageServer   *server = self;// here self is in instance of  
MyMessageServer class

NSConnection  *defaultConnection;
[[NSNotificationCenter defaultCenter] addObserver:server
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification
object:nil];
defaultConnection = [NSConnection  
serviceConnectionWithName:@MyCompanyName.MyProductName.serverFull  
rootObject:server];

[defaultConnection addRunLoop:[NSRunLoop currentRunLoop]];
// not doing [[NSRunLoop currentRunLoop] run]; here as its the main  
thread.


Client code snippet:
server = [[NSConnection  
rootProxyForConnectionWithRegisteredName 
:@MyCompanyName.MyProductName.serverFull host:nil] retain];

server is nil after the above line is executed.

Where can I find a simple implementation?
Or what changes to make to the above code?

Thanks,
Nick

___

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/ckane%40apple.com

This email sent to ck...@apple.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: properties attributes misunderstanding

2009-09-30 Thread Matt Neuburg
On Wed, 30 Sep 2009 15:02:45 +0200, Colin Howarth co...@howarth.de said:

@property (copy) NSBezierPath *path;
an instance of which is accessed in another class:
 temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path];

Why isn't it doing what I think it should do?

Take a look at the docs:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Object
iveC/Articles/ocProperties.html

Search on copy. It's all about the setter, not the getter.

m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: [Solved] NSRunLoop method - configureAsServer alternative in 10.6.1?

2009-09-30 Thread Nick Rogers

Hi,
Very basic error:
did [defaultConnection retain];
in server code.
Seems very basic but when I was doing - configureAsServer, it was  
working without retaining.


Thanks,
Nick

On 30-Sep-2009, at 7:53 PM, Nick Rogers wrote:


Hi,
When I use [[NSRunLoop currentRunLoop] configureAsServer]; after  
creating a service using NSConnection, it works.
But -configureAsServer is declared as deprecated with no alternative  
suggested.

I tried removing it and the code doesn't work.

server code snippet: (doesn't work)

MYMessageServer   *server = self;// here self is in instance of  
MyMessageServer class

NSConnection  *defaultConnection;
[[NSNotificationCenter defaultCenter] addObserver:server
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification
object:nil];
defaultConnection = [NSConnection  
serviceConnectionWithName:@MyCompanyName.MyProductName.serverFull  
rootObject:server];

[defaultConnection addRunLoop:[NSRunLoop currentRunLoop]];
// not doing [[NSRunLoop currentRunLoop] run]; here as its the main  
thread.


Client code snippet:
server = [[NSConnection  
rootProxyForConnectionWithRegisteredName 
:@MyCompanyName.MyProductName.serverFull host:nil] retain];

server is nil after the above line is executed.

Where can I find a simple implementation?
Or what changes to make to the above code?

Thanks,
Nick

___

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/roger_s1%40mac.com

This email sent to roger...@mac.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


Deleting CalTasks through an Array.

2009-09-30 Thread Joshua Garnham
I have an Array of strings and want to remove CalTasks with titles of any of 
the strings. 
I know I can loop through a array with

for(NSString *title in array) {
}

and delete tasks with 

removeTask:title error:nil
But it won't let me delete a CalTask object with the strings from the Array 
instead it wants the actual CalTask object.How would I delete a CalTask object 
by matching it's title to a string in an array?

Cheers.



___

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: Deleting CalTasks through an Array.

2009-09-30 Thread Mike Abdullah


On 30 Sep 2009, at 17:32, Joshua Garnham wrote:

I have an Array of strings and want to remove CalTasks with titles  
of any of the strings.

I know I can loop through a array with

for(NSString *title in array) {
}

and delete tasks with

removeTask:title error:nil
But it won't let me delete a CalTask object with the strings from  
the Array instead it wants the actual CalTask object.How would I  
delete a CalTask object by matching it's title to a string in an  
array?


The API accepts CalTask objects. Logically then you need to fetch such  
objects from the store using the APIs provided. i.e. - 
tasksWithPredicate:

___

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


Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread jonathan
Before entering sleep I would like to send small amounts of data via  
async instances of CFSocket to the local and some remote hosts.


So I register for the sleep notification:

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
			selector: @selector(appWillSleep:) name:  
NSWorkspaceWillSleepNotification object: NULL];


And tell all my local and remote things to stop:

- (void) appWillSleep:(NSNotification*) note
{
[[thingHandler sharedInstance] stopAllRunningThings:self];
}

Now I presume that the 30 second sleep delay referred to in the docs  
for NSWorkspaceWillSleepNotification means that my app can dawdle in - 
appWillSleep for 30 seconds.

Is this correct?
If so then it seems likely that when this method returns the machine  
may sleep before all the network data requests complete.


Is it possible to finagle the runloop within -appWillSleep to allow my  
runloop attached CFSockets to persist for up to 30s before sleep  
overpowers me?

Or have I got this all wrong?

Thanks

Jonathan Mitchell

Developer
http://www.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


[ANN] Snow Leopard Location Manager sample code update

2009-09-30 Thread Bill Cheeseman
If you're interested in playing with Core Location and Location  
Services on a Mac running Snow Leopard, I've posted updated sample  
code and version 1.0.3 of Lucubrator, a free test application, to my  
Web site at http://www.quecheesoftware.com/Quechee_Software/Lucubrator.html 
.


The only change is to improve detection of your AirPort card status.

So far, users have reported successfully finding themselves in places  
like Boston, Massachusetts; Hamburg, Germany; and Sydney, Australia.  
But failure in Bangkok.



--

Bill Cheeseman
b...@cheeseman.name

___

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: Does Core Data have reserved Entity names?

2009-09-30 Thread Alex Reynolds

On Sep 30, 2009, at 4:04 AM, I. Savant wrote:

 Whatever the answer, the simple solution is to change your entity's  
name.


Unfortunately, that simple solution means parting ways with the naming  
scheme of the source I'm pulling data from and changing the naming  
scheme for all my other entities/classes, too, which I was hoping to  
avoid. But thanks to all for the confirmation.


-Alex

___

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: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread Jeff Johnson

If by 'finagle' you mean 'run', then yes, that should work. ;-)

There's a little bit more detail here:

http://developer.apple.com/mac/library/qa/qa2004/qa1340.html

-Jeff


On Sep 30, 2009, at 11:59 AM, jonat...@mugginsoft.com wrote:

Before entering sleep I would like to send small amounts of data via  
async instances of CFSocket to the local and some remote hosts.


So I register for the sleep notification:

[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
			selector: @selector(appWillSleep:) name:  
NSWorkspaceWillSleepNotification object: NULL];


And tell all my local and remote things to stop:

- (void) appWillSleep:(NSNotification*) note
{
[[thingHandler sharedInstance] stopAllRunningThings:self];
}

Now I presume that the 30 second sleep delay referred to in the docs  
for NSWorkspaceWillSleepNotification means that my app can dawdle in  
-appWillSleep for 30 seconds.

Is this correct?
If so then it seems likely that when this method returns the machine  
may sleep before all the network data requests complete.


Is it possible to finagle the runloop within -appWillSleep to allow  
my runloop attached CFSockets to persist for up to 30s before sleep  
overpowers me?

Or have I got this all wrong?

Thanks

Jonathan Mitchell

Developer
http://www.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] October CocoaHeads Mac Developer Meetings

2009-09-30 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are  
free and open to the public. We specialize in Cocoa, but everything  
Mac programming related is welcome.


Australia
Sydney- Thursday, October 1, 2009 18:30.

Canada
Ottawa/Gatineau- Thursday, October 8, 2009 19:00.
Toronto- Tuesday, October 13, 2009 18:30.
Victoria- Thursday, October 8, 2009 19:00.

Denmark
Aarhus- Tuesday, October 13, 2009 19:00.
Copenhagen- Tuesday, October 13, 2009 19:00.

Germany
Berlin- Thursday, October 15, 2009 19:00.
Stuttgart- Tuesday, October 6, 2009 19:00.

Sweden
Malmö- Tuesday, October 13, 2009 19:00.

Switzerland
Zürich- Thursday, October 8, 2009 19:00.

United States
Ann Arbor- Thursday, October 8, 2009 19:00.
Boulder- Tuesday, October 13, 2009 19:00.
Colorado Springs- Thursday, October 8, 2009 19:00.
Columbia- Tuesday, October 13, 2009 19:00.
Dallas- Wednesday, October 7, 2009 19:00.
Fayetteville- Thursday, October 8, 2009 18:00.
Lake Forest- Wednesday, October 14, 2009 19:00.
New York- Thursday, October 8, 2009 18:00.
Philadelphia- Thursday, October 15, 2009 19:00.
St. Louis- Saturday, October 31, 2009 14:00.

United Kingdom
Swindon- Monday, October 5, 2009 20:00.

Some chapters may have yet to post their meeting for next month.  
Meeting times may change. Locations and more information here:

http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads___

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: Displaying a string with Core Animation

2009-09-30 Thread douglas welton
I've been tripped up by this more than once:  Did you add your new  
CATextLayer to your layer hierarchy?


On Sep 30, 2009, at 6:41 AM, Gabriel Zachmann wrote:

I also tried to make my view layer hosted and add a CATextLayer with  
the string property set to my message string (and font and fontSize).

But that never gets displayed.



___

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: Does Core Data have reserved Entity names?

2009-09-30 Thread Bryan Henry
As a general rule, you want to avoid attempting to name classes with  
such generic names. It makes you very much more likely to end up with  
a class name conflict somewhere, especially in large projects.  
Classname prefixes are usually what's used to help ensure there are no  
such conflicts.


- Bryan

On Sep 30, 2009, at 1:11:06 PM, Alex Reynolds wrote:


On Sep 30, 2009, at 4:04 AM, I. Savant wrote:

Whatever the answer, the simple solution is to change your entity's  
name.


Unfortunately, that simple solution means parting ways with the  
naming scheme of the source I'm pulling data from and changing the  
naming scheme for all my other entities/classes, too, which I was  
hoping to avoid. But thanks to all for the confirmation.


-Alex

___

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/bryanhenry%40mac.com

This email sent to bryanhe...@mac.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: Does Core Data have reserved Entity names?

2009-09-30 Thread I. Savant

On Sep 30, 2009, at 1:11 PM, Alex Reynolds wrote:

Unfortunately, that simple solution means parting ways with the  
naming scheme of the source I'm pulling data from and changing the  
naming scheme for all my other entities/classes, too, which I was  
hoping to avoid. But thanks to all for the confirmation.



  I hear you, but ... them's the breaks I'm afraid. Such a basic  
name is sure to collide. I doubt it's as complex a problem as you're  
making it out to be, though:


1 - Renaming a class is easy to do with the refactoring tool in Xcode  
and choosing another entity name can't be *that* earth-shattering. The  
hardest part is finding any places you've referenced the entity by  
name (-insertEntityForName:...) and replacing them with the new name.


2 - Just because it's not called Object in the object model doesn't  
mean you can't call it Object in the user interface ...


--
I.S.




___

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: Does Core Data have reserved Entity names?

2009-09-30 Thread Greg Guerin

Alex Reynolds wrote:

Unfortunately, that simple solution means parting ways with the  
naming scheme of the source I'm pulling data from and changing the  
naming scheme for all my other entities/classes, too, which I was  
hoping to avoid. But thanks to all for the confirmation.



Maybe:

#define Object AlexObject

imported into every source file.  It's BFI, but surprisingly  
effective at times.


  -- GG



___

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


IKImageView imageCorrection property

2009-09-30 Thread Jonathan Hendry

Hi all,

Last night I was trying to use the imageCorrection property on an  
IKImageView, but it wasn't working for me.


Setting the property to a CIFilter didn't have any effect. The  
property remained nil.


Is there something I'm missing?

Thanks,

jon
___

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: NSRunLoop method - configureAsServer alternative in 10.6.1?

2009-09-30 Thread Jens Alfke


On Sep 30, 2009, at 9:17 AM, Christopher Kane wrote:


Since time immemorial the implementation looked like this:
- (void)configureAsServer {
}
So any apparently beneficial effect of calling it was entirely  
coincidental.


No way! I know people who were cured of cancer by calling - 
configureAsServer. My grandma used to call it every day, and she lived  
to be 97. I make sure to call it in all my apps, and when it returns I  
can feel this incredible surge of energy.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Deleting CalTasks through an Array.

2009-09-30 Thread Stamenkovic Florijan


On Sep 30, 2009, at 12:32, Joshua Garnham wrote:

I have an Array of strings and want to remove CalTasks with titles  
of any of the strings.

I know I can loop through a array with

for(NSString *title in array) {
}

and delete tasks with

removeTask:title error:nil
But it won't let me delete a CalTask object with the strings from  
the Array instead it wants the actual CalTask object.How would I  
delete a CalTask object by matching it's title to a string in an  
array?


Joshua,

You need to use CalCalendarStore's method taskPredicateWithCalendar,  
passing it all calendars to get the tasks, then compare titles and  
delete if necessary.


// make a predicate for all tasks
NSPredicate* allCalendarsTaskPredicate = [CalCalendarStore  
taskPredicateWithCalendar:[CalCalendarStore calendars]];


// fetch all the tasks
NSArray* allTasks = [[CalCalendarStore defaultCalendarStore]  
tasksWithPredicate:allCalendarsTaskPredicate];


// delete them
for(CalTask* task in allTasks)
if([arrayOfTitles contains:tast.title])
// delete task

More or less... Sorry for the typos, I am writing directly to mail.

What would be more efficient and *might* work is creating a compound  
predicate out of the allTasks predicate and a predicate that would  
discriminate tasks that don't have a matching title. However, I am not  
sure that predicate would work with the CalendarStore. Something to  
explore if the performance is an issue.


HTH
F
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


poor performance when scrolling scaled text view, with small number of characters per line only

2009-09-30 Thread Martin Redington
I'm seeing very poor performance when programmatically scrolling an
NSTextView under certain conditions.

The text view is scaled using [NSView scaleUnitSquareToSize:], and the
scroll amounts are fractional (I need to exactly match the appearance
of a smaller text view that is also being scrolled).

In most cases, performance is fine, but when the the number of
characters is small (e.g. the first line contains a - i, separated by
spaces), I see very poor performance when text is just leaving the
top, or just entering the bottom of the text view. It's so noticeable
that you can see the text speed up when the characters start to
overlap, and then speed up when the interval between lines reaches one
of the edges.

When only the top or bottom overlaps, performance is fine, and when
the number of characters per line is greater (e.g. a-o), performance
is fine too.

Using the CPU Sampler template in Instruments clearly shows the
performance slow down - the CPU graph is clearly saw-toothed in the
pathological case, and flat and much lower in the non-pathological
cases.

In the peaks, most 70% of CPU is spent in
CGSScanConvolveAndIntegrateRGB, at the bottom of the following stack
trace:

CGSScanConvolveAndIntegrateRGB
CGSScanConverterRendermask
glyph_path_end
CGFontGetGlyphPaths
CGFontCreateGlyphBitmaps32
CGFontCreateGlyphBitmaps
create_missing_bitmaps
CGGlyphLockLockGlyphBitmaps
ripc_RenderGlyphs
ripc_DrawGlyphs
draw_glyphs
CGContextShowGlyphsWithAdvances
-[NSLayoutManager(NSTextViewSupport)
showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:]

Can anyone shed any light on this, or how I might avoid it?

What's weird, is that I only get the problem when the number of
characters per line is small ...





-- 
http://www.mildmanneredindustries.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: Strange Core Data save behaviour (required relationship nil... when it is set the line before saving)

2009-09-30 Thread Ben Trumbull


On Sep 30, 2009, at 12:56 AM, Luke Evans wrote:

Well, I'm more than happy to file a bug, as it has been tricky to  
figure out (and I would probably still be at it without your  
interjection).
There are several ways to frame the problem of course: it could be a  
documentation bug... things aren't as simple as might first appear  
in the docs/guide, or maybe something can be done to have deleted  
object behave in a 'friendlier' manner w.r.t. their defunct  
relationships.  I suppose I can just find a general form of words  
and let you good folks figure out what it really means in practice :-)


Probably some of both.

I still think I might have something more to figure out here too.   
At the end of my testing, as an experiment I had a main thread timer  
fire periodically to perform a save on the main thread's MOC  
(without performing any changes on the main thread's MOC at all).   
This induced the same problem, and I'm still curious as to how the  
main thread's copy of the graph might have the nil in the  
relationship under these conditions.  AFAICS there shouldn't have  
been any chance for either MOC to be in this condition at any time.   
I assume the merge operation from the other thread is 'atomic'  
somehow and activity on another thread (like a save) should not be  
able to catch that MOC in some kind of in-between state?


merge ?  I'm not sure I have a full grasp on your work flow here.  If  
you call mergeChangesFromContextDidSaveNotification, then that can  
obviously make changes to the object graph.


There are two other issues in play.  First, if you've set a merge  
policy, then the MOC may pull in changes necessary to make the save  
correct (e.g. implement and correct an optimistic locking failure).   
Second, firing a timer on the main thread is totally non-deterministic  
with respect to anything else on the main thread.  The application  
event loop is rather amorphously defined, so timers can fire either  
inside or outside the main thread's current event's undo grouping.   
Timers are intrinsically very unpredictable.


Aside from this 'stress' test though, I haven't (yet) got it to fall  
over - essentially under the conditions where only one thread  
(albeit one of several threads on any occasion) is making changes  
and saving at a time.



I'm not sure I understand this last comment.  Do you have threads  
sharing a MOC ?  Because threads with their own MOCs can make their  
own changes and own saves simultaneously.


- Ben



___

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: Some more questions on NSOpenPanel

2009-09-30 Thread David M. Cotter
If anyone has any clue at all on this, or even some random thing that  
i could try to get this to work, i'd be most syked.  thanks again.


Just before we put up the dialog, we enable undo, cut, copy,  
paste, clear, and select all.  these items all have the correct  
HICommand assigned (eg: select all has kHICommandSelectAll as  
it's tag)


Tag?  kHICommandSelectAll?  This is the cocoa-dev list.  ;-)


okye, well yes:

[nsMenuItem setTag: kHICommandSelectAll];

The Select All item needs a target of First Responder and an action  
of

-selectAll:.


okay fine.
so just before i put up the OS dialog, i now set the action to  
selectAll and the target to nil (first reponder, right?)


[nsMenuItem setAction:@selector(selectAll:)];
[nsMenuItem setTarget:nil];


i also enable the menu item
then i put up my NSPanel (the save dialog)

however the edit menu is completely disabled, specifically the  
SelectAll command is still disabled.


what else could i possibly be missing


___

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: Some more questions on NSOpenPanel

2009-09-30 Thread Kyle Sluder
Why was the menu item ever not connected to First Responder?

--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: Some more questions on NSOpenPanel

2009-09-30 Thread David M. Cotter

we set the menu itself to be it's own first responder
this app came from legacy carbon code and we still go thru the ancient  
menu dispatching mechanism.  the menu's own first responder all it  
does is take note of the menu ID and menu item index and fake up the  
result of the old menuselect function, and send that fake event to  
the app to handle, since that's what it knows how to handle.


but that's not the issue now with the cocoa dialog.  before the dialog  
comes up i've done everything expected (AFAIK) but the menu still is  
disabled.


On Sep 30, 2009, at 12:47 PM, Kyle Sluder wrote:


Why was the menu item ever not connected to First Responder?

--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: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread Jens Alfke


On Sep 30, 2009, at 9:59 AM, jonat...@mugginsoft.com wrote:

Before entering sleep I would like to send small amounts of data via  
async instances of CFSocket to the local and some remote hosts.


It's usually best to close open sockets entirely before going to  
sleep. The socket might not work anymore when the system wakes  
(especially on a laptop). Also, it tells the peer on the other end you  
won't be able to receive any data.


Now I presume that the 30 second sleep delay referred to in the docs  
for NSWorkspaceWillSleepNotification means that my app can dawdle in  
-appWillSleep for 30 seconds.

Is this correct?
If so then it seems likely that when this method returns the machine  
may sleep before all the network data requests complete.


It shouldn't take 30 seconds to send a few packets to servers. And the  
user really doesn't want a forced-sleep to be delayed — it's  
frustrating when you shut your MacBook because you have to take it to  
a meeting, and it sits and sits and sits before the sleep indicator  
starts pulsing.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


[NSTextView] Shift left / Undo manager

2009-09-30 Thread Iceberg-Dev

I am currently busy re-inventing the wheel in the form a code editor.

I support Shift Left and Shift Right.

I would like to support Undo on Shift Left.

I'm wondering how this should be done as this operation modifies both  
the selected range(s) and the text.




I searched the archives, the NSTextView header, documentation, looked  
at some source code.


I am able to support the undo operation for the text changes but the  
selected range(s) is/are not reverted to the correct value(s).


From what I can see, Xcode (on Tiger) does not handle the selection  
correctly in this case either (though the result is better than mine)



Any idea?


___

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: Strange Core Data save behaviour (required relationship nil... when it is set the line before saving)

2009-09-30 Thread Ben Trumbull



I don't think anyone has cared enough to file a bug on this.


I don't get it. There's an open manhole in the street with the manhole
cover lying right next to it, and the problem is that no one cared
enough to call the Department of Works to complain?



This has come up 3 or 4 times in about 6 years.  So, is it an open  
manhole in the middle of the street, or is it that the unpaved road  
behind your house that nobody uses is missing a street sign ?


A quick glance suggests this should be pretty easy to fix, but that  
the obvious fix will be slower.  Should everyone's deletes get slower  
just to spare Luke ?  Maybe.  Hard to say without quantifying it.  So,  
now some performance tests need to get written, and the results  
measured.  Also, there's no bug report, and no developer provided test  
case to verify the fix.  So that needs to get written too.


Should we spend our time on this or, judging by complaints, something  
more important ?


cocoa-dev is not a bug reporting forum.

- Ben

___

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: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread jonat...@mugginsoft.com


On 30 Sep 2009, at 20:57, Jens Alfke wrote:



On Sep 30, 2009, at 9:59 AM, jonat...@mugginsoft.com wrote:

Before entering sleep I would like to send small amounts of data  
via async instances of CFSocket to the local and some remote hosts.


It's usually best to close open sockets entirely before going to  
sleep. The socket might not work anymore when the system wakes  
(especially on a laptop). Also, it tells the peer on the other end  
you won't be able to receive any data.
I intend to send off my bit of data, hang around ( = 30 secs) to get  
notification and then close everything.
I can take action at the remote end based on observing the socket  
closing rather than sending the pre-sleep data.
But I get a cleaner shutdown. A deliberate stop rather than an  
unexpected socket disconnection error.




Now I presume that the 30 second sleep delay referred to in the  
docs for NSWorkspaceWillSleepNotification means that my app can  
dawdle in -appWillSleep for 30 seconds.

Is this correct?
If so then it seems likely that when this method returns the  
machine may sleep before all the network data requests complete.


It shouldn't take 30 seconds to send a few packets to servers. And  
the user really doesn't want a forced-sleep to be delayed — it's  
frustrating when you shut your MacBook because you have to take it  
to a meeting, and it sits and sits and sits before the sleep  
indicator starts pulsing.

I intend to observe the requests and hopefully sleep ASAP.

 Not sure though that having called IOCancelPowerChange(,) wether it  
can be revoked before the 30 secs are up.

Perhaps a call to IOAllowPowerChange() will be effective.

Other options might be:

According to http://developer.apple.com/mac/library/qa/qa2001/qa1134.html 
 I can send the kAESleep event to the loginwindow process.
Don't know yet if trying to initiate sleep again so will prove useless/ 
effective/disatrous.


call IODeregisterForSystemPower() to see if that has any effect.



—Jens


Jonathan Mitchell

Developer
http://www.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


Re: Static Analyzer Question

2009-09-30 Thread Dave DeLong
To continue a bit on this idea, I believe that the static analyzer  
only analyzes a single method at a time.  I don't believe it recurses  
into called methods to do analysis.  (Can any of the clang-sa folks  
confirm this?)


Dave

On Sep 29, 2009, at 6:31 PM, Jens Alfke wrote:


On Sep 29, 2009, at 5:12 PM, Steve Cronin wrote:

Why does Clang believe that an 'owning retain count is expected' if  
the method is never called?


Objective-C is a dynamic enough language that there is no way to  
tell at compile time whether a method is reachable or not. Even if  
that selector never appears in your code, it could be constructed at  
runtime, or your code could load a plugin bundle that calls that  
selector.

___

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: Sleep, NSWorkspaceWillSleepNotification, 30 seconds and the run loop

2009-09-30 Thread jonat...@mugginsoft.com




Not sure though that having called IOCancelPowerChange(,) wether it  
can be revoked before the 30 secs are up.

Perhaps a call to IOAllowPowerChange() will be effective.

The above is garbled nonsense
.
I can achieve the desired goal by NOT calling either  
IOCancelPowerChange() or IOAllowPowerChange() immediately.

All that is necessary is to have registered for the IOKit notification.
Having done so I have 30 seconds in which to respond with either   
IOCancelPowerChange() or IOAllowPowerChange().

So I can trigger my network comms in
void MGSSleepCallBack( void * refCon, io_service_t service, natural_t  
messageType, void * messageArgument )

and when done simply call  IOAllowPowerChange() to initiate sleep.


Jonathan Mitchell

Developer
http://www.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


Weird NSToolbar glitch

2009-09-30 Thread Bryan Matteson
Hey everyone. I'm completely at a loss on this one. Here's a pic of  
what's happening to the toolbar.


http://img268.imageshack.us/img268/9236/screenshot20090930at337.png

It happens sometimes when I resize the toolbar and stays until I close  
and reopen the window. It's just a standard toolbar set up in IB,  
nothing special done to it.


Thanks.

B
___

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: Static Analyzer Question

2009-09-30 Thread Ken Thomases

On Sep 29, 2009, at 8:00 PM, Dave DeLong wrote:

To continue a bit on this idea, I believe that the static analyzer  
only analyzes a single method at a time.  I don't believe it  
recurses into called methods to do analysis.  (Can any of the clang- 
sa folks confirm this?)


It will perform analysis for statically bound calls, which is  
restricted to functions, not methods.  As you suspect, since method  
calls are dynamically bound, the analyzer has no way of knowing what  
actual implementation will be invoked at runtime.


Cheers,
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


Re: Weird NSToolbar glitch

2009-09-30 Thread Matthew Lindfield Seager
Hi Bryan,

It's not much info to go on... perhaps NSToolbar objects to the Spice
Girls or Gloria Estafan? =)

What have you tried (.com)?

The screenshot makes a lot of the controls look... nonstandard.
Perhaps try removing some of your customisations one at a time and see
how it affects the problem? It's the sort of problem that might have
been hanging around for a while unnoticed (resizing toolbars isn't one
of the first things I try after making UI changes).

Matt

--

Safe, comfortable and satisfied? Consider supporting some people who aren't!
I'm riding 100 kilometres to raise funds for refugees!
http://my.e2rm.com/personalPage.aspx?registrationID=750445
___

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: Some more questions on NSOpenPanel

2009-09-30 Thread David M. Cotter

so am i just out of luck on this?  i am completely out of ideas.

On Sep 30, 2009, at 12:57 PM, David M. Cotter wrote:


we set the menu itself to be it's own first responder
this app came from legacy carbon code and we still go thru the  
ancient menu dispatching mechanism.  the menu's own first responder  
all it does is take note of the menu ID and menu item index and fake  
up the result of the old menuselect function, and send that fake  
event to the app to handle, since that's what it knows how to handle.


but that's not the issue now with the cocoa dialog.  before the  
dialog comes up i've done everything expected (AFAIK) but the menu  
still is disabled.


On Sep 30, 2009, at 12:47 PM, Kyle Sluder wrote:


Why was the menu item ever not connected to First Responder?

--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


Cocoa UI Libraries?

2009-09-30 Thread Rick Mann
I've come across a few different user-contributed Cocoa UI elements,  
like one that provided a Mail or iTunes-like sidebar. But now I can't  
find them. I can't seem to find the right Google search term, either.


Can anyone point me to some of these libraries?

Thanks!

--
Rick

___

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: Some more questions on NSOpenPanel

2009-09-30 Thread Ken Thomases

On Sep 30, 2009, at 5:57 PM, David M. Cotter wrote:


so am i just out of luck on this?  i am completely out of ideas.


So, forgive me if this was covered earlier in the thread...  You have  
set the open panel to allow multiple selections, right?


[panel setAllowsMultipleSelection:YES]

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


Re: Weird NSToolbar glitch

2009-09-30 Thread Bryan Matteson



It's not much info to go on... perhaps NSToolbar objects to the Spice
Girls or Gloria Estafan? =)

What have you tried (.com)?



;) Yea I'm sorry I guess it's not much to go on, that's how I feel  
though.
Basically I have a NIB file controlled by NSViewController that  
contains a view and a toolbar. From the picture you see that I'm using  
tabs, basically each tab has a view and a toolbar, and clicking each  
tab sets a different view and toolbar.
The tabs work exactly like Safari's bookmark tabs. The problem arises  
when I drag a tab off the bar and it creates a new window controller /  
window instance and adds itself as a tab there. I'm setting the same  
view controller from the old tab to the new tab, and calling  
setToolbar on the new window. That's when the glitch happens.


OK
I seem to have found a solution. That's the way it works though, you  
beat your head against the wall all day and just when you're  
frustrated enough to ask for help, you figure it out.
It seems to work if I create a new view controller instance from the  
NIB. Why is it that I can't just swap a toolbar from one window to the  
other? The other window has been properly destroyed (I think, I'm  
using GC).

___

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 UI Libraries?

2009-09-30 Thread Bryan Matteson


On Sep 30, 2009, at 6:00 PM, Rick Mann wrote:

I've come across a few different user-contributed Cocoa UI elements,  
like one that provided a Mail or iTunes-like sidebar. But now I  
can't find them. I can't seem to find the right Google search term,  
either.


Can anyone point me to some of these libraries?




http://th30z.netsons.org/2009/03/cocoa-sidebar-with-badges-take-2/
http://brandonwalkin.com/bwtoolkit/

Here's a couple good ones, I think.
___

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 UI Libraries?

2009-09-30 Thread Sean McBride
On 9/30/09 4:00 PM, Rick Mann said:

I've come across a few different user-contributed Cocoa UI elements,
like one that provided a Mail or iTunes-like sidebar. But now I can't
find them. I can't seem to find the right Google search term, either.

Can anyone point me to some of these libraries?

One is BWToolkit:
http://brandonwalkin.com/bwtoolkit/

--

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/archive%40mail-archive.com

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


Re: Some more questions on NSOpenPanel

2009-09-30 Thread David M. Cotter
no, this is the save dialog.  i'm talking about the text edit field.   
i want to be able to cut / copy / paste / select all in the TE field  
of the save dialog


On Sep 30, 2009, at 4:05 PM, Ken Thomases wrote:


On Sep 30, 2009, at 5:57 PM, David M. Cotter wrote:


so am i just out of luck on this?  i am completely out of ideas.


So, forgive me if this was covered earlier in the thread...  You  
have set the open panel to allow multiple selections, right?


[panel setAllowsMultipleSelection:YES]

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


Mixed Core Data and static nodes in outline view

2009-09-30 Thread Rick Mann
I'm looking at ways of grouping some Core Data objects in a outline  
view. What I have are 3 or 4 different entities, and I want each of  
the objects of each type to appear under a parent item in the outline  
view.


Currently, I've implemented a simple table view and it's bound to an  
array controller that gets the objects from Core Data. Now I want to  
expand that same list to handle the other objects, so an outline view  
seems natural, with the top level nodes corresponding to the various  
types of entities, and the entities existing below.


Since the model doesn't have any notion of groups, I'd like to  
programmatically create the top entities, and have core data manage  
the children of each. Is this even possible?


TIA,
Rick

___

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 UI Libraries?

2009-09-30 Thread Dave DeLong

Our CocoaHeads group has a decent list of code like this too:

http://cocoaheads.byu.edu/resources/user-interface

(You're welcome to add to it, too!)

Dave
___

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: Mixed Core Data and static nodes in outline view

2009-09-30 Thread Sean McBride
On 9/30/09 4:22 PM, Rick Mann said:

I'm looking at ways of grouping some Core Data objects in a outline
view. What I have are 3 or 4 different entities, and I want each of
the objects of each type to appear under a parent item in the outline
view.

Currently, I've implemented a simple table view and it's bound to an
array controller that gets the objects from Core Data. Now I want to
expand that same list to handle the other objects, so an outline view
seems natural, with the top level nodes corresponding to the various
types of entities, and the entities existing below.

You could certainly do it without bindings and use the delgate/datasoure
methods of NSOutlineView.  A bit of a PITA though.

--

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/archive%40mail-archive.com

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


Re: Mixed Core Data and static nodes in outline view

2009-09-30 Thread Rick Mann


On Sep 30, 2009, at 16:30:24, Sean McBride wrote:


On 9/30/09 4:22 PM, Rick Mann said:


I'm looking at ways of grouping some Core Data objects in a outline
view. What I have are 3 or 4 different entities, and I want each of
the objects of each type to appear under a parent item in the outline
view.

Currently, I've implemented a simple table view and it's bound to an
array controller that gets the objects from Core Data. Now I want to
expand that same list to handle the other objects, so an outline view
seems natural, with the top level nodes corresponding to the various
types of entities, and the entities existing below.


You could certainly do it without bindings and use the delgate/ 
datasoure

methods of NSOutlineView.  A bit of a PITA though.


Yeah, I was hoping to use bindings and let core data handle the bulk  
of the work. Somehow.



___

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: NSWindowController and GC

2009-09-30 Thread Rob Keniger


On 01/10/2009, at 9:20 AM, Bryan Matteson wrote:

I was just reminded of something. I use GC in my app, and unless I  
specifically disable collection for a window controller, it's  
destroyed as soon as it loses key. I solved it by setting the  
controller as the delegate of the window, disabling collection for  
the window controller in windowDidLoad, and re-enabling it in  
windowWillClose:. Is there another way?



Disabling collection for the window controller in this way is a bit of  
a hack. With Garbage Collection, you need to make sure you have a  
strong reference to the window controller somewhere. This generally  
means making the window controller an ivar of another object, e.g.  
your NSDocument instance.


What object creates your window controller in the first place? That's  
probably the object that needs to hang on to it.


--
Rob Keniger



___

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


When to customise the Print Panel?

2009-09-30 Thread Graham Cox

Hi all,

I can see how to add/remove an accessory view to NSPrintPanel using - 
addAccessoryController:, but I'm baffled about when I get the  
opportunity to call this. Currently I'm adding an accessory view to  
the Page Setup panel in my document's -preparePageLayout: method, but  
really that's the wrong place to do what I want - the options really  
belong in the Print panel. NSDocument doesn't have an equivalent - 
preparePrintPanel: method.


What should I be doing?

--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: Mixed Core Data and static nodes in outline view

2009-09-30 Thread Rick Mann


On Sep 30, 2009, at 16:22:45, Rick Mann wrote:

I'm looking at ways of grouping some Core Data objects in a outline  
view. What I have are 3 or 4 different entities, and I want each of  
the objects of each type to appear under a parent item in the  
outline view.


Currently, I've implemented a simple table view and it's bound to an  
array controller that gets the objects from Core Data. Now I want to  
expand that same list to handle the other objects, so an outline  
view seems natural, with the top level nodes corresponding to the  
various types of entities, and the entities existing below.


Since the model doesn't have any notion of groups, I'd like to  
programmatically create the top entities, and have core data manage  
the children of each. Is this even possible?


Do you think I could create an plain Obj-C object with appropriate  
accessors to act as my grouping object, and then have it implement  
Core Data fetch operations to return the children? I don't know,  
though, how to get changes in the managed object context to be  
automatically reflected in the tree view using this technique. I'm  
sure there's some observer/key notification thing to set up, but I'm  
not very fluent in the programmatic aspects of that stuff.


--
Rick


___

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


NSDocumentController didCloseAllSelector

2009-09-30 Thread Chris Idou
The doco for closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo: 
says that it should call
the didCloseAllSelector. How would one do that? This is what I am doing:

[delegate performSelector:didCloseAllSelector withObject:(id)YES 
withObject:contextInfo];

but I'm nervous about that typecast. Is that the way, or is there another way?


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.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: NSWindowController and GC

2009-09-30 Thread Chris Idou


The right way is to make sure something in your program retains a pointer to 
your window controller. Sometimes there will be an obvious place, like a member 
of the object that created the window controller. That is most typical. Worst 
case is you retain a pointer in some global variable or similar, but that also 
has a greater danger that you will forget to zero it out when you are finished 
with it, and it won't get collected. Some of my temporary dialog box 
controllers inherit from a class that puts itself in a global dictionary when 
created, and removes itself when the window closes.





From: Bryan Matteson brysco...@gmail.com
To: cocoa-dev@lists.apple.com
Sent: Thursday, 1 October, 2009 9:20:16 AM
Subject: NSWindowController and GC

I was just reminded of something. I use GC in my app, and unless I specifically 
disable collection for a window controller, it's destroyed as soon as it loses 
key. I solved it by setting the controller as the delegate of the window, 
disabling collection for the window controller in windowDidLoad, and 
re-enabling it in windowWillClose:. Is there another way?

-B
___

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/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.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: NSDocumentController didCloseAllSelector

2009-09-30 Thread Graham Cox


On 01/10/2009, at 11:00 AM, Chris Idou wrote:

The doco for  
closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo: says  
that it should call
the didCloseAllSelector. How would one do that? This is what I am  
doing:


Chris, this stuff is a right old mess. No wonder you're confused.

It says *it* will call that method if all documents are closed. You  
don't necessarily have to call anything - looking at the byzantine  
interactions between all these methods all I can say is, if you can  
avoid it, do so!


What do you want to do? Unless you're overriding - (void) 
canCloseDocumentWithDelegate:(id)delegate shouldCloseSelector:(SEL) 
shouldCloseSelector contextInfo:(void *)contextInfo
to do something in a non-standard way there's nothing to do. If you  
are overriding it, you need to handle the whole kit-n-kaboodle,  
including presenting the alert to the user and saving the document to  
disk, and finally invoking the mysterious callback selector.


I can't actually see an easy way to invoke the callback selector with  
the signature as given - you need to pass it the document (self), a  
BOOL and the contextInfo. You can invoke the method directly on the  
delegate easily enough, but since you're supposed to use the callback  
supplied, that might not work. The only way I can see to do it is to  
create an NSInvocation with the selector, set each argument and call  
invokeWithTarget: passing the delegate.


Someone else might have a brighter idea - this seems very involved and  
badly thought-out.


--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: NSLayoutManager and best override point for temporary attributes

2009-09-30 Thread Martin Wierschin

Hi Keith,

I have certain custom text attributes that are used in my  
NSTextStorage to which I would like to add temporary attributes via  
the NSLayoutManager.


What version of OSX are you testing under? Under Leopard there's a bug  
in -[NSLayoutManager  
temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:]  
that calculates effective ranges that are too short. For specific test  
cases this caused big inefficiencies in the text system. I believe  
this bug is fixed in Snow Leopard.


more recently I have taken to overriding NSLayoutManager's - 
temporaryAttributesAtCharacterIndex:effectiveRange:


If this is too slow, then I'd look to using some kind of cache for  
your calculations. But really, NSLayoutManager's temporary attributes  
are already a cache; one likely to be specifically designed for high  
performance index/run access. I think your original idea of setting  
temporary attributes whenever text changes would be the most efficient.


Perhaps you're recalculating too much, too often? I don't know the  
access patterns for temporary attributes, but I would guess they are  
only queried when associated text is displayed on screen. If that's  
the case, you could fix them up lazily, eg: whenever text changes just  
note down that the attributes are dirty in that range. Your temporary  
attribute methods in your NSLayoutManager subclass can then ensure  
that temporary attributes are not dirty before they are returned.


If none of that is efficient enough, you could rig up a NSTextStorage  
subclass that has two sets of attributes: one set for private use and  
another derived set which only the layout system sees.


Hopefully some of that helps,

~Martin

___

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: Best Design Advice

2009-09-30 Thread Chris Idou
If it displays a window it should be an app. If its an app it should be in 
/Applications and it should be started from Login Items.

You can't install it automatically by security design. But once you get the 
user to install and run it, there are no permissions issues in adding it to 
login items (although asking the user is polite), and connecting to your web 
site.





From: David Blanton aired...@tularosa.net
To: cocoa-dev List cocoa-dev@lists.apple.com
Sent: Sunday, 15 November, 2009 4:21:31 AM
Subject: Best Design Advice

I need to create an app the is auto downloaded and installed from a web site 
when the user clicks a web page button.

The app needs to be installed so that it always runs when the user logs in.

The app needs to periodically (by user preference setting) connect to a web 
server.

The app needs to display a window with information gleaned from its last web 
server connect.

=
1. Where should the app be installed.

2. Are there any permission issues.

3. Is this a background service or status like item.

4. Is it's periodic web connect fired by a timer or some other means.

5. Any other general tips / tricks.
=


Thanks in advance!

db


___

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/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.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: NSDocumentController didCloseAllSelector

2009-09-30 Thread Adam R. Maxwell


On Sep 30, 2009, at 6:42 PM, Graham Cox wrote:

I can't actually see an easy way to invoke the callback selector  
with the signature as given - you need to pass it the document  
(self), a BOOL and the contextInfo. You can invoke the method  
directly on the delegate easily enough, but since you're supposed to  
use the callback supplied, that might not work. The only way I can  
see to do it is to create an NSInvocation with the selector, set  
each argument and call invokeWithTarget: passing the delegate.


NSInvocation is the correct way to handle this.  See the 10.5 release  
notes, and search for NSInvocation on that page:


http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKitOlderNotes.html#X10_5Notes

That should bring you to a helpful discussion titled Advice for  
Overriders of Methods that Follow the  
delegate:didSomethingSelector:contextInfo: Pattern.





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

Releasing NSSearchPathForDirectoriesInDomain causes crash

2009-09-30 Thread Anthony Smith
Does anybody know why releasing the NSArray obtained from  
NSSearchPathForDirectoriesInDomain causes my iPhone app to crash?  
Here's my code:


+ (NSString *)dataFilePath:(NSString *)filename {
	NSArray *paths = NSSearchPathForDirectoriesInDomains 
(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *directory = [paths objectAtIndex:0];

[paths release];

return [directory stringByAppendingPathComponent:filename];
}

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: NSDocumentController didCloseAllSelector

2009-09-30 Thread Chris Idou


What I have is a document based app, but it automatically saves everything - I 
don't want to ask the user. So I'm saving all my documents in 
closeAllDocumentsWithDelegate. It's working pretty good, the only major hassle 
is the app doesn't die on machine shutdown, presumably because I wasn't calling 
didCloseAllSelector.

I agree the whole setup is pretty confusing but after ponding it extensively, I 
think it is more or less sensible, given the need for the RunLoop and so on. 
(albeit, poorly documented).

I'm not sure what you mean you can invoke the method easily enough.

Maybe the right way to do it is with NSInvocation. But knowing what I know 
about objective-c, I can't see how setArgument:atIndex: would be able to know 
that the second argument is a BOOL which is one byte. Maybe it does know and it 
all just works.





From: Graham Cox graham@bigpond.com
To: Chris Idou idou...@yahoo.com
Cc: cocoa-dev@lists.apple.com
Sent: Thursday, 1 October, 2009 11:42:05 AM
Subject: Re: NSDocumentController didCloseAllSelector


On 01/10/2009, at 11:00 AM, Chris Idou wrote:

 The doco for closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo: 
 says that it should call
 the didCloseAllSelector. How would one do that? This is what I am doing:

Chris, this stuff is a right old mess. No wonder you're confused.

It says *it* will call that method if all documents are closed. You don't 
necessarily have to call anything - looking at the byzantine interactions 
between all these methods all I can say is, if you can avoid it, do so!

What do you want to do? Unless you're overriding - 
(void)canCloseDocumentWithDelegate:(id)delegate 
shouldCloseSelector:(SEL)shouldCloseSelector contextInfo:(void *)contextInfo
to do something in a non-standard way there's nothing to do. If you are 
overriding it, you need to handle the whole kit-n-kaboodle, including 
presenting the alert to the user and saving the document to disk, and finally 
invoking the mysterious callback selector.

I can't actually see an easy way to invoke the callback selector with the 
signature as given - you need to pass it the document (self), a BOOL and the 
contextInfo. You can invoke the method directly on the delegate easily enough, 
but since you're supposed to use the callback supplied, that might not work. 
The only way I can see to do it is to create an NSInvocation with the selector, 
set each argument and call invokeWithTarget: passing the delegate.

Someone else might have a brighter idea - this seems very involved and badly 
thought-out.

--Graham


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.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: NSDocumentController didCloseAllSelector

2009-09-30 Thread Graham Cox


On 01/10/2009, at 12:06 PM, Adam R. Maxwell wrote:

NSInvocation is the correct way to handle this.  See the 10.5  
release notes, and search for NSInvocation on that page:


http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKitOlderNotes.html#X10_5Notes

That should bring you to a helpful discussion titled Advice for  
Overriders of Methods that Follow the  
delegate:didSomethingSelector:contextInfo: Pattern.





Wow. I thought it was byzantine even before I read this ;-)

At least it gives some rationale for the design, which helps. Chris,  
looks like this is what you have to do.


--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: Releasing NSSearchPathForDirectoriesInDomain causes crash

2009-09-30 Thread Graham Cox

Yes, because it's not yours to release.

RTFMMGA:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/2043-BEHDEDDB


--Graham



On 01/10/2009, at 12:07 PM, Anthony Smith wrote:

Does anybody know why releasing the NSArray obtained from  
NSSearchPathForDirectoriesInDomain causes my iPhone app to crash?  
Here's my code:


+ (NSString *)dataFilePath:(NSString *)filename {
	NSArray *paths = NSSearchPathForDirectoriesInDomains 
(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *directory = [paths objectAtIndex:0];

[paths release];

return [directory stringByAppendingPathComponent:filename];


___

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: NSWindowController and GC

2009-09-30 Thread Bryan Matteson
Thank you Chris, Rob. I thought as much, but then I'm new to using GC.  
I thought that because I was able to access the window controller  
through the window that it was still reachable in the object graph.   
You know, like

[[aSampleView window] windowController];
Thought that meant there was a pointer already stored in the window  
instance, so unless the window was closed, it would not be collected.  
Thank you for clearing that up, I think I'll go with the global  
dictionary, as these window controller instances are created from  
several different places.


-B



The right way is to make sure something in your program retains a  
pointer to your window controller. Sometimes there will be an  
obvious place, like a member of the object that created the window  
controller. That is most typical. Worst case is you retain a pointer  
in some global variable or similar, but that also has a greater  
danger that you will forget to zero it out when you are finished  
with it, and it won't get collected. Some of my temporary dialog box  
controllers inherit from a class that puts itself in a global  
dictionary when created, and removes itself when the window closes.




___

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: Releasing NSSearchPathForDirectoriesInDomain causes crash

2009-09-30 Thread Anthony Smith

Awesome! Thanks!

On Sep 30, 2009, at 10:18 PM, Graham Cox wrote:


Yes, because it's not yours to release.

RTFMMGA:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/2043-BEHDEDDB


--Graham



On 01/10/2009, at 12:07 PM, Anthony Smith wrote:

Does anybody know why releasing the NSArray obtained from  
NSSearchPathForDirectoriesInDomain causes my iPhone app to crash?  
Here's my code:


+ (NSString *)dataFilePath:(NSString *)filename {
	NSArray *paths = NSSearchPathForDirectoriesInDomains 
(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *directory = [paths objectAtIndex:0];

[paths release];

return [directory stringByAppendingPathComponent:filename];






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: Releasing NSSearchPathForDirectoriesInDomain causes crash

2009-09-30 Thread Adam R. Maxwell
Does the Cocoa memory management documentation cover functions?  It  
specifically refers to ...a method whose name begins with  I  
wonder if something like the CF Create rule applies to Foundation?   
Of the following Create functions


NSCreateMapTable
NSCreateZone
NSCreateHashTable
NSCreateFileContentsPboardType

the first 3 you obviously own...but I'm not sure about the last one.   
You're definitely correct that the result of  
NSSearchPathForDirectoriesInDomains should not be released, but I'm  
not sure the rules for functions are clear.


-- adam

On Sep 30, 2009, at 7:18 PM, Graham Cox wrote:


Yes, because it's not yours to release.

RTFMMGA:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/2043-BEHDEDDB


--Graham



On 01/10/2009, at 12:07 PM, Anthony Smith wrote:

Does anybody know why releasing the NSArray obtained from  
NSSearchPathForDirectoriesInDomain causes my iPhone app to crash?  
Here's my code:


+ (NSString *)dataFilePath:(NSString *)filename {
	NSArray *paths = NSSearchPathForDirectoriesInDomains 
(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *directory = [paths objectAtIndex:0];

[paths release];

return [directory stringByAppendingPathComponent:filename];


___

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/amaxwell%40mac.com

This email sent to amaxw...@mac.com




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

Accessor works intermittently

2009-09-30 Thread David Hirsch

I cannot figure out why this does not work:

Phase *thisPhase = [phases objectAtIndex:i];
float testmode = [thisPhase mode];
float testmode2 = [[phases objectAtIndex:i] mode];

Following along with the code execution in the debugger, testmode gets  
the correct value, but testmode2 gets an erroneous value.  Note that  
phases is an NSMutableArray of Phase* and mode is a trivial accessor  
for a float stored inside Phase:


- (float) mode {return mode;}

I'm running XCode 3.1.2 in OSX 10.5.8.
-Dave

Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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


error with movie player, iSightAudio.plugin

2009-09-30 Thread Elisabeth Robson
Hi,I wrote a small program today that uses MPMoviePlayerController, and when
I run it and the movie starts playing, I get the following message on the
console:

2009-09-30 17:44:43.683 PlayVideo[2128:4a03] Cannot find executable for
CFBundle/CFPlugIn 0x7b49e70 /Library/Audio/Plug-Ins/HAL/iSightAudio.plugin
(not loaded)

2009-09-30 17:44:43.683 PlayVideo[2128:4a03] Cannot find function pointer
iSightAudioNewPlugIn for factory 9BE7661E-8AEF-11D7-8692-000A959F49B0 in
CFBundle/CFPlugIn 0x7b49e70 /Library/Audio/Plug-Ins/HAL/iSightAudio.plugin
(not loaded)


This doesn't happen with another program I wrote today (the only two I've
written since upgrading to 3.1SDK on SnowLeopard).  I'm assuming it has
something to do with the MediaPlayer framework?


Has anyone else seen this error?  It doesn't seem to affect the way the
program works.  I checked the archives and didn't see any previous
discussion about this.


Thanks,


Elisabeth
___

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: NSDocumentController didCloseAllSelector

2009-09-30 Thread Adam R. Maxwell


On Sep 30, 2009, at 7:15 PM, Graham Cox wrote:



On 01/10/2009, at 12:06 PM, Adam R. Maxwell wrote:

That should bring you to a helpful discussion titled Advice for  
Overriders of Methods that Follow the  
delegate:didSomethingSelector:contextInfo: Pattern.




Wow. I thought it was byzantine even before I read this ;-)


Ah, but once you've seen it, you can't forget it :).  The most  
interesting bits of documentation are almost invariably the release  
notes (but they're also the hardest to find).





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: Accessor works intermittently

2009-09-30 Thread Stephen J. Butler
On Wed, Sep 30, 2009 at 6:41 PM, David Hirsch dhir...@mac.com wrote:
 I cannot figure out why this does not work:

                Phase *thisPhase = [phases objectAtIndex:i];
                float testmode = [thisPhase mode];
                float testmode2 = [[phases objectAtIndex:i] mode];

 Following along with the code execution in the debugger, testmode gets the
 correct value, but testmode2 gets an erroneous value.  Note that phases is
 an NSMutableArray of Phase* and mode is a trivial accessor for a float
 stored inside Phase:

                - (float) mode {return mode;}

Something else, probably in Cocoa, is defining a mode selector
before you do with a different return type. When ObjC can't determine
the exact signature of a selector (for example, because the instance
type is id) it uses the first one it finds. Searching through the
header files, I see at least two candidates it's probably choosing:

./AppKit.framework/Versions/C/Headers/NSColorPanel.h:- (NSColorPanelMode)mode;
./AppKit.framework/Versions/C/Headers/NSMatrix.h:- (NSMatrixMode)mode;

You can make it work with:

float testmode2 = [(Phase*)[phases objectAtIndex:i] mode];
___

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: NSDocumentController didCloseAllSelector

2009-09-30 Thread Michael Ash
On Wed, Sep 30, 2009 at 9:39 PM, Adam R. Maxwell amaxw...@mac.com wrote:

 On Sep 30, 2009, at 7:15 PM, Graham Cox wrote:


 On 01/10/2009, at 12:06 PM, Adam R. Maxwell wrote:

 That should bring you to a helpful discussion titled Advice for
 Overriders of Methods that Follow the
 delegate:didSomethingSelector:contextInfo: Pattern.


 Wow. I thought it was byzantine even before I read this ;-)

 Ah, but once you've seen it, you can't forget it :).  The most interesting
 bits of documentation are almost invariably the release notes (but they're
 also the hardest to find).

NSInvocation is crazy overkill for this. It's extremely difficult to
write, and as a bonus it'll be about two orders of magnitude slower
than a regular message send too.

A much simpler way is to do it like this (code not tested, etc.):

void (*method)(NSDocumentController *, BOOL, void *) =
(void*)[delegate methodForSelector: didAllCloseSelector];
method(delegate, didAllCloseSelector, self, YES, contextInfo);

I really don't know why Apple recommends such a complicated way.

(You can also call objc_msgSend() to do it all in one shot, but this
saves you from having to worry about whether you need to use a special
function for float returns, etc. You *do* have to worry about struct
returns, though, and you should not use this technique in that case.)

Mike
___

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


NSApplication's behavior

2009-09-30 Thread Mark Hurley
Still learning the Cocoa Window Architecture...
Goal:  I want to separate my MainWindow out of MainMenu.xib into its own
.xib:  MainView.xib.

1) I create a new Cocoa Application (not document-based)

2) I create a MainWindow.xib and MainWindowController.h/.m setting
appropriately the relationship between them.  MainWindowController inherits
from NSWindowController and follows the proper procedures of fixing the
MainWindow in the init* methods as mentioned in Apple docs.  I also set
the window and delegate

My assumption (based on docs) is that my default or main NIB to be loaded is
the one that has NSApplication set as the File's Owner.  And this should
remain as MainMenu, to ensure the responders for the Menu's are properly
registered/set up.

What is the recommended way to move MainWindow in another NIB? Shall I
instantiate it from applicationDidFinishLaunching? Is there another way
through interface builder, where one NIB refers to the other, etc?

Thank you,

Mark
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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