Re: nib loading / displaying question.

2008-12-13 Thread aaron smith
Ah, yeah that was it. And I had the "release when closed" box checked
in IB, which was causing it to crash. Unchecked that and we're all
good.

Thanks Rob, sorry for the newb question.

On Sat, Dec 13, 2008 at 11:53 PM, Rob Rix  wrote:
> It sounds like you're looking for [aboutPanel makeKeyAndOrderFront: self];.
>
> Rob
>
> On 14-Dec-08, at 2:38 AM, aaron smith wrote:
>
>> hey all, really quick question. I'm messing around with loading nib's
>> from the main bundle.
>>
>> It's pretty basic.
>>
>> -I've got a custom nib called "About" that shows when you select the
>> "About XXX" from the main menu.
>> -I have an AppController file (extends NSObject), that has an action
>> -(IBAction)showAboutPanel:(id)sender
>>
>> I've got it functioning for the most part, It load's the nib, and
>> shows it. But then after it's been closed, it won't ever show up
>> again.
>>
>> Here's my method:
>>
>> -(IBAction)showAboutPanel:(id)sender
>> {
>>NSLog(@"showAboutPanel");
>>if(aboutPanel)
>>{
>>NSLog(@"about panel set %@",aboutPanel);
>>//how do i show it again?
>>}
>>if(!aboutPanel)
>>{
>>[NSBundle loadNibNamed:@"About" owner:self];
>>NSLog(@"about panel %@",aboutPanel);
>>}
>> }
>>
>> I've read quite a bit about nibs and bundles, and I've tried a bunch
>> of different things, can't seem to figure this one out. Any ideas
>> would be great.
>>
>> 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/rix.rob%40gmail.com
>>
>> This email sent to rix@gmail.com
>
>
___

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

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

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

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


Re: Trying To Understand Bindings

2008-12-13 Thread Ashley Clark

On Dec 13, 2008, at 12:19 AM, Bridger Maxwell wrote:


Just when I thought I had bindings down

I have a custom view subclass (sineWaveView) that the user interacts  
with to change a property (connectedContact). I would like to bind  
this to a value (selectedShortRangeContact) in a dictionary  
(database) in another object (databaseClient). Simple, right?  
Anyway, I establish the binding like so:


[sineWaveView bind:@"connectedContact" toObject:databaseClient  
withKeyPath:@"database.selectedShortRangeContact" options:nil];


This seems to only work one-way. When the view sets the property, it  
gets set in the dictionary. However, when I update the value  
directly in the dictionary, the view never gets a notification. It  
is like the binding is one-way.


I'm assuming that your dictionary is in fact an NSMutableDictionary or  
one of the CFDictionary variants. If this is the case then by itself  
it's not sending out KVO notifications. You'll need to either wrap  
that dictionary in some accessors that are in a class where automatic  
KVO notifications are not disabled or one where you're specifically  
issuing willChangeValueForKey: and didChangeValueForKey: methods  
around you actually changing the value in the dictionary.


Another option if you can target Leopard is to look into using an  
NSDictionaryController to bind to your dictionary. I've not done this  
myself but I understand that it is meant to work specifically with  
dictionaries treating them as an array of key/value pairs.



Ashley
___

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: Trying To Understand Bindings

2008-12-13 Thread Ken Thomases

On Dec 13, 2008, at 12:19 AM, Bridger Maxwell wrote:

I have a custom view subclass (sineWaveView) that the user interacts  
with to change a property (connectedContact). I would like to bind  
this to a value (selectedShortRangeContact) in a dictionary  
(database) in another object (databaseClient). Simple, right?  
Anyway, I establish the binding like so:


[sineWaveView bind:@"connectedContact" toObject:databaseClient  
withKeyPath:@"database.selectedShortRangeContact" options:nil];


This seems to only work one-way. When the view sets the property, it  
gets set in the dictionary. However, when I update the value  
directly in the dictionary, the view never gets a notification. It  
is like the binding is one-way.


Hmm.  You're seeing the opposite of what I would expect.  There is a  
default implementation of bind:toObject:withKeyPath:options:, but its  
semantics are not clearly documented anywhere that I've found.   
Empirically, it appears to be one-way in the opposite direction of  
what you're seeing.  It uses KVO to observe the key path on the object  
and, when that changes, updates the property with the same name as the  
binding on the receiver of the bind:... message.  But changes in the  
receiver's property don't automatically generate updates to the  
property at the key path relative to the object.  This typically  
manifests as user manipulations of the view not resulting in updates  
to the model.


For a custom view subclass, you really need to provide your own  
implementation of bindings.  See "How Do Bindings Work?" here: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html


If you are providing your own implementation of bindings, then you'll  
have to share with us exactly what you're doing before we can help.



databaseController = [[NSObjectController alloc]  
initWithContent:databaseClient];
[databaseController  
bind:@"content.database.selectedShortRangeContact"  
toObject:sineWaveView withKeyPath:@"connectedContact" options:nil];


Although the documentation for bind:toObject:withKeyPath:options: says  
that the binding parameter is a key path, it's not.  It's the name of  
a binding. That _may_ correspond to a property in the KVC/KVO sense,  
or it may be its own thing.  (For example, NSTextView has a binding  
called "value", but doesn't have a property called "value".)  In any  
case, it's never a path (multiple elements separated by dots), it's  
just a simple name.


See here to learn about the bindings of an NSObjectController: .  You are trying to set up the "content" binding of your object  
controller, and you want to bind it to the databaseClient object,  
using the key path "database.selectedShortRangeContact".  In other  
words, if you're going to interpose an object controller between your  
view and coordinating controller, then the binding for the object  
controller will look very much like your view binding used to look --  
it's just that you send the message to the object controller and name  
a binding on the controller:


[databaseController bind:@"content" toObject:databaseClient  
withKeyPath:@"database.selectedShortRangeContact" options:nil];


and then you'd bind your view to the object controller:

[sineWaveView bind:@"connectedContact" toObject:databaseController  
withKeyPath:@"content" options:nil];


Again, though, for a custom view subclass you'll have to implement  
what exactly such a binding means.  Bindings for your own classes  
don't come for free.



So, I set it up correctly and I don't get that error. However, even  
when it is set up correctly, I get the following error when I the  
view changes the value:


[ setValue:forUndefinedKey:]: this  
class is not key value coding-compliant for the key  
content.database.selectedShortRangeContact.


The above is a hint about using a key path where a key is expected.   
Note that it's complaining about a key, but when it prints out the  
name of the key it's trying to work with, it's a key path.


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: Trying To Understand Bindings

2008-12-13 Thread Ken Thomases

On Dec 13, 2008, at 1:40 AM, Bridger Maxwell wrote:

Woops, I posted some wrong code which might confuse the issue. This  
is the

real code that binds the view to the dictionary, but only sends
notifications from the view to the dictionary (and not the other way
around).
[databaseClient bind:@"database.selectedShortRangeContact"
toObject:sineWaveView withKeyPath:@"connectedContact" options:nil];


Well, that sort of explains why the one-way-ness that you were seeing  
was in the opposite direction of what I would expect.


However, that bind:... invocation is all wrong.  The one in your  
original message makes more sense.  You typically bind a view to a  
controller, not the other way around.


I would expect the above to cause errors due to the fact that the  
binding named is in the form of a key path, when it should be a  
binding name (which may be a property name).


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: Trying To Understand Bindings

2008-12-13 Thread Quincey Morris

On Dec 12, 2008, at 22:19, Bridger Maxwell wrote:

I have a custom view subclass (sineWaveView) that the user interacts  
with to change a property (connectedContact). I would like to bind  
this to a value (selectedShortRangeContact) in a dictionary  
(database) in another object (databaseClient). Simple, right?  
Anyway, I establish the binding like so:


[sineWaveView bind:@"connectedContact" toObject:databaseClient  
withKeyPath:@"database.selectedShortRangeContact" options:nil];


This question gets asked often enough that it should be in a FAQ  
somewhere...


[NSObject bind:toObject:...] does *not* define a binding, but just  
establishes an already-defined binding between objects. The binding  
definition is a collection of behaviors plus an exposed binding name.  
To use a custom binding, you must first define this behavior, giving  
it a binding name (which is *not* a key or key-path). Then you  
establish the binding using that name as a parameter to [NSObject  
bind:toObject:...].


If you go ahead and use a key as the binding name, you get the one-way  
limited behavior you saw, but it really should produce an error since  
it's not really working as a binding.


How do you define the behavior of a binding? Well, an example is  
described in:



http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html

The value of bindings is their ease of use in IB. Programmatically,  
defining new bindings is probably more trouble than it's worth -- you  
may as well just program the observer behavior you want directly.



___

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: Programmatically constructing list of variable arguments?

2008-12-13 Thread Gustavo Pizano
Hi, I tried to encode the CAlayer, but when decoding, all the info of  
the layer its lost.

dunno what happened, the other info of the object it's good.

G

On 13.12.2008, at 6:19, Michael Ash wrote:


On Fri, Dec 12, 2008 at 12:02 PM, Jonathan del Strother
 wrote:
On Fri, Dec 12, 2008 at 4:42 PM, Michael Ash  
 wrote:

On Fri, Dec 12, 2008 at 9:41 AM, Jonathan del Strother
 wrote:

Maybe an example would be helpful.  Let's say I want to call
-[Bartender mixCocktailIngredients:(NSString*)ingredient ...],  
and I

want to call that with different arguments depending on the user's
preferences.
One way of doing so would be to use an if-statement, and just  
type out

all the possibilities:


Why don't you just rewrite -mixCocktailIngredients: to take an  
NSArray

instead of variable arguments? Seems like that's ultimately what you
need anyway, so just change it to be more sane. If you really love
variable arguments then you can write a vararg version that calls
through to the NSArray version after marshaling the arguments.


Sure, if -mixCocktailIngredients: was my own method, but it's not.
I'm calling something in an existing API.


Are you sure there's no non-vararg way to accomplish it? I would
consider any API that requires the use of varargs to use multiple
objects to be broken. Of course sometimes APIs really are broken and
you have to work around that, but I'd definitely first try searching
for a way around having to do what you request, or convincing whoever
is responsible for this API to un-break it and provide a non-vararg
method.

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

This email sent to gustavxcodepic...@gmail.com


___

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

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

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

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


Re: Programmatically constructing list of variable arguments? [Bad Post last one]

2008-12-13 Thread Gustavo Pizano

Forget the last post I made on this thread.

G
On 13.12.2008, at 11:00, Gustavo Pizano wrote:

Hi, I tried to encode the CAlayer, but when decoding, all the info  
of the layer its lost.

dunno what happened, the other info of the object it's good.

G

On 13.12.2008, at 6:19, Michael Ash wrote:


On Fri, Dec 12, 2008 at 12:02 PM, Jonathan del Strother
 wrote:
On Fri, Dec 12, 2008 at 4:42 PM, Michael Ash  
 wrote:

On Fri, Dec 12, 2008 at 9:41 AM, Jonathan del Strother
 wrote:

Maybe an example would be helpful.  Let's say I want to call
-[Bartender mixCocktailIngredients:(NSString*)ingredient ...],  
and I

want to call that with different arguments depending on the user's
preferences.
One way of doing so would be to use an if-statement, and just  
type out

all the possibilities:


Why don't you just rewrite -mixCocktailIngredients: to take an  
NSArray
instead of variable arguments? Seems like that's ultimately what  
you

need anyway, so just change it to be more sane. If you really love
variable arguments then you can write a vararg version that calls
through to the NSArray version after marshaling the arguments.


Sure, if -mixCocktailIngredients: was my own method, but it's not.
I'm calling something in an existing API.


Are you sure there's no non-vararg way to accomplish it? I would
consider any API that requires the use of varargs to use multiple
objects to be broken. Of course sometimes APIs really are broken and
you have to work around that, but I'd definitely first try searching
for a way around having to do what you request, or convincing whoever
is responsible for this API to un-break it and provide a non-vararg
method.

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

This email sent to gustavxcodepic...@gmail.com




___

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

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

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

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


Re: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)

