Re: Transparent layer-backed views

2009-11-16 Thread Dave Keck
You need to set the window's background color:

[window setBackgroundColor: [NSColor clearColor]];

(Although I'm not sure why this is only necessary when the window's
content view is layer-backed.)

BTW, slick website and product... wish I knew what it said. :)
___

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

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

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

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


real beginner question

2009-11-16 Thread Luca Ciciriello

Hi All.

I'm a real beginner in Objective-C/Cocoa developing and I have two questions.

First of all I want to ask to you if exists a list dedicated to beginners as I 
am. This in order to not bother the real programmers in this developer list 
with real beginner question.

The second question (the technical one) is: Exists a Functional Programming 
stile (property/functionality) I can use in Objective-C 2.0 (I am a Haskell 
programmer and a C++ programmer)?

 

Thanks in advance.

 

Luca.

 

 
  
_
Got more than one Hotmail account? Save time by linking them together
 
http://clk.atdmt.com/UKM/go/186394591/direct/01/___

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

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

Help/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: Where are the interface builder components?

2009-11-16 Thread Alfonso Urdaneta

Sandro Noël wrote:

Greetings.

I'm kind of annoyed with the 1867 A.D. controls that are in interface builder.
Every time i want to do something visually cool, I can see the lines of code 
piling up


If you want to do something cool you have to ditch IB and actually start 
writing code, that's just the way it is.



--
alfonso e. urdaneta
red82.com - are you ready?
___

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

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

Help/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: Where are the interface builder components?

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 1:13 AM, Alfonso Urdaneta  wrote:
> If you want to do something cool you have to ditch IB and actually start
> writing code, that's just the way it is.

This is not true.  While you can't really build a new user interface
control using Interface Builder, you can assemble them just fine in
IB.  There is no reason to "ditch IB" just because you want to use a
nice custom widget.

--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: Where are the interface builder components?

2009-11-16 Thread Alfonso Urdaneta

Kyle Sluder wrote:

On Mon, Nov 16, 2009 at 1:13 AM, Alfonso Urdaneta  wrote:

If you want to do something cool you have to ditch IB and actually start
writing code, that's just the way it is.


This is not true.  While you can't really build a new user interface
control using Interface Builder, you can assemble them just fine in
IB.  There is no reason to "ditch IB" just because you want to use a
nice custom widget.


Fair enough.  All I was trying to say is that you can't expect 
extraordinary results (an awesome and unique UI) by doing the ordinary 
(using IB straight up), and that there is no reason for a programmer to 
fear writing code.



--
alfonso e. urdaneta
red82.com - are you ready?
___

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

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

Help/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: real beginner question

2009-11-16 Thread Sebastian Morsch

Dear Luca,

1. IMHO, providing help for beginners is one aspect of this list.  
There are some people with extraordinary teaching skills registered  
here! As long as you do some initial research (Apple Docs, Google,  
etc) before posting and respect common mailing list etiquette, I'd say  
it's fine to ask beginner questions. However, you should also take a  
look at stackoverflow, which is not a mailing list, so the "email  
noise issue" is not as relevant there as it is here.


2. You might want to read http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html 
 , this will answer all basic questions about ObjC.


Have fun!
Sebastian



Am 16.11.2009 um 09:18 schrieb Luca Ciciriello >:




Hi All.

I'm a real beginner in Objective-C/Cocoa developing and I have two  
questions.


First of all I want to ask to you if exists a list dedicated to  
beginners as I am. This in order to not bother the real programmers  
in this developer list with real beginner question.


The second question (the technical one) is: Exists a Functional  
Programming stile (property/functionality) I can use in Objective-C  
2.0 (I am a Haskell programmer and a C++ programmer)?




Thanks in advance.



Luca.





_
Got more than one Hotmail account? Save time by linking them together
http://clk.atdmt.com/UKM/go/186394591/direct/01/___

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

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

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

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


___

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

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

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

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


RE: real beginner question

2009-11-16 Thread Luca Ciciriello

Thanks Sebastian.

I'll read very carefully the paper you suggest.

 

Bye.

 

Luca.
 
> From: sebastianmor...@mac.com
> To: luca_cicirie...@hotmail.com
> Subject: Re: real beginner question
> Date: Mon, 16 Nov 2009 10:39:26 +0100
> CC: Cocoa-dev@lists.apple.com
> 
> Dear Luca,
> 
> 1. IMHO, providing help for beginners is one aspect of this list. 
> There are some people with extraordinary teaching skills registered 
> here! As long as you do some initial research (Apple Docs, Google, 
> etc) before posting and respect common mailing list etiquette, I'd say 
> it's fine to ask beginner questions. However, you should also take a 
> look at stackoverflow, which is not a mailing list, so the "email 
> noise issue" is not as relevant there as it is here.
> 
> 2. You might want to read 
> http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html
>  
> , this will answer all basic questions about ObjC.
> 
> Have fun!
> Sebastian
> 
> 
> 
> Am 16.11.2009 um 09:18 schrieb Luca Ciciriello  >:
> 
> >
> > Hi All.
> >
> > I'm a real beginner in Objective-C/Cocoa developing and I have two 
> > questions.
> >
> > First of all I want to ask to you if exists a list dedicated to 
> > beginners as I am. This in order to not bother the real programmers 
> > in this developer list with real beginner question.
> >
> > The second question (the technical one) is: Exists a Functional 
> > Programming stile (property/functionality) I can use in Objective-C 
> > 2.0 (I am a Haskell programmer and a C++ programmer)?
> >
> >
> >
> > Thanks in advance.
> >
> >
> >
> > Luca.
> >
> >
> >
> >
> >
> > _
> > Got more than one Hotmail account? Save time by linking them together
> > http://clk.atdmt.com/UKM/go/186394591/direct/01/___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/sebastianmorsch%40mac.com
> >
> > This email sent to sebastianmor...@mac.com
> 
  
_
Got more than one Hotmail account? Save time by linking them together
 
http://clk.atdmt.com/UKM/go/186394591/direct/01/___

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

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

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

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


Applying inline styles to a WebKit - Cocoa application.

2009-11-16 Thread Gustavo Pizano
Hello and sorry if this is not the list to ask this.

Im making a simple webkit-cocoa app that mainly will retrieve prebuilt layouts 
(HTML pages) and components(div, span etc) form a server, and shows them in the 
application in a panel, then I will drag the layout and start placing inside 
components. 
Now i have set a WebView, it loads the webarchive and urls, now im gonna try to 
load with NSData methods(Due that im fetching form a DB)

Im thinking, that after dragging a component into the selectred layout, I want 
to edit some CSS styles, (not all, this is a very VERY simple app) of the 
component, like width, font, and others, so how do I place those CSS styles I 
will apply to the Component to be inline styles? then I save the file as a 
HTML, and send it back to  the server?

I saw the method replaceSelectionWithMarkupString: , in the WebView class, but 
also I saw the methods for setting CSS properties.  Which one should I use, 
what happens, and where will be stored the styles if I use the CSS properties 
methods from WebView?


Thanks. a lot.

Any guidance that will show me a path to tae will be really appreciate it, and 
if this is not the list to post this, let me know I will place it in the webkit 
list, just that I think that list if for people that are developing something 
with the SDK.

Regards

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


Custom background in NSTableHeaderView

2009-11-16 Thread Symadept
Hi,

I am trying to display custom image and the attributed text into the
TableHeaderview. For this I am retrieving the HeaderCell of each TableColumn
and setting its image and attributed text. Then I found out If I set image
first and then text next, only attributed text shown with the default
headerview background. If the Image is set after Text then Background image
overlaps the text.

I am overriding NSTableView and doing two things.

1. setDrawsBackground:NO
2. Invoking empty drawBackgroundInClipRect:clipRect.

Here is my code.

- (void)setColumnHeaderOf:(id)identifier image:(NSImage*)image title:(
NSString*)title

{

NSTableColumn *column=[self tableColumnWithIdentifier:identifier];

[[column headerCell] setCellAttribute:NSCellHasImageOnLeftOrBottom to:
NSImageBelow];

[[column headerCell] setImage:image];

 NSMutableAttributedString *attributedString = [[NSMutableAttributedString
alloc] initWithString:title];

 NSMutableParagraphStyle * aParagraphStyle = [[[NSMutableParagraphStyle
alloc] init] autorelease];

[aParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];

[aParagraphStyle setAlignment:NSCenterTextAlignment];

 CGFloat dividingFactor = 255.0f;

NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc]
initWithObjectsAndKeys:

   [NSFont fontWithName:CP_FONT_NAME size:[NSFont systemFontSize]],
NSFontAttributeName,

   aParagraphStyle, NSParagraphStyleAttributeName,

   nil] autorelease];

[aTitleAttributes setValue:[NSColor colorWithDeviceRed:(246/dividingFactor)
green:(204/dividingFactor) blue:(37/dividingFactor) alpha:1.0f] forKey:
NSForegroundColorAttributeName];

 [attributedString addAttributes:aTitleAttributes range:NSMakeRange(0,
[attributedString length])];

 [[column headerCell] setAttributedStringValue:attributedString];

[attributedString release];

}


- (void)awakeFromNib

{

NSLog(@"KBCustomTableView awakeFromNib");

[[self enclosingScrollView] setDrawsBackground:NO];

NSRect frameRect = [[self headerView] frame];

[[self headerView] setFrameSize:NSMakeSize(frameRect.size.width, 30)];

 [self setColumnHeaderOf:@"Column1" image:[NSImage imageNamed:@"ColHdr1"]
title:@"Column1"];

[self setColumnHeaderOf:@"Column2" image:[NSImage imageNamed:@"ColHdr2"]
title:@"Column2"];

[self setColumnHeaderOf:@"Column3" image:[NSImage imageNamed:@"ColHdr3"]
title:@"Column3"];


 }



- (void)drawBackgroundInClipRect:(NSRect)clipRect

{

NSLog(@"KBCustomTableView drawBackgroundInClipRect");

//[super drawBackgroundInClipRect:clipRect];

}


Thanks in advance.

Regards
symadept
___

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

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

Help/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: SFAuthorization

2009-11-16 Thread Nyxem
Ok, thanks for helping me Kyle. I'll take a look to BetterAuthorizationSample 
code.

Nyxem

On Nov 16, 2009, at 8:13 AM, Kyle Sluder wrote:

