Synthesized ivar for std::tr1::shared_ptr?

2010-05-05 Thread Barry Wark
I'm no C++ guru, so I'm hoping someone can help me by explaining why
the following gives a compiler error:

//MyObjC.h
@interface MyObjC : NSObject {}
@end

//MyObjC.mm
#import "MyObjC.h"
#include "MyClass.h" //provides MyClass, a C++ class
#include 

using std::tr1::shared_ptr;

@interface MyObjC ()

@property (assign, readwrite, nonatomic) shared_ptr foo;

@end

@implementation MyObjC
@synthesize foo; // gives compiler error: instance variable 'foo' has
unknown size

@end


The definitions for both shared_ptr and MyClass are available, as far
as I can tell. Furthermore, the following compiles without error:
//MyObjC.h
#include 
#include "MyClass.h"

@interface MyObjC : NSObject
{
std::tr1::shared_ptr foo;
}
@end

//MyObjC.mm
#import "MyObjC.h"
#include "MyClass.h" //provides MyClass, a C++ class
#include 

using std::tr1::shared_ptr;

@interface MyObjC ()

@property (assign, readwrite, nonatomic) shared_ptr foo;

@end

@implementation MyObjC
@synthesize foo; // gives compiler error: instance variable 'foo' has
unknown size

@end


Thus, I'm lead to believe this is an issue with runtime synthesizing
of the ivar, but I'm at a loss to explain why it should be so. I would
like to keep the C++ out of the header file if possible so that I can
use standard Objective-C when importing the header file in client
modules.

Any guidance from C++ gurus?

Thanks,
Barry
___

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

Please do not post admin requests or moderator comments to the list.
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: CoreData Object with transient attributes faulting after sync

2010-05-05 Thread Jerry Krinock

On 2010 May 05, at 02:54, Tom Fewster wrote:

> the managed objects which contain transient values fault (didTurnIntoFault: 
> is called) and are recreated (awakeFromFetch is called), even though nothing 
> has changed, except for the contents of the transient attributes. This only 
> seems to happen on the first sync after the application is launched, 
> subsequent syncs doesn't fault the managed objects.

I don't know the answer to that exactly, but, particularly with an sqlite 
store, transient attributes have some exceptional behaviors.  Search the Core 
Data Programming Guide for 'transient'. 

> I have also noticed that the 
> NSManagedObjectContextObjectsDidChangeNotification notification is never 
> broadcast in this situation.

The documentation for NSManagedObjectContextObjectsDidChangeNotification 
contains alot of "fine print".  You might want to read it carefully.

> Therefore, anything that contains a reference to a managed object contains an 
> invalid reference, and I have no way of knowing when I need to update the 
> reference (I guess I could retain the MO and call isFault before each use, 
> but that doesn't seen nice)
> 
> - Is it expected behaviour...

You're using two features there, transient attributes and 
NSManagedObjectContextObjectsDidChangeNotification, which, in my experience, 
are problematic.  Might be a good time to see how Undo and Redo work.

Sorry I'm not being helpful.  My advice is to file bugs, and also try to avoid 
reliance upon these two features.




___

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

Please do not post admin requests or moderator comments to the list.
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: iPhone resource cache - memory question

2010-05-05 Thread Shripada Hebbar
Hi,

I don't see any point in doing this on our own as the iPhone OS anyway gives
you memory warning when we are consuming too much of it, and this is the
right occasion to cleanup anything that is not needed ( in
applicationDidReceiveMemoryWarning: message).

Perhaps you are trying to implement some cache such as image or audio
specific to your app, in that case, you can in advance set the limit say 5
or 10 MB and if the cache exceeds, delete the least recently used item? Or
when you receive memory warning, perhaps delete all items in the cache..

-Shripada

On 06/05/10 7:13 AM, "cocoa-dev-requ...@lists.apple.com"
 wrote:

> 
> Message: 10
> Date: Wed, 5 May 2010 16:27:29 -0700
> From: Philip Mobley 
> Subject: iPhone resource cache - memory question
> To: Cocoa-dev@lists.apple.com
> Message-ID: 
> Content-Type: text/plain; charset=us-ascii
> 
> I am designing a slightly smarter resource cache that purges less frequently
> used resources instead of a purge all when getting an UIApplication delegate
> "applicationDidReceiveMemoryWarning:" message.  I know the target (currently)
> is 20 MBs (although that could change with future hardware).  The problem I am
> running into is finding out if I have purged enough.
> 
> Is there a method to get the current app memory allocation for the iPhone?
> Also is there a  constant that I can compare it to (memory value to issue
> warning)?
> 
> This would allow me to do a loop something like:
> 
> while (appCurrentMemory > issueMemoryWarningAtValue) {
>   [self purgeOldestAccessedObject];
> }
> 
> 


---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
___

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

Please do not post admin requests or moderator comments to the list.
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: Are there any tools or techniques for detecting / debugging retain-cycles?

2010-05-05 Thread Andy Lee




--Andy

___

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

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

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

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


Re: table view text cells: align vertically

2010-05-05 Thread Graham Cox
Search for RSVerticallyCenteredTextFieldCell - does what it says on the tin.

--Graham


On 06/05/2010, at 1:17 PM, Rainer Standke wrote:

> Hello,
> 
> I am looking for a way to center align text in a table view vertically. I 
> understand that this may need some custom drawing mechanism.
> 
> Is there any sample code out there? Or is there another way?
> 
> 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


table view text cells: align vertically

2010-05-05 Thread Rainer Standke
Hello,

I am looking for a way to center align text in a table view vertically. I 
understand that this may need some custom drawing mechanism.

Is there any sample code out there? Or is there another way?

Thanks,

Rainer___

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

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

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

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


[SOLVED] Re: Linking a specific controller instance to user defaults

2010-05-05 Thread Graham Cox
Hi Quincey. That occurred to me too but seems a bit hackish.

I solved it by asking the delegate for the settings name root. The delegate is 
a distinct class in this case, so it can return a unique string, and the 
delegate can be set in IB and so is available at -awakeFromNib time. Works well 
in this case though if the delegate weren't a unique instance it would simply 
move the problem elsewhere - though I guess you could just keep going up 
through a chain of delegates until someone could return an unambiguous answer...

--Graham


On 06/05/2010, at 3:22 AM, Quincey Morris wrote:

> On May 5, 2010, at 05:42, Graham Cox wrote:
> 
>> The problem should be obvious - how to ensure that each instance of the 
>> controller can use a specific unique key in the user defaults. Creating a 
>> unique key is easy, but at load time how to calculate the exact same key for 
>> the specific instance is not. I thought of adding a 'settings name' property 
>> that was used to prefix the key but there's no way to set it earlier than 
>> -awakeFromNib time from some external object that "knows" which instance it 
>> is using. Ideally the settings name could be set for the instance in IB, but 
>> since this is a generic NSObject subclass I can't do that without making an 
>> IB plugin just to set it, which seems like major overkill.
>> 
>> Is there another way to set the settings name just in time?
> 
> The first thing that sprang to mind was to use two different subclasses of 
> the controller. Then either test the class name, or have the subclasses 
> return a unique name or key (that's built into the subclass so you don't have 
> to set it in IB).

___

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

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

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

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


Re: Custom NSPathControl

2010-05-05 Thread Graham Cox
Thanks guys, I've made some progress - I can get it to display my "path", I 
just need to work on setting the icons which looks straightforward enough at 
this point.

--Graham


On 06/05/2010, at 4:50 AM, Corbin Dunn wrote:

> 
> On May 5, 2010, at 10:20 AM, Quincey Morris wrote:
> 
>> On May 5, 2010, at 04:20, Graham Cox wrote:
>> 
>>> So is using NSPathControl even possible for this, or would I just be better 
>>> off writing a complete new control from scratch? NSPathControl does some 
>>> neat things like fading overlong text within a subcell that I could use, as 
>>> well as displaying an icon and a triangle for the next item. What about 
>>> subclassing the subcell? I guess I'm just looking for some direction here 
>>> or even better, some code out there I can use.
>> 
>> If you don't need the icons, and you don't need any slashes in your text, 
>> setting a path string instead of a URL works just fine.
> 
> ..and if you do need them, set the path string, then manually set the icons 
> on the -pathComponentCells. If you need slashes in the text, use a URL with 
> some custom prefix and escape the slashes.
> 
> -corbin

___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread Shawn Erickson
On Wed, May 5, 2010 at 4:28 PM, Dave Keck  wrote:
>> Which makes me wonder why Apple doesn't make an API for doing it "the right 
>> way" easily? :-)
>
> I'd be disappointed if this didn't happen in 10.7. I'm hoping for a
> kind of AEWP that handles all of the launchd shenanigans for you, and
> only exec()s if the codesigning bits check out.

Consider... SMJobBless

http://developer.apple.com/mac/library/documentation/General/Reference/ServiceManagementFwRef/ServiceManagement_h/index.html#//apple_ref/c/func/SMJobBless

-Shawn
___

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

Please do not post admin requests or moderator comments to the list.
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: NSSegmentedControl in a toolbar [SOLVED]

2010-05-05 Thread Flavio Donadio
Quincey, Brian and Graham,


I tried one last time, setting my toolbar in pure code. I started from the 
SimpleToolbar sample that comes with the XCode tools. And it works! There's a 
remaining bug: the label positions are wrong in the toolbar customization 
palette.

The code is here: http://www.donadio.com.br/cocoa/SimpleToolbar.zip

The NSToolbarItemGroup Class Reference is right, but could have some images to 
make it clearer.


Cheers,
Flavio

On 05/05/2010, at 16:03, Brian Postow wrote:

> On May 5, 2010, at 2:57 PM, Flavio Donadio wrote:
> 
>> I am sure a lot of people think it is a NSSegmentedControl. Is there a way 
>> to know this for sure? I mean, you seem to really know it, but how did you 
>> do?
>> 
> 
> the way to tell is to look in the preview.app package and see that there are 
> parts of the buttons laying around as explicit separate files... 
___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread Dave Keck
AuthorizationExecuteWithPrivileges
___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread koko

To what does AEWP decode?

On May 5, 2010, at 5:33 PM, Dave Keck wrote:

Which makes me wonder why Apple doesn't make an API for doing it  
"the right way" easily? :-)


I'd be disappointed if this didn't happen in 10.7. I'm hoping for a
kind of AEWP that handles all of the launchd shenanigans for you, and
only exec()s if the codesigning bits check out.
___

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

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

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

This email sent to k...@highrolls.net



___

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

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

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

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


Re: iPhone resource cache - memory question

2010-05-05 Thread David Duncan
On May 5, 2010, at 4:27 PM, Philip Mobley wrote:

> I am designing a slightly smarter resource cache that purges less frequently 
> used resources instead of a purge all when getting an UIApplication delegate 
> "applicationDidReceiveMemoryWarning:" message.  I know the target (currently) 
> is 20 MBs (although that could change with future hardware).  The problem I 
> am running into is finding out if I have purged enough.  