2008-12-13 Thread Gustavo Pizano
Hi, I tried to encode the CAlayer, but when decoding, all the info of  
the layer its lost.

dunno what happened, the other info of the object it's good.

G


On 13.12.2008, at 6:16, Michael Ash wrote:


On Fri, Dec 12, 2008 at 3:43 PM, Gustavo Pizano
 wrote:
Hello. I want to send the following an object in a drag-n-drop  
operation, so

I need to transform it to a NSData

so I have this object

@interface Ship : NSObject  {

  int size;
  int impacts;
  ShipLocation * location;
  CALayer * shipImageLayer;

}

now, I was reading that I must implement  and implement the
-(id)initWithCoder:(NSCoder *)coder and -(void)encodeWithCoder: 
(NSCoder

*)coder methods,  so far so good,
then I can use the  encodeObject: forKey method of NSCoder class.  
so I will

have the following

-(id)initWithCoder:(NSCoder *)coder
{
  [coder encodeInt:size forKey:@"size"];
  [coder encodeInt:impacts forKey:@"impacts"];


}

but after I dunno how to code the location and the  shipImageLayer?  
I guess
ShipLocation should  implement  also and encode its  
attributes,
but in shipLocation there is also a CALayer, so I still have the  
question on

how to do it with a CALayer.


When you get to an object, you can simply encode it using [coder
encodeObject:obj forKey:@"key"]. Of course obj must implement NSCoding
as well, otherwise this will not work. For your own classes, you'll
need to implement NSCoding for everything that will get encoded.
CALayer already implements NSCoding so there's nothing tricky for that
one.

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

This email sent to gustavxcodepic...@gmail.com


___

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

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

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

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


Re: open package installer in bundle resources directory not working

2008-12-13 Thread Mark Allan

Dennis,

You need to set the launch path of the executable within your NSTask -  
currently you're passing /usr/bin/open as an argument to nothing.   
There are two ways to do this: firstly, using the same logic you've  
got below, you can have the launch path be a shell and pass /usr/bin/ 
open as an argument to the shell; alternatively, make /usr/bin/open  
the launch executable.