> On Sun, Nov 15, 2009 at 10:39 AM, nyx...@gmail.com  wrote:
>> If i understood correctly, the function AuthorizationExecuteWithPrivileges() 
>> executes the given command in a new process.
>> 
>> Is there a way to wait for the created process to terminate ?
> 
> No, using AEWP correctly will always create a zombie:
> http://lists.apple.com/archives/cocoa-dev/2008/Oct/msg00195.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: NSFileManager thread safety?

2009-11-16 Thread Gregory Weston
David Cake wrote:

> The following code snippet works fine from my main thread.
>NSFileManager *tempFileManager = [[NSFileManager alloc] init];
>NSString *path= [self tempDirPath];
>if(![tempFileManager  removeItemAtPath: path  error: nil]) {
>NSLog(@"failed to remove temp files");
>}
> [tempFileManager release];
> 
> But from within
> -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication 
> *)sender
> or other delegate methods, it gets my EXC_BAD_ACCESS on the 
> removeItemAtPath call
> - any suggestions? I thought NSFileManager was supposed to be 
> thread-safe in 10.5 and 10.6?


Given Dave Keck's correct comment that threading shouldn't even come up in the 
situation you describe, I should point out that according to the docs the 
result of sending init to an NSFileManager object in 10.5 is undefined. If 
you're testing there, it's entirely legit for tempFileManager to be invalid 
after the first line executes.
___

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

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