What I would probably do is have each cached object check in with a size, and 
track the total cache size separately. When you get a memory warning, shrink 
the cache by about half. If the cache is under a certain size (say 5MB) just 
purge the entire thing.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Authenticate NSFileManager Operations

2010-05-05 Thread Dave Keck
> Which makes me wonder why Apple doesn't make an API for doing it "the right 
> way" easily? :-)

I'd be disappointed if this didn't happen in 10.7. I'm hoping for a
kind of AEWP that handles all of the launchd shenanigans for you, and
only exec()s if the codesigning bits check out.
___

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

Please do not post admin requests or moderator comments to the list.
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


iPhone resource cache - memory question

2010-05-05 Thread Philip Mobley
I am designing a slightly smarter resource cache that purges less frequently 
used resources instead of a purge all when getting an UIApplication delegate 
"applicationDidReceiveMemoryWarning:" message.  I know the target (currently) 
is 20 MBs (although that could change with future hardware).  The problem I am 
running into is finding out if I have purged enough.  

Is there a method to get the current app memory allocation for the iPhone?  
Also is there a  constant that I can compare it to (memory value to issue 
warning)?

This would allow me to do a loop something like:

while (appCurrentMemory > issueMemoryWarningAtValue) {
  [self purgeOldestAccessedObject];
}


___

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

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

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

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


Re: Using a keyboard to push a button

2010-05-05 Thread Seth Willits
On May 5, 2010, at 2:05 PM, Jens Alfke wrote:

> In Interface Builder, select the button and then use the Attributes inspector 
> to set its key equivalent. (Click the box to the right of “Key Equiv.:” and 
> press the Enter key.)



On May 5, 2010, at 2:03 PM, Seth Willits wrote:

> Set the action of the field to performClick: of the button.
> 
> In Interface Builder, hold Control, click on the field and drag the 
> connection line to the button, release. Select performClick:



The difference between these two solutions (and which one is appropriate) 
depends on the situation. I assumed one way, but you probably were looking for 
Jens' answer. Anyway, the difference is this:

Jens' sets a default button for the entire window. That means that for *any* 
field you're in, or even if you're not in one, when you press Return, the 
default button is "clicked."

The way I describe makes it so that when you press Return only in that 
*specific* field, does the button get clicked. 

Both are useful in different situations.


--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
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: Change background image in select behavior in the NSToolbarItem

2010-05-05 Thread Kyle Sluder
2010/5/5 Junio Gonçalves Vitorino :
> Doesn't exist some way or i'm speaking bullshit.

Huh? Are you bumping this thread or something? If someone feels like
responding, they will respond.

Though I must say it would help your chances of getting a response if
you explained what you wanted better. Maybe a screenshot?

--Kyle Sluder
___

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

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

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

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


Re: Windows following the menubar in Cocoa

2010-05-05 Thread Lee Ann Rucker
It does? That's awesome. I think putting things back where the user  
put them is a good reason all by itself; I always hate it when I need  
to move my work laptop somewhere, because all my windows from the big  
monitor get squished onto the little one and reorganized.


Alas, my work laptop won't get to move to 10.6 until there's a 10.7.

On May 5, 2010, at 3:06 PM, Eric Gorr wrote:



On May 3, 2010, at 6:48 PM, Murat Konar wrote:



On May 3, 2010, at 3:31 PM, Eric Gorr wrote:

Is there a way to configure a Cocoa window so it will follow the  
menubar to another display?


Is it even a good idea?



Probably not.

However, there is at least one other situation where the OS will  
move windows for you.


Let's say you have Display A and B, both are connected to the  
computer, and the menu bar is configured to be on Display B.


If you disconnect Display B, the menu bar will automatically move to  
Display A - along with all of the windows that were on Display B.


If you the reconnect Display B, the menu bar will automatically move  
back to Display B - along with all of the windows that used to be on  
Display B.


Well, this is how it works in 10.6.3. In 10.5.8, when Display B was  
reconnected, only the Carbon based windows were moved.


It is unclear to me that reconnecting Display B should necessarily  
move windows, but, perhaps, there is a good reason for it that I am  
missing.



___

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

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

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

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


Re: Change background image in select behavior in the NSToolbarItem

2010-05-05 Thread Junio Gonçalves Vitorino
Doesn't exist some way or i'm speaking bullshit.

2010/5/5 Junio Gonçalves Vitorino 

> Hi everyone,
>
> I'd like know if i can change the background image of select behavior when
> i click in a NSToolbarItem. An example of the i wanna is the AppZapper
> toolbar, I'd like put a image with a closed square more rounded. That's
> possible?
>
> --
> Atenciosamente, Cordially
>
> Junio Vitorino
> http://www.lamiscela.net
> 55 31 9901-7499
>



-- 
Atenciosamente, Cordially

Junio Vitorino
http://www.lamiscela.net
55 31 9901-7499
___

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

Please do not post admin requests or moderator comments to the list.
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: Windows following the menubar in Cocoa

2010-05-05 Thread Eric Gorr

On May 3, 2010, at 6:48 PM, Murat Konar wrote:

> 
> On May 3, 2010, at 3:31 PM, Eric Gorr wrote:
> 
>> Is there a way to configure a Cocoa window so it will follow the menubar to 
>> another display?
> 
> Is it even a good idea? 


Probably not.

However, there is at least one other situation where the OS will move windows 
for you.

Let's say you have Display A and B, both are connected to the computer, and the 
menu bar is configured to be on Display B. 

If you disconnect Display B, the menu bar will automatically move to Display A 
- along with all of the windows that were on Display B.

If you the reconnect Display B, the menu bar will automatically move back to 
Display B - along with all of the windows that used to be on Display B.

Well, this is how it works in 10.6.3. In 10.5.8, when Display B was 
reconnected, only the Carbon based windows were moved.

It is unclear to me that reconnecting Display B should necessarily move 
windows, but, perhaps, there is a good reason for it that I am missing.

___

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

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

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

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


Are there any tools or techniques for detecting / debugging retain-cycles?

2010-05-05 Thread Michael A. Crawford
-Michael
___

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

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

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

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


Re: Custom view as a menu item

2010-05-05 Thread Nava Carmon
thanks Dave!

On May 5, 2010, at 7:21 PM, Dave DeLong wrote:

> -[NSMenuItem setView:] ?
> 
> http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/doc/uid/2265-SW1
> 
> Dave
> 
> On May 5, 2010, at 10:17 AM, Nava Carmon wrote:
> 
>> Anyone?
>> 
>> On May 4, 2010, at 10:18 AM, Nava Carmon wrote:
>> 
>>> Hi,
>>> 
>>> I need to implement a menu that looks and feels like that of spotlight: 
>>> with a search field as a first item and  other items will be filled from 
>>> some xml file on fly. Are there some examples/ideas on how to do it?
>>> 
>>> Thanks a lot,
>>> 
>>> Nava Carmon
>>> ncar...@mac.com
>>> 
>>> "Think good and it will be good!"
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/ncarmon%40mac.com
> 
> This email sent to ncar...@mac.com


Nava Carmon
ncar...@mac.com

"Think good and it will be good!"

___

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

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

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

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


Re: Using a keyboard to push a button

2010-05-05 Thread Jens Alfke

On May 5, 2010, at 3:46 AM, Benjamin Navarro wrote:

> My problem is that I have no idea how can I use the "Enter" keyboard key to 
> press the button (make a kind of shortcut). 

In Interface Builder, select the button and then use the Attributes inspector 
to set its key equivalent. (Click the box to the right of “Key Equiv.:” and 
press the Enter key.)

—Jens___

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

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

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

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


Re: Authenticate NSFileManager Operations

2010-05-05 Thread Seth Willits
On May 5, 2010, at 1:01 PM, Kyle Sluder wrote:

>> I'm just going to come out and say it, that I just could not understand what 
>> the heck that code was doing and why. I read everything twice. It's a 
>> bajillion lines of sample code, and since *we all know how much you can 
>> trust Apple sample code to be correct,* there was no way I was going to use 
>> it as is. I don't think I could figure out at the time what needed to be 
>> done to make sure it was working correctly either.
> 
> The whole reason that BAS is confusing is because doing AEWP correctly
> is confusing.


Which makes me wonder why Apple doesn't make an API for doing it "the right 
way" easily? :-)


--
Seth Willits



___

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

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

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

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


Re: Using a keyboard to push a button

2010-05-05 Thread Seth Willits
On May 5, 2010, at 3:46 AM, Benjamin Navarro wrote:

> Hi, I've just realized my first graphic application in Cocoa. It works great, 
> there are 3 textField and 2 static text and when I push a button, the program 
> calculate the two values to put in the static texts using the text fields. 
> My problem is that I have no idea how can I use the "Enter" keyboard key to 
> press the button (make a kind of shortcut). 

Set the action of the field to performClick: of the button.

In Interface Builder, hold Control, click on the field and drag the connection 
line to the button, release. Select performClick:



--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
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: Loading iPhone bundle in Mac OS X application

2010-05-05 Thread Chris Hanson
You're thinking of otool, not otest. OCUnit's otest does load bundles,  
but it doesn't open (say) ARM bundles on Intel-based Macs.


You can't load a bundle for one platform on another. They're different  
platforms...


  -- Chris

On May 5, 2010, at 1:10 PM, Bill Bumgarner  wrote:



On May 4, 2010, at 11:26 PM, Csaba Trucza wrote:

As far as I know the otest unit testing application runs as a  
command line
tool (so I assume it is a Mac OS X application) and somehow manages  
to load

the iPhone bundles.

Any ideas?


otest doesn't load the bundle at all.

It examines the mach-o file directly.

See /usr/include/mach-o/

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/cmh%40me.com

This email sent to c...@me.com

___

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

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

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

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


Re: Loading iPhone bundle in Mac OS X application

2010-05-05 Thread Bill Bumgarner

On May 5, 2010, at 1:13 PM, Kyle Sluder wrote:

> It tests the code that was built for the simulator. See here for more
> information:http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html

What Kyle said -- I read "otest" as "otool". :)

But, depending on needs, you might likely need to use the mach-o APIs to 
introspect the binary.

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: Loading iPhone bundle in Mac OS X application

2010-05-05 Thread Kyle Sluder
On Tue, May 4, 2010 at 11:26 PM, Csaba Trucza
 wrote:
> I want to examine the classes in a bundle built for iPhone in a desktop
> application.

You can't. You would be trying to load ARM code into an Intel process.

> As far as I know the otest unit testing application runs as a command line
> tool (so I assume it is a Mac OS X application) and somehow manages to load
> the iPhone bundles.

It tests the code that was built for the simulator. See here for more
information: 
http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html

--Kyle Sluder
___

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

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

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

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


Re: ScriptingBridge Commands

2010-05-05 Thread has
On May 5, 2010, at 7:45 PM, John Nairn wrote:

> My main reason to use SB is that is is there be default. I find that a 
> surprising (maybe) percentage of my users will balk at anything that requires 
> installation of something (even if free).