Option one, notice the added "-c" switch to the shell:
[task setLaunchPath: @"/bin/tcsh"];
	[task setArguments: [NSArray arrayWithObjects: @"-c", @"/usr/bin/ 
open", path, nil]];

Option two:
[task setLaunchPath: @"/usr/bin/open"];
[task setArguments: [NSArray arrayWithObjects: path, nil]];

Caveat: This is from memory, but it shouldn't be too far off.

Mark

On 13 Dec 2008, at 02:48, Denis Bohm wrote:
I'm trying to distribute an installer within my own application  
bundle in the resources directory and run it from my application.   
When I try to run it from the debugger I get the error "launch path  
not accessible".  However, if I then use the terminal to run the  
command by hand using the same path it works.


Anyone have any idea why it fails to run it from the application?



Code in my application:

NSTask* task = [[NSTask alloc] init];
NSString* path = [[NSBundle mainBundle]  
pathForResource:@"FTDIUSBSerialDriver" ofType:@"pkg"];

NSLog(path);
[task setArguments: [NSArray arrayWithObjects: @"/usr/bin/open",  
path, nil]];

[task launch];

Output from the debugger when it fails:

2008-12-12 18:34:15.179 Firefly Upload Center[3364:813] /Users/denis/ 
sandbox/firefly/design/device/upload/mac/UploadCenter/build/Debug/ 
Firefly Upload Center.app/Contents/Resources/FTDIUSBSerialDriver.pkg

(gdb) continue
Current language:  auto; currently objective-c
Firefly Upload Center: unexpected exception:  
NSInvalidArgumentException: launch path not accessible

-[NSConcreteTask launchWithDictionary:] (in Foundation) + 2490
-[NSConcreteTask launch] (in Foundation) + 41
	-[FDApplication applicationDidFinishLaunching:] (in Firefly Upload  
Center) (FDApplication.m:67)

_nsnote_callback (in Foundation) + 364
__CFXNotificationPost (in CoreFoundation) + 362
_CFXNotificationPostNotification (in CoreFoundation) + 179
	-[NSNotificationCenter postNotificationName:object:userInfo:] (in  
Foundation) + 128
	-[NSNotificationCenter postNotificationName:object:] (in  
Foundation) + 56

-[NSApplication _postDidFinishNotification] (in AppKit) + 125
-[NSApplication _sendFinishLaunchingNotification] (in AppKit) + 77
	-[NSApplication(NSAppleEventHandling) _handleAEOpen:] (in AppKit) +  
284
	-[NSApplication(NSAppleEventHandling)  
_handleCoreEvent:withReplyEvent:] (in AppKit) + 98
	-[NSAppleEventManager  
dispatchRawAppleEvent:withRawReply:handlerRefCon:] (in Foundation) +  
655


This works from the command line:

open "/Users/denis/sandbox/firefly/design/device/upload/mac/ 
UploadCenter/build/Debug/Firefly Upload Center.app/Contents/ 
Resources/FTDIUSBSerialDriver.pkg"


___

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: open package installer in bundle resources directory not working

2008-12-13 Thread Mark Allan
An easier way may be to get NSWorkspace to do the work for you using  
the "openFile:" message.


http://tinyurl.com/NSWorkspace

Mark

On 13 Dec 2008, at 11:01, Mark Allan wrote:

Dennis,

You need to set the launch path of the executable within your NSTask  
- currently you're passing /usr/bin/open as an argument to nothing.   
There are two ways to do this: firstly, using the same logic you've  
got below, you can have the launch path be a shell and pass /usr/bin/ 
open as an argument to the shell; alternatively, make /usr/bin/open  
the launch executable.


Option one, notice the added "-c" switch to the shell:
[task setLaunchPath: @"/bin/tcsh"];
	[task setArguments: [NSArray arrayWithObjects: @"-c", @"/usr/bin/ 
open", path, nil]];

Option two:
[task setLaunchPath: @"/usr/bin/open"];
[task setArguments: [NSArray arrayWithObjects: path, nil]];

Caveat: This is from memory, but it shouldn't be too far off.

Mark

On 13 Dec 2008, at 02:48, Denis Bohm wrote:
I'm trying to distribute an installer within my own application  
bundle in the resources directory and run it from my application.   
When I try to run it from the debugger I get the error "launch path  
not accessible".  However, if I then use the terminal to run the  
command by hand using the same path it works.


Anyone have any idea why it fails to run it from the application?



Code in my application:

NSTask* task = [[NSTask alloc] init];
NSString* path = [[NSBundle mainBundle]  
pathForResource:@"FTDIUSBSerialDriver" ofType:@"pkg"];

NSLog(path);
[task setArguments: [NSArray arrayWithObjects: @"/usr/bin/open",  
path, nil]];

[task launch];

Output from the debugger when it fails:

2008-12-12 18:34:15.179 Firefly Upload Center[3364:813] /Users/ 
denis/sandbox/firefly/design/device/upload/mac/UploadCenter/build/ 
Debug/Firefly Upload Center.app/Contents/Resources/ 
FTDIUSBSerialDriver.pkg

(gdb) continue
Current language:  auto; currently objective-c
Firefly Upload Center: unexpected exception:  
NSInvalidArgumentException: launch path not accessible

-[NSConcreteTask launchWithDictionary:] (in Foundation) + 2490
-[NSConcreteTask launch] (in Foundation) + 41
	-[FDApplication applicationDidFinishLaunching:] (in Firefly Upload  
Center) (FDApplication.m:67)

_nsnote_callback (in Foundation) + 364
__CFXNotificationPost (in CoreFoundation) + 362
_CFXNotificationPostNotification (in CoreFoundation) + 179
	-[NSNotificationCenter postNotificationName:object:userInfo:] (in  
Foundation) + 128
	-[NSNotificationCenter postNotificationName:object:] (in  
Foundation) + 56

-[NSApplication _postDidFinishNotification] (in AppKit) + 125
-[NSApplication _sendFinishLaunchingNotification] (in AppKit) + 77
	-[NSApplication(NSAppleEventHandling) _handleAEOpen:] (in AppKit)  
+ 284
	-[NSApplication(NSAppleEventHandling)  
_handleCoreEvent:withReplyEvent:] (in AppKit) + 98
	-[NSAppleEventManager  
dispatchRawAppleEvent:withRawReply:handlerRefCon:] (in Foundation)  
+ 655


This works from the command line:

open "/Users/denis/sandbox/firefly/design/device/upload/mac/ 
UploadCenter/build/Debug/Firefly Upload Center.app/Contents/ 
Resources/FTDIUSBSerialDriver.pkg"


___

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/markjallan%40blueyonder.co.uk

This email sent to markjal...@blueyonder.co.uk




___

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

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

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

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


Re: How to create blunt Edges for a NSWindow

2008-12-13 Thread Andrew Farmer

On 11 Dec 08, at 08:09, Arjun SM wrote:

Hi,
I am a novice in cocoa and i have created a simple app which has  
only one

window.
I wanted to display a bottom bar that has blunt edges at the corners  
of the

window. (Ex Finder windows bottom bar)


We answered the exact same question a few days ago:

http://www.cocoabuilder.com/archive/message/cocoa/2008/12/12/225221
___

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


Main menu crash when migrating to Leopard

2008-12-13 Thread Klaus Backert
Being about to migrate a Cocoa document-based application of mine,  
which is under development, from Mac OS X 10.4.11 and Xcode 2.5 to Mac  
OS X 10.5.5 and Xcode 3.1.2 (on a PowerPC G5) the application crashes  
in the phase of – I think – setting up and displaying the main menu.  
This didn't happen before.


Here is an excerpt from the debugger console output ("Blotto" is the  
application's product name):


2008-12-13 12:57:33.701 Blotto[715:813] NSExceptionHandler has  
recorded the following exception:
NSUnknownKeyException -- [< 0x45fdd0>  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key inputBarExtent.
Stack trace:  0x5cdbc  0x93f1f4ec  0x90d8dabc  0x923a2b40  0x95d54d14   
0x92297734  0x96450620  0x96442d6c  0x9644296c  0x9548c830   
0x9548c210  0x9545ce94  0x2ebc  0x2e5c
2008-12-13 12:57:33.724 Blotto[715:813] [  
exceptionHandler:shouldHandleException:mask:] invoking at /Volumes/C/ 
Development/Projects/Blotto/BloAppDelegate.mm:392
2008-12-13 12:57:33.725 Blotto[715:813] NSExceptionHandler will now  
suspend the current thread and wait for debugger attachment

NSExceptionHandlerExceptionRaiser (in ExceptionHandling) + 208
objc_exception_throw (in libobjc.A.dylib) + 72
-[NSException init] (in CoreFoundation) + 0
-[CIFilter setValue:forUndefinedKey:] (in QuartzCore) + 200
-[NSObject(NSKeyValueCoding) setValue:forKey:] (in Foundation) + 264
-[CIFilter setValue:forKey:] (in QuartzCore) + 308
ResetMenuBarWindowFilter() (in HIToolbox) + 464
ShowBar(unsigned char, unsigned char) (in HIToolbox) + 312
SetSystemUIMode (in HIToolbox) + 284
-[NSApplication finishLaunching] (in AppKit) + 776
-[NSApplication run] (in AppKit) + 100
NSApplicationMain (in AppKit) + 444
main (in Blotto) (main.m:9)
start (in Blotto) + 68
(gdb) continue
2008-12-13 12:57:46.521 Blotto[715:813] [<0xa0411d2c> 0x45fdd0> setValue:forUndefinedKey:]: this class is not  
key value coding-compliant for the key inputBarExtent.

(gdb) continue
2008-12-13 12:57:56.041 Blotto[715:813] An uncaught exception was raised
2008-12-13 12:57:56.042 Blotto[715:813] [<0xa0411d2c> 0x45fdd0> setValue:forUndefinedKey:]: this class is not  
key value coding-compliant for the key inputImage.
2008-12-13 12:57:56.043 Blotto[715:813] [  
exceptionHandler:shouldLogException:mask:] invoking at /Volumes/C/ 
Development/Projects/Blotto/BloAppDelegate.mm:404
2008-12-13 12:57:56.048 Blotto[715:813] NSExceptionHandler has  
recorded the following exception:
NSUnknownKeyException -- [< 0x45fdd0>  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key inputImage.
Stack trace:  0x90d8de58  0x93f1f4ec  0x90d8dabc  0x923a2b40   
0x95d54d14  0x92297734  0x92297f98  0x95d33bd4  0x9548caac   
0x9548c210  0x9545ce94  0x2ebc  0x2e5c
2008-12-13 12:57:56.063 Blotto[715:813] [  
exceptionHandler:shouldHandleException:mask:] invoking at /Volumes/C/ 
Development/Projects/Blotto/BloAppDelegate.mm:392
2008-12-13 12:57:56.064 Blotto[715:813] NSExceptionHandler will now  
suspend the current thread and wait for debugger attachment

__raiseError (in CoreFoundation) + 188
objc_exception_throw (in libobjc.A.dylib) + 72
-[NSException init] (in CoreFoundation) + 0
-[CIFilter setValue:forUndefinedKey:] (in QuartzCore) + 200
-[NSObject(NSKeyValueCoding) setValue:forKey:] (in Foundation) + 264
-[CIFilter setValue:forKey:] (in QuartzCore) + 308
-[CIFilter dealloc] (in QuartzCore) + 184
NSPopAutoreleasePool (in Foundation) + 520
-[NSApplication finishLaunching] (in AppKit) + 1412
-[NSApplication run] (in AppKit) + 100
NSApplicationMain (in AppKit) + 444
main (in Blotto) (main.m:9)
start (in Blotto) + 68
[Switching to process 715 thread 0x3903]
[Switching to process 715 thread 0x3903]
kill
quit

I realize, that the functions SetSystemUIMode, ShowBar, and  
ResetMenuBarWindowFilter belong to Carbon (I have never done much with  
Carbon). I tried to find something relevant in the local documention  
and with google on the web using a lot of different search criterions,  
but got no useful result.


As one attempt to solve the problem I had deleted the old MainMenu.nib  
from the project, created a completely new MainMenu.xib – xib! –, and  
integrated it into the Xcode project. This didn't help.


Could someone please help?! This is the first time after years, that I  
don't know what to do :-(


Some more information:
- project format: Xcode 3.1 compatible
- architecture: native
- base SDK: Mac OS X 10.5
- compiler: GCC 4.0
- deployment target: Mac OS X 10.5
- garbage collection: off

Thanks in advance
Klaus

___

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

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

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

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


Re: How to handle document scaling in an NSRulerView Client?

2008-12-13 Thread Carlos Eduardo Mello


On Dec 13, 2008, at 3:17AM, Dave Fernandes wrote:

Not sure if I'm missing your point, but you can always call  
registerUnitWithName again with the new conversion factor after  
changing the view scale.




With the same unit name? That's weird. Given the method name, and the  
fact that it's a class method, I had the impression this was a more  
or less global/permanent setting for the ruler, and that somehow I  
would need to unregister the unit before defining another one with  
the same 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: - [NSBitmapImageRep tiffRepresentation] malloc error

2008-12-13 Thread Thomas Clement

On Dec 12, 2008, at 11:28 PM, David Duncan wrote:


On Dec 12, 2008, at 12:50 PM, Thomas Clement wrote:


The image was 14340 x 14173 (8-bit RGB with no alpha).

Also I got these messages in the console:
kernel[0]: (default pager): [KERNEL]: no space in available paging  
segments

malloc: *** mmap(size=1073741824) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Attempt to allocate 1073741824 bytes for NS/CFData failed


Yup, your running into malloc() and VM space issues.


What approach should I take to handle large images?



I don't think there is an equivalent to this in AppKit, but you can  
do this using Core Graphics & ImageIO. The MassiveImage sample  
demonstrates how you can stream very large images (up to 32k x 32k  
iirc) to disk.





Looks like this is what I need.

Now I also need to read pixel values from images on disk. For the same  
reason I'd like to avoid loading the entire image into memory.
Is it possible to access pixel values piece by piece? I can't find how  
to do that using data providers.



Thanks to you and Nick for the help!
Thomas

___

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


Rotating a CALayer more than once is not working

2008-12-13 Thread Gustavo Pizano

Hello.

I want to rotate a CALayer by 90 degrees each time I click on it. but  
the first attempt I tried i rotated the layer just once, and then I  
click on it again and nothing happened.


this is the code.

-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.contents != nil) {
NSLog(@"%@",[nLayer name]);
		[nLayer setTransform:CATransform3DMakeRotation(90 * M_PI / 180, 0,  
0, 1.0)];


}

}


then I tried the following, but of course because the  position during  
the animation is temporary once the animation its over it returns to  
the original position


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {
NSLog(@"%@",[nLayer name]);
CAAnimation* rotateAnimation = [self animateForRotating];   
[rotateAnimation setValue:nLayer forKey:@"rotatedLayer"];
[rotateAnimation setDelegate:self]; 
[nLayer addAnimation:rotateAnimation forKey:@"whatever"];

}

}


-(CAAnimation *)animateForRotating
{
float radians = 90 * M_PI / 180;
CATransform3D transform;
transform = CATransform3DMakeRotation(radians, 0, 0, 1.0);
CABasicAnimation* animation;
animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:transform];
animation.duration = 0.4;
animation.cumulative = NO;
return animation;
}


-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
CALayer * nLayer = [anim valueForKey:@"rotatedLayer"];
	//[nLayer  
setPosition:CGPointMake(nLayer.frame.origin.x,nLayer.frame.origin.y)];

}

SO i dunno how to make the ayer stay in the final position after being  
rotated. any  ideas what can I do?


Thanks

Gustavo

___

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: Looking for info on creating Plugins/Modules

2008-12-13 Thread Tom Jones
This is great, thanks! I think you even covered follow up questions,  
now it's off to read the Apple documentation.


Thanks again,
tom



On Dec 12, 2008, at 1:05 AM, Chris Hanson wrote:


On Dec 12, 2008, at 12:16 AM, Kyle Sluder wrote:

On Fri, Dec 12, 2008 at 2:58 AM, Tom Jones   
wrote:
I'm hoping someone could point me in the right direction. Where  
would I read
up on how to create modules or plugins for a Cocoa application?  
I'm not even

sure I'm asking the right question :-)


CFPlugin.


CFPlugIn is a poor choice for Cocoa applications because it assumes  
a COM-style infrastructure and ends up both requiring more work than  
and providing fewer features than the Objective-C runtime gives you  
for free.  I would not recommend CFPlugIn for Cocoa (or really any  
new) development.


What you want to use is NSBundle and its concept of "principal  
class."  You can put a framework in your application that both it  
and your developers' plug-ins can link against, which provides an  
API for your application.  Among other things, your application's  
API can include a "MyAppPlugIn" class that your developers' plug-in  
bundles must subclass and specify as the NSPrincipalClass in their  
Info.plist file.


Then it's simply a matter of looping through an appropriate set of  
directories at application start-up, loading all of the bundles you  
find in those directories that have an appropriate path extension  
(e.g. those whose path extension is "myappplugin"), asking each  
bundle for its principal class, and creating an instance of its  
principal class provided it's the right kind of class.  (Why do you  
need to do an -isKindOfClass: check?  Because -[NSBundle  
principalClass] is documented to use the first class found in a  
bundle if no NSPrincipalClass key is specified in its


Some points you'll want to remember in designing your plug-in  
architecture:


- Provide a user default that developers can use to add to your plug- 
in search paths.  By default you'll want to probably search for plug- 
ins inside your application, and then in your application's  
Application Support folder in every domain (user, local, system,  
network).  You should provide the ability for a developer to tell a  
single instance of your application, during debugging, that it  
should look first in another directory.  Since you can override user  
default values using command-line arguments, they're the ideal  
solution there:  During debugging your developers can pass - 
AdditionalPlugInPath to your app and have it look in their build  
folder first.


- Only load the first plug-in with a given identifier.  In  
combination with the search path strategy above, this means a  
developer can easily have the GM version of a plug-in installed on  
their system and also easily do development of the next version.


- Use a path extension other than "bundle" or "plugin" for your own  
plug-ins.  These two path extensions are utterly generic; without  
specific support, one application can't magically use another  
application's plug-ins, so they shouldn't be named in a way that  
implies it's possible.


- Your plug-ins should have a document type and UTI declared in your  
app's Info.plist so they can be recognized as file packages rather  
than folders by the Finder and get a nice icon.  The UTI for your  
plug-ins should conform to the "com.apple.bundle" UTI.  (Having a  
distinct path extension and UTI means you could write a Quick Look  
importer for plug-ins that, say, shows some information about the  
plug-in to the user when they highlight it in the Finder and press  
the space bar.)


- Remember binary compatibility.  Don't just expose all of the guts  
of your application through your framework, create a properly- 
abstracted API that you feel comfortable supporting for at least a  
couple versions of your application.  Don't underestimate how  
attached users are to the things they wind up able to accomplish  
with third-party plug-ins to your application, especially if they  
can do things with plug-ins that get saved in your application's  
documents.


- The Apple Publications Style Guide term is "plug-in" with a hyphen  
in prose, "Plug-in" capitalized, and "PlugIn" when using intercaps  
in class and directory names.


Hope this is useful!

  -- Chris



___

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 handle document scaling in an NSRulerView Client?

2008-12-13 Thread Dave Fernandes
I can't say whether Apple designed it this way, but it's been working  
for me to call registerUnitWithName with the conversion factor and  
then [theRuler setMeasurementUnits:measurementName] immediately after  
changing the measurement units.


This works even if you have multiple views using the same registered  
measurement unit, but with different conversion factors. The  
setMeasurementUnits method must be copying the conversion factor in  
effect at the time of the call.


(I hope someone will correct me if I'm doing anything that's not  
blessed by the Cocoa framework.)


Dave

On Dec 13, 2008, at 8:11 AM, Carlos Eduardo Mello wrote:



On Dec 13, 2008, at 3:17AM, Dave Fernandes wrote:

Not sure if I'm missing your point, but you can always call  
registerUnitWithName again with the new conversion factor after  
changing the view scale.




With the same unit name? That's weird. Given the method name, and  
the fact that it's a class method, I had the impression this was a  
more or less global/permanent setting for the ruler, and that  
somehow I would need to unregister the unit before defining another  
one with the same 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


How to use NSString with CommonCrypto HMAC correctly?

2008-12-13 Thread Alex Reynolds
I am trying to use the HMAC SHA-1 components of Apple's CommonCrypto  
library with NSStrings, and I am running into some difficulty.


I have the following method:

- (NSString *) hmacSha1:(NSString *)key data:(NSString *)data
{   
unsigned char digest[CC_SHA1_DIGEST_LENGTH] = {0};
char *keychar = (char *)malloc([key length]);
char *datachar = (char *)malloc([data length]);
strcpy(keychar, [key UTF8String]);
strcpy(datachar, [data UTF8String]);

CCHmacContext hctx;
CCHmacInit(&hctx, kCCHmacAlgSHA1, keychar, strlen(keychar));
CCHmacUpdate(&hctx, datachar, strlen(datachar));
CCHmacFinal(&hctx, digest);
	NSData *encStrD = [NSData dataWithBytes:digest  
length:CC_SHA1_DIGEST_LENGTH];
	NSString *encStr = [NSString base64StringFromData:encStrD length: 
[encStrD length]];


free(keychar);
free(datachar);

	return [[[NSString alloc] initWithString:[NSString  
base64StringFromData:encStrD length:[encStrD length]]] autorelease];

}

My key is derived from text entered into a UITextField. I call its - 
text method, which returns a NSString instance.


Problem:

When I pass in the NSString "key" from this UITextField, the value of  
"digest" is wrong. (I have a JavaScript utility that I can use to  
calculate correct digests, for verification purposes.)


Workaround:

If I manually set "key" inside the method, then "digest" is computed  
correctly:


- (NSString *) hmacSha1:(NSString *)key data:(NSString *)data {

key = @"here_is_my_secret_key_blah_blah_blah";
...
}

Steps to troubleshoot:

I have two lines in this method (not shown) that log the bytes and  
length of the key:


NSLog(@"hmacSha1secretKeyB: %@", [[NSData dataWithBytes:keychar  
length:strlen(keychar)] description]);

NSLog(@"hmacSha1secretKeyL: %d", strlen(keychar));

I have other similar log statements that show the bytes and length of  
the digest.


The strange thing is that the key bytes that are logged are identical,  
whether the key's NSString value comes from the UITextField -text  
method call, or whether I use key = @"..."


Nonetheless, when the key comes from the UITextField, the digest is  
wrong. When the key is manually set, the digest is correct.


Why would manually assigning a value to the key variable resolve this  
issue?


I apologize if this is a dumb question. I have been tearing my hair  
out to get this working. Thanks for any advice.


Regards,
Alex

NB. Please ignore the NSString helper method that does base 64  
encoding, which I have tested separately. The values that I need to  
test are actually the digest, not the base 64 encoding, which comes  
after.

___

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


__NSGetTransformedIdealAdvances crash

2008-12-13 Thread Mark Alldritt

Hello All,

I'm experiencing an extremely intermittent crash, and I'm not able to  
figure out what I'm doing to cause it.  I have not been able to work  
up a test case for it.  It just seems to happen, and when it happens  
it happens a few times (1-3) in a row and then simply stops  
happening.  When I bring in the Xcode debugger to try and isolate a  
cause, it stops happening.  Here's the stack trace:


Thread 0 Crashed:
0   com.apple.AppKit  	0x0157b2a5  
__NSGetTransformedIdealAdvances + 543
1   com.apple.AppKit  	0x0160af9d - 
[NSLayoutManager(NSTextViewSupport)  
showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment 
:] + 447
2   com.apple.AppKit  	0x01609a1f - 
[NSLayoutManager(NSPrivate)  
_drawGlyphsForGlyphRange:atPoint:parameters:] + 9206
3   com.apple.AppKit  	0x01607623 - 
[NSLayoutManager(NSTextViewSupport) drawGlyphsForGlyphRange:atPoint:]  
+ 70
4   com.latenightsw.ScriptDebugger	0x000f42ed -[LNSTextLayoutManager  
drawGlyphsForGlyphRange:atPoint:] + 80141
5   com.apple.AppKit  	0x01603c13 -[NSTextView drawRect:]  
+ 1435
6   com.latenightsw.ScriptDebugger	0x001a88c2 -[SDOSAScriptTextView  
drawRect:] + 22626
7   com.apple.AppKit  	0x0160351b -[NSTextView  
_drawRect:clip:] + 2579
8   com.apple.AppKit  	0x0159c0d5 -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 1819
9   com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
10  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
11  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
12  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
13  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
14  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
15  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
16  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
17  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
18  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
19  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
20  com.apple.AppKit  	0x0159cb0b -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 4433
21  com.apple.AppKit  	0x0159b5f3 -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 306
22  com.apple.AppKit  	0x01598117 -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] +  
3090
23  com.apple.AppKit  	0x014d8b77 -[NSView  
displayIfNeeded] + 933
24  com.apple.AppKit  	0x014d8725 -[NSWindow  
displayIfNeeded] + 189
25  com.apple.AppKit  	0x014d8548  
_handleWindowNeedsDisplay + 436
26  com.apple.CoreFoundation  	0x012dc9c2 __CFRunLoopDoObservers +  
466