Help/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: retain and don`t retain in accessor methods

2009-11-16 Thread Austin Ziegler
On Sun, Nov 15, 2009 at 10:35 AM, Clark Cox  wrote:
> On Sat, Nov 14, 2009 at 11:35 PM, Ariel Feinerman  
> wrote:
>> 2009/11/15 Kyle Sluder 
>>> On Sat, Nov 14, 2009 at 2:35 PM, Ariel Feinerman 
>>> wrote:
>>> > I need two versions of -initWith ... and -set ... methods of custom timer
>>> > class (for example, to prevent the circle references);
>>> Do not use accessors in your initializers or -dealloc.
>> Hm, it means to do the same work two times, I think. For example if I change
>> the mechanism in the setting of instance variables, I must to change one in
>> difference inits method; can you say a reason?
> The reason often given (to which I don't personally subscribe) is that
> the accessor could be overridden in a subclass, and therefore do
> things that aren't appropriate (i.e. they could assume something about
> the already-dealloc'ed or not-yet-init'ed portions of the subclass).

Is that true anymore, though? I've been looking at a lot of sample
code lately, and it's very common practice to use "self.foo = ..." in
initializers, even when they're declared nonatomic. I know you said
you don't subscribe to it, but it seems to be an accepted practice
these days.

As to the original question, I'm not a Cocoa expert (far from it!),
but on general principles that sort of flag raises a code smell.
Sometimes it's unavoidable, but I'd either:

* use two different classes that have different ownership expectations
(one expects ownership and retains; the other does not and does not);
or
* have two different initializers with different names indicating the
different ownership (e.g., initWithTarget, initWithObserved). You may
have some code duplication here, but you could minimize some of that
with a "- (void)initTimer" method that sets time and calls begin.

-austin
-- 
Austin Ziegler • halosta...@gmail.com • aus...@halostatue.ca
http://www.halostatue.ca/ • http://twitter.com/halostatue
___

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

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

Help/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: Applying inline styles to a WebKit - Cocoa application.

2009-11-16 Thread Alastair Houghton
On 16 Nov 2009, at 10:35, Gustavo Pizano wrote:

> Hello and sorry if this is not the list to ask this.

I think WebKit does have its own mailing lists, but I can't think why the Cocoa 
part of WebKit would be off topic here...

> I saw the method replaceSelectionWithMarkupString: , in the WebView class, 
> but also I saw the methods for setting CSS properties.  Which one should I 
> use, what happens, and where will be stored the styles if I use the CSS 
> properties methods from WebView?

However, while you might be lucky as lots of people follow cocoa-dev and may 
already know the answer, you don't say whether you've tried either of these 
approaches.  I think your best bet for a fast answer is actually to write a 
short test program that does both of the above things and see what works.

Kind regards,

Alastair.

-- 
http://alastairs-place.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: Applying inline styles to a WebKit - Cocoa application.

2009-11-16 Thread Gustavo Pizano
Hello Alastair.

In fact I found a example and it shows something applying a css style, so I 
will see how can I port that to my app, it will be on wednesday the first 
priority task. 

Simplifying, the create a DOMElement variable, get the element form the 
DOMDocument, and then the do something like :
[[domDoc style] setFontFamily:@"Lucida Grande"] something like that.. so I was 
checking (after a lot of searching for the WebKit api) that I can set any 
DOMCSSStyle to the DOMElement and as I saw in the code, it places it inline .

I will keep informed of my progress,


Gustavo
 
On Nov 16, 2009, at 3:09 PM, Alastair Houghton wrote:

> On 16 Nov 2009, at 10:35, Gustavo Pizano wrote:
> 
>> Hello and sorry if this is not the list to ask this.
> 
> I think WebKit does have its own mailing lists, but I can't think why the 
> Cocoa part of WebKit would be off topic here...
> 
>> I saw the method replaceSelectionWithMarkupString: , in the WebView class, 
>> but also I saw the methods for setting CSS properties.  Which one should I 
>> use, what happens, and where will be stored the styles if I use the CSS 
>> properties methods from WebView?
> 
> However, while you might be lucky as lots of people follow cocoa-dev and may 
> already know the answer, you don't say whether you've tried either of these 
> approaches.  I think your best bet for a fast answer is actually to write a 
> short test program that does both of the above things and see what works.
> 
> Kind regards,
> 
> Alastair.
> 
> -- 
> http://alastairs-place.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: Performance

2009-11-16 Thread Jeremy Pereira

On 16 Nov 2009, at 06:14, Chris Carson wrote:

> 
> The application runs pretty well, and running it through the Leaks instrument 
> there are no leaks except for 16-bytes when the application is first starting 
> caused by IOUSBLib. However, looking at it in the Activity Monitor, the real 
> memory used starts off at 25 MB and steadily grows to 250+ MB while the 
> virtual memory starts off at about the same and steadily grows to about the 
> same or sometimes close to 500MB, over the course of several minutes. This 
> especially happens if I don't move the mouse for a while, or don't have the 
> application in focus. As soon as a move the mouse or bring the application 
> into focus, it's as if an autorelease pool is drained and the memory drops 
> back down to 30-40MB real and 30-40MB virtual. This is annoying since the 
> application hangs for 5 seconds or so when this memory draining is occurring. 
> Has anyone dealt with this before? Any ideas on what could be causing this 
> and how to work around it?

It always used to be the case that NSTimer firings didn't count as "real" 
events so the autorelease pool didn't drain if the only "events" in your app 
were timer events.  As soon as you do something to fire a real event e.g. move 
the mouse or bring the app to the front, the autorelease pool drains.

I guess the work around would be to create your own pool at the beginning of 
the timer firing code and drain it at the end.


> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
> 
> This email sent to a...@jeremyp.net


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___

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

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

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

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


Re: How can a plug-in bundle get access to its own resources?

2009-11-16 Thread Steve Christensen
I understand your frustration, but as I said, one class instance per  
process is a feature of the Objective-C runtime and has been the case  
since before there was an OS X. Please understand that having 200 plug- 
ins, all using the same class name, is not a typical situation. You  
are doing it to simplify your build process, but that's not a good  
reason for saying that the runtime behavior needs to change.


It looks like your build process is already modifying a number of  
project settings on a per-plugin basis, so adding one more #define  
shouldn't break you. Remember that ALL of the classes in your plugins  
are visible and loaded in the same way, so if any of the others  
besides your plugin's "main" class would have issues being loaded from  
a single plugin, then you'll have to make sure their names are unique  
as well.



On Nov 15, 2009, at 11:35 PM, Motti Shneor wrote:


Thank you all, and thank you Steve - I think the point is clear now.

However, I'm afraid this limit renders the whole Obj-C interface for  
plug-ins impractical for any medium-to-large company with legacy code.


There is nothing more natural than re-implementing an interface  
using the same class. Unfortunately, this is also the common  
practice in C++, Java and other OO languages. Most applications will  
naturally select plugins that fit a specific function by looking for  
"those implementing this specific interface"  usually ---  
implementing the same class! (Yes, I know Java and Obj-C provide  
protocols/Interfaces for that).


Our company makes more than 200 professional-class Audio plug-ins,  
developed along 14 years or so. They all build from one same code  
base, for multi-platform multi-host deployment. It's virtually  
impossible to set a separate class name for every exposed class of  
every plug-in. Not only this is cumbersome, and hard to interface in  
other platforms than Obj-C/Cocoa, it introduces huge pollution to  
the "name space" of both our code, and the host-applications code  
and other makers plug-ins.


In all other code-deployment mechanisms we encountered (Windows  
DLLs. Linux Dynamic libraries. Mac shared-libraries dylibs and even  
C/C++ code bundles, there is always a way for a piece of code when  
run (usually when initialized) to ask where it comes from (i.e. the  
path to the binary file it was loaded from) thus, allowing the code  
access its resources.


If Obj-C intentionally lacks name-spaces, then some other  
replacement mechanism MUST exist to tell one loaded binary from  
another! This,to my opinion directly leads to the Bundle mechanism,  
responsible for loading and unloading of the actual code. It is only  
very natural to ask that code can access its own resources! what's  
simpler than that?


Moreover, Cocoa provides such API (mainBundle) for applications,  
which makes perfect sense to everyone. How is it that ONLY  
application bundles support this API? After all, every code bundle  
is structured the same, and includes resources etc.


I think many plugin code makers, especially those with legacy code,  
and  cross-platform needs, will have to avoid Obj-C APIs in their  
plug-ins. Which is a real pity. The dynamic nature of Obj-C calls  
for such API to exist.


Such an obvious deficiency in the Obj-C and Bundle mechanisms can  
hardly be tolerated in the long run. The situation is error-prone,  
simply because we live in an open-space where other software makers  
could easily introduce a class named just like mine, and confuse the  
system at runtime. There even isn't an error when two same-namesd  
classes are loaded!


The last solution from Steve seems the best way out currently,  
although it's a little hard to introduce into our build system. We  
currently control the product names and the binaries created using  
only the XCode projects facilities --- we use pre-build scripts that  
read the "product definition" from an external database, then modify  
the Project environment accordingly. The Product name is never hard- 
coded, and the high-level interface sources never change to produce  
a new product or a variation of it.


Luckily, #define-s can be introduced at the project level. Maybe  
we'll just do that, If we can limit the number of exposed classes to  
just the plug-in names (over 200 i remind, not including versions  
and variations that must live together).


Any Ideas for the Versioning problem? Does anyone have good  
experience with the Framework version mechanism?


I saw these

myFramework.framework packages with

myFramework.framework
myFramework.framework/Resources (alias)
myFramework.framework/Versions/
myFramework.framework/Versions/A/
myFramework.framework/Versions/Current (alias)

Structures everywhere --- Do they work right? I mean can a host  
application (or host library) load a plug-in by a specific version,  
and KNOW FOR SURE that the right library was loaded?


Any references to how-to implement multi-version code bundles?


O

Re: real beginner question

2009-11-16 Thread David Rowland


On Nov 16, 2009, at 12:18 AM, Luca Ciciriello wrote:



Hi All.

I'm a real beginner in Objective-C/Cocoa developing and I have two  
questions.


First of all I want to ask to you if exists a list dedicated to  
beginners as I am. This in order to not bother the real programmers  
in this developer list with real beginner question.


The second question (the technical one) is: Exists a Functional  
Programming stile (property/functionality) I can use in Objective-C  
2.0 (I am a Haskell programmer and a C++ programmer)?




If you know C++, look at this,


http://pierre.chachatelier.fr/programmation/fichiers/cpp-objc-en.pdf




I found it very helpful.


___

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

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

Help/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: Where are the interface builder components?

2009-11-16 Thread Scott Ribe
> But where are the ones from apple... that's what i'm wondering,
> Why do we have to duplicate work that evidently has already been done.
> I'm confused as why apple is not including it in it's development tools.
> it makes no sense to me...

Because it takes longer to release new UI widgets as general-purpose tools
than it does to create them in isolation in a single app? Because it takes
more work to create a widget + an IB plug-in that it does to code up the
widget in an app?

New plug-ins *have* been added to IB some time after widgets show up in
Apple apps (toolbars come to mind), but Apple can't do everything at once
and they're certainly not going to hold up shipping new features in
iWhatever just because you'll want the IB plug-in at the same time.

Any particular widget you have a need for, file an enhancement request...

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

Help/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: Performance

2009-11-16 Thread Matt Neuburg
On Sun, 15 Nov 2009 22:14:32 -0800 (PST), Chris Carson 
said:
>The application runs pretty well, and running it through the Leaks instrument
there are no leaks except for 16-bytes when the application is first starting
caused by IOUSBLib. However, looking at it in the Activity Monitor, the real
memory used starts off at 25 MB and steadily grows to 250+ MB while the virtual
memory starts off at about the same and steadily grows to about the same or
sometimes close to 500MB, over the course of several minutes. This especially
happens if I don't move the mouse for a while, or don't have the application in
focus. As soon as a move the mouse or bring the application into focus, it's as
if an autorelease pool is drained and the memory drops back down to 30-40MB real
and 30-40MB virtual. This is annoying since the application hangs for 5 seconds
or so when this memory draining is occurring. Has anyone dealt with this before?
Any ideas on what could be causing this and how to work around it?

You have already understood it. :) If you autorelease stuff (or ask the
framework to make you an autoreleased object), you are saying: Release this
when you feel like it. "When you feel like it" doesn't happen when the app
isn't getting any events in the background.

The solution is either Don't Do That (i.e. if these are objects that you
own, then release them, don't autorelease them) or (more likely) introduce
your own autorelease pool into your loop, releasing it at the bottom of the
loop or (even more likely) at the bottom of every n loops, where n is some
convenient integer.

This point is nicely covered (though rather densely, and without an example)
here:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Memory
Mgmt/Articles/mmAutoreleasePools.html

"If you write a loop that creates many temporary objects, you may create an
autorelease pool inside the loop to dispose of those objects before the next
iteration. This can help reduce the maximum memory footprint of the
application."

m.

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



___

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

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

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

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


Re: How can a plug-in bundle get access to its own resources?

2009-11-16 Thread Alastair Houghton
On Nov 15, 2009, at 11:35 PM, Motti Shneor wrote:

> Thank you all, and thank you Steve - I think the point is clear now.
> 
> However, I'm afraid this limit renders the whole Obj-C interface for plug-ins 
> impractical for any medium-to-large company with legacy code.

Not really, no.

> There is nothing more natural than re-implementing an interface using the 
> same class. Unfortunately, this is also the common practice in C++, Java and 
> other OO languages. Most applications will naturally select plugins that fit 
> a specific function by looking for "those implementing this specific 
> interface"  usually --- implementing the same class! (Yes, I know Java and 
> Obj-C provide protocols/Interfaces for that).

You could conceivably cause yourself trouble in Java doing this as well, 
assuming you are really talking about implementing the exact same class.  In 
practice you probably *aren't* talking about that, because the package name 
will be different, right?

So what's stopping you from building your ObjC class names up in the same way 
that a Java program might use a full class name (e.g. 
com_mycompany_MyPackage_ThisPlugin_Object)?

> In all other code-deployment mechanisms we encountered (Windows DLLs. Linux 
> Dynamic libraries. Mac shared-libraries dylibs and even C/C++ code bundles, 
> there is always a way for a piece of code when run (usually when initialized) 
> to ask where it comes from (i.e. the path to the binary file it was loaded 
> from) thus, allowing the code access its resources.
> 
> If Obj-C intentionally lacks name-spaces, then some other replacement 
> mechanism MUST exist to tell one loaded binary from another! This,to my 
> opinion directly leads to the Bundle mechanism, responsible for loading and 
> unloading of the actual code. It is only very natural to ask that code can 
> access its own resources! what's simpler than that?
> 
> Moreover, Cocoa provides such API (mainBundle) for applications, which makes 
> perfect sense to everyone. How is it that ONLY application bundles support 
> this API? After all, every code bundle is structured the same, and includes 
> resources etc.

It *isn't* only application bundles that support it.  It works just fine with 
*any* bundle.  But the -bundleForClass: method assumes (as does the rest of the 
ObjC runtime) that each ObjC class has a unique name.  The onus is on you to 
conform to that rule; how you do it is your business; one scheme that will work 
is the one I suggested above, copied from Java (though the usual approach is 
just to use a two letter prefix identifying the 
author/company/application/framework and work from there, but as you say, that 
might not work so well for the case you're dealing with).

If you don't like writing these long names out, you could use a #define to 
help, e.g.

 #define P(x)   com_mycompany_MyApp_Plugins_FooPlugin_##x

> The last solution from Steve seems the best way out currently, although it's 
> a little hard to introduce into our build system. We currently control the 
> product names and the binaries created using only the XCode projects 
> facilities --- we use pre-build scripts that read the "product definition" 
> from an external database, then modify the Project environment accordingly. 
> The Product name is never hard-coded, and the high-level interface sources 
> never change to produce a new product or a variation of it.
> 
> Luckily, #define-s can be introduced at the project level. Maybe we'll just 
> do that, If we can limit the number of exposed classes to just the plug-in 
> names (over 200 i remind, not including versions and variations that must 
> live together).

As I say, you must already have unique names for Java, right?

> Any Ideas for the Versioning problem? Does anyone have good experience with 
> the Framework version mechanism?

I'm not 100% certain what you're asking about here, but...

> I saw these
> 
> myFramework.framework packages with
> 
> myFramework.framework
> myFramework.framework/Resources (alias)
> myFramework.framework/Versions/
> myFramework.framework/Versions/A/
> myFramework.framework/Versions/Current (alias)
> 
> Structures everywhere --- Do they work right? I mean can a host application 
> (or host library) load a plug-in by a specific version, and KNOW FOR SURE 
> that the right library was loaded?

They do work, but I suspect they aren't what you're looking for.  The framework 
version stuff is there so that an application or plug-in can link against what 
it considers to be the current version of the framework, and then someone can 
introduce a binary incompatible version without breaking the apps that are 
linking against its predecessor.  It's really only a symlink structure, 
however, just like the similar one used on both Linux and OS X for "ordinary" 
shared objects/dylibs... there isn't anything clever going on per se.

I don't think there's an API for dynamically loading a particular version, 
though; you'll always load the version po

setToolTip: not working

2009-11-16 Thread Ben Haller
  I'm having difficulty setting tooltips on some views in code.  This  
should be a simple matter of calling setToolTip: on the views in  
question, as far as I can tell from the docs, but that is not working  
for me.  I surfed the various lists for prior questions about this,  
and found several, but didn't find any answers, so I thought maybe I'd  
ask again.  :->


  I'm seeing this for both NSButtons and my own custom view.  My  
custom view is very simple, so I'll show you that:


@interface AKColorStripeView : NSView
{
float minValue, maxValue;
int discreteValueCount;
}

- (void)setMinValue:(float)minValue maxValue:(float)maxValue;
- (void)setDiscreteValueCount:(int)count;

@end

@implementation AKColorStripeView

- (void)geneticBasisChanged
{
if (discreteValueCount == 0)
		[self setToolTip:[NSString stringWithFormat:@"Genetic values are  
continuous, from %.1f to %.1f", minValue, maxValue]];

else
		[self setToolTip:[NSString stringWithFormat:@"Genetic values are  
discrete, with %d possible values from %.1f to %.1f",  
discreteValueCount, minValue, maxValue]];


[self setNeedsDisplay:YES];
}

- (void)setMinValue:(float)newMinValue maxValue:(float)newMaxValue
{
minValue = newMinValue;
maxValue = newMaxValue;

[self geneticBasisChanged];
}

- (void)setDiscreteValueCount:(int)count
{
	discreteValueCount = count;		// defaults to zero, meaning continuous  
genetic values


[self geneticBasisChanged];
}

- (void)drawRect:(NSRect)dirtyRect
{
... nothing surprising here ...
}

- (BOOL)isOpaque
{
return NO;
}

@end

  A few things I've tried:

- ran it on 10.5.8 and 10.6.1, and the tooltip didn't show up on either

- tried moving the setToolTip call into -viewDidMoveToWindow, thinking  
that maybe the tooltip setup didn't work properly before the view had  
a window to live in, but that didn't help


- tried calling -removeAllToolTips on the view before calling  
setToolTip:, but that made no difference


  I'm at a complete loss.  Is anybody else setting tooltips on simple  
views (i.e. not on toolbar items, matrix cells, etc., where the code  
path is different from the base -[NSView setToolTip:] code path)?  If  
so, is there any secret incantation that I'm missing here?  As I  
mentioned, I'm seeing the same problem with setting tooltips on  
NSButtons that are created and added to a window in code; that's as  
simple as a single-line call to -setToolTip: on the button with a  
static NSString, so there's not really much code to post, but here's a  
snippet:


			playOneLifeStageButton = [[NSButton alloc]  
initWithFrame:NSMakeRect(modelRowOrigin.x, modelRowOrigin.y + 6 - 1,  
29, 30)];
			[playOneLifeStageButton  
configureForEnabledImageNamed:@"EndEnabled.tiff"  
pressedImageNamed:@"EndPressed.tiff" toggles:NO];

[playOneLifeStageButton setToolTip:@"Step forward one 
phase"];
[playOneLifeStageButton 
setAction:@selector(playOneLifeStage:)];
[contentView addSubview:playOneLifeStageButton];

  The tooltip doesn't show up for that button, either.

  Thanks!

Ben Haller
Stick Software

___

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

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

Help/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: real beginner question

2009-11-16 Thread Scott Ribe
> The second question (the technical one) is: Exists a Functional Programming
> stile (property/functionality) I can use in Objective-C 2.0 (I am a Haskell
> programmer and a C++ programmer)?

Well, "blocks", Apple has added something rather similar to anonymous or
naked methods, closures, what have you... They're of course "C-flavored" and
somewhat different than anything else you may have used. But if your C++
uses functors or any kind of function object, you'll probably grok them
right away ;-)

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

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


Creation date of Feb 14th 1946 - Why?

2009-11-16 Thread Matt Gough
Can someone let me know if there is something magical about a file having its 
creation date set to:

1946-02-14 08:34:56 +

I am guessing it is a special flag used by Finder to let it know that a file is 
busy (since even after a restart a file with such a creation date is shown 
dimmed)
Am I correct?

Are there any other magic dates that are being used?

FYI - I am writing a FUSE file system and need to prevent such dates ending up 
at the back-end.

Thanks

Matt Gough___

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

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

Help/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: Performance

2009-11-16 Thread Michael Ash
On Mon, Nov 16, 2009 at 1:14 AM, Chris Carson  wrote:
> The application runs pretty well, and running it through the Leaks instrument 
> there are no leaks except for 16-bytes when the application is first starting 
> caused by IOUSBLib. However, looking at it in the Activity Monitor, the real 
> memory used starts off at 25 MB and steadily grows to 250+ MB while the 
> virtual memory starts off at about the same and steadily grows to about the 
> same or sometimes close to 500MB, over the course of several minutes. This 
> especially happens if I don't move the mouse for a while, or don't have the 
> application in focus. As soon as a move the mouse or bring the application 
> into focus, it's as if an autorelease pool is drained and the memory drops 
> back down to 30-40MB real and 30-40MB virtual. This is annoying since the 
> application hangs for 5 seconds or so when this memory draining is occurring. 
> Has anyone dealt with this before? Any ideas on what could be causing this 
> and how to work around it?

You're correct that it's an autorelease pool draining. Cocoa only
drains autorelease pools when an event is processed, and what it
counts as an event is not necessarily what you count as an event.

Some more info, and a possible fix, here:

http://www.mikeash.com/?page=pyblog/more-fun-with-autorelease.html

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: CALayer Transitions

2009-11-16 Thread Matt Neuburg
On Sun, 15 Nov 2009 22:38:04 -0600, Gordon Apple  said:
>What I don't understand, is that, according to the core animation guide,
>kCATransition seems to be what I want for a key instead of "sublayers".  The
>guide says this is triggered by "replaceSublayer: with:".  However, stepping
>it through, I never see this key come through the delegate.

You seem to be imagining that you can call addAnimation:forKey: and then the
animation will just lurk there, waiting for something called the "key" to
come along, and then the animation will trigger. That is not what
addAnimation:forKey: does, and it isn't what the "key" means.

[Hmmm... The cause of your confusion might be that a view has something
called defaultAnimationForKey:. It has an animations dictionary, so you can
install an animation in that dictionary, under a key, and that key will be
used to hunt to for an animation when a property is changed. But a layer is
not a view; so that has nothing to do with what we're discussing now.]

As I said before, to see what addAnimation:forKey: does and what the key is,
look at the Animation section of the Core Animation Programming Guide. The
animation is performed right now (and in the case of a BasicAnimation,
*what* it animates is a property, designated by its keypath). The "key" is
just an arbitrary name to help you refer to this animation later, if needed
(as in removeAnimation:forKey:).

m.

>On 11/15/09 8:51 PM, "Matt Neuburg"  wrote:
>
>> On Sat, 14 Nov 2009 14:58:31 -0600, Gordon Apple  said:
>>>I assume this should be simple, but so far I haven't found the magic
>>> incantation, even after reading the docs, Dudley's book, and some archives.
>>> 
>>> Problem:  Layer called "contentLayer" has sublayers containing layer A,
>>> which is to be transitioned to layer B.  (Note: Using GC here.)  Controller
>>> code:
>>> 
>>> -(void)transitionFrom:(CALayer*)A to:(CALayer*)B{
>>> 
>>>CATransition* trans = [CATransition animation];
>>>trans.type = kCATransitionPush;
>>>trans.subtype = kCATransitionFromLeft;
>>>trans.speed = 0.5;
>>>
>>>[[self contentLayer] addAnimation:trans forKey:kCATransition];
>>>[[self contentLayer] replaceSublayer:A with:B];
>>> }
>>> 
>>>My understanding (likely wrong) is that replaceSublayer triggers the
>>> necessary action to start the transition, then the animation object is
>>> automatically removed (default).
>>> 
>>>   I get an initial transition, then on subsequent calls get layer
>>> replacement but no transition.  What am I missing?
>> 
>> Your understanding is likely wrong. :) addAnimation:forKey: on a layer
>> triggers the animation then and there. Look at the examples in the Animation
>> section of the Core Animation Programming Guide.
>> 
>> That, however, isn't what you want. You want the action of replacing
>> sublayer A with sublayer B to trigger the animation. For that, look at the
>> Actions section of the Core Animation Programming Guide.
>> 
>> For my money, the easiest way to set this up is to make self your
>> contentLayer's delegate and implement actionForLayer:forKey:. So, assuming
>> the delegation is already set up:
>> 
>> -(void)transitionFrom:(CALayer*)A to:(CALayer*)B {
>> [[window.contentView layer] replaceSublayer:A with:B];
>> }
>> 
>> - (id)actionForLayer:(CALayer *)theLayer
>> forKey:(NSString *)theKey {
>> if ([theKey isEqualToString:@"sublayers"]) {
>> CATransition* trans = [CATransition animation];
>> trans.type = kCATransitionPush;
>> trans.subtype = kCATransitionFromLeft;
>> trans.speed = 0.5;
>> return trans;
>> }
>> return [NSNull null]; // or whatever
>> }
>> 
>> To be cleverer about when to trigger the animation and when not, just raise
>> an ivar flag in self. For example, you might like to animate when certain
>> sublayers are added but not others. So transitionFrom would raise a flag and
>> actionForLayer could check that flag (in addition to checking the key).
>> That's why I like this approach: it's so flexible. However, there are other
>> ways to do it.
>> 
>> By the way, there is an example almost *exactly* like this in the Actions
>> section of the Core Animation Programming Guide. m.
>
>-- 
>Gordon Apple
>Ed4U
>Little Rock, AR
>
>
>
>
>

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



___

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

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

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

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


Re: Creation date of Feb 14th 1946 - Why?

2009-11-16 Thread Mark Woollard
It was the day ENIAC, the first general purpose electronic computer was 
revealed to the world. I guess you can't have a digital file created before 
that ;-)

Mark

On 16 Nov 2009, at 17:16, Matt Gough wrote:

> Can someone let me know if there is something magical about a file having its 
> creation date set to:
> 
> 1946-02-14 08:34:56 +
> 
> I am guessing it is a special flag used by Finder to let it know that a file 
> is busy (since even after a restart a file with such a creation date is shown 
> dimmed)
> Am I correct?
> 
> Are there any other magic dates that are being used?
> 
> FYI - I am writing a FUSE file system and need to prevent such dates ending 
> up at the back-end.
> 
> Thanks
> 
> Matt Gough___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/mark.woollard%40mac.com
> 
> This email sent to mark.wooll...@mac.com

___

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

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

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

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


NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kevin
I searched the archives on this issue and found several posts with the  
same question with zero responses. Is NSUndoManager simply not  
supported in a modal window? Can one of the Apple engineers confirm  
this?


Here's a recap of the problem I'm running into:

I have a simple Core Data app which displays a list of entities in the  
main window. To create or add new entities, I use a second modal  
window with a separate managed object context (a scratchpad) so  
changes can be undone/redone without interfering with the main managed  
object context.


The editing window is launched using runModalForWindow:. If I make a  
series of discrete changes in this modal window, doing a single undo  
results in undoing ALL my changes. Setting the run loop modes of  
NSUndoManager (obtained from the second managed object context) to  
contain NSModalPanelRunLoopMode doesn't appear to make any difference.


If I don't launch the window using runModalForWindow: and simply use  
makeKeyAndOrderFront:, everything works as expected.


- Kevin
___

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

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

Help/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: Authorization Samples for Cocoa?

2009-11-16 Thread Nick Zitzmann

On Nov 15, 2009, at 7:09 PM, Laurent Daudelin wrote:

> The BLAuthentication class uses "AuthorizationExecuteWithPrivileges" which 
> doesn't seem to allow to pass a description like "AuthorizationRightSet" 
> seems to allow. I've searched for some samples but they are all very outdated 
> (from 2005 (AuthForAll) and 2007 (BetterAuthorizationSample)) and are way too 
> complex to understand in like one hour. I can't imagine that all that crap 
> hasn't been encapsulated under some Objective-C classes. Anyone has any idea 
> or pointer to something basic I don't need to take a few hours to figure it 
> out?

Typed in Mail, untested, use at your own risk but it ought to work, and all 
that:

#import 

const char *myFancyMessage = "We humbly ask for your password so we can do this 
and that.";
AuthorizationItem promptItem = {kAuthorizationEnvironmentPrompt, 
strlen(myFancyMessage), myFancyMessage, 0};
AuthorizationEnvironment myEnvironment = {1, &promptItem};
AuthorizationItem myRight = {kAuthorizationRightExecute, 0, NULL, 0};
AuthorizationRights myRights = {1, &myRight};
SFAuthorization *sfAuthorization = [SFAuthorization 
authorizationWithFlags:kAuthorizationFlagInterationAllowed|kAuthorizationFlagPreAuthorize
 rights:myRights environment:myEnvironment];

At that last line, the security server ought to pre-authorize with the message 
in myFancyMessage instead of the default message. Then you use AEWP() with the 
AuthorizationRef obtained from the SFAuthorization to do whatever it is you 
need to do.

Nick Zitzmann


___

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

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

Help/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: Having a touch point want to find layer it is in

2009-11-16 Thread David Duncan
On Nov 12, 2009, at 11:53 PM, Tino Rachui wrote:

> I have a UIView and a hierarchy of CALayers added to the views layer. When a
> touch event occurs I can get the 'locationInView' for instance but what is
> the best way to find the top most visible CALayer in the views layer
> hierarchy? I played a bit with 'hitTest' but in vain so far. Maybe I'm doing
> something fundamentally wrong. Suggestions much appreciated.


What is wrong with -hitTest:? It is exactly what you should be using.
--
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: Authorization Samples for Cocoa?

2009-11-16 Thread Laurent Daudelin
On Nov 16, 2009, at 09:37, Nick Zitzmann wrote:

> 
> On Nov 15, 2009, at 7:09 PM, Laurent Daudelin wrote:
> 
>> The BLAuthentication class uses "AuthorizationExecuteWithPrivileges" which 
>> doesn't seem to allow to pass a description like "AuthorizationRightSet" 
>> seems to allow. I've searched for some samples but they are all very 
>> outdated (from 2005 (AuthForAll) and 2007 (BetterAuthorizationSample)) and 
>> are way too complex to understand in like one hour. I can't imagine that all 
>> that crap hasn't been encapsulated under some Objective-C classes. Anyone 
>> has any idea or pointer to something basic I don't need to take a few hours 
>> to figure it out?
> 
> Typed in Mail, untested, use at your own risk but it ought to work, and all 
> that:
> 
> #import 
> 
> const char *myFancyMessage = "We humbly ask for your password so we can do 
> this and that.";
> AuthorizationItem promptItem = {kAuthorizationEnvironmentPrompt, 
> strlen(myFancyMessage), myFancyMessage, 0};
> AuthorizationEnvironment myEnvironment = {1, &promptItem};
> AuthorizationItem myRight = {kAuthorizationRightExecute, 0, NULL, 0};
> AuthorizationRights myRights = {1, &myRight};
> SFAuthorization *sfAuthorization = [SFAuthorization 
> authorizationWithFlags:kAuthorizationFlagInterationAllowed|kAuthorizationFlagPreAuthorize
>  rights:myRights environment:myEnvironment];
> 
> At that last line, the security server ought to pre-authorize with the 
> message in myFancyMessage instead of the default message. Then you use AEWP() 
> with the AuthorizationRef obtained from the SFAuthorization to do whatever it 
> is you need to do.


Thanks, Nick, I'll give it a shot!

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



___

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

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

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

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


Re: Synchronization & Core Data

2009-11-16 Thread Karolis Ramanauskas
Hmm,

So I am reading this ("Core Data: Apple's API for Persisting Data on Mac OS
X") and I see:

1. It covers sync services, which, I understand, I can't use to sync with
iPhone.
2. It covers core-data for iPhone in general, however that doesn't solve my
specific problem.
3. It covers the networking side and using NSManagedObject in a distributed
manner, however it only mentions in the last paragraph of "Distributed Core
Data" that:

"The design that we built here can also be used in a peer environment as
opposed to the client-server design. Multiple peers could use Bonjour to
discover each other and use distributed objects to sync their data stores so
that each device has a complete and up-to-date copy of the data set. In a
situation like that, a user could have our application on each of their
machines, and whenever they are near each other (that is, on the same local
network), they would automatically update each other. Talk about a pleasant
user experience!"

As you can see they do not talk about actually implementing synchronization,
so my original question stands. Any ideas are appreciated.

Thanks

On Sun, Nov 15, 2009 at 8:49 PM, Karolis Ramanauskas wrote:

> Good evening to everyone,
>
> I'm in a (extensive) planning stage of a project and an issue of
> synchronization is forcing itself on me, I asked a question this morning
> about a networking side of things, and I got some info from nice people here
> about MYNetwork: http://bitbucket.org/snej/mynetwork/wiki/Home (I want to
> be able to sync data between Desktops and iPhones on a local network).
>
> However, now I'm wondering how should I organize / store my data. I want to
> use CoreData and I could, easily. I probably won't even have to write a lot
> of code as I'm storing numbers, strings, and dates. Most of the behavior I
> need is free. But how would I sync core data stores between devices? Only
> info I could find was this post:
> http://forums.pragprog.com/forums/90/topics/3201. Perhaps someone has some
> experience with this? Should I do, as the post says, and create "date
> modified" attribute and write my own logic? Or is it possible, after all, to
> get some behavior for free from core data framework?
>
> Thanks,
> Karolis
>
___

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

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

Help/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: CALayer Transitions

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 9:23 AM, Matt Neuburg  wrote:
> On Sun, 15 Nov 2009 22:38:04 -0600, Gordon Apple  said:
>>    What I don't understand, is that, according to the core animation guide,
>>kCATransition seems to be what I want for a key instead of "sublayers".  The
>>guide says this is triggered by "replaceSublayer: with:".  However, stepping
>>it through, I never see this key come through the delegate.
>
> You seem to be imagining that you can call addAnimation:forKey: and then the
> animation will just lurk there, waiting for something called the "key" to
> come along, and then the animation will trigger. That is not what
> addAnimation:forKey: does, and it isn't what the "key" means.

No, I believe now he is talking about the delegate method
-actionForLayer:forKey:, and wondering why he never gets a key of
kCATransition, instead getting one for @"sublayers".  This runs
contrary to the documentation.

--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: retain and don`t retain in accessor methods

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 5:18 AM, Austin Ziegler  wrote:
> Is that true anymore, though? I've been looking at a lot of sample
> code lately, and it's very common practice to use "self.foo = ..." in
> initializers, even when they're declared nonatomic. I know you said
> you don't subscribe to it, but it seems to be an accepted practice
> these days.