Yep, it's always nice when frequently used dependencies are included in the 
stock OS install (gcc, I'm looking at you), particularly in those 
environments (e.g. corporate) where the politics of third-party installs can be 
difficult to negotiate. That said, if folks are regularly using Python or Ruby 
in place of AppleScript, appscript's well worth a look simply because it's so 
much nicer to use than SB. Application scripting's painful enough without the 
extra headaches that SB brings, plus you get features like interactive help and 
ASTranslate to make the transition from AS that much easier.

Alternatively, if the majority of your users are using Python/Ruby/ObjC, then 
you might want to consider forgoing Apple events altogether and providing a 
straight ObjC API, either via NSBundle-based plugins or via Distributed 
Objects. Not that these approaches don't have issues of their own, but at least 
they will provide users with a familiar OO API rather than the weird RPC+query 
idioms of Apple events (with or without SB's clumsy faux-OO semantics on top).


> I think I know the reason the application commands do not work. It might even 
> be solvable, but in my app all commands at application level work at document 
> level too so that is a work around (because scripting without a document open 
> is not very useful)
> 
> I think the reason is that the base application object in the scripting 
> definition is NSApplication and all my application commands are defined in a 
> category of NSApplication, but not in the object itself. I am guessing the SB 
> cannot handle that.

SB does appear to generate the appropriate methods - albeit using a syntax that 
is neither consistent nor intuitive - but sdp is naming the methods differently 
when generating the corresponding header file (i.e. -commandName:nil 
argument:value vs. -commandNameArgument:value). Doesn't really surprise me - 
it's hardly the first time I've found SB and/or sdp to make a muck of things. 
Most of OS X's AppleScript-related technologies have been half-baked in concept 
and/or implementation, and their QA is completely lousy, so while it's 
frustrating this is nothing unusual by AppleScript standards.


> A potential solution might be to subclass NSApplication in my app and then 
> define that class in the AppleScript suite. 

I'm very skeptical. It's not your application design that's at fault here; it's 
SB/sdp's doing, so trying to bend your app to suit SB will probably just 
backfire. As I say, SB makes all sorts of blind assumptions, so chances are 
that if you give your app an 'application' class by any other name it'll still 
work in AS (which is very forgiving) but will break even worse in SB. And don't 
forget that Cocoa Scripting can be very prickly too, so if the CS side is 
currently behaving itself then last thing you want to do is jinx that as well.

If you know a significant proportion of your users will be using SB then I 
recommend you supply supplementary documentation that shows them how to write 
these commands correctly, also noting that sdp-generated headers define these 
method names incorrectly so that ObjC users will know to amend them accordingly.

Regards,

has

-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

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


Re: Loading iPhone bundle in Mac OS X application

2010-05-05 Thread Bill Bumgarner

On May 4, 2010, at 11:26 PM, Csaba Trucza wrote:

> As far as I know the otest unit testing application runs as a command line
> tool (so I assume it is a Mac OS X application) and somehow manages to load
> the iPhone bundles.
> 
> Any ideas?

otest doesn't load the bundle at all.

It examines the mach-o file directly.  

See /usr/include/mach-o/

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


EPS image in NSScrollView

2010-05-05 Thread jyoung79
Hoping someone can steer me in the right direction.  I'm not very good with 
Objective-C, but I'm trying to view an EPS image within a scroll window.  When 
making the window bigger, I'd like the EPS to enlarge.  For example, I'd like 
the width of the EPS to show in the scroll window and when the window is made 
bigger then the EPS will enlarge.  The user could then scroll down to see the 
rest of the image.  I'd like it to work similar to how the PDFKit displays PDF 
images in it's scroll view.

I started off by dragging an 'Object' controller to the 'MainMenu.xib' window 
and then setting it's class to appController.  I then drug a 'scroll view' from 
the library into my 'MainMenu.xib' window.  When I double click on that I get a 
window titled 'Bordered Scroll View (Custom View)' and it has the word 'Custom 
View' inside the window itself.  Ultimately, I'm going to display this scroll 
view within a 'Box' so I can switch views easily.  Next I Control-dragged from 
the appController (in the 'MainMenu.xib' window) to the center of the 'Bordered 
Scroll View' window (where it says 'Custom View') and I selected "theView".  
Then I Control-dragged from the appController (in the 'MainMenu.xib' window) to 
the 'Bordered Scroll View' (in the 'MainMenu.xib' window) and selected 
"scrollView".  I connected the 'box' appropriately as well.  In my .h file I 
have:

IBOutlet NSScrollView *scrollView;
IBOutlet NSView *theView;
IBOutlet NSBox *theBox;

In my .m file I have:

---
if ([ext isEqualToString:@"EPS"]) {
NSImage *theImage = [[NSImage alloc] initWithContentsOfFile:filePath];
[theImage drawInRect:NSMakeRect(0.0, 0.0, [theImage size].width, 
[theImage size].height) fromRect:NSZeroRect operation:NSCompositeSourceOver 
fraction:1.0];
}
---

but it only displays part of the EPS image outside the scroll window.  I've 
also been researching 'dataWithEPSInsideRect' but I'm pretty lost:

---
if ([ext isEqualToString:@"EPS"]) {
NSData *theData = [theView dataWithEPSInsideRect:[theView bounds]];
NSEPSImageRep *epsRep = [NSEPSImageRep imageRepWithData:theData];
NSImage *epsImage = [[NSImage alloc] initWithSize:[theView 
bounds].size];
[epsImage addRepresentation:epsRep];
[theView setContentView:epsImage];
[theBox setContentView:scrollView];
}
---

I'd appreciate any thoughts or if you could point me to a web-site that 
discusses this possibility further.

Thanks.

Jay
___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread Jeff Kelley
Be sure NOT to redistribute the Adobe AIR framework unless you have prior 
written permission from Adobe.

Jeff Kelley
slaun...@umich.edu
Campus Computing Sites
Information and Technology Services
University of Michigan

On May 5, 2010, at 11:57 AM, k...@highrolls.net wrote:

> I was using PackageMaker and it installed the framework.  In a second step to 
> install an adobe air application the installer failed and that is why I went 
> to roll my own.
> 
> -koko
> 
> 
> On May 5, 2010, at 9:51 AM, Mike Abdullah wrote:
> 
>> Are you writing an installer? If so, don't. Use the system-supplied one.
>> 
>> On 5 May 2010, at 16:32, k...@highrolls.net wrote:
>> 
>>> I am using
>>> 
>>> - (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString 
>>> *)dstPatherror:(NSError **)error
>>> 
>>> to copy a framework to /Library/Frameworks.
>>> 
>>> But first I use
>>> 
>>> - (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error
>>> 
>>> 
>>> On my system all is well.  On a user system I get
>>> 
>>> You do not have appropriate access privileges.
>>> 
>>> On the remove step.
>>> 
>>> How does one invoke authentication for NSFileManager operations?
>>> 
>>> -koko
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>>> 
>>> This email sent to cocoa...@mikeabdullah.net
>> 
>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/slauncha%40umich.edu
> 
> This email sent to slaun...@umich.edu
> 
> 

___

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

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

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

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


Change background image in select behavior in the NSToolbarItem

2010-05-05 Thread Junio Gonçalves Vitorino
Hi everyone,

I'd like know if i can change the background image of select behavior when i
click in a NSToolbarItem. An example of the i wanna is the AppZapper
toolbar, I'd like put a image with a closed square more rounded. That's
possible?

-- 
Atenciosamente, Cordially

Junio Vitorino
http://www.lamiscela.net
55 31 9901-7499
___

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

Please do not post admin requests or moderator comments to the list.
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 a keyboard to push a button

2010-05-05 Thread Benjamin Navarro
Hi, I've just realized my first graphic application in Cocoa. It works great, 
there are 3 textField and 2 static text and when I push a button, the program 
calculate the two values to put in the static texts using the text fields. 
My problem is that I have no idea how can I use the "Enter" keyboard key to 
press the button (make a kind of shortcut). 

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


CoreData Object with transient attributes faulting after sync

2010-05-05 Thread Tom Fewster

I have a CoreData application which is using SyncServices (via 
NSPersistentStoreCoordinatorSyncing). A couple of entities contain transient 
attributes (transient values are not synced). The sync works fine & as expected.
However, when the managed object context is reloaded after the sync is 
complete, the managed objects which contain transient values fault 
(didTurnIntoFault: is called) and are recreated (awakeFromFetch is called), 
even though nothing has changed, except for the contents of the transient 
attributes. This only seems to happen on the first sync after the application 
is launched, subsequent syncs doesn't fault the managed objects. 

I have also noticed that the NSManagedObjectContextObjectsDidChangeNotification 
notification is never broadcast in this situation. Therefore, anything that 
contains a reference to a managed object contains an invalid reference, and I 
have no way of knowing when I need to update the reference (I guess I could 
retain the MO and call isFault before each use, but that doesn't seen nice)

- Is it expected behaviour to fault and awakeFromFetch a managed object with 
transient attributes after a sync?
- Why does this only happen to MO's with transient attributes (it may happen 
with others, I just haven't experienced it)?
- Is there anyway to prevent this from happening e.g. change the merge policies 
on the NSManagedObjectContext?

Hope I have made my problem clear.

Thanks,
Tom

___

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

Please do not post admin requests or moderator comments to the list.
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


Loading iPhone bundle in Mac OS X application

2010-05-05 Thread Csaba Trucza
Hello,

I want to examine the classes in a bundle built for iPhone in a desktop
application.
Right now I am stuck at loading the iPhone bundle in the Mac OS X
application.
I tried loading with NSBundle load, but it complains of incompatible
architectures.
As far as I know the otest unit testing application runs as a command line
tool (so I assume it is a Mac OS X application) and somehow manages to load
the iPhone bundles.

Any ideas?

Csaba Trucza
___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread Kyle Sluder
On Wed, May 5, 2010 at 12:52 PM, Seth Willits  wrote:
> I'm just going to come out and say it, that I just could not understand what 
> the heck that code was doing and why. I read everything twice. It's a 
> bajillion lines of sample code, and since *we all know how much you can trust 
> Apple sample code to be correct,* there was no way I was going to use it as 
> is. I don't think I could figure out at the time what needed to be done to 
> make sure it was working correctly either.

The whole reason that BAS is confusing is because doing AEWP correctly
is confusing.

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


Core Data: *Really* Automatic Migration : Span Multiple Versions

2010-05-05 Thread Jerry Krinock
Say that a Core Data document-based app package contains:

model version 1
mapping model 1->2
model version 2
mapping model 2->3
model version 3

It seems to me that a document created when version 1 was current will not be 
openable by the latest version of the app, at least with the 10.5 SDK, because 
the "automatic" migration performed by -[NSPersistentDocument 
configurePersistentStoreCoordinatorForURL:] is not smart enough to search 
for and apply mapping models serially.

One solution to this problem is to edit mapping model 1->2 into a new combined 
mapping model 1->3.  Not much fun when you get up to version 6 and need to edit 
and test five mapping models.

A better solution would be to override -[NSPersistentDocument 
configurePersistentStoreCoordinatorForURL:] to do the required searching 
and serial migrations.  Disadvantage is that it might take a really long time 
to open a really old document, but that's acceptable.

Something like this:

Get store metadata for the document to be opened.
Read the "VersionInfo" plist with NSPropertyListSerialization method (yuck).
Extract from plist the current model version.
Extract from plist an array of all model versions.
Get managed object model of current model version and send it 
-isConfiguration:compatibleWithStoreMetadata:.
If it returns YES, goto Finish:.
For each other model version, get managed object model and send it 
-isConfiguration:compatibleWithStoreMetadata:, until you find one that is 
compatible with the document.
Call this the sourceModel.
Label TryMigrate:
Send +[NSMappingModel mappingModelFromBundles:forSourceModel:destinationModel:] 
with different destination models until you get a mapping model.  Call the 
successful destination the destinModel.
Create a NSMigrationManager with sourceModel, destinModel.
Send this migration manager the message 
-migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error],
 creating a temporary file.
If migration succeeded, rename the source file, adding a tilde, and rename the 
temporary file to have the name of the original document.
If destinModel is current model version, goto Finish:.
Set sourceModel to destinModel.
Go back to TryMigrate:
Label Finish:
Invoke super -configurePersistentStoreCoordinatorForURL:.

Has anyone already done this?

Any suggestions before I try it?

___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread Seth Willits
On May 5, 2010, at 8:49 AM, Ken Thomases wrote:

> Another technique is outlined in the BetterAuthorizationSample sample code:
> 
> http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/Introduction/Intro.html


I'm just going to come out and say it, that I just could not understand what 
the heck that code was doing and why. I read everything twice. It's a bajillion 
lines of sample code, and since *we all know how much you can trust Apple 
sample code to be correct,* there was no way I was going to use it as is. I 
don't think I could figure out at the time what needed to be done to make sure 
it was working correctly either.

My solution was to use AuthorizationExecuteWithPrivileges from within my GUI 
app to run whatever I need. Apparently that's the wrong way, but the "right" 
way confused the snot out of me.  In my case, I have code in my application to 
install and load a kext on demand, and unload and uninstall. That involves 
authenticating to run kextload/unload, cp, rm, and chown. It works, and instead 
of being *thousands* of lines of code, it's under 200. But I'd still rather do 
it the right way if it wasn't so insane.


--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
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: NSSegmentedControl in a toolbar

2010-05-05 Thread Brian Postow

On May 5, 2010, at 2:57 PM, Flavio Donadio wrote:

> Quincey,
> 
> 
> Now, that's the kind of answer I needed, even if it doesn't really get me 
> where I want! At least, it stops me from pursuing something too difficult, 
> impossible or undesirable.
> 
> On 05/05/2010, at 14:17, Quincey Morris wrote:
> 
>> And that points to your real problem -- what you want *isn't* a segmented 
>> control. Segment controls have their segment labels inside the segments, not 
>> below them, which is why (for example) what looks like a segmented control 
>> in Mail (Reply -- Reply All -- Forward) isn't one.
> 
> I am sure a lot of people think it is a NSSegmentedControl. Is there a way to 
> know this for sure? I mean, you seem to really know it, but how did you do?
> 

the way to tell is to look in the preview.app package and see that there are 
parts of the buttons laying around as explicit separate files... 

>> If you want it to look like the Mail toolbar, then you can't use a segmented 
>> control, and you're going to have to do some work. I don't know offhand how 
>> to get items with no space between them. Maybe that's what toolbar groups 
>> are for -- I've never had occasion to use them.
> 
> For now, I am going the "cheap trick" route and using spaces to make it look 
> like multiple labels, as advised by Brian Postow. That's what I did in the 
> first design and I can live with that.
> 
> I'll research about NSToolbarItemGroups some other day and post the results 
> here. I have things to get done now. ;)
> 
> Thanks everybody for the help (or for trying)!
> 
> 
> Cheers,
> Flavio___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/brian.postow%40acordex.com
> 
> This email sent to brian.pos...@acordex.com
> 

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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

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

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

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


Re: Client/Server Design

2010-05-05 Thread Phillip Mills
On 2010-05-05, at 2:24 PM, Jens Alfke wrote:

> While the device is docked the user can use iTunes to (clumsily) transfer 
> files between the Mac filesystem and the app’s Documents folder. 

That seems so basic (without the 'clumsy') that I have trouble believing that 
it hasn't existed forever.

> if connecting to the user’s computer you’ll need a small listener app to run 
> there and handle the data transfer.

That was my fallback position.

> Greg already mentioned BLIP, a high-level messaging protocol, which is 
> implemented in my MYNetwork library for Mac and iPhone:
>   http://bitbucket.org/snej/mynetwork/

Thanks to both of you.  I'll take a look at that.  I've now also discovered a 
set of classes called 'PKFileServer' that I want to examine.

___

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

Please do not post admin requests or moderator comments to the list.
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: NSSegmentedControl in a toolbar

2010-05-05 Thread Flavio Donadio
Quincey,


Now, that's the kind of answer I needed, even if it doesn't really get me where 
I want! At least, it stops me from pursuing something too difficult, impossible 
or undesirable.

On 05/05/2010, at 14:17, Quincey Morris wrote:

> And that points to your real problem -- what you want *isn't* a segmented 
> control. Segment controls have their segment labels inside the segments, not 
> below them, which is why (for example) what looks like a segmented control in 
> Mail (Reply -- Reply All -- Forward) isn't one.

I am sure a lot of people think it is a NSSegmentedControl. Is there a way to 
know this for sure? I mean, you seem to really know it, but how did you do?

> If you want it to look like the Mail toolbar, then you can't use a segmented 
> control, and you're going to have to do some work. I don't know offhand how 
> to get items with no space between them. Maybe that's what toolbar groups are 
> for -- I've never had occasion to use them.

For now, I am going the "cheap trick" route and using spaces to make it look 
like multiple labels, as advised by Brian Postow. That's what I did in the 
first design and I can live with that.

I'll research about NSToolbarItemGroups some other day and post the results 
here. I have things to get done now. ;)

Thanks everybody for the help (or for trying)!


Cheers,
Flavio___

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

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

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

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


Re: Custom NSPathControl

2010-05-05 Thread Corbin Dunn

On May 5, 2010, at 10:20 AM, Quincey Morris wrote:

> On May 5, 2010, at 04:20, Graham Cox wrote:
> 
>> So is using NSPathControl even possible for this, or would I just be better 
>> off writing a complete new control from scratch? NSPathControl does some 
>> neat things like fading overlong text within a subcell that I could use, as 
>> well as displaying an icon and a triangle for the next item. What about 
>> subclassing the subcell? I guess I'm just looking for some direction here or 
>> even better, some code out there I can use.
> 
> If you don't need the icons, and you don't need any slashes in your text, 
> setting a path string instead of a URL works just fine.

..and if you do need them, set the path string, then manually set the icons on 
the -pathComponentCells. If you need slashes in the text, use a URL with some 
custom prefix and escape the slashes.

-corbin


___

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

Please do not post admin requests or moderator comments to the list.
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: [[NSFileManager alloc] init] considered thread-safe

2010-05-05 Thread Michael Ash
On Wed, May 5, 2010 at 2:29 PM, Jens Alfke  wrote:
>
> On May 5, 2010, at 8:50 AM, Michael Ash wrote:
>
>>> Delegates are the only reason the doc says anything other than "go nuts".
>>>  This is what both Jens and I were trying to say.
>>
>> Is this true for all OS X versions, for 10.6+, or some other combination?
>
> For all, I think, although the issue doesn’t apply prior to 10.5 because 
> there wasn’t a delegate. Aside from the delegate, NSFileManager is really 
> just a stateless procedural API wrapped up in an object instance, so it has 
> the same thread safety as the underlying filesystem calls, i.e. “go nuts”.

That's what I would have thought, but it was explicitly listed as not
being thread safe before 10.5, and is still listed as "v10.5 and
later" next to the entry that marks it as thread safe in the Cocoa
thread safety summary.

Just because the API is stateless doesn't mean the object itself
doesn't have any state underneath. It *shouldn't*, but I'd tend to
trust the API docs.

However, I'm only targeting 10.5 these days, and that doc answers my
question, so I'm in good shape! I should have looked there first.

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: Communication between Cocoa and Carbon threads

2010-05-05 Thread Jens Alfke

On May 4, 2010, at 10:30 PM, Abhijeet Singh wrote:

> I have read in Mac OSX Technology overview that we can integrate Carbon with 
> Cocoa application. So can anybody suggest what are the possible ways to send 
> message from Cocoa thread to Carbon thread in an Cocoa Application.

There’s really only one kind of thread in an app, although there are multiple 
APIs (NSThread, pthreads, Carbon’s MP calls). So the question is how to message 
between threads in general.

If your Carbon code uses runloops already, you can use Mach ports and messages 
for communication, using CoreFoundation APIs. (I am pretty sure there is Apple 
sample code demonstrating how to do this.)

If not, you may have to roll your own techniques using classic techniques like 
a thread-safe queue. Implement the queue with a C or C++ API, and then you can 
use it from both Carbon and Cocoa code. One thread can then push messages into 
the queue while another thread runs a loop that pulls messages as they arrive.

—Jens___

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

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

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

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


Re: [[NSFileManager alloc] init] considered thread-safe

2010-05-05 Thread Jens Alfke

On May 5, 2010, at 8:50 AM, Michael Ash wrote:

>> Delegates are the only reason the doc says anything other than "go nuts".
>>  This is what both Jens and I were trying to say.
> 
> Is this true for all OS X versions, for 10.6+, or some other combination?

For all, I think, although the issue doesn’t apply prior to 10.5 because there 
wasn’t a delegate. Aside from the delegate, NSFileManager is really just a 
stateless procedural API wrapped up in an object instance, so it has the same 
thread safety as the underlying filesystem calls, i.e. “go nuts”.

—Jens___

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

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

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

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


Re: Weird "iPhone OS 4.0 Library" dialog popping up

2010-05-05 Thread Tino Rachui
Ok I'm calm again. Thanks for the answers folks.

Regards,
Tino

Am 05.05.2010 um 18:03 schrieb Fritz Anderson:

> On 5 May 2010, at 6:49 AM, Tino Rachui wrote:
> 
>> I've installed beta 3 of the new iPhone OS 4 SDK. From time to time a dialog 
>> pops up now titled "iPhone OS 4.0 Library - To download this update, log in 
>> to Apple Developer Connection at connect.apple.com. Your login information 
>> will be sent securely." asking me for name and password. This looks 
>> extremely suspicious to me. Has anyone an explanation for that? 
> 
> I won't comment on NDA software, but I'll remark on the behavior of Xcode 
> 3.2, which is public.
> 
> New installations of Xcode ship with documentation sets that mostly refer to 
> documents on Apple web servers, so that when you download Xcode, it won't 
> include the gigabytes of documentation. Xcode will then offer to download the 
> complete sets. For that, you need an Apple Developer Connection membership. 
> It asks you (only once; it will remember) for the Apple ID and password you 
> supplied when you signed up.
> 
> Nothing suspicious at all.
> 
> Inquiries about Xcode are better directed to xcode-users, though it, too, 
> prohibits discussion of NDA software.
> 
>   — F
> 

___

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

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

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

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


Re: Client/Server Design

2010-05-05 Thread Jens Alfke

On May 5, 2010, at 5:27 AM, Phillip Mills wrote:

> I have ideas for a number of different applications that share a general 
> architecture: use an iPhone as a remote data-collection front end to a Mac 
> app that does more complicated processing, or to a general purpose 
> application such as a spreadsheet or database, or to a variety of apps that 
> each do their own specific processing (*nix style).  The core feature in all 
> of this is a need for easy file or document transmission between the systems.

OS 3.2 (i.e. the iPad, for now) supports document sharing. While the device is 
docked the user can use iTunes to (clumsily) transfer files between the Mac 
filesystem and the app’s Documents folder. Apps like Pages and GoodReader use 
this.

The UI for this is currently really bad, as in “I can’t believe this came from 
Apple”, but I can only assume that’s because they haven’t had time to get it 
right yet, but had to ship it anyway because it’s pretty crucial for the iWork 
apps. So I strongly expect/hope it will work more smoothly on the Mac side in 
the future.

The alternatives all involve network transfer, either up to a server or 
directly to the user’s computer. For a server you’d probably want to use a 
straight HTTP POST, which any web app will understand; if connecting to the 
user’s computer you’ll need a small listener app to run there and handle the 
data transfer. Greg already mentioned BLIP, a high-level messaging protocol, 
which is implemented in my MYNetwork library for Mac and iPhone:
http://bitbucket.org/snej/mynetwork/

—Jens___

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

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

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

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


Re: NSSegmentedControl in a toolbar

2010-05-05 Thread Brian Postow
I should mention that what I did is that I used a segmented control, and then 
used the single under the control label, but used spaces and centering to make 
it LOOK like it had two labels, even though it really only has one label...  so 
instead of having "next" under one arrow and "prev" under the other, I have 
"prev  next" under the segmented control... it's a kludge, but it was 
the best I came up with...


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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

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

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

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


Re: ScriptingBridge Commands

2010-05-05 Thread has
John Nairn wrote:

> I have been using ScriptingBridge to script my AppleScriptable Cocoa  
> app using Python and Ruby. Today I noticed that commands defined on  
> the main application do not work with error message that the  
> application has no such attribute. I checked the header file created  
> by the ScriptingBridge and see that all commands are defined in a  
> generic GEDitCOM_IIItem that is subclass of SBObject:
> [...]
> Is this a bug in the ScriptingBridge framework?

Probably. SB's API is heavily obfuscated and makes all sorts of accidental or 
deliberate assumptions about how scriptable applications operate that don't 
actually match up with reality. (e.g. Google "scripting bridge"+"appscript" if 
you want to see me tearing it various holes.) At any rate, I ran into similar 
problems:

#!/usr/bin/python
from ScriptingBridge import *
iTunes = 
SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")
iTunes.activate() # works ok
iTunes.pause() # works ok
iTunes.playOnce_(False) # AttributeError: 'ITunesApplication' object 
has no attribute 'playOnce_'

Eventually, I figured out the magic invocation via sleuthing and guesswork:

iTunes.play_once_(None, False)

I didn't bother trying to find out if -[iTunesApplication playOnce:] works in 
ObjC, which is what the sdp-generated header claims it should be. But it 
wouldn't surprise me if it broke there - sdp's output isn't always correct 
either.

For comparison, here's how you do it in py-appscript:

#!/usr/bin/python
from appscript import *
itunes = app('iTunes')
itunes.activate()
itunes.pause()
itunes.play()

Much nicer, more capable native API, and far less prone to compatibility 
problems than SB. (I build heavy-duty workflows with it in my day job.) The 
only downside is that it's not present in OS X by default, but it's trivial to 
install via setuptools as long as you've got gcc on your system and it's 
MIT-licensed so redistribution isn't a problem.

HTH

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

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


Re: Linking a specific controller instance to user defaults

2010-05-05 Thread Quincey Morris
On May 5, 2010, at 05:42, Graham Cox wrote:

> The problem should be obvious - how to ensure that each instance of the 
> controller can use a specific unique key in the user defaults. Creating a 
> unique key is easy, but at load time how to calculate the exact same key for 
> the specific instance is not. I thought of adding a 'settings name' property 
> that was used to prefix the key but there's no way to set it earlier than 
> -awakeFromNib time from some external object that "knows" which instance it 
> is using. Ideally the settings name could be set for the instance in IB, but 
> since this is a generic NSObject subclass I can't do that without making an 
> IB plugin just to set it, which seems like major overkill.
> 
> Is there another way to set the settings name just in time?

The first thing that sprang to mind was to use two different subclasses of the 
controller. Then either test the class name, or have the subclasses return a 
unique name or key (that's built into the subclass so you don't have to set it 
in IB).


___

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

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

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

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


Re: Custom NSPathControl

2010-05-05 Thread Quincey Morris
On May 5, 2010, at 04:20, Graham Cox wrote:

> So is using NSPathControl even possible for this, or would I just be better 
> off writing a complete new control from scratch? NSPathControl does some neat 
> things like fading overlong text within a subcell that I could use, as well 
> as displaying an icon and a triangle for the next item. What about 
> subclassing the subcell? I guess I'm just looking for some direction here or 
> even better, some code out there I can use.

If you don't need the icons, and you don't need any slashes in your text, 
setting a path string instead of a URL works just fine.


___

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

Please do not post admin requests or moderator comments to the list.
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: Client/Server Design

2010-05-05 Thread Greg Guerin

Phillip Mills wrote:

I've read the notorious Technical Note TN2152, "iPhone OS does not  
currently provide a direct way for third party developers to  
transfer data between the user's computer and their device," but I  
assume common workarounds are in place.  Obviously I could follow  
the note's suggestions about rolling my own from lower level  
functions (or GameKit?), however I thought I should ask whether  
there are strategies and libraries that other people have found  
useful for solving similar problems.



Cocoa AsyncSocket
http://code.google.com/p/cocoaasyncsocket/

BLIP Protocol
http://groups.google.com/group/blip-protocol

  -- GG

___

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

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

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

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


Re: NSSegmentedControl in a toolbar

2010-05-05 Thread Quincey Morris
On May 5, 2010, at 07:00, Flavio Donadio wrote:

> Yes, I could do it in IB, if only I knew how to put the labels below each 
> segment, which is my ultimate goal here.

And that points to your real problem -- what you want *isn't* a segmented 
control. Segment controls have their segment labels inside the segments, not 
below them, which is why (for example) what looks like a segmented control in 
Mail (Reply -- Reply All -- Forward) isn't one.

If you want to use a segmented control, put the title inside the segments (with 
an image if you like), and put a shared descriptive label (Send, or something 
like that, in your example) below.

If you want it to look like the Mail toolbar, then you can't use a segmented 
control, and you're going to have to do some work. I don't know offhand how to 
get items with no space between them. Maybe that's what toolbar groups are for 
-- I've never had occasion to use them.


___

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

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

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

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


Re: Custom NSPathControl

2010-05-05 Thread Corbin Dunn

On May 5, 2010, at 4:20 AM, Graham Cox wrote:

> I have a UI that is designed to break down a huge collection of items into a 
> manageable subset that the user can work with at a time. Each item 
> effectively has a sort of "path", that describes its hierarchy, not in terms 
> of its location on disk, which is irrelevant, but its place in the whole big 
> collection of objects which is vaguely analogous to a file path.
> 
> I was looking at NSPathControl as a way to neatly show which item was 
> selected including its hierarchical information, but quickly realised that 
> this control is very strongly tied to NSURLs as a specific form of path and 
> was not designed to be readily abstracted.

It is tied to NSUrls, but it can easily be abstracted. Just use a non file URL. 
Or, explicitly control the pathComponentCells and fill them up with you what 
you want. You'll want to subclass NSPathCell, and NSPathComponentCell.

Override points:

+ (Class)pathComponentCellClass; (or, directly set the pathComponentCells)
- (NSRect)rectOfPathComponentCell:(NSPathComponentCell *)cell 
withFrame:(NSRect)frame inView:(NSView *)view;


> 
> So is using NSPathControl even possible for this, or would I just be better 
> off writing a complete new control from scratch? NSPathControl does some neat 
> things like fading overlong text within a subcell that I could use, as well 
> as displaying an icon and a triangle for the next item. What about 
> subclassing the subcell? I guess I'm just looking for some direction here or 
> even better, some code out there I can use.

It can work. If you have trouble, please do log bugs with issues you encounter. 
The goal was to make it flexible, but there is the possibility of issues, 
depending on "what you want to do"

corbin___

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

Please do not post admin requests or moderator comments to the list.
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: Avoid drawing in half pixel

2010-05-05 Thread Corbin Dunn

On May 5, 2010, at 8:18 AM, Gustavo Pizano wrote:

> Hello all.
> 
> I have a split view and inside I have custom views, in one subview Im drawing 
> lines with a NSBezierPath, and when I move the divider I  see sometimes the 
> lines very thin some others no, so I  know this last behavior its because Im 
> drawing in half a pixel.
> 
> I was reading the apple docs about this topic,  and I tried at the beginning 
> of my drawRect method I did as in "Converting Coordinate Values" topic 
> suggest to convert my starting drawing point,  but that din't help. I still 
> see the above behavior. 
> I realize then that when I resize the window I  have the same behavior, so 
> what I did was in the windowDelegate  windowWillResize method, I did the 
> following:
> 
>   if((NSInteger)frameSize.width % 2 != 0){
>   frameSize.width += 1.0f;
>   
>   }
>   if((NSInteger)frameSize.height % 2 != 0){
>   frameSize.height += 1.0f;
>   }
> 
> and when I resize the window I don't see hte problem anymore. I tried 
> applying this same to the splitview delegate when resizing, but unfortunately 
> this approach didn't work well, I started getting warnings in the console 
> that the size of the subviews weren't correct and it was being recalculated 
> at the cost of performance.
> 
> So any other idea on what can I do to avoid this behavior? 

First off, is frameSize from self.frame.size? If you have a view's frame that 
is not integral (ie: x=3.5, or width=300.5), then the view's contents will draw 
fuzzy. You don't want that. So, do some consistent truncing/ceiling. ie: 
frame.origin.x = trunc(frame.origin.x), or rounding -- rounding usually isn't 
what you want, since sometimes it will round up and other times it will round 
down. It is better to be consistent with trunc/ceil, but it depends on what you 
are doing. 

The same advice goes for the rects you are using as bezier paths.

corbin


___

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

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

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

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


Re: Custom view as a menu item

2010-05-05 Thread Dave DeLong
-[NSMenuItem setView:] ?

http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/doc/uid/2265-SW1

Dave

On May 5, 2010, at 10:17 AM, Nava Carmon wrote:

> Anyone?
> 
> On May 4, 2010, at 10:18 AM, Nava Carmon wrote:
> 
>> Hi,
>> 
>> I need to implement a menu that looks and feels like that of spotlight: with 
>> a search field as a first item and  other items will be filled from some xml 
>> file on fly. Are there some examples/ideas on how to do it?
>> 
>> Thanks a lot,
>> 
>> Nava Carmon
>> ncar...@mac.com
>> 
>> "Think good and it will be good!"


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: Authenticate NSFileManager Operations

2010-05-05 Thread Fritz Anderson
On 5 May 2010, at 10:57 AM, k...@highrolls.net wrote:

> I was using PackageMaker and it installed the framework.  In a second step to 
> install an adobe air application the installer failed and that is why I went 
> to roll my own.

To put it _very_ charitably, PackageMaker has quite a few subtleties. You may 
find it profitable to join the installer-dev mailing list, and explain your 
problems with it in detail there.

— F

___

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

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

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

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


Custom view as a menu item

2010-05-05 Thread Nava Carmon
Anyone?

On May 4, 2010, at 10:18 AM, Nava Carmon wrote:

> Hi,
> 
> I need to implement a menu that looks and feels like that of spotlight: with 
> a search field as a first item and  other items will be filled from some xml 
> file on fly. Are there some examples/ideas on how to do it?
> 
> Thanks a lot,
> 
> Nava Carmon
> ncar...@mac.com
> 
> "Think good and it will be good!"
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/ncarmon%40mac.com
> 
> This email sent to ncar...@mac.com


Nava Carmon
ncar...@mac.com

"Think good and it will be good!"

___

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

Please do not post admin requests or moderator comments to the list.
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: Avoid drawing in half pixel

2010-05-05 Thread Gustavo Pizano

On May 5, 2010, at 6:01 PM, Simone Tellini wrote:

> On Wed, 5 May 2010 17:52:53 +0200, Gustavo Pizano
>  wrote:
> 
>> So at the beginning of my drawRect, shall I use NSIntegralRect([self
>> bounds])?
> 
> yes, and use the resulting rect's origin as reference point for your
> drawing.
> 
>> Im gonna give a try...   most probably I need antialiasing, because Im
>> drawing some strings also in the view, so having no AA will affect them
>> isn't it?
> 
> you can turn it on/off according to your needs: ie. turn it off, draw
> vertical/horizontal lines that you don't want to become blurry, turn it on
> and draw the rest.
> 
Yes thats what Im doing right now, turning on and off and saving and restoring 
the ctx, now im dealing with the rounded corners of the path .. :S..

G.

> -- 
> Simone Tellini
> http://www.tellini.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/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: UIPickerView and MKMapView

2010-05-05 Thread Fritz Anderson
On 5 May 2010, at 8:25 AM, Gerriet M. Denkmann wrote:

> I have an MKMapView to which I add a subview.

I have never succeeded at adding views to MKMapView, nor ever seen it succeed. 
The  If you need to add controls, you should enclose them and the map view in a 
wrapper view.

— F

___

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

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

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

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


Re: Weird "iPhone OS 4.0 Library" dialog popping up

2010-05-05 Thread Fritz Anderson
On 5 May 2010, at 6:49 AM, Tino Rachui wrote:

> I've installed beta 3 of the new iPhone OS 4 SDK. From time to time a dialog 
> pops up now titled "iPhone OS 4.0 Library - To download this update, log in 
> to Apple Developer Connection at connect.apple.com. Your login information 
> will be sent securely." asking me for name and password. This looks extremely 
> suspicious to me. Has anyone an explanation for that? 

I won't comment on NDA software, but I'll remark on the behavior of Xcode 3.2, 
which is public.

New installations of Xcode ship with documentation sets that mostly refer to 
documents on Apple web servers, so that when you download Xcode, it won't 
include the gigabytes of documentation. Xcode will then offer to download the 
complete sets. For that, you need an Apple Developer Connection membership. It 
asks you (only once; it will remember) for the Apple ID and password you 
supplied when you signed up.

Nothing suspicious at all.

Inquiries about Xcode are better directed to xcode-users, though it, too, 
prohibits discussion of NDA software.

— F

___

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

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

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

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


Re: Avoid drawing in half pixel

2010-05-05 Thread Simone Tellini
On Wed, 5 May 2010 17:52:53 +0200, Gustavo Pizano
 wrote:

> So at the beginning of my drawRect, shall I use NSIntegralRect([self
> bounds])?

yes, and use the resulting rect's origin as reference point for your
drawing.

> Im gonna give a try...   most probably I need antialiasing, because Im
> drawing some strings also in the view, so having no AA will affect them
> isn't it?

you can turn it on/off according to your needs: ie. turn it off, draw
vertical/horizontal lines that you don't want to become blurry, turn it on
and draw the rest.

-- 
Simone Tellini
http://www.tellini.org
___

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

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

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

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


Re: Avoid drawing in half pixel

2010-05-05 Thread Gustavo Pizano
from apps docs
"During layout, make sure views and images are positioned on integral pixel 
boundaries."

this is what Im doing wrong I think... the problem is how to correct it, 
because when I resize the splitview of course its not staying in a integral 
pixel.. thats when I see the lines bigger than normal.

Gustavo



On May 5, 2010, at 5:51 PM, Rob Ross wrote:

> Try turning off anti-aliasing. Also see :
> 
> http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-BCICIJAJ
> 
> Rob
> 
> On May 5, 2010, at 8:18 AM, Gustavo Pizano wrote:
> 
>> Hello all.
>> 
>> I have a split view and inside I have custom views, in one subview Im 
>> drawing lines with a NSBezierPath, and when I move the divider I  see 
>> sometimes the lines very thin some others no, so I  know this last behavior 
>> its because Im drawing in half a pixel.
>> 
>> I was reading the apple docs about this topic,  and I tried at the beginning 
>> of my drawRect method I did as in "Converting Coordinate Values" topic 
>> suggest to convert my starting drawing point,  but that din't help. I still 
>> see the above behavior. 
>> I realize then that when I resize the window I  have the same behavior, so 
>> what I did was in the windowDelegate  windowWillResize method, I did the 
>> following:
>> 
>>  if((NSInteger)frameSize.width % 2 != 0){
>>  frameSize.width += 1.0f;
>>  
>>  }
>>  if((NSInteger)frameSize.height % 2 != 0){
>>  frameSize.height += 1.0f;
>>  }
>> 
>> and when I resize the window I don't see hte problem anymore. I tried 
>> applying this same to the splitview delegate when resizing, but 
>> unfortunately this approach didn't work well, I started getting warnings in 
>> the console that the size of the subviews weren't correct and it was being 
>> recalculated at the cost of performance.
>> 
>> So any other idea on what can I do to avoid this behavior? 
>> 
>> 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: Authenticate NSFileManager Operations

2010-05-05 Thread koko
I was using PackageMaker and it installed the framework.  In a second  
step to install an adobe air application the installer failed and that  
is why I went to roll my own.


-koko


On May 5, 2010, at 9:51 AM, Mike Abdullah wrote:

Are you writing an installer? If so, don't. Use the system-supplied  
one.


On 5 May 2010, at 16:32, k...@highrolls.net wrote:


I am using

- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString  
*)dstPatherror:(NSError **)error