27  com.apple.CoreFoundation0x012ddd1c CFRunLoopRunSpecific + 844
28  com.apple.CoreFoundation0x012decf8 CFRunLoopRunInMode + 88
29  com.apple.HIToolbox   	0x029ad480  
RunCurrentEventLoopInMode + 283
30  com.apple.HIToolbox   	0x029ad1d2 ReceiveNextEventCommon +  
175
31  com.apple.HIToolbox   	0x029ad10d  
BlockUntilNextEventMatchingListInMode + 106

32  com.apple.AppKit0x014d63ed _DPSNextEvent + 657
33  com.apple.AppKit  	0x014d5ca0 -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:] + 128

34  com.apple.AppKit0x014cecdb -[NSApplication run] + 795
35  com.omnigroup.OmniAppKit0x00591f76 -[OAApplication run] + 406
36  com.apple.AppKit0x0149bf14 NSApplicationMain + 574
37  com.latenightsw.ScriptDebugger  0x00025a0a main() + 138
38  com.latenightsw.ScriptDebugger  0x2cfc 0x1000 + 7420
39  com.latenightsw.ScriptDebugger

Re: How to use NSString with CommonCrypto HMAC correctly?

2008-12-13 Thread Chris Ridd


On 13 Dec 2008, at 16:01, Alex Reynolds wrote:

I am trying to use the HMAC SHA-1 components of Apple's CommonCrypto  
library with NSStrings, and I am running into some difficulty.


I have the following method:

- (NSString *) hmacSha1:(NSString *)key data:(NSString *)data
{   
unsigned char digest[CC_SHA1_DIGEST_LENGTH] = {0};
char *keychar = (char *)malloc([key length]);
char *datachar = (char *)malloc([data length]);
strcpy(keychar, [key UTF8String]);
strcpy(datachar, [data UTF8String]);


That's not going to work. The length of an NSString is not the same as  
the number of bytes you need to hold a NUL-terminated UTF-8 version of  
it. You'll always end up mallocing too few bytes :-(


Something like this would be more simpler/more accurate:

char *keychar = strdup([key UTF8String]);

or if you don't have or like strdup(), this:

char *t = [key UTFString];
char *keychar = (char *)malloc(strlen(t) + 1);
strcpy(keychar, t);

Dunno about the rest of your code, but that jumped out at me.

Cheers,

Chris
___

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


Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread John Love
I do not understand why this code completes with the specified  
application not being active .. when it really is?  I really need your  
help.


BOOL AppActive = NO;
NSWorkspace  *workSpace;
NSArray  *runningAppDictionaries;
NSDictionary *aDictionary;

workSpace = [NSWorkspace sharedWorkspace];
runningAppDictionaries = [workSpace launchedApplications];

for (aDictionary in runningAppDictionaries) {

		if ([aDictionary valueForKey:@"NSApplicationName"] == @"My  
Application") {

AppActive = YES;
break;
}

}

return AppActive;

Thanks ...

John Love
Touch the Future! Teach!

___

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


setNeedsDisplay Equivalent for NSMenuItem?

2008-12-13 Thread Chunk 1978
i've noticed in some menu bar apps like Google's GMail Notifier, the
time since last email check will display when changed while the menu
is open. how can i emulate this behavior in my own NSMenuItem that
changes every 30 seconds (it shows a timer)?  currently it will change
the setTitle of the NSMenuItem, but will only display it's update the
next time the user opens the menu.
___

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

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

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

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


Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread Jean-Daniel Dupas


Le 13 déc. 08 à 18:14, John Love a écrit :

I do not understand why this code completes with the specified  
application not being active .. when it really is?  I really need  
your help.


BOOL AppActive = NO;
NSWorkspace  *workSpace;
NSArray  *runningAppDictionaries;
NSDictionary *aDictionary;

workSpace = [NSWorkspace sharedWorkspace];
runningAppDictionaries = [workSpace launchedApplications];

for (aDictionary in runningAppDictionaries) {

		if ([aDictionary valueForKey:@"NSApplicationName"] == @"My  
Application") {

AppActive = YES;
break;
}

}

return AppActive;

Thanks ...


Because operator overriding does not exists in Obj-C and so, == is a  
pointer comparaison and not a string comparaison.


use the isEqual: method to compare two object.


___

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

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

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

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


Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread jmunson

Specifically, in his case, wouldn't it be:

aDictionary valueForKey:@"NSApplicationName"] isEqualToString:  
@"MyApplication"


?

Quoting Jean-Daniel Dupas :



Le 13 déc. 08 à 18:14, John Love a écrit :