On the contrary, it is becoming less of an accepted practice.  Perhaps
the reason you see code like that is because due to a previous
compiler bug it was impossible to access synthesized instance
variables by any means other than going through their accessors.  This
has now been fixed; you can use self->foo syntax to get at the
instance variable.

There are cases where you do, in fact, want to use accessors in your
initializer.  For example, say you subclass NSObjectController to make
some undo-manager-controller thingy (don't ask me what for, this is a
hypothetical).  You replace its designated initializer with one like
-initWithUndoManager:.  You might want to call super's -setContent:
rather than using the -initWithContent: initializer for whatever
reason.

> * have two different initializers with different names indicating the
> different ownership (e.g., initWithTarget, initWithObserved). You may
> have some code duplication here, but you could minimize some of that
> with a "- (void)initTimer" method that sets time and calls begin.

This is the direction I'd go in.

--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: CALayer Transitions

2009-11-16 Thread Gordon Apple
OK, straight out of the core animation guide section on Layer Actions:


"The CALayer class provides default action objects­instances of CAAnimation,
a CAAction protocol compliant class­for all animatable layer properties.
CALayer also defines the following action triggers that are not linked
directly to properties, as well as the action identifiers in Table 1.
...
A layer replaces an existing layer in a visible layer tree using
replaceSublayer: with:.