to copy a framework to /Library/Frameworks.

But first I use

- (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error


On my system all is well.  On a user system I get

You do not have appropriate access privileges.

On the remove step.

How does one invoke authentication for NSFileManager operations?

-koko
___

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

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

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

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





___

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

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

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

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


Re: Authenticate NSFileManager Operations

2010-05-05 Thread koko

Thanks for the direction Ken!

-koko

On May 5, 2010, at 9:51 AM, Ken Thomases wrote:


On May 5, 2010, at 10:32 AM, k...@highrolls.net wrote:


I am using

- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString  
*)dstPatherror:(NSError **)error


to copy a framework to /Library/Frameworks.

But first I use

- (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error


On my system all is well.


It's not so much your system as the fact that you're logged into an  
administrator account.



On a user system I get

You do not have appropriate access privileges.

On the remove step.


Indeed, a normal user account won't have permissions to modify stuff  
in /Library




How does one invoke authentication for NSFileManager operations?


One does not.  A central tenet of the Unix security model is that  
processes can not gain privileges, they can only reduce their  
privileges.  So, privileged operations can only be performed by a  
process which started out with privileges and never gave them up.


In other words, you have to launch a separate process in a special  
way in order to perform privileged operations.


One technique is to use the "authopen" command, if it works for the  
purpose.  Another technique is outlined in the  
BetterAuthorizationSample sample code:


http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/Introduction/Intro.html

Cheers,
Ken




___

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

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

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

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


Re: Authenticate NSFileManager Operations

2010-05-05 Thread koko

Don't = No I must ! (lol)

-koko

On May 5, 2010, at 9:51 AM, Mike Abdullah wrote:

Are you writing an installer? If so, don't. Use the system-supplied  
one.


On 5 May 2010, at 16:32, k...@highrolls.net wrote:


I am using

- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString  
*)dstPatherror:(NSError **)error