I do not understand why this code completes with the specified   
application not being active .. when it really is?  I really need   
your help.


BOOL AppActive = NO;
NSWorkspace  *workSpace;
NSArray  *runningAppDictionaries;
NSDictionary *aDictionary;

workSpace = [NSWorkspace sharedWorkspace];
runningAppDictionaries = [workSpace launchedApplications];

for (aDictionary in runningAppDictionaries) {

if ([aDictionary valueForKey:@"NSApplicationName"] == @"My 
Application") {
AppActive = YES;
break;
}

}

return AppActive;

Thanks ...


Because operator overriding does not exists in Obj-C and so, == is a
pointer comparaison and not a string comparaison.

use the isEqual: method to compare two object.


___

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/jmunson%40his.com

This email sent to jmun...@his.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: setNeedsDisplay Equivalent for NSMenuItem?

2008-12-13 Thread Ashley Clark

On Dec 13, 2008, at 11:18 AM, Chunk 1978 wrote:


i've noticed in some menu bar apps like Google's GMail Notifier, the
time since last email check will display when changed while the menu
is open. how can i emulate this behavior in my own NSMenuItem that
changes every 30 seconds (it shows a timer)?  currently it will change
the setTitle of the NSMenuItem, but will only display it's update the
next time the user opens the menu.


You'll probably have to use a custom view for that item. Look at the  
PhotoSearch example code for how to add custom views to a menu.


http://developer.apple.com/samplecode/PhotoSearch/index.html


Ashley
___

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

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

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

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


Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread Jean-Daniel Dupas
Yes, you can use this variant in this case, but the result will be the  
same.


Quote from isEqualToString: documentation

	«When you know both objects are strings, this method is a faster way  
to check equality than isEqual:»



Le 13 déc. 08 à 18:41, jmun...@his.com a écrit :


Specifically, in his case, wouldn't it be:

aDictionary valueForKey:@"NSApplicationName"] isEqualToString:  
@"MyApplication"


?

Quoting Jean-Daniel Dupas :



Le 13 déc. 08 à 18:14, John Love a écrit :

I do not understand why this code completes with the specified   
application not being active .. when it really is?  I really need   
your help.


BOOL AppActive = NO;
NSWorkspace  *workSpace;
NSArray  *runningAppDictionaries;
NSDictionary *aDictionary;

workSpace = [NSWorkspace sharedWorkspace];
runningAppDictionaries = [workSpace launchedApplications];

for (aDictionary in runningAppDictionaries) {

		if ([aDictionary valueForKey:@"NSApplicationName"] == @"My  
Application") {

AppActive = YES;
break;
}

}

return AppActive;

Thanks ...


Because operator overriding does not exists in Obj-C and so, == is a
pointer comparaison and not a string comparaison.

use the isEqual: method to compare two object.


___

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/jmunson%40his.com

This email sent to jmun...@his.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/devlists%40shadowlab.org

This email sent to devli...@shadowlab.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


Cancel CGEvent

2008-12-13 Thread sheen mac
Hi All,

Is  it possible to cancel CGEvent for mouse at CGEventTrapCallBack ?.
Could suggest some link info?.

Thanks In Advance,
Sheen




  
___

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: Cancel CGEvent

2008-12-13 Thread Jean-Daniel Dupas


Le 13 déc. 08 à 19:19, sheen mac a écrit :


Hi All,

Is  it possible to cancel CGEvent for mouse at CGEventTrapCallBack ?.
Could suggest some link info?.

Thanks In Advance,
Sheen



From the CGEventTapCallBack reference:

If the event tap is an active filter, your callback function should  
return one of the following:


	• The (possibly modified) event that is passed in. This event is  
passed back to the event system.


	• A newly-constructed event. After the new event has been passed back  
to the event system, the new event will be released along with the  
original event.


• NULL if the event passed in is to be deleted.



Did you try that and it didn't work, or have you just miss that in the  
reference ?


___

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

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

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

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


How to make a CALayer dont get blur when rotating.

2008-12-13 Thread Gustavo Pizano
Hello well finally I manage to rotate the CALayer each time I click on  
it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its kinda  
blurry I dunno how to rotate the layer without loosing quality.


the contents of the layer its .png


Thanks


Gus
___

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


Distributed Objects with Garbage Collection (on PPC)

2008-12-13 Thread Bridger Maxwell
Hey,

I am working on a networking system that uses distributed objects. This is a
large collaboration between students, and I thought garbage collection would
be perfect for new Cocoa programmers, so we wouldn't have to deal with
memory management quite yet. The network will be a mix of Intel and PPC, so
there is another complication too.

Everything seems to work on Intel, it is on PPC that we have the problems.
When we first make the connection to the server, we can message the remote
object just fine. It is when we try to message the distant object at later
times that we get errors. This sounds enough like a memory management
problem. Sure enough, when turn off garbage collection, and add in the
proper retain calls, it seems to function fine. Does distributed objects
work with garbage collection (on PPC)? Here are some of the errors I am
getting.

Console output:

2008-12-13 11:42:02.204 StationTerminal[715:10b] *** -[NSAutoreleasePool
objectForKey:]: unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.222 StationTerminal[715:10b] Exception name:
NSInvalidArgumentException Reason: *** -[NSAutoreleasePool objectForKey:]:
unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.225 StationTerminal[715:10b] *** -[NSLock lock]:
deadlock ( '(null)')
2008-12-13 11:42:02.227 StationTerminal[715:10b] *** Break on _NSLockError()
to debug.

Note here, that NSAutoreleasePool is getting objectForKey:, as if it were a
dictionary. It is not always NSAutoreleasePool getting the message, we have
also got NSCFDataType and some internal color-related class receiving this
message, among others. Sound enough like a memory mangement issue?

Here is the call stack when that error is thrown. (the last call that is in
my program is #18, resetSubscriptions)

#0  0x8260 in ?? ()
#1  0x96a7fb94 in CFSocketCreateRunLoopSource ()
#2  0x91c1ef90 in __NSAddSocketToLoopForMode ()
#3  0x96a4a314 in CFDictionaryApplyFunction ()
#4  0x91c1fdcc in -[NSSocketPort scheduleInRunLoop:forMode:] ()
#5  0x91aed0c4 in +[NSRunLoop(NSRunLoop) _runLoop:addPort:forMode:] ()
#6  0x91c1f084 in -[NSSocketPort addConnection:toRunLoop:forMode:] ()
#7  0x91aecc64 in -[NSConnection addPortsToRunLoop:] ()
#8  0x91b0ae3c in -[NSConnection _incrementLocalProxyCount] ()
#9  0x91b0c678 in lookUpOrCreateLocalProxyForObject ()
#10 0x91b07128 in -[NSConcretePortCoder encodeObject:isBycopy:isByref:] ()
#11 0x91b06910 in _NSWalkData2 ()
#12 0x91b07974 in -[NSConcretePortCoder encodeInvocation:] ()
#13 0x91b07370 in -[NSConcretePortCoder encodeObject:isBycopy:isByref:] ()
#14 0x91b06910 in _NSWalkData2 ()
#15 0x91b057bc in -[NSConnection sendInvocation:internal:] ()
#16 0x96aea71c in ___forwarding___ ()
#17 0x96aea838 in __forwarding_prep_0___ ()
#18 0x2afc in -[SCPushDatabaseClient resetSubscriptions]
(self=0x1029d70, _cmd=0x9bcc) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:88
#19 0x3438 in -[SCPushDatabaseClient setSimulator:] (self=0x1029d70,
_cmd=0x9c1c, simulatorName=0x1020310) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:157
#20 0x91b445d8 in _NSSetObjectValueAndNotify ()
#21 0x91af2f88 in -[NSObject(NSKeyValueCoding) setValue:forKey:] ()
#22 0x91b65768 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#23 0x2588 in -[SCPushDatabaseClient
setValue:forKeyPath:sentFromServer:] (self=0x1029d70, _cmd=0x9b80,
value=0x1020310, keyPath=0x106c0c0, fromServer=0 '\000') at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:64
#24 0x23b8 in -[SCPushDatabaseClient setValue:forKeyPath:]
(self=0x1029d70, _cmd=0x91f99e38, value=0x1020310, keyPath=0x106c0c0) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:47
#25 0x91b65734 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#26 0x91b65734 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#27 0x94feda4c in -[NSBinder
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
()
#28 0x94fed81c in -[NSBinder setValue:forBinding:error:] ()
#29 0x94fed4d4 in -[NSValueBinder
_applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
()
#30 0x94fed134 in -[NSValueBinder
applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
()
#31 0x94fecdcc in -[NSValueBinder performAction:] ()
#32 0x94fecca8 in -[_NSBindingAdaptor
_objectDidTriggerAction:bindingAdaptor:] ()
#33 0x94e4fff0 in -[NSControl sendAction:to:] ()
#34 0x94e500e0 in -[NSApplication sendAction:to:from:] ()
#35 0x94eeb8a8 in -[NSMenu performActionForItemAtIndex:] ()
#36 0x94eeb5d8 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] ()
#37 0x94eccd90 in AppKitMenuEventHandler ()
#38 0x901ed3cc in DispatchEventToHandler

Re: Rotating a CALayer more than once is not working

2008-12-13 Thread Steve Bird


On Dec 13, 2008, at 9:50 AM, Gustavo Pizano wrote:


Hello.

I want to rotate a CALayer by 90 degrees each time I click on it.  
but the first attempt I tried i rotated the layer just once, and  
then I click on it again and nothing happened.


You are not TRANSFORMING each time.
You are setting THE transformation to 90 degrees.  When you click  
again, you are again setting THE transformation to 90 degrees (where  
it was already).

Try adding 90 degrees EACH time to your angle.

If you're facing North, it's the difference between "turn left" and  
"turn West".


"Turn West" only works the first time.  "Turn Left" works every time.




this is the code.