The action identifier constant kCATransition

When an action trigger occurs, the layer¹s actionForKey: method is invoked.
This method returns an action object that corresponds to the action
identifier passed as the parameter, or nil if no action object exists.
When the CALayer implementation of actionForKey: is invoked for an
identifier the following search pattern is used:
1.If the layer has a delegate, and it implements the method
actionForLayer:forKey: it is invoked, passing the layer, and the action
identifier as parameters. The delegate¹s actionForLayer:forKey:
implementation should respond as follows: "
=

Then it searches the action dictionary, etc.  BTW, I found other
references to this exact issue through Google.  The examples treat VIEW
transitions and layer CONTENT transitions, but not LAYER transitions.
However, the above reference refers specifically to transitioning CALayers
by insert, remove, and replace.  So whassup?

I'm now using the delegate method instead of addAnimation:forKey:.  It
does work with the "sublayers" key.  (Haven't put in the flag yet, but need
it.)

I'm not trying to start an argument, I'm just trying to understand what
I may not understand here.  The docs seem clear enough, but it ain't
happening that way.

On 11/16/09 11:23 AM, "Matt Neuburg"  wrote:

> On Sun, 15 Nov 2009 22:38:04 -0600, Gordon Apple  said:
>>What I don't understand, is that, according to the core animation guide,
>> kCATransition seems to be what I want for a key instead of "sublayers".  The
>> guide says this is triggered by "replaceSublayer: with:".  However, stepping
>> it through, I never see this key come through the delegate.
> 
> You seem to be imagining that you can call addAnimation:forKey: and then the
> animation will just lurk there, waiting for something called the "key" to
> come along, and then the animation will trigger. That is not what
> addAnimation:forKey: does, and it isn't what the "key" means.
> 
> [Hmmm... The cause of your confusion might be that a view has something
> called defaultAnimationForKey:. It has an animations dictionary, so you can
> install an animation in that dictionary, under a key, and that key will be
> used to hunt to for an animation when a property is changed. But a layer is
> not a view; so that has nothing to do with what we're discussing now.]
> 
> As I said before, to see what addAnimation:forKey: does and what the key is,
> look at the Animation section of the Core Animation Programming Guide. The
> animation is performed right now (and in the case of a BasicAnimation,
> *what* it animates is a property, designated by its keypath). The "key" is
> just an arbitrary name to help you refer to this animation later, if needed
> (as in removeAnimation:forKey:).



___

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

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

Help/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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Keary Suska
On Nov 16, 2009, at 10:34 AM, Kevin wrote:

> I searched the archives on this issue and found several posts with the same 
> question with zero responses. Is NSUndoManager simply not supported in a 
> modal window? Can one of the Apple engineers confirm this?
> 
> Here's a recap of the problem I'm running into:
> 
> I have a simple Core Data app which displays a list of entities in the main 
> window. To create or add new entities, I use a second modal window with a 
> separate managed object context (a scratchpad) so changes can be 
> undone/redone without interfering with the main managed object context.
> 
> The editing window is launched using runModalForWindow:. If I make a series 
> of discrete changes in this modal window, doing a single undo results in 
> undoing ALL my changes. Setting the run loop modes of NSUndoManager (obtained 
> from the second managed object context) to contain NSModalPanelRunLoopMode 
> doesn't appear to make any difference.
> 
> If I don't launch the window using runModalForWindow: and simply use 
> makeKeyAndOrderFront:, everything works as expected.

Are you sure that you know which NSUndoManager is being called? When not using 
a modal session it is possible that the API simply "does the right thing", or 
appears to under certain circumstances. There may be a combination of issues 
involved. My advice would be to make sure that when your modal session is 
active that the undo actions will always use the temporary MOC's undo manager.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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

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

Help/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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kevin
Thanks for the reply. To answer your question, the  
windowWillReturnUndoManager: delegate method in my modal window  
controller returns the temporary MOC's undo manager:


- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window
{
return [self.temporaryMOC undoManager];
}

I have confirmed that undo/redo is getting called on the temporary  
MOC's undo manager as I can have changes in the main window, none of  
which are affected if I undo/redo in the modal window.


Kevin

On Nov 16, 2009, at 12:40 PM, Keary Suska wrote:


On Nov 16, 2009, at 10:34 AM, Kevin wrote:

I searched the archives on this issue and found several posts with  
the same question with zero responses. Is NSUndoManager simply not  
supported in a modal window? Can one of the Apple engineers confirm  
this?


Here's a recap of the problem I'm running into:

I have a simple Core Data app which displays a list of entities in  
the main window. To create or add new entities, I use a second  
modal window with a separate managed object context (a scratchpad)  
so changes can be undone/redone without interfering with the main  
managed object context.


The editing window is launched using runModalForWindow:. If I make  
a series of discrete changes in this modal window, doing a single  
undo results in undoing ALL my changes. Setting the run loop modes  
of NSUndoManager (obtained from the second managed object context)  
to contain NSModalPanelRunLoopMode doesn't appear to make any  
difference.


If I don't launch the window using runModalForWindow: and simply  
use makeKeyAndOrderFront:, everything works as expected.


Are you sure that you know which NSUndoManager is being called? When  
not using a modal session it is possible that the API simply "does  
the right thing", or appears to under certain circumstances. There  
may be a combination of issues involved. My advice would be to make  
sure that when your modal session is active that the undo actions  
will always use the temporary MOC's undo manager.


Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"



___

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

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

Help/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: CALayer Transitions

2009-11-16 Thread Matt Neuburg
On Mon, 16 Nov 2009 10:25:07 -0800, Kyle Sluder 
said:
>On Mon, Nov 16, 2009 at 9:23 AM, Matt Neuburg  wrote:
>> On Sun, 15 Nov 2009 22:38:04 -0600, Gordon Apple  said:
>>>    What I don't understand, is that, according to the core animation guide,
>>>kCATransition seems to be what I want for a key instead of "sublayers".  The
>>>guide says this is triggered by "replaceSublayer: with:".  However, stepping
>>>it through, I never see this key come through the delegate.
>>
>> You seem to be imagining that you can call addAnimation:forKey: and then the
>> animation will just lurk there, waiting for something called the "key" to
>> come along, and then the animation will trigger. That is not what
>> addAnimation:forKey: does, and it isn't what the "key" means.
>
>No, I believe now he is talking about the delegate method
>-actionForLayer:forKey:, and wondering why he never gets a key of
>kCATransition, instead getting one for @"sublayers".  This runs
>contrary to the documentation.

Nothing here "runs contrary to the documentation." We're now talking apples
and oranges. The "key" used in addAnimation:forKey: (such as kCATransition)
has nothing whatever to do with the "key" that arrives in
actionForLayer:forKey:. They both happen to be called "key" but that's all.
The former, as I explained in my previous message, is just an arbitrary
name, which is used just in case you need to call removeAnimationForKey:
later, and for no other purpose. The latter is the name of a CALayer
animatable property; that property is changing, and you are now being asked
whether to animate that property.

It is a pity that Apple has used the word "key" (and, by implication,
keyPath) in such a fast-and-loose way all over the place. If
addAnimation:forKey: were called addAnimation:withArbitraryName:, and
actionForLayer:forKey: were called actionForLayer:forAnimatableProperty:, we
wouldn't be having this problem now. :)

If you want to complain about the documentation, the thing to complain about
is that it's so hard to discover what the keys are for
actionForLayer:forKey:. Well, yes, there is a list of the keys under
"Animatable Properties" in the Core Animation Programming Guide; but nothing
tells you that replaceSublayer:with: corresponds to the "sublayers"
animatable property key.

m.

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



___

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

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

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

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


Re: CALayer Transitions

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 11:01 AM, Matt Neuburg  wrote:
> Nothing here "runs contrary to the documentation." We're now talking apples
> and oranges. The "key" used in addAnimation:forKey: (such as kCATransition)
> has nothing whatever to do with the "key" that arrives in
> actionForLayer:forKey:. They both happen to be called "key" but that's all.
> The former, as I explained in my previous message, is just an arbitrary
> name, which is used just in case you need to call removeAnimationForKey:
> later, and for no other purpose. The latter is the name of a CALayer
> animatable property; that property is changing, and you are now being asked
> whether to animate that property.

You have it backwards.  kCATransition is documented to be sent as the
action identifier to -actionForLayer:forKey: whenever the sublayer
tree changes.  Instead, CA is only sending @"sublayers".  This is
incorrect.

--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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 10:50 AM, Kevin  wrote:
> I have confirmed that undo/redo is getting called on the temporary MOC's
> undo manager as I can have changes in the main window, none of which are
> affected if I undo/redo in the modal window.

This isn't necessarily a confirmation of that.  Check in the debugger
to be absolutely sure.

Maybe try abandoning -groupsByEvent?

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


opening a document via Finder without NSDocument

2009-11-16 Thread Philip White

Hello,
  Could someone point me to some examples showing how to respond to  
open document events without using NSDocumentController? I think I've  
figured out that I need to register to receive those events with  
NSAppleEventManager but I'm having trouble figuring out exactly how to  
do this.
  The Apple docs say to look at the TextEdit project for an example  
of a document based application that does not use the NSDocument  
architecture, but the version of TextEdit that ships with more recent  
XCodes does use NSDocument. Downloading an old version of XCode just  
to get that example would be an ordeal on my satellite connection.


Thanks!
  Philip
___

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

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

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

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


Accessing FilesOwner fm controller

2009-11-16 Thread Harry Plate
I am writing a plugin to another application, and I must manage my own NIBs.

I have been successful loading them and getting some of the basic UI
elements working.

But, what I am having trouble with is communicating with "File's Owner".
When I instantiate the NIB, I pass my class as owner - then when the
controller is called via -awakeFromNib, I need to communicate with that
class to get some additional information.

How is that done?

I've tried to use the topLevelObjects that is returned from

[nib instantiateNibWithOwner: self topLevelObjects: &topObjects ]

Thinking that I would find the controller, and pass to it a pointer to my
class that is the Files Owner. That works, but its too late for
-awakeFromNib (by the time I return fm
instantiateNibWithOwner:topLevelObjects: the -awakeFromNib has already been
invoked.

So how can I get access to File's Owner from the controller so I can
communicate w/ my class during -awakeFromNib?

TIA,

-harry


___

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

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

Help/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: opening a document via Finder without NSDocument

2009-11-16 Thread Nick Zitzmann

On Nov 16, 2009, at 12:15 PM, Philip White wrote:

> Could someone point me to some examples showing how to respond to open 
> document events without using NSDocumentController?



Nick Zitzmann


___

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

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

Help/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: Stack-based C++ class to wrap NSAutoreleasePool

2009-11-16 Thread BJ Homer
Does the stack-based idiom allow returning an autoreleased object?  I'd
think you'd end up with code like this:

- (id)arrayWithStuff {
  StackAutoreleasePool();
  NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil];
  return array;
}

which would essentially translate into:

- (id)arrayWithStuff {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil];
  [pool release];
  return array;  // array is dead
}