to copy a framework to /Library/Frameworks.

But first I use

- (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error


On my system all is well.  On a user system I get

You do not have appropriate access privileges.

On the remove step.

How does one invoke authentication for NSFileManager operations?

-koko
___

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

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

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

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





___

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

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

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

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


Re: Avoid drawing in half pixel

2010-05-05 Thread Gustavo Pizano
Hello Simone.

So at the beginning of my drawRect, shall I use NSIntegralRect([self bounds])?

Im gonna give a try...   most probably I need antialiasing, because Im drawing 
some strings also in the view, so having no AA will affect them isn't it?

G.

On May 5, 2010, at 5:46 PM, Simone Tellini wrote:

> On Wed, 05 May 2010 17:40:24 +0200, Simone Tellini
> 
> wrote:
>> ___
>> 
> 
> ok, this weird. If I reply with Thunderbird, the body of the message gets
> eaten by the mailing list server.
> 
> I was saying:
> 
>> I was reading the apple docs about this topic,  and I tried at the
> beginning of my drawRect 
>> method I did as in "Converting Coordinate Values" topic suggest to
> convert my starting 
>> drawing point,  but that din't help. I still see the above behavior.
> 
> you should probably leave the view frame alone. You could use
> NSIntegralRect() to properly adjust the coordinates of the area you draw
> in.
> 
> Or you can disable anti-aliasing, if not needed. Check
> -setShouldAntialias: in NSGraphicsContext
> 
> -- 
> Simone Tellini
> http://www.tellini.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/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: Avoid drawing in half pixel

2010-05-05 Thread Rob Ross
Try turning off anti-aliasing. Also see :

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-BCICIJAJ

Rob

On May 5, 2010, at 8:18 AM, Gustavo Pizano wrote:

> Hello all.
> 
> I have a split view and inside I have custom views, in one subview Im drawing 
> lines with a NSBezierPath, and when I move the divider I  see sometimes the 
> lines very thin some others no, so I  know this last behavior its because Im 
> drawing in half a pixel.
> 
> I was reading the apple docs about this topic,  and I tried at the beginning 
> of my drawRect method I did as in "Converting Coordinate Values" topic 
> suggest to convert my starting drawing point,  but that din't help. I still 
> see the above behavior. 
> I realize then that when I resize the window I  have the same behavior, so 
> what I did was in the windowDelegate  windowWillResize method, I did the 
> following:
> 
>   if((NSInteger)frameSize.width % 2 != 0){
>   frameSize.width += 1.0f;
>   
>   }
>   if((NSInteger)frameSize.height % 2 != 0){
>   frameSize.height += 1.0f;
>   }
> 
> and when I resize the window I don't see hte problem anymore. I tried 
> applying this same to the splitview delegate when resizing, but unfortunately 
> this approach didn't work well, I started getting warnings in the console 
> that the size of the subviews weren't correct and it was being recalculated 
> at the cost of performance.
> 
> So any other idea on what can I do to avoid this behavior? 
> 
> 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: Authenticate NSFileManager Operations

2010-05-05 Thread Jerry Krinock

On 2010 May 05, at 08:32, k...@highrolls.net wrote:

> How does one invoke authentication for NSFileManager operations?

Mike Abdullah's answer is correct regarding installers.  If you're not writing 
an installer,

Easy way: Tell the Finder to do it with an Apple Event (thanks to Jean-Daniel 
Dupas)
Hard way: Write a authorized Helper tool based on BetterAuthorizationSample

___

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

Please do not post admin requests or moderator comments to the list.
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: Authenticate NSFileManager Operations

2010-05-05 Thread Mike Abdullah
Are you writing an installer? If so, don't. Use the system-supplied one.

On 5 May 2010, at 16:32, k...@highrolls.net wrote:

> I am using
> 
> - (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString 
> *)dstPatherror:(NSError **)error
> 
> to copy a framework to /Library/Frameworks.
> 
> But first I use
> 
> - (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error
> 
> 
> On my system all is well.  On a user system I get
> 
>   You do not have appropriate access privileges.
> 
> On the remove step.
> 
> How does one invoke authentication for NSFileManager operations?
> 
> -koko
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Re: [[NSFileManager alloc] init] considered thread-safe

2010-05-05 Thread Michael Ash
On Wed, May 5, 2010 at 2:37 AM, Ken Ferry  wrote:
> On Tue, May 4, 2010 at 11:27 PM, Quincey Morris > wrote:
>
>> I'm not concerned with the issue of delegates. My question is whether a
>> single (delegate-less) instance of NSFileManager can be used simultaneously
>> from multiple threads, or whether each thread needs a separate instance to
>> prevent conflicts but multiple instances don't conflict with each other
>> though they share the filesystem. Both possibilities are a kind of thread
>> safety.
>>
>
> You can use a single instance from multiple threads, generally the shared
> one.
>
> Delegates are the only reason the doc says anything other than "go nuts".
>  This is what both Jens and I were trying to say.

Is this true for all OS X versions, for 10.6+, or some other combination?

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: Authenticate NSFileManager Operations

2010-05-05 Thread Ken Thomases
On May 5, 2010, at 10:32 AM, k...@highrolls.net wrote:

> I am using
> 
> - (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString 
> *)dstPatherror:(NSError **)error
> 
> to copy a framework to /Library/Frameworks.
> 
> But first I use
> 
> - (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error
> 
> 
> On my system all is well.

It's not so much your system as the fact that you're logged into an 
administrator account.

>  On a user system I get
> 
>   You do not have appropriate access privileges.
> 
> On the remove step.

Indeed, a normal user account won't have permissions to modify stuff in /Library


> How does one invoke authentication for NSFileManager operations?

One does not.  A central tenet of the Unix security model is that processes can 
not gain privileges, they can only reduce their privileges.  So, privileged 
operations can only be performed by a process which started out with privileges 
and never gave them up.

In other words, you have to launch a separate process in a special way in order 
to perform privileged operations.

One technique is to use the "authopen" command, if it works for the purpose.  
Another technique is outlined in the BetterAuthorizationSample sample code:

http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/Introduction/Intro.html

Cheers,
Ken

___

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

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

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

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


Re: Avoid drawing in half pixel

2010-05-05 Thread Simone Tellini
On Wed, 05 May 2010 17:40:24 +0200, Simone Tellini

wrote:
> ___
>

ok, this weird. If I reply with Thunderbird, the body of the message gets
eaten by the mailing list server.

I was saying:

> I was reading the apple docs about this topic,  and I tried at the
beginning of my drawRect 
> method I did as in "Converting Coordinate Values" topic suggest to
convert my starting 
> drawing point,  but that din't help. I still see the above behavior.

you should probably leave the view frame alone. You could use
NSIntegralRect() to properly adjust the coordinates of the area you draw
in.

Or you can disable anti-aliasing, if not needed. Check
-setShouldAntialias: in NSGraphicsContext

-- 
Simone Tellini
http://www.tellini.org
___

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

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

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

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


Re: Avoid drawing in half pixel

2010-05-05 Thread Simone Tellini

___

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

Please do not post admin requests or moderator comments to the list.
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: Avoid drawing in half pixel

2010-05-05 Thread Gustavo Pizano
?
On May 5, 2010, at 5:31 PM, Simone Tellini wrote:

> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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


Authenticate NSFileManager Operations

2010-05-05 Thread koko

I am using

- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString  
*)dstPatherror:(NSError **)error


to copy a framework to /Library/Frameworks.

But first I use

- (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error


On my system all is well.  On a user system I get

You do not have appropriate access privileges.

On the remove step.

How does one invoke authentication for NSFileManager operations?

-koko
___

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

Please do not post admin requests or moderator comments to the list.
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: Avoid drawing in half pixel

2010-05-05 Thread Simone Tellini

___

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

Please do not post admin requests or moderator comments to the list.
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


Avoid drawing in half pixel

2010-05-05 Thread Gustavo Pizano
Hello all.

I have a split view and inside I have custom views, in one subview Im drawing 
lines with a NSBezierPath, and when I move the divider I  see sometimes the 
lines very thin some others no, so I  know this last behavior its because Im 
drawing in half a pixel.

I was reading the apple docs about this topic,  and I tried at the beginning of 
my drawRect method I did as in "Converting Coordinate Values" topic suggest to 
convert my starting drawing point,  but that din't help. I still see the above 
behavior. 
I realize then that when I resize the window I  have the same behavior, so what 
I did was in the windowDelegate  windowWillResize method, I did the following:

if((NSInteger)frameSize.width % 2 != 0){
frameSize.width += 1.0f;

}
if((NSInteger)frameSize.height % 2 != 0){
frameSize.height += 1.0f;
}

and when I resize the window I don't see hte problem anymore. I tried applying 
this same to the splitview delegate when resizing, but unfortunately this 
approach didn't work well, I started getting warnings in the console that the 
size of the subviews weren't correct and it was being recalculated at the cost 
of performance.

So any other idea on what can I do to avoid this behavior? 

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: NSSegmentedControl in a toolbar

2010-05-05 Thread Brian Postow

I've tried doing this myself. I don't think it can be done. at least not the 
way we want to do it.

If you look in the Preview.app package, you can find all of the images that it 
uses in the contents/resources folder. Notice that it has buttonLeft.tiff,  
ButtonLeftAquar.tif, buttonLeftDark.tif, etc. similarly with center and right. 
If you look at any cocoa program YOU'VE written, it doesn't have separate tiff 
files for parts of buttons. This tells me that the way that preview does this 
is to manually create 3 images and treat them as buttons by swapping tiffs 
around manually.  

In other words, Preview CHEATS! or perhaps it doesn't cheat, it does it the 
hard way, and there's no way to cheat, depending on how you look at it...

At that point I gave up... if you have more luck, I'd be really interested to 
hear about it...

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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

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

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

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


Re: NSSegmentedControl in a toolbar

2010-05-05 Thread Flavio Donadio
Jerry,


I get the idea, but...

On 05/05/2010, at 01:42, Jerry Krinock wrote:

> I have an NSSearchField in a toolbar.  It is a subview of an NSToolbarItem, 
> not of an NSView.

You're right. I forgot the fact that you can only have NSToolbarItems (or 
subclasses of it) in a NSToolbar. I tried an NSView and it didn't work, as 
expected. I am thinking too much about the code from the Button Madness sample.

I tried using NSToolbar's -insertItemWithItemIdentifier:atIndex to put the 
NSToolbarItemGroup in the toolbar, but it does't work either.

I have a NSSearchField too, and it was a piece of cake to get working.

> And again, unless you need to be popping things in and out of views, it's 
> generally easier to instantiate controls in your xib (Interface Builder) 
> instead of in code.

Yes, I could do it in IB, if only I knew how to put the labels below each 
segment, which is my ultimate goal here.

The best I can do in IB is to set the label for the whole NSSegmentedControl -- 
with spaces, like "Reply  Reply All Forward" -- and adjust the widths so it 
aligns correctly. It doesn't look bad, but doesn't seem right, though.

If there's a way to do it from IB, I'll post a question in xcode-users, which 
seems more appropriate for IDE-related questions. I still think I have to do it 
in code, because I tried every single option in IB and didn't get it to work.


Cheers,
Flavio___

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

Please do not post admin requests or moderator comments to the list.
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


UIPickerView and MKMapView

2010-05-05 Thread Gerriet M. Denkmann
I have an MKMapView to which I add a subview.

This subview contains a UISegmentedControl, which can be clicked.
And a UISlider which can be slidden (if such a word exists).

And also a UIPickerView which stubbornly refuses to act. 
When I try to move the slot machine wheel, it does not budge, but the MKMapView 
behind moves instead.

Any suggestion how to get the stuck UIPickerView to move would be highly 
appreciated.

Kind regards,

Gerriet.

___

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

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

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

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


Linking a specific controller instance to user defaults

2010-05-05 Thread Graham Cox
Another tricky problem...

I have two instances of a particular view controller in my app - however it is 
not an NSViewController, merely an NSObject that happens to control a view. The 
two views are identical in function but have distinct uses within the app's GUI 
as a whole.

The controllers have two particular properties relating to the layout of the 
view that would be usefully persistent. Making these persistent is very easy, I 
can simply write the property to the user defaults in the setter, and restore 
it at some suitable time, say -awakeFromNib (by the way both controller 
instances are instantiated in different nibs).

The problem should be obvious - how to ensure that each instance of the 
controller can use a specific unique key in the user defaults. Creating a 
unique key is easy, but at load time how to calculate the exact same key for 
the specific instance is not. I thought of adding a 'settings name' property 
that was used to prefix the key but there's no way to set it earlier than 
-awakeFromNib time from some external object that "knows" which instance it is 
using. Ideally the settings name could be set for the instance in IB, but since 
this is a generic NSObject subclass I can't do that without making an IB plugin 
just to set it, which seems like major overkill.

Is there another way to set the settings name just in time?

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


Client/Server Design

2010-05-05 Thread Phillip Mills
I have ideas for a number of different applications that share a general 
architecture: use an iPhone as a remote data-collection front end to a Mac app 
that does more complicated processing, or to a general purpose application such 
as a spreadsheet or database, or to a variety of apps that each do their own 
specific processing (*nix style).  The core feature in all of this is a need 
for easy file or document transmission between the systems.

I've read the notorious Technical Note TN2152, "iPhone OS does not currently 
provide a direct way for third party developers to transfer data between the 
user's computer and their device," but I assume common workarounds are in 
place.  Obviously I could follow the note's suggestions about rolling my own 
from lower level functions (or GameKit?), however I thought I should ask 
whether there are strategies and libraries that other people have found useful 
for solving similar problems.

I'm specifically not interested in web apps since the solution should work with 
systems that don't have a general-purpose HTTP server 
configured.___

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

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

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

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


Re: Weird "iPhone OS 4.0 Library" dialog popping up

2010-05-05 Thread Stephane Sudre
The iPhone OS 4 SDK is probably under NDA. You should probably use the
Developer Forums on the ADC website instead.

On Wed, May 5, 2010 at 1:49 PM, Tino Rachui  wrote:
> I've installed beta 3 of the new iPhone OS 4 SDK. From time to time a dialog 
> pops up now titled "iPhone OS 4.0 Library - To download this update, log in 
> to Apple Developer Connection at connect.apple.com. Your login information 
> will be sent securely." asking me for name and password. This looks extremely 
> suspicious to me. Has anyone an explanation for that?
>
> Thanks in advance,
> Tino
___

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

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

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

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


Weird "iPhone OS 4.0 Library" dialog popping up

2010-05-05 Thread Tino Rachui
I've installed beta 3 of the new iPhone OS 4 SDK. From time to time a dialog 
pops up now titled "iPhone OS 4.0 Library - To download this update, log in to 
Apple Developer Connection at connect.apple.com. Your login information will be 
sent securely." asking me for name and password. This looks extremely 
suspicious to me. Has anyone an explanation for that? 

Thanks in advance,
Tino

___

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

Please do not post admin requests or moderator comments to the list.
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


Communication between Cocoa and Carbon threads

2010-05-05 Thread Abhijeet Singh
Hi,I am new to Cocoa. Me and my team are working on an application for a 
scientific instrument. It is a Cocoa application in that user interface part is 
being developed using Cocoa. Now we have some lower level code that interacts 
with hardware and they are basically Carbon threads. Now our user interface 
needs to communicate with these Carbon threads. I have read in Mac OSX 
Technology overview that we can integrate Carbon with Cocoa application. So can 
anybody suggest what are the possible ways to send message from Cocoa thread to 
Carbon thread in an Cocoa Application. At present I am looking into NSThread 
details to find a way of communicationThanks & Regards AbhijeetDear 
cocoadev ! Get Yourself a cool, short @in.com Email ID now!
___

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

Please do not post admin requests or moderator comments to the list.
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


Custom NSPathControl

2010-05-05 Thread Graham Cox
I have a UI that is designed to break down a huge collection of items into a 
manageable subset that the user can work with at a time. Each item effectively 
has a sort of "path", that describes its hierarchy, not in terms of its 
location on disk, which is irrelevant, but its place in the whole big 
collection of objects which is vaguely analogous to a file path.

I was looking at NSPathControl as a way to neatly show which item was selected 
including its hierarchical information, but quickly realised that this control 
is very strongly tied to NSURLs as a specific form of path and was not designed 
to be readily abstracted.

So is using NSPathControl even possible for this, or would I just be better off 
writing a complete new control from scratch? NSPathControl does some neat 
things like fading overlong text within a subcell that I could use, as well as 
displaying an icon and a triangle for the next item. What about subclassing the 
subcell? I guess I'm just looking for some direction here or even better, some 
code out there I can use.

thanks for any help,

--Graham


___

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

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

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

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


Re: Ticker Style Scrolling Text

2010-05-05 Thread Joachim Deelen
no, I'm using CATextLayer directly. It has a "string" attribute for NSString or 
NSAttributedString. And CA is available since 10.5.

-
Joachim



Am 04.05.2010 um 02:11 schrieb Erik Benoist:

> joachim- 
> quick question- do you convert your text to images when you use 
> CoreAnimation? And is CA only available for 10.6+? 
> 
> -Erik
> 
> On May 3, 2010, at 1:59 PM, Joachim Deelen wrote:
> 
>> Hi Erik,
>> 
>> I think one way to go would be CoreAnimation ... At least I'm using it in my 
>> iTunes Menubar Controller Playwatch.
>> 
>> CATextLayer, CAScrollLayer and CABasicAnimation are the Classes that might 
>> be helpful. But CoreAnimation is rather complex.
>> 
>> There might be ways to implement it with a "normal" NSView contained in a 
>> NSScrollView. And yes, you would have to implement at least one custom 
>> NSView.
>> 
>> regards,
>> Joachim
>> 
>> http://www.aquarius-software.de/AQUARIUS-software_en/PlaywatchFeatures.html
>> 
>> 
>> Am 03.05.2010 um 00:58 schrieb Erik Benoist:
>> 
>>> I am writing a small NSStatusItem which displays a NSString in the menu bar 
>>> and supplies a series of NSMenuItems. As the text to be displayed is 
>>> occasionally longer than would be permitted on the Menu Bar I would like to 
>>> animate the text in a Stock Ticker style scrolling animation. Much like 
>>> you'd see in iTunes when a song is too long to be displayed or how the 
>>> modem connect NSStatusItem will scroll the words "dialing... 
>>> authentication...". I tried to simply write text to the menu bar using a 
>>> Timer writing one character at a time, but the result isn't smooth and due 
>>> to spacing in between letters can be variable in how much it moves each 
>>> iteration. 
>>> 
>>> I suspect that a custom NSView is set to the NSStatusItem, but I am at a 
>>> complete loss as to how to pull this off. Any examples of how to:
>>> 1. Properly animate the text. 
>>> 2. Attach the resulting animation to the menu bar
>>> 
>>> would be greatly appreciated. I have googled around extensively and have 
>>> yet to find a solid example or clue. 
>>> 
>>> Thank you,
>>> Erik Benoist___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40deelen.de
>>> 
>>> This email sent to cocoa-...@deelen.de
>>> 
>> 
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
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 glitches in NSTableView with variable row hight (just like Console.app)

2010-05-05 Thread Marco Masser

On 28.04.2010, at 12:45, Marco Masser wrote:

> 
> On 21.04.2010, at 05:47, Adam R. Maxwell wrote:
> 
>> 
>> On Apr 19, 2010, at 8:56 AM, Marco Masser wrote:
>> 
>>> I'm trying to implement a logging facility for an app that should behave 
>>> quite the same as OS X's Console.app in terms of displaying the log, i.e. 
>>> an NSTableView with varying row heights. I got it working so far, but there 
>>> are major drawing glitches when resizing the window or scrolling through 
>>> the list.
>> 
>> I did this a while ago, and it's working fine.  I recall having numerous 
>> problems with drawing glitches, but don't remember the details.  My code is 
>> BSD licensed, and found here:
>> 
>> http://code.google.com/p/mactlmgr/source/browse/trunk/TLMLogDataSource.m
>> 
>> The key point to fix problems during resize was implementing 
>> tableViewColumnDidResize: to invalidate row heights, and caching row heights 
>> for performance.  I think the TLMLogMessageCell subclass was used to get 
>> wrapping behavior similar to that of Apple's Console program.
>> 
>> hth,
>> Adam
>> 
> 
> Sorry for my late answer!
> 
> Thanks a lot to all three of you, Jerry, Jens, and Adam.
> I can't test your suggestions right now, but I definitely will. If I won't 
> get satisfactory results with Adam's hint, I think I'll opt for the 
> NSTextView. Anyway, I'll let you know how it worked.

Adam's hint seems to do the trick, thanks a lot!

For posterity: My NSTableView implementation has four methods now, two for the 
data itself:
-numberOfRowsInTableView:
- tableView:objectValueForTableColumn:row:

... and two for the resizing stuff:
- tableView:heightOfRow: Here, I calculate and cache the row height. For 
calculation I set a string on my table view's data cell directly and call 
-cellSizeForBounds: on it.
- tableViewColumnDidResize: Here, the string's size is invalidated.

Here's the my (very app-specific) code for the last two methods, I hope this 
helps someone at some point:

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
{
// filteredMessageCache is an NSArray of the log entries currently 
displayed
LogEntry* logEntry = [filteredMessageCache objectAtIndex:row];

// messageColumn is the NSTableColumn displaying the long strings to be 
wrapped
CGFloat columnWidth = [messageColumn width];

// My LogEntry class has a messageSize NSSize ivar. It would be 
prettier if it was not directly in the model class...
NSSize stringSize = logEntry.messageSize;

if (stringSize.width < 0.0)
{
// messageCell is the NSTextFieldCell messageColumn's dataCell
[messageCell setStringValue:logEntry.message];
stringSize = [messageCell cellSizeForBounds:NSMakeRect(0.0, 
0.0, FLT_MAX, FLT_MAX)];
logEntry.messageSize = stringSize;
}

CGFloat rowHeight = ceilf(stringSize.width / columnWidth) * [tableView 
rowHeight];

return MAX(rowHeight, stringSize.height);
}

- (void)tableViewColumnDidResize:(NSNotification *)notification
{
NSSize invalidSize = NSMakeSize(-1.0, -1.0);

// reset the size of all messages. Again, it would be prettier if it 
was not directly in the model class...
for (LogEntry* logEntry in messageCache)
{
logEntry.messageSize = invalidSize;
}

NSRange allIndexes = NSMakeRange(0, [filteredMessageCache count]);
[logTable noteHeightOfRowsWithIndexesChanged:[NSIndexSet 
indexSetWithIndexesInRange:allIndexes]];
}

___

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

Please do not post admin requests or moderator comments to the list.
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: premultiplying alpha

2010-05-05 Thread Thomas Davie

On 5 May 2010, at 06:05, Ken Ferry wrote:

> 
> On Tue, May 4, 2010 at 9:30 AM, David Duncan  wrote:
> On May 4, 2010, at 8:57 AM, Thomas Davie wrote:
> 
> > After much searching about, I discovered (contrary to what the docs say), 
> > that NSBitmapImageReps do not always premultiply their r/g/b by their 
> > alpha.  
> 
> I think you're misreading something.  NSAlphaNonpremultipliedBitmapFormat 
> exists. :-)

Indeed, but nearly the first thing the documentation says is:
"If a coverage (alpha) plane exists, a bitmap’s color components are 
premultiplied with it. If you modify the contents of the bitmap, you are 
therefore responsible for premultiplying the data. For this reason, though, if 
you want to manipulate the actual data, an NSBitmapImageRep object is not 
recommended for storage. If you need to work with data that is not 
premultiplied, you should use Quartz, specificallyCGImageCreate with 
kCGImageAlphaLast."

This is repeated variously through the documentation, with no mention of the 
alphaNonPremultiplied format except in the constants section.

I've filed a documentation bug report :)

Bob___

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

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

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

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