-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.contents != nil) {
NSLog(@"%@",[nLayer name]);
		[nLayer setTransform:CATransform3DMakeRotation(90 * M_PI / 180, 0,  
0, 1.0)];




Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175


___

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: Distributed Objects with Garbage Collection (on PPC)

2008-12-13 Thread Bill Bumgarner

On Dec 13, 2008, at 11:26 AM, Bridger Maxwell wrote:
Everything seems to work on Intel, it is on PPC that we have the  
problems.
When we first make the connection to the server, we can message the  
remote
object just fine. It is when we try to message the distant object at  
later

times that we get errors. This sounds enough like a memory management
problem. Sure enough, when turn off garbage collection, and add in the
proper retain calls, it seems to function fine. Does distributed  
objects
work with garbage collection (on PPC)? Here are some of the errors I  
am

getting.

Console output:

2008-12-13 11:42:02.204 StationTerminal[715:10b] *** - 
[NSAutoreleasePool

objectForKey:]: unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.222 StationTerminal[715:10b] Exception name:
NSInvalidArgumentException Reason: *** -[NSAutoreleasePool  
objectForKey:]:

unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.225 StationTerminal[715:10b] *** -[NSLock lock]:
deadlock ( '(null)')
2008-12-13 11:42:02.227 StationTerminal[715:10b] *** Break on  
_NSLockError()

to debug.


Distributed Objects, in general, is very tricky.

It sounds like you are running into a situation where the differences  
between the way the stacks are managed on Intel vs. PPC means that an  
object is being rooted on the Intel side on the stack that isn't being  
rooted on PPC.   This could happen for a number of legitimate reasons.


Specifically, it sounds like some object was being reaped too early by  
the collector.  This is most likely because:


- the pointer is hidden by being off alignment in a structure or  
having been XORed with something for some tricksy reason.


- the pointer has wandered into unscanned memory and, thus, the  
collector no longer sees the reference


Or it could simply be case of a memory smasher and you are getting  
lucky on Intel.


Do you know what dictionary is being reaped prematurely?   Is it one  
of yours or from the infrastructure?


b.bum
___

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: Rotating a CALayer more than once is not working [Solved: now contents of the layer not being rotated]

2008-12-13 Thread Gustavo Pizano
Aha... I was making that mistake. Thanks for the advice, but now I  
have another problem, and its that the layer its rotating good, but  
the contents of the layer stay  untouched,  I dunno if I explain  
myself, I see the layer rotating,  but then if I want to drag the  
layer with the new position (after rotating)  I realize that when I  
get the contents of the layer to set the image that will be dragged,  
the contents of the layer which is  a CGImageRef its still in  
horizontal position,  allowing me to see only on portion of the image  
that its in the layer (this portion is the one that is inside the  
layer which in fact was successfully rotated, I tried the following  
without success.



-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];
unsigned int flags;
flags = [event modifierFlags];
if ( (nLayer.name != nil) &&  (flags & NSControlKeyMask)) {
NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];
		CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext]  
graphicsPort];

CGContextSaveGState(ctx);
CGContextRotateCTM(ctx,[value floatValue]);
CGContextDrawImage(ctx, [nLayer frame], 
(CGImageRef)nLayer.contents);
CGContextRestoreGState(ctx);

}



}

I wrote that after reading how to rotate CGImages, but nothing  
happens, when trying to drag I see only one portion of the image.



... any advice on this one... I guess because of the contents are not  
being rotated also is why im seeing the image of the layer blurred, as  
I post in a message before this one.



Thanks for your help


G
___

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: Distributed Objects with Garbage Collection (on PPC)

2008-12-13 Thread John Pannell

Hi Bridger-

I had precisely the same issue some months ago, and wrote to this  
list.  I did get a response off-list from an Apple engineer that  
mentioned that this was a known problem and there was no workaround at  
present.  Not sure if things have changed since then (although perhaps  
they have, as I was seeing the same problem on the Intel side as the  
PPC).  I ended up returning to managing my own memory, as I needed the  
DO in the implementation I was working on.


Anyone have more recent info?

John

Positive Spin Media
http://www.positivespinmedia.com

On Dec 13, 2008, at 12:26 PM, Bridger Maxwell wrote:


Hey,

I am working on a networking system that uses distributed objects.  
This is a
large collaboration between students, and I thought garbage  
collection would

be perfect for new Cocoa programmers, so we wouldn't have to deal with
memory management quite yet. The network will be a mix of Intel and  
PPC, so

there is another complication too.

Everything seems to work on Intel, it is on PPC that we have the  
problems.
When we first make the connection to the server, we can message the  
remote
object just fine. It is when we try to message the distant object at  
later

times that we get errors. This sounds enough like a memory management
problem. Sure enough, when turn off garbage collection, and add in the
proper retain calls, it seems to function fine. Does distributed  
objects
work with garbage collection (on PPC)? Here are some of the errors I  
am

getting.

Console output:

2008-12-13 11:42:02.204 StationTerminal[715:10b] *** - 
[NSAutoreleasePool

objectForKey:]: unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.222 StationTerminal[715:10b] Exception name:
NSInvalidArgumentException Reason: *** -[NSAutoreleasePool  
objectForKey:]:

unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.225 StationTerminal[715:10b] *** -[NSLock lock]:
deadlock ( '(null)')
2008-12-13 11:42:02.227 StationTerminal[715:10b] *** Break on  
_NSLockError()

to debug.

Note here, that NSAutoreleasePool is getting objectForKey:, as if it  
were a
dictionary. It is not always NSAutoreleasePool getting the message,  
we have
also got NSCFDataType and some internal color-related class  
receiving this

message, among others. Sound enough like a memory mangement issue?

___

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


NSFilenamesPboardType for copy/paste and not just drag drop

2008-12-13 Thread Cocoa Dummy
Hello, I am attempting to implement a Copy from my application for files
on a remote server that are displayed in a listview.  This is an ftp type
client.  I cannot seem to implement these file copies from my app to where
you can paste them in finder, though similar attempts work for drag/drop.
 I initialliy tried NSFilesPromisePboardType as the type for the
pasteboard, which would be ideal, but I could not get it to work.  I then
tried NSFilenamesPboardType; "Paste" would not show up in finder menus, but
I could paste the filenames into TextEdit. These both work for drag/drop.
Are they not supported for copy/paste operations?


Thanks,
Sean
___

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

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

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

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


how to get exeption dates in iCal

2008-12-13 Thread Ankur Diyora
Hello all,
I am retrieving event of iCal  using calcalendar store.Now for recurrence
rule how to get exeption dates.

Thank you.
___

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

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

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

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


Key-bindings Dictionary Location

2008-12-13 Thread Dong Feng
Seems a lot Apple documents say that a key-bindings dictionary should
be located either 1)
/System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict,
or 2) ~/Library/KeyBindings/StandardKeyBinding.dict.

However, the dictionary used by Xcode has different filename for case
2, and different location (i.e. both path and filename) for case 1. So
what's the complete rules of locating a key-bindings dictionary?
___

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: open package installer in bundle resources directory not working

2008-12-13 Thread Kyle Sluder
Mark, there are a few things wrong with your advice.

1) Don't invoke a shell unless you need to.  Doing so introduces far
too many variables to be useful for the simple purpose of launching
another executable.
2) The first argument to a program needs to be the name of the
program.  For example, when you run `ls` from a shell, the shell sets
argv[0] to "ls".  If you were to run `/bin/ls`, argv[0] would instead
be "/bin/ls".
3) Why all this trouble of launching executables?  There's a reason
Launch Services is a public framework; use that.  Don't use
-[NSWorkspace openFile:], because that's not guaranteed to open the
package in Installer.app.  Instead, use LSOpenURLsWithRole:
http://developer.apple.com/DOCUMENTATION/Carbon/Reference/LaunchServicesReference/Reference/reference.html#//apple_ref/doc/uid/TP3998-CH1g-TPXREF104

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


[JOB] P/T iPhone Game Developer, NYC

2008-12-13 Thread Beau Gould
This is a part time, on-site opportunity in New York City (contract)
which has the possibility of turning into a full time job provided both
parties are interested.  

My client is an award-winning, cross-media game developer and they are
looking for a talented iPhone Developer to join the team. 

Specialized Knowledge/Expertise Requirements:  
o Must be familiar with the iPhone SDK 
o Extensive experience programming in C, Objective-C, C++, or Cocoa 
o Skill to build software from product requirement specification 
o Ability to map out software plan and lead a team 
o Familiarity with common game algorithms and/or design patterns 
o Passionate gamer and creative problem solver 
o Strong sense of design and experience with graphic design applications

o Excellent written and verbal communication skills 
o Excellent debugging and optimization skills 
o Agile development experience a plus 

Responsibilities: 
o Developing games for the iPhone 
o Optimizing the performance of games 
o Creating and maintaining utilities for use in development 
o Creating and maintaining technical documentation 
o Working closely with the development, design, and QA teams to meet
completion deadlines for each project 
o Integrating change requests and playtesting feedback 

To be considered, please submit your resume and/or portfolio along with
some examples of your work to bg @ capitalmarketsp.com 

Thank you, 

Beau Gould 
Executive Advisor 
Capital Markets Placement 
www.cmp.jobs 
bg @ capitalmarketsp.com 

iPhone Jobs: http://www.linkedin.com/groups?gid=1408127 

___

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


Drawing NSTextFieldCell subclass in table view

2008-12-13 Thread Andre Masse

Hi,

I want to display a cell like mail's message count in a table view but  
with a fixed size and centered on both axes. I've created a  
NSTextFieldCell subclass and its doing fine except that it draws in  
the first row only, which could mean I'm drawing at the wrong  
coordinates. Obviously, this is not what I want :-)


Drawing without modifying the cellFrame (commenting out the first 2  
lines and changing the argument to "frame") produces the expected  
result: a nice oval in every row but filling the entire cell space...


Any help, pointer to doc or tutorial are welcome.

Thanks,

Andre Masse


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
// we want 36x20
CGFloat y = cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);

CGFloat lineWidth = 1.5;

frame = NSInsetRect(frame, lineWidth, lineWidth);

//draw frame
CGFloat radius = NSHeight(frame)*0.45;

	NSBezierPath *backgroundPath = [NSBezierPath  
bezierPathWithRoundedRect:frame xRadius:radius yRadius:radius];

[backgroundPath setLineWidth:lineWidth];
[frameColor set];
[backgroundPath stroke];

// fill it
frame.size.height -= 2;
frame.origin.y += 1;
frame =  NSInsetRect(frame, 1, 0);

[fillColor set];
	[[NSBezierPath bezierPathWithRoundedRect:frame xRadius:radius  
yRadius:radius] fill];


// draw text
[super drawWithFrame:frame inView:controlView];


}

___

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: Live updating NSPredicateEditorRowTemplate?

2008-12-13 Thread Guy Umbright


To close this out...

I figured it out to as good as I think it gets.  The key is to call  
NSRuleEditor::setCriteria with nil arrays.  The nil arrays force it to  
go to its data source (which for NSPredicateEditor is the row  
templates) to refill.  It does reset the row to the initial value, but  
I don't really think there is a way around that and I think it is  
valid (at least easily rationalized)  interface-wise that if you  
change the criteria mid edit of a predicate it has to reset in case  
your selected option vanished.  Not optimal, but oh well.


Example:

	[_editor setCriteria:[NSArray array] andDisplayValues:[NSArray array]  
forRowAtIndex: 1];


On Dec 8, 2008, at 8:58 PM, Peter Ammon wrote:



On Dec 8, 2008, at 6:37 PM, Guy Umbright wrote:

I am trying to create an NSPredicateEditorRowTemplate with its last  
view a  popup that contains a list of things (elsewhere in the  
window) that can be updated while the editor is being displayed.  I  
can get it so that I can add an instance of the template, update  
the list of items and add another instance which shows the updated  
list, but the original does not update.


For example, the original templates specifies A,B,C in the last  
popup.  I add a row with that template then I add a D to the list  
of items and then add another row to the Predicate Editor.  This  
new row will show me a list of A,B,C,D but the original row still  
just shows A,B,C.


Is there a way to resync that existing row with the new list of  
items in its source template?  Am I going to have to remove and re- 
add the row programmatically?