Is there some reason why this would not happen?

-BJ
___

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

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

Help/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: opening a document via Finder without NSDocument SOLVED

2009-11-16 Thread Philip White

Thanks!
  Boy do I feel silly. I guess I'm not used to the layout of the new  
Snow Leopard docs, what with NSApplicationDelegate having its own  
page. Anyway, I sure spent a lot of time being frustrated by  
NSAppleEventManager.


Thanks again!

Case closed,
 Philip

On Nov 16, 2009, at 1:27 PM, Nick Zitzmann wrote:



On Nov 16, 2009, at 12:15 PM, Philip White wrote:

Could someone point me to some examples showing how to respond to  
open document events without using NSDocumentController?





Nick Zitzmann




___

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

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

Help/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: Stack-based C++ class to wrap NSAutoreleasePool

2009-11-16 Thread Clark Cox
On Mon, Nov 16, 2009 at 11:28 AM, BJ Homer  wrote:
> Does the stack-based idiom allow returning an autoreleased object?

No. It does not. For the autoreleased object to survive the
destruction of the C++ object, it would have to be autoreleased after
it's destruction. Though, if you're planning on returning an
autoreleased object, you're already assuming that there is an
autorelease pool in place, in which case, there is no need to wrap the
local function in your own pool.

> I'd think you'd end up with code like this:
> - (id)arrayWithStuff {
>   StackAutoreleasePool();
>   NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil];
>   return array;
> }
> which would essentially translate into:
> - (id)arrayWithStuff {
>   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>   NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil];
>   [pool release];
>   return array;  // array is dead
> }
> Is there some reason why this would not happen?

No, your interpretation is correct. You wouldn't want to wrap such a
method in an autorelease pool at all; whether or not that pool is tied
to the method scope is largely irrelevant at that point.

-- 
Clark S. Cox III
clarkc...@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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kevin

On Nov 16, 2009, at 1:12 PM, Kyle Sluder wrote:

On Mon, Nov 16, 2009 at 10:50 AM, Kevin   
wrote:
I have confirmed that undo/redo is getting called on the temporary  
MOC's
undo manager as I can have changes in the main window, none of  
which are

affected if I undo/redo in the modal window.


This isn't necessarily a confirmation of that.  Check in the debugger
to be absolutely sure.


Did that and yes, the temporary MOC's undo manager is being called.



Maybe try abandoning -groupsByEvent?


I did and it worked. Calling [[self.temporaryMOC undoManager]  
setGroupsByEvent:NO] did the trick.


Although I'm ecstatic that it worked, I'm not sure why it did. Many  
thanks for suggesting that.


- Kevin



--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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 1:08 PM, Kevin  wrote:
>> Maybe try abandoning -groupsByEvent?
>
> I did and it worked. Calling [[self.temporaryMOC undoManager]
> setGroupsByEvent:NO] did the trick.
>
> Although I'm ecstatic that it worked, I'm not sure why it did. Many thanks
> for suggesting that.

Well it really shouldn't have, unless I'm completely mistaken.  Here's
what should have happened in my mind:

- Top of run loop
- Incoming click on "show modal window" button (or other UI event
causing this code to execute)
- Main document undo manager opens undo group
- UI event dispatched
- Temporary MOC created
- Temporary undo manager created
- Modal runloop mode assigned to temporary undo manager
- Temporary undo manager assigned to temporary MOC
- Start modal runloop
- Temporary undo manager opens undo group
- End modal runloop iteration
- Incoming user-mucks-with-field event
- Begin modal runloop iteration
- Temporary undo manager opens undo group
- Text field records undo event for user-mucking
- End modal runloop iteration
- Begin modal runloop iteration
...

So this should have worked out of the box.

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


How to stop NSScrollView from scrolling to top when horizontally resizing contained NSTextView?

2009-11-16 Thread Lyndsey Ferguson
Hello Everyone,

I have a NSTextView for which I want to display a horizontal scroll
bar. Following some leads on the internet, I have most of it working
except that I am having problems with the vertical scroll bar.

What I have done is to find the width of the longest line (in pixels
with the given font) and then I resize the NSTextContainer and the
NSTextView appropriately. This way the horizontal scroll bar is
representative of the width and scrolling to the right will scroll to
the end of the longest line of text.

After doing this work, I noticed that my NSScrollView would show and
hide the vertical scroll bar as I typed. I've 'fixed' this problem by
setting autohidesScrollers to NO before the resize and then YES
afterwards. However, there still remains another problem where, as I
type, the vertical scrollbar thumb jumps to the top of the scrollbar
and back to the proper place as I type. I type 'a' , it jumps
to the top, I press the  again and it jumps back to the proper
location.

Any thoughts?

Here is some sample code:

- (CGFloat)longestLineOfText
{
    CGFloat longestLineOfText = 0.0;

    NSRange lineRange;

    NSString* theScriptText = [myTextView string];

    NSDictionary* attributesDict = [NSDictionary
dictionaryWithObject:scriptFont forKey:NSFontAttributeName];
//scriptFont is a instance variable

    NSUInteger characterIndex = 0;
    NSUInteger stringLength = [theScriptText length];

    while (characterIndex < stringLength) {
        lineRange = [theScriptText
lineRangeForRange:NSMakeRange(characterIndex, 0)];

        NSSize lineSize = [[theScriptText
substringWithRange:lineRange] sizeWithAttributes:attributesDict];
        longestLineOfText = max(longestLineOfText, lineSize.width);

        characterIndex = NSMaxRange(lineRange);
    }

    return longestLineOfText;

}

// 

- (void)updateMyTextViewWidth
{
    static CGFloat previousLongestLineOfText = 0.0;

    CGFloat currentLongestLineOfText = [self longestLineOfText];
    if (currentLongestLineOfText != previousLongestLineOfText) {
        BOOL shouldStopBlinkingScrollBar = (previousLongestLineOfText
< currentLongestLineOfText);
        previousLongestLineOfText = currentLongestLineOfText;

        NSTextContainer* container = [myTextView textContainer];
        NSScrollView* scrollView = [myTextView enclosingScrollView];
        if (shouldStopBlinkingScrollBar) {
                [scrollView setAutohidesScrollers:NO];
        }

        CGFloat padding = [container lineFragmentPadding];

        NSSize size = [container containerSize];
        size.width = currentLongestLineOfText + padding * 2;
        [container setContainerSize:size];

        NSRect frame = [myTextView frame];
        frame.size.width = currentLongestLineOfText + padding * 2;
        [myTextView setFrame:frame];

        if (shouldStopBlinkingScrollBar) {
                [scrollView setAutohidesScrollers:YES];
        }
    }
}

--
Lyndsey Ferguson
___

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

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

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

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


Trouble with NSSegmentedControl

2009-11-16 Thread Dave DeLong
Hi everyone,

I'm having an issue with NSSegmentedControl.  My control has two segments.  
Segment 0 has an image of NSAddTemplate, and segment 1 has an image of 
NSRemoveTemplate.  Segment 0 is always enabled, and segment 1 is conditionally 
enabled.  Segment 0 has a menu, segment 1 does not.

The behavior I'm expecting is this:  When I click on segment 0, the menu is 
immediately show, and the action is not sent to the target.  When I click on 
segment 1, the action is immediately sent to the target.

What I'm observing is that for both cells, the action is immediately sent to 
the target.  Only when I click and hold on segment 0 does the menu show up.

However, I've found this line in some documentation: "Note also that if a 
segment contains a menu, the action message is not sent when [the 
NSSegmentedControl] is clicked." (very last sentence of this page: 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/SegmentedControl/Articles/SegmentedControlCode.html)

How can I achieve the behavior that I'm looking for (and that is implied in the 
documentation)?  Is there a way to set a different target and action for each 
segment?

Thanks,

Dave DeLong

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

NSOpenPanel accessoryView and new windows...

2009-11-16 Thread Harry Plate
I am successful creating/defining an accessoryView for an NSOpenPanel.

However, I find that some secondary windows that are displayed as a result
of a button in that accessory view, do not get displayed properly, nor am I
able to get keyboard focus to that window.

When I say "properly", the new window is "under" the NSOpenPanel. I would
like this new window to become the active window, and must ultimately be
dismissed to get back to the NSOpenPanel.

I have tried the methods -orderFront, -orderFrontRegardless,
-makeKeyAndOrderFront on my new window but they all exhibit the same
behavior  with the new window "under" the open panel.

I also note that the default About panel support has the same ordering
issue.

What needs to be done get my new window on top of the panel, and receiving
key/mouse events?


TIA,

-harry


___

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

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

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

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


Re: Accessing FilesOwner fm controller

2009-11-16 Thread Ken Thomases
On Nov 16, 2009, at 1:21 PM, Harry Plate wrote:

> I am writing a plugin to another application, and I must manage my own NIBs.

> But, what I am having trouble with is communicating with "File's Owner".
> When I instantiate the NIB, I pass my class as owner - then when the
> controller is called via -awakeFromNib, I need to communicate with that
> class to get some additional information.
> 
> How is that done?

If I'm understanding what you're asking, the answer is that the class of your 
controller needs to declare an outlet.  In the NIB, you connect that outlet to 
File's Owner.  By the time of -awakeFromNib, the outlet will have been set and 
will point to the object which owns the NIB.

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: Stack-based C++ class to wrap NSAutoreleasePool

2009-11-16 Thread Ken Thomases
On Nov 16, 2009, at 1:50 PM, Clark Cox wrote:

> Though, if you're planning on returning an
> autoreleased object, you're already assuming that there is an
> autorelease pool in place, in which case, there is no need to wrap the
> local function in your own pool.

> You wouldn't want to wrap such a
> method in an autorelease pool at all; whether or not that pool is tied
> to the method scope is largely irrelevant at that point.

There are reasons to have a local autorelease pool even if you know there is 
already an autorelease pool in an outer scope.

If you need to return an object from your inner pool to a caller, you retain 
it, release/drain your inner pool, and then re-autorelease the object before 
returning it.

With the C++ RAII approach, you'd have to put the StackAutoreleasePool() macro 
inside a block and put your return outside of it.

Regards,
Ken

___

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

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

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

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


Re: NSPopUpButton submenu's

2009-11-16 Thread SRD
> Hierarchical menus can be confusing because there are so many layers to keep
> track of: menus, items, etc.  In the code above, log the title of the
> selected item.  Is it what you expect?

I do log the titles and they are not what I expect, for example, the
code below produces the output below that.

- (IBAction) readMenuSelection:(id) sender
{   
NSMenu *projectMenu = [sender menu];
NSLog(@"projectMenu = %@", projectMenu);

NSMenuItem *menuItem = [sender selectedItem];
NSLog(@"menuItem %@", menuItem);
NSLog(@"hasSubMenu %d", [menuItem hasSubmenu]);

NSMenu *subMenu = [menuItem submenu];
NSLog(@"submenu %@", subMenu);

Only the first item is a submenu (create) and the other three (load,
save, save as) are NSMenuItems. So if I run it and select a menu item
underneath the 1st layer's 1st item … here's the output ...

2009-11-16 18:35:01.820 mytest[29588:a0f] projectMenu = 
Title: ProjectMenu
Supermenu: 0x0 (None), autoenable: NO
Items: (
"",
"",
"",
"",
"",
""
)
2009-11-16 18:35:01.820 mytest[29588:a0f] menuItem 
2009-11-16 18:35:01.821 mytest[29588:a0f] hasSubMenu 0
2009-11-16 18:35:01.821 mytest[29588:a0f] submenu (null)

What I actually selected was a menu item underneath the 'Create' menu
item (2nd level down), but no where's have I actually been able to get
access to 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: Accessing FilesOwner fm controller

2009-11-16 Thread Graham Cox

On 17/11/2009, at 6:21 AM, Harry Plate wrote:

> But, what I am having trouble with is communicating with "File's Owner".
> When I instantiate the NIB, I pass my class as owner - then when the
> controller is called via -awakeFromNib, I need to communicate with that
> class to get some additional information.
> 
> How is that done?


You pass your class (instance) as owner. Therefore you have it. You don't need 
to get it again from the nib, it's the same object that you passed in the first 
place.

By the way, passing another object as File's Owner is slightly unusual - 
normally that would be 'self', in that the controller responsible for the nib 
is usually its owner.

--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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kevin
After some more experimenting: It works for the first few edits after  
which the behavior reverts to "undo/redo in bunches". And you're  
right, I shouldn't have to do setGroupsByEvent:NO when in fact it's  
the opposite of what I want.


In short, this remains an issue. I'm perplexed as to why the undo  
manager behaves this way. I've read the docs over and over again and  
aside from setRunLoopModes: method, which I'm calling with  
NSModalPanelRunLoopMode, there's no mention of any special  
considerations when using it with modal windows.


Kevin

On Nov 16, 2009, at 3:21 PM, Kyle Sluder wrote:

On Mon, Nov 16, 2009 at 1:08 PM, Kevin   
wrote:

Maybe try abandoning -groupsByEvent?


I did and it worked. Calling [[self.temporaryMOC undoManager]
setGroupsByEvent:NO] did the trick.

Although I'm ecstatic that it worked, I'm not sure why it did. Many  
thanks

for suggesting that.


Well it really shouldn't have, unless I'm completely mistaken.  Here's
what should have happened in my mind:

- Top of run loop
- Incoming click on "show modal window" button (or other UI event
causing this code to execute)
- Main document undo manager opens undo group
- UI event dispatched
- Temporary MOC created
- Temporary undo manager created
- Modal runloop mode assigned to temporary undo manager
- Temporary undo manager assigned to temporary MOC
- Start modal runloop
- Temporary undo manager opens undo group
- End modal runloop iteration
- Incoming user-mucks-with-field event
- Begin modal runloop iteration
- Temporary undo manager opens undo group
- Text field records undo event for user-mucking
- End modal runloop iteration
- Begin modal runloop iteration
...

So this should have worked out of the box.

--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: Trouble with NSSegmentedControl

2009-11-16 Thread Seth Willits


On Nov 16, 2009, at 2:09 PM, Dave DeLong wrote:

How can I achieve the behavior that I'm looking for (and that is  
implied in the documentation)?