You should call -[NSPredicateEditor setRowTemplates:] with an array  
containing the new template (but not the old one).  If you want to  
preserve the predicate, you may have to save off the predicate via - 
objectValue, and then set it back; or alternatively calling  
reloadCriteria should work.


-Peter



___

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: open package installer in bundle resources directory not working

2008-12-13 Thread Iceberg-Dev


On Dec 13, 2008, at 12:46 PM, Kyle Sluder wrote:


3) Why all this trouble of launching executables?  There's a reason
Launch Services is a public framework; use that.  Don't use
-[NSWorkspace openFile:], because that's not guaranteed to open the
package in Installer.app.  Instead, use LSOpenURLsWithRole:
http://developer.apple.com/DOCUMENTATION/Carbon/Reference/ 
LaunchServicesReference/Reference/reference.html#//apple_ref/doc/ 
uid/TP3998-CH1g-TPXREF104


Just in case:

I've been using NSWorkspace exactly for this for more than 6 years now.

Still waiting for a report from a user stating it does not open  
Installer.app but another application...



___

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: Encoding a Custom Object which has a CALayer instance Variable (newbie Question)

2008-12-13 Thread Michael Ash
On Sat, Dec 13, 2008 at 5:02 AM, Gustavo Pizano
 wrote:
> Hi, I tried to encode the CAlayer, but when decoding, all the info of the
> layer its lost.
> dunno what happened, the other info of the object it's good.

Could be that CALayer doesn't support NSCoding very well. This would
be kind of strange, but not too surprising, as it's a pretty complex
object with a lot of ties to the window server.

In that case you'll have to encode enough information to re-create the
layer instead. You're creating it at some point, so think about how
you do that and what information you use to do it. Encode that
information, and then in your -initWithCoder: you can get all of the
base information back out and use it to create a new CALayer that
matches the old one.

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


Re: setNeedsDisplay Equivalent for NSMenuItem?

2008-12-13 Thread Michael Ash
On Sat, Dec 13, 2008 at 12:18 PM, Chunk 1978  wrote:
> i've noticed in some menu bar apps like Google's GMail Notifier, the
> time since last email check will display when changed while the menu
> is open. how can i emulate this behavior in my own NSMenuItem that
> changes every 30 seconds (it shows a timer)?  currently it will change
> the setTitle of the NSMenuItem, but will only display it's update the
> next time the user opens the menu.

Are you sure that your timer is even executing? By default timers will
not execute when a menu is pulled down. You need to explicitly
schedule it in the event tracking runloop mode for this to happen.

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


Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread Michael Ash
On Sat, Dec 13, 2008 at 12:14 PM, John Love  wrote:
>if ([aDictionary valueForKey:@"NSApplicationName"] == @"My
> Application") {

In addition to what the others have said, you should be checking the
bundle ID if at all possible, not the name. A bundle ID is (intended
to be) a unique identifier for an application, whereas a matching name
could easily come from a completely different application which just
happens to have the same name.

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


Re: Drawing NSTextFieldCell subclass in table view

2008-12-13 Thread Iceberg-Dev


On Dec 13, 2008, at 11:11 PM, Andre Masse wrote:


Hi,

I want to display a cell like mail's message count in a table view  
but with a fixed size and centered on both axes. I've created a  
NSTextFieldCell subclass and its doing fine except that it draws in  
the first row only, which could mean I'm drawing at the wrong  
coordinates. Obviously, this is not what I want :-)


Drawing without modifying the cellFrame (commenting out the first 2  
lines and changing the argument to "frame") produces the expected  
result: a nice oval in every row but filling the entire cell space...


Any help, pointer to doc or tutorial are welcome.

Thanks,

Andre Masse


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
// we want 36x20
CGFloat y = cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);

CGFloat lineWidth = 1.5;

frame = NSInsetRect(frame, lineWidth, lineWidth);

//draw frame
CGFloat radius = NSHeight(frame)*0.45;

	NSBezierPath *backgroundPath = [NSBezierPath  
bezierPathWithRoundedRect:frame xRadius:radius yRadius:radius];

[backgroundPath setLineWidth:lineWidth];
[frameColor set];
[backgroundPath stroke];

// fill it
frame.size.height -= 2;
frame.origin.y += 1;
frame =  NSInsetRect(frame, 1, 0);

[fillColor set];
	[[NSBezierPath bezierPathWithRoundedRect:frame xRadius:radius  
yRadius:radius] fill];


// draw text
[super drawWithFrame:frame inView:controlView];


}


NSTextFieldCell is flipped. This has an impact on the y value. It  
might be the cause of the issue in your case.



___

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: Drawing NSTextFieldCell subclass in table view

2008-12-13 Thread Patrick Mau


On 13.12.2008, at 23:11, Andre Masse wrote:


Hi,

I want to display a cell like mail's message count in a table view  
but with a fixed size and centered on both axes. I've created a  
NSTextFieldCell subclass and its doing fine except that it draws in  
the first row only, which could mean I'm drawing at the wrong  
coordinates. Obviously, this is not what I want :-)


Drawing without modifying the cellFrame (commenting out the first 2  
lines and changing the argument to "frame") produces the expected  
result: a nice oval in every row but filling the entire cell space...


Any help, pointer to doc or tutorial are welcome.

Thanks,

Andre Masse


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
// we want 36x20
CGFloat y = cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);


Hi Andre

It seems you are not using the cellFrame.origin.y when you create your  
new frame.


CGFloat y = cellFrame.origin.y + cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);

Regards,
Patrick

___

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

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

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

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


constraining autoresizing of a splitview subview

2008-12-13 Thread christophe mckeon gonzalez de leon
hi,

i have a splitview containing two vertical subviews.
i'd like the user to be able to resize the the views at will
via. the divider, but when the splitview is resized due to
a window resize for instance, i want only one of the subviews
to be autoresized in the horizontal direction, while both
are resized appropriately in the vertical direction.

what would be the best/standard way of going about this?

thanks for any tips,
_c
___

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: constraining autoresizing of a splitview subview

2008-12-13 Thread Kevin Gessner

http://www.omnigroup.com/mailman/archive/macosx-dev/2004-March/051353.html

HTH,
-- Kevin

Kevin Gessner
http://kevingessner.com
ke...@kevingessner.com





On Dec 13, 2008, at 7:39 PM, christophe mckeon gonzalez de leon wrote:


hi,

i have a splitview containing two vertical subviews.
i'd like the user to be able to resize the the views at will
via. the divider, but when the splitview is resized due to
a window resize for instance, i want only one of the subviews
to be autoresized in the horizontal direction, while both
are resized appropriately in the vertical direction.

what would be the best/standard way of going about this?

thanks for any tips,
_c
___

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/kevin%40kevingessner.com

This email sent to ke...@kevingessner.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: constraining autoresizing of a splitview subview

2008-12-13 Thread Patrick Mau

Hi Christophe

The code below should be implemented in your NSSplitView's delegate.
The 'sender' argument is your splitView.

It will pick the first two subviews and adjust the width of
the right subview (index 1). The height will be adjusted to your
splitview's frame.

I hope it's useful,
Patrick

- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize: 
(NSSize)oldSize

{
float dividerThickness = [sender dividerThickness];

NSView *left = [[sender subviews] objectAtIndex:0];
NSView *right = [[sender subviews] objectAtIndex:1];

NSRect newFrame = [sender frame]; // the splitvies's new frame
NSRect leftFrame = [left frame];
NSRect rightFrame = [right frame];

leftFrame.size.height = newFrame.size.height;

rightFrame.size.width = newFrame.size.width -  
leftFrame.size.width - dividerThickness;

rightFrame.size.height = newFrame.size.height;
rightFrame.origin.x = leftFrame.size.width + dividerThickness;

[left setFrame:leftFrame];
[right setFrame:rightFrame];
}

On 14.12.2008, at 01:39, christophe mckeon gonzalez de leon wrote:


hi,

i have a splitview containing two vertical subviews.
i'd like the user to be able to resize the the views at will
via. the divider, but when the splitview is resized due to
a window resize for instance, i want only one of the subviews
to be autoresized in the horizontal direction, while both
are resized appropriately in the vertical direction.

what would be the best/standard way of going about this?

thanks for any tips,
_c

___

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: Drawing NSTextFieldCell subclass in table view

2008-12-13 Thread Andre Masse

Right on Patrick!

Thanks a lot,

Andre Masse

On Dec 13, 2008, at 19:26, Patrick Mau wrote:

Hi Andre

It seems you are not using the cellFrame.origin.y when you create  
your new frame.


CGFloat y = cellFrame.origin.y + cellFrame.size.height/2.0 - 10.0;
NSRect frame = NSMakeRect(cellFrame.origin.x, y, 36.0, 20.0);

Regards,
Patrick



___

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

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

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

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


Re: Drawing NSTextFieldCell subclass in table view

2008-12-13 Thread Andre Masse
Although this was not the cause in this particular problem, it will  
help with another issue I have in an another class.


Thanks for the info,

Andre Masse


On Dec 13, 2008, at 19:03, Iceberg-Dev wrote:



NSTextFieldCell is flipped. This has an impact on the y value. It  
might be the cause of the issue in your case.





___

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


context menu item sample from apple code samples still valid?