NSSegmentedControl, like NSSplitView, leaves *much* to be desired.  
Over time, my solution has evolved into an NSSegmentedControl subclass  
with a few tweaks (like per-cell actions, and fixing of "selected  
cell" value funkiness), and a full custom control with different  
styles and behavior.


As for the action firing before the menu is shown, it doesn't look  
like my tweaked subclass does what you need it to. I'm sure my  
entirely-custom control does, though it's not really in a shareable  
state. I think there are little bugs and oddities, and lack of a  
standard appearance that would probably make you not want use it.


But



Is there a way to set a different target and action for each segment?



Yes. This I can help you with. I'll send you the code off-list.



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


message to zombie NSWindowController

2009-11-16 Thread James Walker
When running on Tiger, my NSWindowController subclass that runs a modal 
preferences dialog gets a retain message after it has been deallocated. 
 I can't reproduce this on Snow Leopard.  The backtrace starts:


#0  0x92cc5fb8 in -[_NSZombie retain] ()
#1  0x92c2f1cc in -[NSInvocation retainArguments] ()
#2  0x93c5bc70 in _NSSendCommitEditingSelector ()
#3  0x93c7f1ec in -[NSController 
_controllerEditor:didCommit:contextInfo:] ()

#4  0x90a461f4 in objc_msgSendv ()
#5  0x92bf3fcc in -[NSInvocation invoke] ()
#6  0x92bf457c in -[NSInvocation invokeWithTarget:] ()
#7  0x92c02f38 in __NSFireDelayedPerform ()
#8  0x907f2384 in __CFRunLoopDoTimer ()

Items #2 and #3 make me think this might have something to do with the 
NSEditor protocol, but I don't understand how.  As far as I can tell, I 
don't have any objects that conform to that protocol... no NSDocument, 
no NSObjectController, etc.


I saw a release note saying that in 10.5, NSWindowController was changed 
to send setNextResponder: nil to its window on dealloc, to prevent 
zombie messaging, so I tried that, but no joy.

--
  James W. Walker, Innoventive Software LLC
  
___

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

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

Help/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: Where are the interface builder components?

2009-11-16 Thread Sandro Noël
Thank you all for your feedback!

I guess i'll have to make my own.
I just find it sad to have to duplicate work, it's unproductive.

cheers!
Sandro Noel.


On 2009-11-16, at 11:53 AM, Scott Ribe wrote:

>> But where are the ones from apple... that's what i'm wondering,
>> Why do we have to duplicate work that evidently has already been done.
>> I'm confused as why apple is not including it in it's development tools.
>> it makes no sense to me...
> 
> Because it takes longer to release new UI widgets as general-purpose tools
> than it does to create them in isolation in a single app? Because it takes
> more work to create a widget + an IB plug-in that it does to code up the
> widget in an app?
> 
> New plug-ins *have* been added to IB some time after widgets show up in
> Apple apps (toolbars come to mind), but Apple can't do everything at once
> and they're certainly not going to hold up shipping new features in
> iWhatever just because you'll want the IB plug-in at the same time.
> 
> Any particular widget you have a need for, file an enhancement request...
> 
> -- 
> Scott Ribe
> scott_r...@killerbytes.com
> http://www.killerbytes.com/
> (303) 722-0567 voice
> 
> 

___

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

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

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

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


Dependent/injected tests vs. linker visibility

2009-11-16 Thread Jim Correia

[Moved from Xcode-Users since it really isn’t an Xcode issue.]

I have some dependent/injected unit tests to test application-specific  
functionality. I've added a test that calls a C function which is  
defined in the application. This causes a link-time error because, by  
default, applications are compiled with -fvisibility=hidden.


What practical solution are you all using for this problem?

- Globally make symbols visible?
- Only for Debug (or a Test specific) configuration?
- Mark specific symbols, as required for the unit tests, to be visible?
- Avoid using dependent/injected tests?

Jim___

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

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

Help/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 thread safety?

2009-11-16 Thread Joar Wingfors

On 16 nov 2009, at 04.07, Gregory Weston wrote:

> Given Dave Keck's correct comment that threading shouldn't even come up in 
> the situation you describe, I should point out that according to the docs the 
> result of sending init to an NSFileManager object in 10.5 is undefined. If 
> you're testing there, it's entirely legit for tempFileManager to be invalid 
> after the first line executes.


I think that the docs are wrong here. It's OK to alloc+init new copies of 
NSFileManager on Mac OS X 10.5 and later. I've filed a bug report for fixing up 
the documentation.

j o a r


___

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

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

Help/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: Trouble with NSSegmentedControl

2009-11-16 Thread Dave DeLong
Thanks to Seth and his subclass of NSSegmentedControl, I have this working 
exactly as I had hoped!

Cheers,

Dave

On Nov 16, 2009, at 7:44 PM, Seth Willits wrote:

> 
> On Nov 16, 2009, at 2:09 PM, Dave DeLong wrote:
> 
>> How can I achieve the behavior that I'm looking for (and that is implied in 
>> the documentation)?
> 
> NSSegmentedControl, like NSSplitView, leaves *much* to be desired. Over time, 
> my solution has evolved into an NSSegmentedControl subclass with a few tweaks 
> (like per-cell actions, and fixing of "selected cell" value funkiness), and a 
> full custom control with different styles and behavior.
> 
> As for the action firing before the menu is shown, it doesn't look like my 
> tweaked subclass does what you need it to. I'm sure my entirely-custom 
> control does, though it's not really in a shareable state. I think there are 
> little bugs and oddities, and lack of a standard appearance that would 
> probably make you not want use it.
> 
> But
> 
> 
>> Is there a way to set a different target and action for each segment?
> 
> 
> Yes. This I can help you with. I'll send you the code off-list.


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

How to replace ComboBoxCell with TextFieldCell when not editing

2009-11-16 Thread Symadept
Hi,

I want to replace the ComboBoxCell with TextFieldCell when I am not editing
the cell and shall be replaced with ComboBoxCell when clicked on that
particular cell. Any pointers highly appreciable.

Regards
symadept
___

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

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

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

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


Re: How to replace ComboBoxCell with TextFieldCell when not editing

2009-11-16 Thread Graham Cox

On 17/11/2009, at 4:25 PM, Symadept wrote:

> I want to replace the ComboBoxCell with TextFieldCell when I am not editing
> the cell and shall be replaced with ComboBoxCell when clicked on that
> particular cell. Any pointers highly appreciable.


You're not learning, are you?

http://catb.org/~esr/faqs/smart-questions.html

http://mattgemmell.com/2008/12/08/what-have-you-tried

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


Enabling keyboard shortcuts in nswindow

2009-11-16 Thread Lorenzo Thurman
I have an NSStatusItem where I am using an NSWindow as it's About Box.  
When displayed, I can close the window via a mouse click, but not with  
the cmd w shortcut. I've looked In Apple documents about this, but the  
documentation assumes a document based app where this action is tied  
to the file->close window menuitem. How do I get this behavior for an  
NSStatusItem? Pardon me if this is basic, but I can't find the answer.  
My window uses a subclass of NSWindowController and from what I've  
found, I should be able to make it the first responder and then  
override it's (nsresponder) keyDown method to handle this event, but  
no dice; all I get is a beep. So, if someone can point me in the right  
direction, I'd appreciate it.


--"My break-dancing days are over, but there's always the funky chicken"
The Full Monty
___

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

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

Help/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: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Rob Keniger

On 17/11/2009, at 12:41 PM, Kevin wrote:

> After some more experimenting: It works for the first few edits after which 
> the behavior reverts to "undo/redo in bunches". And you're right, I shouldn't 
> have to do setGroupsByEvent:NO when in fact it's the opposite of what I want.
> 
> In short, this remains an issue. I'm perplexed as to why the undo manager 
> behaves this way. I've read the docs over and over again and aside from 
> setRunLoopModes: method, which I'm calling with NSModalPanelRunLoopMode, 
> there's no mention of any special considerations when using it with modal 
> windows.


If you have a paid dev membership, now might be the time to use a support 
incident I think.

--
Rob Keniger



___

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

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

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

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


Re: NSUndoManager and runModalForWindow: (again)

2009-11-16 Thread Kyle Sluder
On Mon, Nov 16, 2009 at 9:50 PM, Rob Keniger  wrote:
> If you have a paid dev membership, now might be the time to use a support 
> incident I think.

I'd file a Radar first.  There is a workaround that isn't completely
insane, and either the documentation or the implementation is wrong.
DTS incidents are much better used in cases where you're stuck on
something that could potentially be your own fault.  I'm pretty sure
we've established that Kevin isn't doing anything (obviously) wrong
here.

Then again it is November.  :)

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