2008-12-13 Thread aaron smith
Does anyone know if this is still a valid sample?
(http://developer.apple.com/samplecode/SampleCMPlugIn/index.html)
It's from 06, so it would seem old.
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


NSTask with ssh-agent

2008-12-13 Thread James W. Walker
I'm using NSTask to run Mercurial, which internally uses ssh to  
communicate with a server.  It works when there is no pass phrase on  
the private key, but what if there is one?  I've heard that Leopard  
has a built-in ssh-agent that integrates with the Keychain, but I  
don't understand how to take advantage of that.  Any clues?

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: constraining autoresizing of a splitview subview

2008-12-13 Thread christophe mckeon gonzalez de leon
wow that was fast! thanks guys
___

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


Newbie Q: Why is UIWindow in the AppDelegate not an ivar?

2008-12-13 Thread Debajit Adhikary
When you create an iPhone app, in the AppDelegate, why is the
UIWindow created locally within -applicationDidFinishLaunching and not
declared
as an ivar? The functionality does not seem to change either way. I'd
like to know how one approach is better than the other.

What I presume is that the window object really doesn't need to be accessed
from outside later. But doesn't declaring it as an ivar make it more
accessible from the "outside" allowing greater application extensibility?

@implementation AppDelegate

- (void) applicationDidFinishLaunching:(UIApplication*) application
{
   UIWindow* window = ... ;
   [window addSubView: ...];
   [window makeKeyAndVisible];
}

...
@end
___

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


override hide on deactivate?

2008-12-13 Thread Chunk 1978
i'm trying to override the hide on deactivate method but it's not
working.  i have unchecked "Hides On Deactivate" for my window in IB.

-=-=-=-=-

- (BOOL)hidesOnDeactivate
{
NSBeep();
return NO;
}

-=-=-=-=-

i know that if i didn't want the window to hide on deactivate i could
simply uncheck the the option in IB, but i'm attempting to hide some
views inside the window (by setting their alpha to 0.0 ) when the
window is ordered back.
___

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


Rather than NSWorkspaceDidUnmountNotification?

2008-12-13 Thread Nor
Is there any way to get any notifications rather than "
NSWorkspaceDidUnmountNotification" ?
I mean I want to get something faster than that, as soon as the connection
was cut.
The notification comes to my application after Finder shows a dialog and has
user to press some button like disconnect on the dialog. It takes several
seconds after connection is cut.
Any suggestions would be very appreciated.
Thank you in advance.
Nor
___

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: Newbie Q: Why is UIWindow in the AppDelegate not an ivar?

2008-12-13 Thread Debajit Adhikary
I meant to ask what the tradeoffs are between declaring the UIWindow object
as an instance variable in the AppDelegate vs. as a local object in
-applicationDidFinishLaunching:

The specific example I'd mentioned was from Erica Sadun's book, and looking
at Apple's sample code, and the code that XCode generates, it seems that the
UIWindow object is typically declared as an instance variable in the
AppDelegate and seems the way to go (as opposed to Erica Sadun's example of
using a local UIWindow object).


On Sat, Dec 13, 2008 at 6:34 PM, Debajit Adhikary wrote:

> When you create an iPhone app, in the AppDelegate, why is the
> UIWindow created locally within -applicationDidFinishLaunching and not
> declared
> as an ivar? The functionality does not seem to change either way. I'd
> like to know how one approach is better than the other.
>
> What I presume is that the window object really doesn't need to be accessed
> from outside later. But doesn't declaring it as an ivar make it more
> accessible from the "outside" allowing greater application extensibility?
>
> @implementation AppDelegate
>
> - (void) applicationDidFinishLaunching:(UIApplication*) application
> {
>UIWindow* window = ... ;
>[window addSubView: ...];
>[window makeKeyAndVisible];
> }
>
> ...
> @end
>
>
___

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: Newbie Q: Why is UIWindow in the AppDelegate not an ivar?

2008-12-13 Thread Luke Hiesterman
Generally speaking you will do well for yourself to follow Apple's  
example over Erica's. I haven't actually read her book but I've had  
several examples come to my attention of where she doesn't do things  
in the best way.


Erica is a talented hacker but please get in the habit of following  
the canonical examples. These have been thoroughly vetted and approved  
my many experts.


Luke

Sent from my iPhone.

On Dec 13, 2008, at 7:22 PM, Debajit Adhikary   
wrote:


I meant to ask what the tradeoffs are between declaring the UIWindow  
object

as an instance variable in the AppDelegate vs. as a local object in
-applicationDidFinishLaunching:

The specific example I'd mentioned was from Erica Sadun's book, and  
looking
at Apple's sample code, and the code that XCode generates, it seems  
that the

UIWindow object is typically declared as an instance variable in the
AppDelegate and seems the way to go (as opposed to Erica Sadun's  
example of

using a local UIWindow object).


On Sat, Dec 13, 2008 at 6:34 PM, Debajit Adhikary  
wrote:



When you create an iPhone app, in the AppDelegate, why is the
UIWindow created locally within -applicationDidFinishLaunching and  
not

declared
as an ivar? The functionality does not seem to change either way. I'd
like to know how one approach is better than the other.

What I presume is that the window object really doesn't need to be  
accessed

from outside later. But doesn't declaring it as an ivar make it more
accessible from the "outside" allowing greater application  
extensibility?


@implementation AppDelegate

- (void) applicationDidFinishLaunching:(UIApplication*) application
{
  UIWindow* window = ... ;
  [window addSubView: ...];
  [window makeKeyAndVisible];
}

...
@end



___

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

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


Programatically creating windows

2008-12-13 Thread Development

I am creating a window more or less from scratch in my main controller.
The following is the code and all referred to objects are defined in  
the xib file save mainWindow which i am obviously creating.


	mainWindow = [[NSWindow alloc]initWithContentRect:[mainProto frame]  
styleMask:NSBorderlessWindowMask


backing:NSBackingStoreBuffered defer:NO];

NSRect winFrame = [mainWindow frame];
	NSRect controlFrame =  
NSMakeRect(winFrame.size.width-650,winFrame.size.height -27,

 
[buttonView frame].size.width,[buttonView frame].size.height);
[docView setEditable:YES];
[mainWindow setBackgroundColor:[NSColor clearColor]];
[mainWindow setOpaque:NO];
[mainWindow setHasShadow:YES];
[mainWindow setIgnoresMouseEvents:NO];
[mainWindow setContentView:mwContent];
[mwContent addSubview:docScroll];
	[mwContent addSubview:buttonView positioned:NSWindowBelow  
relativeTo:docScroll];

[buttonView setFrame:controlFrame];
[mainWindow makeKeyAndOrderFront:self];
[mainWindow setInitialFirstResponder:docView];


Anyway, the window shows just fine but I cannot for the life of me get  
it to allow me to edit the text in the NSTextView. I am at a loss.  
Does any one know which step I'm leaving out here?

___

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


first responder stopped working

2008-12-13 Thread John Nairn
My application frequently recreates a window which involves deleting  
all the subviews and adding new ones (while keeping the window open).  
It used to work, but now when it reloads, it fails to accept the one  
view I designate to the be the first view.


After the window is recreated I perform a delayed method and use

   if(firstCell!=nil)
   {   id aView = [firstCell theView];
   if([aView acceptsFirstResponder])
   {   [[self window] makeFirstResponder:aView];
   }
   else
   NSLog(@"does not accept to be responder");
   }

This used to work, but has recently stopped working. When the window  
displays, the view (firstCell is my object and the views are all  
NSTextField views) does get selected. If I tab, one of two things  
happens:


1. It tabs to the next view making it look like the view is partially  
made the first responded, but never selected


2. Other times the window freezes up with this error message

*** NSRunStorage, _NSBlockNumberForIndex(): index (4294967294) beyond  
array bounds (30)


which I do not recognize in my code.

---
John Nairn
GEDitCOM - Genealogy Software for the Macintosh
http://www.geditcom.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


NSTimer EXC_BAD_ACCESS

2008-12-13 Thread Daniel Luis dos Santos

Hello,

I have a NSTimer that is created every time I press a button. It then  
calls the update function successively until some amount of time passes.
When I press the button again I get a EXC_BAD_ACCESS on the timer's  
initialization :


	NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval: step  
target: self

selector: @selector(_updateDisplay:) userInfo: nil repeats: 
YES];

step is a double, and _updateDisplay has the right signature.
The stack trace is something like :

#0  0x90705558 in tiny_malloc_from_free_list
#1  0x906fe3ed in szone_malloc
#2  0x906fe2f8 in malloc_zone_malloc
#3  0x932b9451 in _CFRuntimeCreateInstance
#4  0x9327f844 in CFDateCreate
#5	0x93329f63 in -[__NSPlaceholderDate  
initWithTimeIntervalSinceReferenceDate:]

#6  0x9332a7fd in +[NSDate dateWithTimeIntervalSinceNow:]
#7	0x9034aa3f in +[NSTimer(NSTimer)  
scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:]


I haven't 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: Programatically creating windows

2008-12-13 Thread Michael Babin

On Dec 13, 2008, at 10:40 PM, Development wrote:

I am creating a window more or less from scratch in my main  
controller.
The following is the code and all referred to objects are defined in  
the xib file save mainWindow which i am obviously creating.


	mainWindow = [[NSWindow alloc]initWithContentRect:[mainProto frame]  
styleMask:NSBorderlessWindowMask


backing:NSBackingStoreBuffered defer:NO];

NSRect winFrame = [mainWindow frame];
	NSRect controlFrame =  
NSMakeRect(winFrame.size.width-650,winFrame.size.height -27,
	 [buttonView frame].size.width,[buttonView  
frame].size.height);

[docView setEditable:YES];
[mainWindow setBackgroundColor:[NSColor clearColor]];
[mainWindow setOpaque:NO];
[mainWindow setHasShadow:YES];
[mainWindow setIgnoresMouseEvents:NO];
[mainWindow setContentView:mwContent];
[mwContent addSubview:docScroll];
	[mwContent addSubview:buttonView positioned:NSWindowBelow  
relativeTo:docScroll];

[buttonView setFrame:controlFrame];
[mainWindow makeKeyAndOrderFront:self];
[mainWindow setInitialFirstResponder:docView];


Anyway, the window shows just fine but I cannot for the life of me  
get it to allow me to edit the text in the NSTextView. I am at a  
loss. Does any one know which step I'm leaving out here?




___

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: override hide on deactivate?

2008-12-13 Thread Graham Cox


On 14 Dec 2008, at 1:59 pm, Chunk 1978 wrote:


i'm attempting to hide some
views inside the window (by setting their alpha to 0.0 )



Wouldn't calling -setHidden:YES be a better plan?

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


nib loading / displaying question.

2008-12-13 Thread aaron smith
hey all, really quick question. I'm messing around with loading nib's
from the main bundle.

It's pretty basic.

-I've got a custom nib called "About" that shows when you select the
"About XXX" from the main menu.
-I have an AppController file (extends NSObject), that has an action
-(IBAction)showAboutPanel:(id)sender

I've got it functioning for the most part, It load's the nib, and
shows it. But then after it's been closed, it won't ever show up
again.

Here's my method:

-(IBAction)showAboutPanel:(id)sender
{
NSLog(@"showAboutPanel");
if(aboutPanel)
{
NSLog(@"about panel set %@",aboutPanel);
//how do i show it again?
}
if(!aboutPanel)
{
[NSBundle loadNibNamed:@"About" owner:self];
NSLog(@"about panel %@",aboutPanel);
}
}

I've read quite a bit about nibs and bundles, and I've tried a bunch
of different things, can't seem to figure this one out. Any ideas
would be great.

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: nib loading / displaying question.

2008-12-13 Thread Rob Rix
It sounds like you’re looking for [aboutPanel makeKeyAndOrderFront:  
self];.


Rob

On 14-Dec-08, at 2:38 AM, aaron smith wrote:


hey all, really quick question. I'm messing around with loading nib's
from the main bundle.

It's pretty basic.

-I've got a custom nib called "About" that shows when you select the
"About XXX" from the main menu.
-I have an AppController file (extends NSObject), that has an action
-(IBAction)showAboutPanel:(id)sender

I've got it functioning for the most part, It load's the nib, and
shows it. But then after it's been closed, it won't ever show up
again.

Here's my method:

-(IBAction)showAboutPanel:(id)sender
{
NSLog(@"showAboutPanel");
if(aboutPanel)
{
NSLog(@"about panel set %@",aboutPanel);
//how do i show it again?
}
if(!aboutPanel)
{
[NSBundle loadNibNamed:@"About" owner:self];
NSLog(@"about panel %@",aboutPanel);
}
}

I've read quite a bit about nibs and bundles, and I've tried a bunch
of different things, can't seem to figure this one out. Any ideas
would be great.

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

This email sent to rix@gmail.com


___

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

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

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

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