Re: How to draw text with fade out effect?

2009-02-01 Thread Benjamin Dobson


On 29 Jan 2009, at 06:32:45, Kyle Sluder wrote:


Perhaps the better solution is to draw the text as normal and then
re-draw the background with the appropriate alpha on top.


Am I missing something or could you use an NSGradient object to do this?
___

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

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

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

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


Re: Drawing Invalidation Question

2009-02-01 Thread Benjamin Dobson


On 1 Feb 2009, at 05:41:49, Seth Willits wrote:


When inside of -[NSView drawRect:], what's the difference between

- (void)drawRect:(NSRect)rect;
{
 if ([self needsToDrawRect:someRect])
 
}


... and ...


- (void)drawRect:(NSRect)rect;
{
 if (NSIntersectsRect(rect, someRect))
 
}


... ?


Apart from anything else, the first makes it clear what your intent  
is, which would be useful when you return to that bit of code later.

___

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

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

Help/Unsubscribe/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 draw text with fade out effect?

2009-02-01 Thread Kyle Sluder
On Sun, Feb 1, 2009 at 4:35 AM, Benjamin Dobson
 wrote:
> Am I missing something or could you use an NSGradient object to do this?

Sure, if you used a gradient or solid color to draw the background in
the first place.  Just give the starting color an alpha of 0 and the
ending color an alpha of 1.

Or you could follow Ken Ferry's advice and take the direct approach by
applying a gradient mask to the context before drawing the text.
That's probably the best way to do it.

--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: Drawing Invalidation Question

2009-02-01 Thread William Jon Shipley

When inside of -[NSView drawRect:], what's the difference between

- (void)drawRect:(NSRect)rect;
{
  if ([self needsToDrawRect:someRect])
  
}

- (void)drawRect:(NSRect)rect;
{
  if (NSIntersectsRect(rect, someRect))
  
}


The NSView keeps a list of the actual subrectangles inside its bounds  
which are dirty, but it unions them all together into the single  
'rect' parameter in -drawRect:, so 'rect' can be much larger than the  
strict minimum of what needs to be drawn.


You can get the actual list of dirty rects with - 
getRectsBeingDrawn:... or, alternately, if you have an expensive  
element you can check ahead of time if you need to draw it at all with  
-needsToDrawRect: -- even though the element might lie inside your  
bounds and inside 'rect', it still might not be touched by a dirty  
region.


-W
___

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

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

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

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


Re: Using NSAppleScript With AXMakeProcessTrusted -- and/or, How To Indirectly Launch A Secure Agent

2009-02-01 Thread Bill Cheeseman
on 2009-01-31 4:44 PM, Tobias Zimmerman at automa...@gmail.com wrote:

> So, I have read up on the AXMakeProcessTrusted function, and seen the
> example at http://caffeinatedcocoa.com/blog/?p=12 on how to use this
> function.  The problem is, using that approach causes the AppleScripts in my
> application to fail with the error ­2709 (can¹t access dictionary).

I can't answer your AppleScript question because I haven't yet made my
scriptable app trusted. But I can comment from personal experience on
AXMakeProcessTrusted because I have it working in the next version of my
PreFab UI Brower product, which is not itself scriptable (I have not yet
released the next version).

The example code at caffeinatedcocoa.com for the TrustMe application is OK
as an example of how to call the AXMakeProcessTrusted function, but you
shouldn't write a real application that runs as root the way TrustMe does.
It isn't secure to leave an application running as root, and running as root
may be what is killing your scriptability.

Instead, follow the Apple Authorization Services examples and documentation:
Place a very simple helper application in your main application's bundle.
The only job of the helper application should be to run AXMakeProcessTrusted
against your main application executable. Your helper application has to run
as root for a brief moment because AXMakeProcessTrusted requires root
access, but then the helper application should quit. You might also find
that your main application's scripting interface starts working once it
isn't running as root.

You can write your main application's executable so that it runs the helper
application at launch time automatically, or as I do you can run it from a
menu item or a button when the user chooses to make the main application
trusted.

> First question:  I have seen a message saying that AXMakeProcessTrusted was
> broken in Tiger.  Was it fixed in Leopard?  It seems to work correctly, save
> causing my AppleScripts to fail.

AXMakeProcessTrusted works perfectly well in Leopard.

I have long suspected that the comments about its being broken in Tiger were
based on misunderstandings about the right way to use it, but I haven't
actually tried to make it work on Tiger so I'm not sure.

> Next question:  Are the AppleScripts failing because the application process
> has elevated rights due to AXMakeProcessTrusted, or is it because the
> application links to the Security Framework?  I have seen posts/messages
> that suggest both.  If I can get my application the status of
> AXProcessIsTrusted without linking to the Security Framework, will the
> AppleScripts work?  (And is this a bug or a security feature?)

I think I might have read somewhere that scriptability is disabled in an
application that is running as root, for security reasons. If that is
correct, then you should be able to solve your AppleScript problem by moving
AXMakeProcessTrusted into a separate helper application as described above.
Since you should move AXMakeProcessTrusted into a separate helper
application anyway for security reasons, you will be able to answer your
AppleScript question yourself.

> Third question: Assuming the answers to the first two questions are
> favorable, how would you more experienced and wise developers go about doing
> something like this?  How can I do a one-time operation as root without
> linking the Security Framework into my main application?  It seems to me I
> need to include two separate agents in my app ‹ one that is run with normal
> permissions from the main app (thus, no need to link to the Security
> Framework or give the main app generally elevated permissions), and then a
> second one, called from the first agent with privileges, that actually
> executes the AXMakeProcessTrusted function on the main app.  Does this seem
> right?  I am a novice programmer, but I have looked at both NSTask and the
> NSWorkspace - launchedApplication: method and can¹t discern the easier way
> to go in terms of passing the main app¹s path to the first, and then the
> second agent applications.  I am not even sure of the proper build settings
> for a project using two helpers in this manner.  Could I use a shell/perl
> script as the middle agent?

I don't think you need a second "agent" for this purpose. I'm pretty sure
linking to the Security Framework is not your problem. Just put
AXMakeProcessTrusted in a very simple helper application that runs as root.
Then put all the rest of your functionality in your main application's
executable, which is trusted but does not run as root. My main application
puts up the authentication dialog, then it uses NSTask to launch the
AXMakeProcessTrusted helper application and communicates the authorization
ref to it. Apple's authorization example code shows how to communicate the
authorization ref from your main application which puts up the authorization
dialog, to the helper application which runs as root.

There is one complication that can be resolve

Re: +[NSColor highlightColor] returns white instead of actual color

2009-02-01 Thread Jerry Krinock

Sorry, there's more to this

+[NSColor selectedTextBackgroundColor] definitely gives a color based  
on System Preferences > Appearance > Highlight Color (for selected  
text).  However, the color actually used in NSTableView is darker than  
this.


For example, I set the color in System Preferences to RGB = {255, 0,  
255}, but when I use DigitalColor Meter.app on a highlighted cell in a  
"stock" NSTableView, I measure {204, 0, 204}.  Now, 204=51*4 and  
255=51*5.  So it looks like someone in the NSTextFieldCell Department  
decided to reduce the brightness by 20%, because, of course, if  
someone set their "highlight" (sic) color to all white, the white text  
drawn on it by NSTextFieldCell would be invisible.


So, I was able to match the "stock" NSTextFieldCell using a little  
brightness-tweaking method that I had lying around.  Is this 20%  
reduction in brightness documented anywhere?  I even searched Human  
Interface Guldelines for "highlight" but didn't find any mention of  
this.


Interestingly, in NSTextViews (TextEdit docs, this message in  
Mail.app), the text is drawn in black instead of white, and the 20%  
reduction is not applied.  And then, Xcode's editor ignores my System  
Preferences and uses black on orange, like it or not.  Seems like we  
need some User Interface Police here.


***

color = [NSColor selectedTextBackgroundColor] ;
color = [color colorTweakBrightness:-.20] ;

***

#import 

@interface NSColor (Tweak)

/*!
 @briefReturns a copy of the receiver, but with the
 brightness altered by a given tweak factor.

 @details  If tweak > 0, the brightness is altered by
 blending the receiver with +tweak fraction of pure white. 
 If tweak < 0, the brightness is altered by
 blending the receiver with -tweak fraction of pure black. 
 if tweak = 0, the returned color will be an identical copy of
 the receiver.

 @paramtweak  The factor by which to tweak the brightness. 
 A value greater than +1.0 is clipped to +1.0.
 A value less than -1.0 is clipped to -1.0.
 @result   A tweaked, autoreleased copy of the receiver
*/
- (NSColor*)colorTweakBrightness:(float)tweak ;

@end

***

#import "NSColor+Tweak.h"


@implementation NSColor (Tweak)

- (NSColor*)colorTweakBrightness:(float)tweak {
SEL blendColorSelector = (tweak > 0) ? @selector(whiteColor) :  
@selector (blackColor) ;
NSColor* blendColor = [NSColor  
performSelector:blendColorSelector] ;

float blend = fabs(tweak) ;
blend = MIN(blend, 1.0) ;
return [self blendedColorWithFraction:(CGFloat)blend
  ofColor:blendColor] ;
}

@end



___

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

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

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

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


unable to catch mouseDown

2009-02-01 Thread Jeffrey Goines
Hello.
I have a custom view to which I add a NSMatrix as subview.

I've set the target and action of the cells and it's working like I want.

Now I want to introduce some mode in which the behaviour is different.
A mouseclick should no longer trigger the action.
I want to catch the click in the view and process it further there since
it's the appropriate place.

I've tried setting the view to acceptFirstResponder and the Matrix to
resignFirstResponder,
yet it's not working.
It behaves as if the Matrix lies on top of the view and not as if the click
has to get through
the custom view to the Matrix which is a subview.
I don't understand that.

Thanks!
___

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

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

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

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


Re: Drawing Invalidation Question

2009-02-01 Thread Kyle Sluder
>From the View Programming Guide for Cocoa (
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaViewsGuide/Optimizing/chapter_8_section_5.html#//apple_ref/doc/uid/TP40002978-CH11-SW4
):

"In Mac OS X version 10.3 and later, views can constrain their drawing
even further by using the NSView methods getRectsBeingDrawn:count: and
needsToDrawRect:. These methods provide direct and indirect access,
respectively, to the detailed representation of a view's invalid
areas—that is, its list of non-overlapping rectangles—that the
Application Kit maintains for each NSView instance. The Application
Kit automatically enforces clipping to this list of rectangles, and
you can further improve performance in views that do complex or
expensive drawing by having them limit their drawing to objects that
intersect any of the rectangles in this list."

The parameter to -drawRect: specifies a rectangle that includes all
those dirty rectangles.  If, for example, your view consists of lots
of expensive-to-draw regions, you can test each of those regions using
-needsToDrawRect: to avoid drawing ones that aren't in a dirty region
but wind up being included in the big rectangle.

--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: +[NSColor highlightColor] returns white instead of actual color

2009-02-01 Thread Jerry Krinock


On 2009 Feb 01, at 2:50, Graham Cox wrote:


The...


colour set in System Preferences > Appearance > Highlight Color (for  
selected text)



is returned by +[NSColor selectedTextBackgroundColor].


Thanks - indeed it is.  And I found another one all by myself, with a  
good guess!...


The method which, I would say, "returns the gray background color used  
behind selected text when its view is not the key view",  
+secondarySelectedControlColor, is described in the documentation as  
"returns the system color used in non-key views."  ?!?!?!?


I sent 'em a little Feedback on that one.

___

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

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

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

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


Re: Serial IO seems to be starving UI

2009-02-01 Thread Peter N Lewis

At 0:21 -0500 31/1/09, Michael Ash wrote:

And even there, a continuous
sequence of 0-delay performs should not lock the user out of your
program. Seems to me that most non-user events should be interleaved
in with user events based on when they occur, or at the very least
given equal time. It's too easy to lock up the main event loop such
that the user can no longer do anything otherwise.


Yes, this can be really annoying.  I ran in to it on the iPhone, 
where if you run a sequence of actions say every 0.01 seconds, but 
your action takes longer than 0.01 seconds and then the phone 
entirely stops accepting UI which is problematic to say the least. 
And very confusing to debug.


It's actually good to learn *why* this was happening!
   Peter.

--
  Keyboard Maestro 3 Now Available!
   Now run macros from your iPhone with Keyboard Maestro Control!

Keyboard Maestro  Macros for your Mac
   
___

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

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

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

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


Re: Core Data relationship disappears

2009-02-01 Thread Ivan C Myrvold
I just found out why, and it was as simple as I didn't check the "To- 
Many Relationship" check box in my xcdatamodel for the reverse  
relationship from Transponder to ServiceItem.

After doing that, all the transponder data came into my table view.

Ivan

Den 1. feb.. 2009 kl. 01:43 skrev Jerry Krinock:



On 2009 Jan 31, at 8:33, Ivan C Myrvold wrote:

But later on, the transponder relationship have been set to nil,  
and I don't know why. There is probably something missing in my  
core data code.


Or, something that should not be in your code that is in your code


Do anyone know what I am missing?


Certainly I cannot tell from the information you provided.  Possibly  
you did not save the managed object context?  Another possibility is  
that it got cascade-deleted:


http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdRelationships.html#/ 
/apple_ref/doc/uid/TP40001857-SW1


Delete Rule is shown in the .xcdatamodel when inspecting a  
relationship.


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ivan%40myrvold.org

This email sent to i...@myrvold.org



___

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

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

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

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


Re: +[NSColor highlightColor] returns white instead of actual color

2009-02-01 Thread Graham Cox


On 1 Feb 2009, at 6:11 pm, Jerry Krinock wrote:

except +[NSColor highlightColor] returns white instead of actual  
highlight color I have set in System Preferences > Appearance, which  
is green




The green (or whatever) colour set in System Preferences is returned  
by +[NSColor selectedTextBackgroundColor]. The other reply you  
received is incorrect, as far as I can tell.


--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: Drawing Invalidation Question

2009-02-01 Thread Graham Cox


On 1 Feb 2009, at 4:41 pm, Seth Willits wrote:




When inside of -[NSView drawRect:], what's the difference between

- (void)drawRect:(NSRect)rect;
{
 if ([self needsToDrawRect:someRect])
 
}


... and ...


- (void)drawRect:(NSRect)rect;
{
 if (NSIntersectsRect(rect, someRect))
 
}


... ?


AFAICT from the documentation, there isn't a difference. Am I  
misreading something important?



As others have mentioned, there is potentially a huge difference. If  
you invalidate a lot of small rectangles, the update region might be  
quite complex in shape; the  passed in -drawRect: is only the  
bounds of this complex area.


But there is also a difference in intent between -needsToDrawRect: and  
-getRectsBeingDrawn:count:, even though they also appear to amount to  
much the same thing. The first method implies you'll be iterating a  
list and testing each element against the view to see if it needs to  
be drawn or not. In many (most?) cases that's going to work out just  
fine. But if you have a huge number of possible objects to draw,  
merely iterating the list and testing for every update could incur a  
noticeable performance penalty. The second method offers the  
possibility of using a different approach that allows you to  
efficiently search and locate the objects needing to be drawn without  
iterating the entire list to do so. (An analogy would be the  
difference between a linear search and a binary search). That can have  
great benefits (though as I say, typically only for large numbers of  
objects). Algorithms such as BSP, R*-Trees and so forth can be used  
with the second approach. My own tests indicate that the number at  
which a BSP storage approach starts being worth considering is around  
the 1000 object mark, depending on what exactly it is you're drawing.  
YMMV.


This is probably more than you need or care to know at this point but  
I thought it might be worth mentioning ;-)


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


Off topic:Info on stack trace

2009-02-01 Thread Arnab Ganguly
Hi All,
I am developing an application using COCOA, which generates stack trace for
an application crash.
I am able get the stack traces but issue is on the trace, the address
information comes  correctly but the symbols information is not correct. It
is coming in "?" format etc.
Any idea or suggestion as how to get the symbols information correctly.Any
help or suggestion would be very much appreciated.

Is there any sample application similar to Crashreporter.app?

Note my OS is Tiger hence I won't be able to use backtrace or
backtrace_symbols function.Is there any alternative to implement similar in
Tiger?

Thanks in advance
Arnab
___

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

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

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

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


Triggering NSTextView changes and bindings

2009-02-01 Thread Chris Idou
I've got an NSTextView whose attributeValue is bound to a core-data object.

I've got a menu item which programmatically modifies the NSTextView's contents.

The programmatic changes don't trigger a modification to the underlying object 
unless the user tabs to and exits the NSTextView manually.

What is the correct way, when programmatically modifying an NSTextView, to make 
sure the system propagates changes to underlying bindings?


  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
more
___

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

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

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

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


Re: NSTextField with an date formatting

2009-02-01 Thread Matt Neuburg
On Sat, 31 Jan 2009 18:04:48 +, minapre999 
said:
>
>I have an NSTextField that is bound to a date in a Core Data program.
>The text field has an NSDateFormatter attached to it.  All connections
>are set up using IB.  The odd thing is that the user needs to enter
>the date into  the text field twice for the text field to correctly
>update to the new date.  Using key value observing, the text field
>object correctly updates it's data on the first enter.  The text field
>simply does not display the new value.  Calling setNeedsDisplay or any
>other similar method does not do anything.  Interestingly, when I
>modify the program to add a second text field (ie now have two text
>fields, both with date formatters and bound to the same date in Core
>Data), when the user changes the date in text field 1, it will result
>in text field 2 but not text field 1 correctly updating to the new
>date, and vice versa.  I suspect this may be a bug, has anyone else
>experience anything similar  and what is the process of reporting to
>Apple if it is a bug?

Can you reduce the problem to a little tiny project and show it? m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

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


Minimum System Version Check - With Reliable Notification

2009-02-01 Thread I. Savant

List:

  Over the years, the standard mechanisms for requiring a minimum  
system version and displaying a kind message to the user have proven  
unreliable. I recently had the need to revisit this issue but (as far  
as I can tell) searching the list archives and all the other usual  
sources don't quite reveal a complete solution, merely suggestions.


  I've seen a few people suggest creating a 'miniature' run loop or  
using Carbon, but in my mind, the cleanest, most straightforward  
solution was just to put the responsibility back into the hands of the  
OS (where it was supposed to be in the first damn place). AppleScript  
to the rescue.


  For the archives, following is a quick and dirty - but complete -  
solution to this issue. It assumes 10.5 as the minimum system (I trust  
it's obvious what to change and where for other versions). Perhaps not  
so obvious to newbies, this belongs in your project's main.m file.




int main(int argc, char *argv[])
{
// Obtain system version
static SInt32 systemVersion;
Gestalt(gestaltSystemVersion, &systemVersion);

// Only run if we're on 10.5 or above ...
if (systemVersion >= 0x1050)
{

// We're fine - start the app instance
return NSApplicationMain(argc,  (const char **) argv);

} else {

// Fails minimum requirement - we'll use AppleScript to
// display a warning message to bypass the OS X
// system version checking mess ...

// Set up an autorelease pool (NSAppleScript needs it)
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// Create then execute the AppleScript, ignoring any errors
// (Gasp! Ignore errors? Yes - if the script doesn't compile
// or it fails, more is wrong than we can do anything about ...)
		NSString * source = @"beep\ndisplay alert \"This awesome application  
requires Mac OS X 10.5 or above and cannot run on your computer. Why  
on God's great creation are you not up to date?! Bad user, BAD USER!\"  
as warning";
		NSAppleScript * script = [[[NSAppleScript alloc]  
initWithSource:source] autorelease];

[script executeAndReturnError:nil];

// Release the pool. It probably doesn't matter, but what kind
// of Cocoa developer would I be if I didn't? What will people 
SAY?!
[pool release];

// Goodbye, cruel world!
return -1

}

// To be honest, I'm not sure what's best here, but since
// NSApplicationMain() isn't supposed to come back, errors
// are handled, and main() requires a return, a clean
// return seems the right thing to do ... YMMV.
return 0;
}

  AppleScript will beep (with the user's preferred standard error  
sound) display the caution icon with your app's icon grafted atop. You  
may or may not want to lose the beep. Not sure why caution / error  
dialogs don't automatically sound the error beep anyway, but that's  
another philosophical debate entirely.


  I'd recommend completely foregoing the use of the  
LSMinimumSystemVersion key approach (search the docs and the list  
archives if you're unfamiliar) since the user will get two "this won't  
work" messages when the LSMinimumSystemVersion is actually honored.  
Two such messages may seem like you're just rubbing it in. ;-)


  Alternatively, you could include the already-compiled script in the  
app's resources to save a millisecond or two during runtime, but I  
don't feel it's necessary and I would think it'd be easier just to  
change the message in the app's source.


  Also, regarding the return, I didn't bother looking up exactly what  
the implications are but I'd imagine there are a few other ways it can  
be done, all of which are probably more or less fine. I'd be  
interested in opinions on this.


  Experts are welcome to pick the whole thing apart and point out its  
wrongness as desired. :-)


--
I.S.



___

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

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

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

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


Re: Triggering NSTextView changes and bindings

2009-02-01 Thread Michael Ash
On Sun, Feb 1, 2009 at 11:45 AM, Chris Idou  wrote:
> I've got an NSTextView whose attributeValue is bound to a core-data object.
>
> I've got a menu item which programmatically modifies the NSTextView's 
> contents.
>
> The programmatic changes don't trigger a modification to the underlying 
> object unless the user tabs to and exits the NSTextView manually.
>
> What is the correct way, when programmatically modifying an NSTextView, to 
> make sure the system propagates changes to underlying bindings?

The correct way is not to do it in the first place.

Views are there for the user to modify, not for your program to
modify. Bindings are two-directional: your program should change the
*model*, and then the binding will ensure that the NSTextView matches
that change.

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: NSTextField with an date formatting

2009-02-01 Thread minapre999



I put together a tiny little project & it actually behaves perfectly  
as it is supposed to!  As far as I can tell it is identical to my  
current project exept  it just has the one entity with one attributes  
and one window with a table view of dates and a couple of text  
fields.  The text fields and the table view are hooked up to the MOC  
via binding in an identical manner to my main project, so I am stumped  
on this one.  Meanwhile I have a workaround for the immediate problem  
(two text fields, one on top of the other, one hidden, one not, when  
the user sets the date in the text field then it becomes hidden and  
the other one becomes visible).


Peter F



On 1 Feb 2009, at 17:20, Matt Neuburg wrote:

On Sat, 31 Jan 2009 18:04:48 +, minapre999 >

said:


I have an NSTextField that is bound to a date in a Core Data program.
The text field has an NSDateFormatter attached to it.  All  
connections

are set up using IB.  The odd thing is that the user needs to enter
the date into  the text field twice for the text field to correctly
update to the new date.  Using key value observing, the text field
object correctly updates it's data on the first enter.  The text  
field
simply does not display the new value.  Calling setNeedsDisplay or  
any

other similar method does not do anything.  Interestingly, when I
modify the program to add a second text field (ie now have two text
fields, both with date formatters and bound to the same date in Core
Data), when the user changes the date in text field 1, it will result
in text field 2 but not text field 1 correctly updating to the new
date, and vice versa.  I suspect this may be a bug, has anyone else
experience anything similar  and what is the process of reporting to
Apple if it is a bug?


Can you reduce the problem to a little tiny project and show it? m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!






___

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

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

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

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


theoretical, can i use the same wave effect, which i can see when i adding new widget in dashboard?

2009-02-01 Thread Carlo Gulliani
hi all, how can i use (make) the wave effect like in dashboard when i adding 
new widget? i'm trying to find info in google but i've not result. any ideas?


  
___

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

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

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

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


Re: theoretical, can i use the same wave effect, which i can see when i adding new widget in dashboard?

2009-02-01 Thread Mike Abdullah
Dashboard uses Core Image to achieve the effect. You may also be able  
to do the same thing on Leopard using Core Animation.


On 1 Feb 2009, at 18:24, Carlo Gulliani wrote:

hi all, how can i use (make) the wave effect like in dashboard when  
i adding new widget? i'm trying to find info in google but i've not  
result. any ideas?




___

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

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

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

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


___

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

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

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

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


Re: theoretical, can i use the same wave effect, which i can see when i adding new widget in dashboard?

2009-02-01 Thread Carlo Gulliani
ok, thank for info, i'll try 2morrow




From: Mike Abdullah 
To: Carlo Gulliani 
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, February 1, 2009 9:58:09 PM
Subject: Re: theoretical, can i use the same wave effect, which i can see when 
i adding new widget in dashboard?

Dashboard uses Core Image to achieve the effect. You may also be able to do the 
same thing on Leopard using Core Animation.

On 1 Feb 2009, at 18:24, Carlo Gulliani wrote:

> hi all, how can i use (make) the wave effect like in dashboard when i adding 
> new widget? i'm trying to find info in google but i've not result. any ideas?
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net


  
___

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

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

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

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


Re: theoretical, can i use the same wave effect, which i can see when i adding new widget in dashboard?

2009-02-01 Thread Nathan
Back when I was trying to find tutorials/examples to learn CA, one of  
the links said it replicated the dashboard ripple effect. I never  
clicked on the link but it just came up in a google search. Try  
finding that.


Good luck, Nate

On Feb 1, 2009, at 1:24 PM, Carlo Gulliani   
wrote:


hi all, how can i use (make) the wave effect like in dashboard when  
i adding new widget? i'm trying to find info in google but i've not  
result. any ideas?




___

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

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

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


This email sent to lipton_lo...@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: Using NSAppleScript With AXMakeProcessTrusted -- and/or, > How To Indirectly Launch A Secure Agent

2009-02-01 Thread Tobias Zimmerman
Bill-

Thank you for the detailed and thoughtful response.  I have done some
further poking about and found instructions on granting accessibility
permissions from the command line.  After doing this on my working app, the
AppleScripts no longer execute (error -2709), leading me to conclude that
the only way to do what I want is to have the users activate universal
access for assistive devices.

To clarify, my app is trying to execute AppleScripts, not receive scripting.
I am going to post a follow-up to accessibility-dev to see if there is a way
around this.

For now, it seems that an application that has been granted
AXMakeProcessTrusted cannot access the scripting dictionaries of other
applications.

Thanks again.


> From: Bill Cheeseman 
> Subject: Re: Using NSAppleScript With AXMakeProcessTrusted -- and/or,
> How To Indirectly Launch A Secure Agent
> To: Cocoa-Dev Mail 
> Message-ID: 
> Content-Type: text/plain; charset="ISO-8859-1"
> 
> on 2009-01-31 4:44 PM, Tobias Zimmerman at automa...@gmail.com wrote:
> 
>> So, I have read up on the AXMakeProcessTrusted function, and seen the
>> example at http://caffeinatedcocoa.com/blog/?p=12 on how to use this
>> function.  The problem is, using that approach causes the AppleScripts in my
>> application to fail with the error �2709 (can�t access dictionary).
> 
> I can't answer your AppleScript question because I haven't yet made my
> scriptable app trusted. But I can comment from personal experience on
> AXMakeProcessTrusted because I have it working in the next version of my
> PreFab UI Brower product, which is not itself scriptable (I have not yet
> released the next version).
> 
> The example code at caffeinatedcocoa.com for the TrustMe application is OK
> as an example of how to call the AXMakeProcessTrusted function, but you
> shouldn't write a real application that runs as root the way TrustMe does.
> It isn't secure to leave an application running as root, and running as root
> may be what is killing your scriptability.
> 
> Instead, follow the Apple Authorization Services examples and documentation:
> Place a very simple helper application in your main application's bundle.
> The only job of the helper application should be to run AXMakeProcessTrusted
> against your main application executable. Your helper application has to run
> as root for a brief moment because AXMakeProcessTrusted requires root
> access, but then the helper application should quit. You might also find
> that your main application's scripting interface starts working once it
> isn't running as root.
> 
> You can write your main application's executable so that it runs the helper
> application at launch time automatically, or as I do you can run it from a
> menu item or a button when the user chooses to make the main application
> trusted.
> 
>> First question:  I have seen a message saying that AXMakeProcessTrusted was
>> broken in Tiger.  Was it fixed in Leopard?  It seems to work correctly, save
>> causing my AppleScripts to fail.
> 
> AXMakeProcessTrusted works perfectly well in Leopard.
> 
> I have long suspected that the comments about its being broken in Tiger were
> based on misunderstandings about the right way to use it, but I haven't
> actually tried to make it work on Tiger so I'm not sure.
> 
>> Next question:  Are the AppleScripts failing because the application process
>> has elevated rights due to AXMakeProcessTrusted, or is it because the
>> application links to the Security Framework?  I have seen posts/messages
>> that suggest both.  If I can get my application the status of
>> AXProcessIsTrusted without linking to the Security Framework, will the
>> AppleScripts work?  (And is this a bug or a security feature?)
> 
> I think I might have read somewhere that scriptability is disabled in an
> application that is running as root, for security reasons. If that is
> correct, then you should be able to solve your AppleScript problem by moving
> AXMakeProcessTrusted into a separate helper application as described above.
> Since you should move AXMakeProcessTrusted into a separate helper
> application anyway for security reasons, you will be able to answer your
> AppleScript question yourself.
> 
>> Third question: Assuming the answers to the first two questions are
>> favorable, how would you more experienced and wise developers go about doing
>> something like this?  How can I do a one-time operation as root without
>> linking the Security Framework into my main application?  It seems to me I
>> need to include two separate agents in my app � one that is run with normal
>> permissions from the main app (thus, no need to link to the Security
>> Framework or give the main app generally elevated permissions), and then a
>> second one, called from the first agent with privileges, that actually
>> executes the AXMakeProcessTrusted function on the main app.  Does this seem
>> right?  I am a novice programmer, but I have looked at both NSTask and the
>> NSWorkspace - launche

Re: Minimum System Version Check - With Reliable Notification

2009-02-01 Thread Ken Ferry
Hi,
I think the primary issue with this approach is that the app may not get as
far as main.

If the app uses a symbol from the frameworks that is not available at
runtime, dyld will fail to load the binary.

Aaron Hillegass gives a solution at
http://weblog.bignerdranch.com/?p=13that involves using an auxiliary
executable.  A shell process that has very
good compatibility loads, and if it determines that the OS is new enough, it
loads the real application.

-Ken

On Sun, Feb 1, 2009 at 9:26 AM, I. Savant  wrote:

> List:
>
>  Over the years, the standard mechanisms for requiring a minimum system
> version and displaying a kind message to the user have proven unreliable. I
> recently had the need to revisit this issue but (as far as I can tell)
> searching the list archives and all the other usual sources don't quite
> reveal a complete solution, merely suggestions.
>
>  I've seen a few people suggest creating a 'miniature' run loop or using
> Carbon, but in my mind, the cleanest, most straightforward solution was just
> to put the responsibility back into the hands of the OS (where it was
> supposed to be in the first damn place). AppleScript to the rescue.
>
>  For the archives, following is a quick and dirty - but complete - solution
> to this issue. It assumes 10.5 as the minimum system (I trust it's obvious
> what to change and where for other versions). Perhaps not so obvious to
> newbies, this belongs in your project's main.m file.
>
>
>
> int main(int argc, char *argv[])
> {
>// Obtain system version
>static SInt32 systemVersion;
>Gestalt(gestaltSystemVersion, &systemVersion);
>
>// Only run if we're on 10.5 or above ...
>if (systemVersion >= 0x1050)
>{
>
>// We're fine - start the app instance
>return NSApplicationMain(argc,  (const char **) argv);
>
>} else {
>
>// Fails minimum requirement - we'll use AppleScript to
>// display a warning message to bypass the OS X
>// system version checking mess ...
>
>// Set up an autorelease pool (NSAppleScript needs it)
>NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
>// Create then execute the AppleScript, ignoring any errors
>// (Gasp! Ignore errors? Yes - if the script doesn't compile
>// or it fails, more is wrong than we can do anything about
> ...)
>NSString * source = @"beep\ndisplay alert \"This awesome
> application requires Mac OS X 10.5 or above and cannot run on your computer.
> Why on God's great creation are you not up to date?! Bad user, BAD USER!\"
> as warning";
>NSAppleScript * script = [[[NSAppleScript alloc]
> initWithSource:source] autorelease];
>[script executeAndReturnError:nil];
>
>// Release the pool. It probably doesn't matter, but what
> kind
>// of Cocoa developer would I be if I didn't? What will
> people SAY?!
>[pool release];
>
>// Goodbye, cruel world!
>return -1
>
>}
>
>// To be honest, I'm not sure what's best here, but since
>// NSApplicationMain() isn't supposed to come back, errors
>// are handled, and main() requires a return, a clean
>// return seems the right thing to do ... YMMV.
>return 0;
> }
>
>  AppleScript will beep (with the user's preferred standard error sound)
> display the caution icon with your app's icon grafted atop. You may or may
> not want to lose the beep. Not sure why caution / error dialogs don't
> automatically sound the error beep anyway, but that's another philosophical
> debate entirely.
>
>  I'd recommend completely foregoing the use of the LSMinimumSystemVersion
> key approach (search the docs and the list archives if you're unfamiliar)
> since the user will get two "this won't work" messages when the
> LSMinimumSystemVersion is actually honored. Two such messages may seem like
> you're just rubbing it in. ;-)
>
>  Alternatively, you could include the already-compiled script in the app's
> resources to save a millisecond or two during runtime, but I don't feel it's
> necessary and I would think it'd be easier just to change the message in the
> app's source.
>
>  Also, regarding the return, I didn't bother looking up exactly what the
> implications are but I'd imagine there are a few other ways it can be done,
> all of which are probably more or less fine. I'd be interested in opinions
> on this.
>
>  Experts are welcome to pick the whole thing apart and point out its
> wrongness as desired. :-)
>
> --
> I.S.
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription

Re: Drawing Invalidation Question

2009-02-01 Thread Seth Willits

On Feb 1, 2009, at 3:07 AM, Graham Cox wrote:

As others have mentioned, there is potentially a huge difference. If  
you invalidate a lot of small rectangles, the update region might be  
quite complex in shape; the  passed in -drawRect: is only the  
bounds of this complex area.


Which is why the docs confused me. I knew there were subrectangles,  
but the weird thing was this line in the docs:
"It is optimized to efficiently reject any rectangle that lies outside  
the bounding box of the area the receiver is being asked to draw in  
drawRect:."


So it's not optimized to reject anything outside of the sub- 
rectangles? This sentence really threw me off. In retrospect and I can  
see that it simply means that it's doing a simple check up front like  
below, but it's a rather poorly worded description as it doesn't  
mention the sub-rectangles at all. Documentation fail. ;-)


- (BOOL)needsDisplayInRect:(NSRect)rect;
{
if (!NSIntersectsRect(rect, theBigBoundingRect)) {
return NO;
}

... other checks
}






But there is also a difference in intent between
This is probably more than you need or care to know at this point  
but I thought it might be worth mentioning ;-)


Actually, it is very relevant to what I am doing. :-)




Thanks all,

--
Seth Willits



___

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

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

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

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


Re: unable to catch mouseDown

2009-02-01 Thread Ken Ferry
Hi Jeffrey,
> It behaves as if the Matrix lies on top of the view and not as if the
click has to get through the custom view to the Matrix which is a subview.

That is exactly how clicks work.  The first view to receive mouseDown: is
the _deepest_ view that it the click hits. Please see the Cocoa event
handling guide for more details, <
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/EventOverview/Introduction/chapter_1_section_1.html
>.

You can modify the view that first receives -mouseDown: by overriding
-[NSView hitTest:].  It's relatively rare though, and more useful when you
do not know what your subviews will be.   Please consider if a plain
NSMatrix is appropriate as a subview in the first place!

-Ken

On Sun, Feb 1, 2009 at 6:47 AM, Jeffrey Goines <
jeffrey.m.goi...@googlemail.com> wrote:

> Hello.
> I have a custom view to which I add a NSMatrix as subview.
>
> I've set the target and action of the cells and it's working like I want.
>
> Now I want to introduce some mode in which the behaviour is different.
> A mouseclick should no longer trigger the action.
> I want to catch the click in the view and process it further there since
> it's the appropriate place.
>
> I've tried setting the view to acceptFirstResponder and the Matrix to
> resignFirstResponder,
> yet it's not working.
> It behaves as if the Matrix lies on top of the view and not as if the click
> has to get through
> the custom view to the Matrix which is a subview.
> I don't understand that.
>
> Thanks!
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

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

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

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

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


Re: maximum theoretical speedup with dual quad processors

2009-02-01 Thread Michael Ash
On Sat, Jan 31, 2009 at 10:15 PM, Robert Marini  wrote:
> Easily reproduced doesn't always translate into guaranteed to occur.  In my
> experience, using a single queue in your application is a sufficient
> safeguard as no system framework I've encountered causes an issue.

Well, it turns out that this is not actually any sort of safeguard.
With the help of a persistent experimenter posting to my blog, I have
come up with this extremely simple test case:

#import 

@interface MyOperation : NSOperation {} @end
@implementation MyOperation
- (void)main
{
usleep(1);
}
@end

int main(int argc, char **argv)
{
NSAutoreleasePool *outerPool = [[NSAutoreleasePool alloc] init];

NSOperationQueue *queue = [[NSOperationQueue alloc] init];
unsigned count = 0;
while(1)
{
NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc] init];

MyOperation *op = [[MyOperation alloc] init];
[queue addOperation:op];
[op release];

if(++count % 5 == 0)
NSLog(@"%u operations", count);

[innerPool release];
}

[outerPool release];
return 0;
}

It crashes reliably on my Mac Pro. Note that it uses only one queue.
Note that it only enqueues operations from the main thread. Note that
it uses a very simple custom NSOperation subclass, and doesn't use
NSInvocationOperation at all. Note that it does nothing really
interesting or unusual in any way.

And yet it still crashes reliably on my computer, often before it can
even reach the 50,000 operation mark and print the first log line.

I will update my bug with Apple with this new, simplified test case.
For any Apple types reading along, it's rdar://6332143.

At this point, I can only recommend avoiding the entire API until and
unless the problem is fixed. It's true that it's weird and fairly
rare. It's true that your particular usage pattern may avoid it. Or it
may simply not have triggered it yet. It's hard to say either way, and
given the simplicity and the directness of the above test case, it
seems to me that counting on your code to avoid the trouble spot is
unrealistic.

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: Minimum System Version Check - With Reliable Notification

2009-02-01 Thread I. Savant

On Feb 1, 2009, at 3:54 PM, Ken Ferry wrote:

I think the primary issue with this approach is that the app may not  
get as far as main.


If the app uses a symbol from the frameworks that is not available  
at runtime, dyld will fail to load the binary.




  Ah *ha* ... you are of course absolutely right.

  I confess I hadn't even thought this issue. Alas it seems Aaron's  
suggestion is probably the only real solution until we're so far past  
10.5 (where the issue is supposed to be "good and fixed") that we  
react with shock when we learn the user is still using 10.5.


  That sucks.

  Thanks for the shot of common sense, though - that was pretty lame  
of me. ;-) I completely failed to think the problem all the way  
through. I guess it's obvious that the app I tested this on uses some  
pretty plain (old-school) Cocoa. :-)


--
I.S.


___

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

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

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

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


Re: +[NSColor highlightColor] returns white instead of actual color

2009-02-01 Thread Ken Ferry

Hi jerry,

My memory is that this is the alternateSelectedControlColor. I'm not  
at a mac right now, so I cannot verify.


-Ken

On Feb 1, 2009, at 6:46 AM, Jerry Krinock  wrote:


Sorry, there's more to this

+[NSColor selectedTextBackgroundColor] definitely gives a color  
based on System Preferences > Appearance > Highlight Color (for  
selected text).  However, the color actually used in NSTableView is  
darker than this.


For example, I set the color in System Preferences to RGB = {255, 0,  
255}, but when I use DigitalColor Meter.app on a highlighted cell in  
a "stock" NSTableView, I measure {204, 0, 204}.  Now, 204=51*4 and  
255=51*5.  So it looks like someone in the NSTextFieldCell  
Department decided to reduce the brightness by 20%, because, of  
course, if someone set their "highlight" (sic) color to all white,  
the white text drawn on it by NSTextFieldCell would be invisible.


So, I was able to match the "stock" NSTextFieldCell using a little  
brightness-tweaking method that I had lying around.  Is this 20%  
reduction in brightness documented anywhere?  I even searched Human  
Interface Guldelines for "highlight" but didn't find any mention of  
this.


Interestingly, in NSTextViews (TextEdit docs, this message in  
Mail.app), the text is drawn in black instead of white, and the 20%  
reduction is not applied.  And then, Xcode's editor ignores my  
System Preferences and uses black on orange, like it or not.  Seems  
like we need some User Interface Police here.


***

color = [NSColor selectedTextBackgroundColor] ;
color = [color colorTweakBrightness:-.20] ;

***

#import 

@interface NSColor (Tweak)

/*!
@briefReturns a copy of the receiver, but with the
brightness altered by a given tweak factor.

@details  If tweak > 0, the brightness is altered by
blending the receiver with +tweak fraction of pure white. 
If tweak < 0, the brightness is altered by
blending the receiver with -tweak fraction of pure black. 
if tweak = 0, the returned color will be an identical copy of
the receiver.

@paramtweak  The factor by which to tweak the brightness. 
A value greater than +1.0 is clipped to +1.0.
A value less than -1.0 is clipped to -1.0.
@result   A tweaked, autoreleased copy of the receiver
*/
- (NSColor*)colorTweakBrightness:(float)tweak ;

@end

***

#import "NSColor+Tweak.h"


@implementation NSColor (Tweak)

- (NSColor*)colorTweakBrightness:(float)tweak {
   SEL blendColorSelector = (tweak > 0) ? @selector(whiteColor) :  
@selector (blackColor) ;
   NSColor* blendColor = [NSColor  
performSelector:blendColorSelector] ;

   float blend = fabs(tweak) ;
   blend = MIN(blend, 1.0) ;
   return [self blendedColorWithFraction:(CGFloat)blend
 ofColor:blendColor] ;
}

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

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

___

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

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

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

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


Re: +[NSColor highlightColor] in NSTableView

2009-02-01 Thread Graham Cox


On 2 Feb 2009, at 1:46 am, Jerry Krinock wrote:

+[NSColor selectedTextBackgroundColor] definitely gives a color  
based on System Preferences > Appearance > Highlight Color (for  
selected text). However, the color actually used in NSTableView is  
darker than this.


For example, I set the color in System Preferences to RGB = {255, 0,  
255}, but when I use DigitalColor Meter.app on a highlighted cell in  
a "stock" NSTableView, I measure {204, 0, 204}.  Now, 204=51*4 and  
255=51*5.  So it looks like someone in the NSTextFieldCell  
Department decided to reduce the brightness by 20%, because, of  
course, if someone set their "highlight" (sic) color to all white,  
the white text drawn on it by NSTextFieldCell would be invisible.


So, I was able to match the "stock" NSTextFieldCell using a little  
brightness-tweaking method that I had lying around.  Is this 20%  
reduction in brightness documented anywhere?  I even searched Human  
Interface Guldelines for "highlight" but didn't find any mention of  
this.


Interestingly, in NSTextViews (TextEdit docs, this message in  
Mail.app), the text is drawn in black instead of white, and the 20%  
reduction is not applied.  And then, Xcode's editor ignores my  
System Preferences and uses black on orange, like it or not.  Seems  
like we need some User Interface Police here.


***

color = [NSColor selectedTextBackgroundColor] ;
color = [color colorTweakBrightness:-.20] ;



Just to make sure you're aware of it, but -[NSColor shadowWithLevel:]  
(and its sister method, -[NSColor highlightWithLevel:]) are darkening  
and brightening methods that NSColor has - there's no need to write  
your own unless they're doing something unusually funky.


I can't shed any light on what NSTableView uses, maybe Corbin could  
let you know? (I modified the title of the message so he might notice  
it ;-)


Xcode is using my system prefs for text highlight here - never seen  
black on orange, maybe your editor settings have been changed at some  
point?


--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: Off topic:Info on stack trace

2009-02-01 Thread Rob Keniger


On 02/02/2009, at 2:14 AM, Arnab Ganguly wrote:


Hi All,
I am developing an application using COCOA, which generates stack  
trace for

an application crash.
I am able get the stack traces but issue is on the trace, the address
information comes  correctly but the symbols information is not  
correct. It

is coming in "?" format etc.
Any idea or suggestion as how to get the symbols information  
correctly.Any

help or suggestion would be very much appreciated.

Is there any sample application similar to Crashreporter.app?

Note my OS is Tiger hence I won't be able to use backtrace or
backtrace_symbols function.Is there any alternative to implement  
similar in

Tiger?

Thanks in advance
Arnab


This article should help:

http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html


--
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: maximum theoretical speedup with dual quad processors

2009-02-01 Thread Rob Keniger


On 02/02/2009, at 7:27 AM, Michael Ash wrote:


It crashes reliably on my Mac Pro. Note that it uses only one queue.
Note that it only enqueues operations from the main thread. Note that
it uses a very simple custom NSOperation subclass, and doesn't use
NSInvocationOperation at all. Note that it does nothing really
interesting or unusual in any way.

And yet it still crashes reliably on my computer, often before it can
even reach the 50,000 operation mark and print the first log line.



I can confirm that this code reliably crashes my iMac, eventually. It  
gets to around 200 operations before it crashes, but it does crash.


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


[MEET] CocoaHeads Frankfurt, 2.2.2009 8pm

2009-02-01 Thread Torsten Curdt
Just a quick reminder: Cocoa chit-chat, code and beers. Tonight at
Club Voltaire.

http://cocoaheads.org/de/Frankfurt/index.html

Hope to see you there!

cheers
--
Torsten
___

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

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

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

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


Auto-saving documents

2009-02-01 Thread Chris Idou
I want my app to automatically save a document when the user closes its window, 
without prompting the user.

I had thought I'd found a solution by overriding
- (void)canCloseDocumentWithDelegate:(id)delegate 
shouldCloseSelector:(SEL)shouldCloseSelector contextInfo:(void*)contextInfo
to call saveDocument: in the NSDocument. But apparently saveDocument can call 
canCloseDocumentWithDelegate: resulting in an endless loop.

I thought of overriding windowShouldClose: etc, but that doesn't happen until 
after the user is prompted if they want to save.

What is the correct way to achieve this?


  Stay connected to the people that matter most with a smarter inbox. Take 
a look http://au.docs.yahoo.com/mail/smarterinbox
___

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

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

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

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


Re: maximum theoretical speedup with dual quad processors

2009-02-01 Thread Peter N Lewis

At 16:27 -0500 1/2/09, Michael Ash wrote:

It crashes reliably on my Mac Pro. Note that it uses only one queue.
Note that it only enqueues operations from the main thread. Note that
it uses a very simple custom NSOperation subclass, and doesn't use
NSInvocationOperation at all. Note that it does nothing really
interesting or unusual in any way.

And yet it still crashes reliably on my computer, often before it can
even reach the 50,000 operation mark and print the first log line.


This test crashed for me as well, after 315.

Seems pretty clear cut.
   Peter.
--
  Keyboard Maestro 3 Now Available!
   Now run macros from your iPhone with Keyboard Maestro Control!

Keyboard Maestro  Macros for your Mac
   
___

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

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

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

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


Re: Drawing Invalidation Question

2009-02-01 Thread Graham Cox


On 2 Feb 2009, at 8:05 am, Seth Willits wrote:

So it's not optimized to reject anything outside of the sub- 
rectangles? This sentence really threw me off. In retrospect and I  
can see that it simply means that it's doing a simple check up front  
like below, but it's a rather poorly worded description as it  
doesn't mention the sub-rectangles at all. Documentation fail. ;-)



I agree it's a long-winded way to say it's performing a basic  
intersection check, but I think it's probably historic - the  
subrectangles weren't available until 10.3 (I think, maybe it was  
10.2?) so previous to that you only had the overall bounding box to go  
on. The docs may not have been revised since then.


--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: Auto-saving documents

2009-02-01 Thread Kyle Sluder
On Sun, Feb 1, 2009 at 6:52 PM, Chris Idou  wrote:
> I want my app to automatically save a document when the user closes its 
> window, without prompting the user.

What do you want to do if the user hasn't saved the document?  Do you
want to prompt the user, save to a default location, or abandon the
document?

> I had thought I'd found a solution by overriding
> - (void)canCloseDocumentWithDelegate:(id)delegate 
> shouldCloseSelector:(SEL)shouldCloseSelector contextInfo:(void*)contextInfo
> to call saveDocument: in the NSDocument. But apparently saveDocument can call 
> canCloseDocumentWithDelegate: resulting in an endless loop.

What makes you think that?

--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: maximum theoretical speedup with dual quad processors

2009-02-01 Thread Michael Ash
On Sun, Feb 1, 2009 at 8:04 PM, Peter N Lewis  wrote:
> At 16:27 -0500 1/2/09, Michael Ash wrote:
>>
>> It crashes reliably on my Mac Pro. Note that it uses only one queue.
>> Note that it only enqueues operations from the main thread. Note that
>> it uses a very simple custom NSOperation subclass, and doesn't use
>> NSInvocationOperation at all. Note that it does nothing really
>> interesting or unusual in any way.
>>
>> And yet it still crashes reliably on my computer, often before it can
>> even reach the 50,000 operation mark and print the first log line.
>
> This test crashed for me as well, after 315.
>
> Seems pretty clear cut.

Thanks to both you and Rob for repeating the experiment. Interesting
that it's so variable. On my computer it would occasionally require
several million to crash, but most of the time it explodes within the
first few hundred thousand. No doubt due to the different hardware
involved, and maybe even what else is running/active on the system.
Threading bugs do tend to be that way.

Mike
___

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

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

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

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


Re: Drawing Invalidation Question

2009-02-01 Thread Michael Ash
On Sun, Feb 1, 2009 at 4:05 PM, Seth Willits  wrote:
> On Feb 1, 2009, at 3:07 AM, Graham Cox wrote:
>
>> As others have mentioned, there is potentially a huge difference. If you
>> invalidate a lot of small rectangles, the update region might be quite
>> complex in shape; the  passed in -drawRect: is only the bounds of this
>> complex area.
>
> Which is why the docs confused me. I knew there were subrectangles, but the
> weird thing was this line in the docs:
> "It is optimized to efficiently reject any rectangle that lies outside the
> bounding box of the area the receiver is being asked to draw in drawRect:."
>
> So it's not optimized to reject anything outside of the sub-rectangles? This
> sentence really threw me off. In retrospect and I can see that it simply
> means that it's doing a simple check up front like below, but it's a rather
> poorly worded description as it doesn't mention the sub-rectangles at all.
> Documentation fail. ;-)

You left out the word "efficiently" from the formulation of your
contrapositive, which I think is important. To me, the words
"optimized" and "efficiently" make it clear that it's only describing
a speed enhancement, and telling you that there's no need to do your
own bounding-rect culling beforehand. The full behavior of the method
is described at the top of the documentation.

Of course documentation quality and clarity is a matter of opinion,
and may vary.

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: Can we render QCRenderer in CAOpenGLLayer..?

2009-02-01 Thread Anshul jain
Thanks Gordon for the information  but i am not using the garbage  
collection. Is there any problem with my code is there any sample  
code for it..


On 31-Jan-09, at 10:31 PM, Gordon Apple wrote:

   Just curious - are you using garbage collection?  We recently  
determined
there is a bug in QCCompositionLayer with garbage collection that  
prevents

the composition from playing.  QCCompositionLayer is a subclass of
CAOpenGLLayer. Maybe you hit the same bug?


On 1/31/09 10:09 AM, "cocoa-dev-requ...@lists.apple.com"
 wrote:


I am trying to play  QCComposition in CAOpenGLLayer
According to the documentation of QCRenderer this should work fine.
but at final output nothing is displayed. Can anyone tell me where i
am going wrong...?

but at final output nothing is displayed. Can anyone tell me where i
am going wrong.




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/anshul.jain%40prithvisolutions.com

This email sent to anshul.j...@prithvisolutions.com



Thanks & Regards

Anshul jain
anshul.j...@prithvisolutions.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: Auto-saving documents

2009-02-01 Thread Chris Idou



On Sun, Feb 1, 2009 at 6:52 PM, Chris Idou  wrote:
>> I want my app to automatically save a document when the user closes its 
>> window, without prompting the user.
>
>What do you want to do if the user hasn't saved the document?  Do you
>want to prompt the user, save to a default location, or abandon the
>document?


I want the app to automatically save the document when the user closes the 
window. The way it works there is always a location to save.

>> I had thought I'd found a solution by overriding
>> - (void)canCloseDocumentWithDelegate:(id)delegate 
>> shouldCloseSelector:(SEL)shouldCloseSelector contextInfo:(void*)contextInfo
>> to call saveDocument: in the NSDocument. But apparently saveDocument can 
>> call canCloseDocumentWithDelegate: resulting in an endless loop.
>
>What makes you think that?

It looked like that in the debugger when it blew up with an endless stack 
frames in canCloseDocumentWithDelegate, and the active line seemed to be 
saveDocument. The only two lines were  saveDocument and [super 
canCloseDocumentWithDelegate...].



  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
more
___

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

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

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

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


QCRenderer method createSnapshotImageOfType: returning nil

2009-02-01 Thread Anshul jain
 I am trying to Play a composition in  a OPenGL layer. I have read in  
Documentation that we can do that using QCRenderer. Here is my  
initialization code


- (CGLContextObj)copyCGLContextForPixelFormat: 
(CGLPixelFormatObj)pixelFormat

{
	CGLContextObj object =  [super  
copyCGLContextForPixelFormat:pixelFormat];
	NSString *path = [[NSBundle mainBundle] pathForResource:@"Blob"  
ofType:@"qtz"];

QCComposition *aComposition = [QCComposition compositionWithFile:path];
	CGColorSpaceRef colorRef =   
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
	qcRenderer = [[QCRenderer alloc] initWithCGLContext:object  
pixelFormat:pixelFormat colorSpace:colorRef composition:aComposition];

_startTime = -1.0;
return object;
}

i render it using this code

- (BOOL)canDrawInCGLContext:(CGLContextObj)glContext pixelFormat: 
(CGLPixelFormatObj)pixelFormat forLayerTime: 
(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp

{
BOOL success = [self renderAtTime:timeStamp];
if (texture)
CVOpenGLBufferRelease(texture);
texture = [qcRenderer createSnapshotImageOfType:@"CVOpenGLBuffer"];
if (success) {
if (texture)
return YES;
}
return NO;
}

- (BOOL) renderAtTime:(const CVTimeStamp*)time
{
NSTimeInterval  videoTime,
localTime;
id  image;
if (time) {
if(time->flags & kCVTimeStampVideoTimeValid)
			videoTime = (NSTimeInterval)time->videoTime / (NSTimeInterval)time- 
>videoTimeScale;

else
videoTime = 0; //Not sure what the best thing to do is
if(_startTime < 0) {
_startTime = videoTime;
localTime = 0;
}
else
localTime = videoTime - _startTime;
return [qcRenderer renderAtTime:localTime arguments:nil];
}
return NO;
}

Can any one tell what can be the reason for the QCRenderer to reurn NIL.

Thanks!
Anshul
___

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

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

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

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


Cg Geometry Shader

2009-02-01 Thread Kaluriel Hargrove

___

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

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

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

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


Question on insertObject: inAtIndex

2009-02-01 Thread Phillip Hall

I have the following setup

1 custom model class (Vegetable)
1 class (AppController) Has an NSMutableArray (vegetables) property.
1 NSArrayController.  Object controller set to Class with Class name  
set to Vegetable.  Content Array is bound to AppController.vegetables


I have a button on my window which is bound to the NSArrayControllers  
add: action.


Now I want to know the different ways to know when the an object is  
added to the vegetables array via the NSArrayControllers add: action.


First i Iooked registering an observer on the AppControllers key path  
"vegetable".  This worked fine.


I then read about the insertObject: inAtIndex: method.  Reading  
the documentation it seems this should be called by the  
NSArrayController if its implemented by its content array (in my case  
AppController).


I have implemented the method, but it does not get called.  I  
obviously have the wrong end of the stick on how insertObject:  
inAtIndex:  is supposed to be used.


Can anyone see where I have gone wrong?

Thanks -

Phillip Hall
___

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

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

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

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


NSXMLParser and Unicode/"Foreign" Character problems

2009-02-01 Thread Todd Atkins
I'm reading in a validated XML  file via NSXMLParser and things work
very well except when it comes to elements that contain "foreign"
charcters such as ß, ü, ä, etc. For example, i have an element like
so:

Großefehn-4 - Großefehnkanal

I want to extract the contents, "Großefehn-4 - Großefehnkanal", into a
string, but all I end up with is "ßefehn-4 - Großefehnkanal" with
everything else cut off.

I'm using the following:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName attributes:(NSDictionary
*)attributeDict
{
   if ([elementName isEqualToString:@"g:name"]) {
   NSLog(@"Found Name Element");
   }
}

and

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
   if (!currentValue) {
   currentValue = [[NSMutableString alloc] init];
   }
   NSLog(@"String: %@",string);
   [currentValue setString:string];
}

and

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
{
   if ( [elementName isEqualToString:@"g:name"] ) {
   [gNames addObject:[NSString stringWithString:currentValue]];
   }
}

What happens is that gNames ends up with the truncated string value.
The output of NSLog, though, shows:
2009-02-01 12:45:09.538 [320:10b] String: Gro
2009-02-01 12:45:09.538 [320:10b] String: ßefehn-4 - Großefehnkanal

I'm also adding these strings to an array, and the array for this
particular entry shows:
\U00dfefehn-4 - Gro\U00dfefehnkanal

So for some reason, it's breaking up those strings into seperate
lines, and I can't figure out why. The only thing I can figure is that
it has to do with the encoding, but the XML document is UTF-8. Any
insight is much appreciated.
___

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

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

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

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


Receive drop event on dock icon

2009-02-01 Thread Johannes Plunien

Hi,

i've been searching without success for a hint how to receive a event  
when a file was dropped on my applications dock icon. I've already  
configured my apps properties to allow extensions "png jpg jpeg gif"  
with store type "Binary" and "Role" viewer. So far i can drop images  
to the dock icon, but i dont know how to receive that drop event. I  
just need some hints where to start reading at developer.apple.com or  
somewhere else.


Thanks,
Johannes

--
Johannes Plunien | mailto:p...@pqpq.de | http://www.pqpq.de/contact/



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSXMLParser and Unicode/"Foreign" Character problems

2009-02-01 Thread Stephen J. Butler
On Sun, Feb 1, 2009 at 1:36 PM, Todd Atkins  wrote:
> What happens is that gNames ends up with the truncated string value.
> The output of NSLog, though, shows:
> 2009-02-01 12:45:09.538 [320:10b] String: Gro
> 2009-02-01 12:45:09.538 [320:10b] String: ßefehn-4 - Großefehnkanal

That's perfectly valid behavior, and is documented in the delegate
parser:foundCharacters:. Since you already have an NSMutableString,
use appendString: instead.
___

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

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

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

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


becomeFirstResponder override issue

2009-02-01 Thread Chris Anderson

Hello!

I've created a subclass of NSDatePicker to catch when a date picker  
has focus. I have overridden the becomeFirstResponder method and  
indeed it detects when it has focus. The code inside the method does  
work except for any IBOutlets that I may have connected. They don't  
respond to any requests.


I have verified that the IBOutlets are connected by adding a separate  
IBAction in the subclass and a simple button to invoke the action.  
Inside the IBAction I can call the same IBOutlets successfully.


I am baffled as to why when the IBOutlets are inside  
becomeFirstResponder they don't seem connected. Example below...


-(BOOL)becomeFirstResponder // myArrayController will not respond
{ NSLog(@"DetectDatePicker:firstResponder: %i", [[myArrayController  
arrangedObjects] count]);

return YES;
}
-(IBAction)detectPicker:(id)sender // myArrayController successfully  
responds
{ NSLog(@"DetectDatePicker:performClick: %i",[[myArrayController  
arrangedObjects] count]);

}

Any help would be appreciated.  Thanks!

Chris
___

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

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

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

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


Re: Question on insertObject: inAtIndex

2009-02-01 Thread mmalc Crawford


On Jan 31, 2009, at 9:35 PM, Phillip Hall wrote:

I then read about the insertObject: inAtIndex: method.  Reading  
the documentation it seems this should be called by the  
NSArrayController if its implemented by its content array (in my  
case AppController).





mmalc

___

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

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

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

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


Re: theoretical, can i use the same wave effect, which i can see when i adding new widget in dashboard?

2009-02-01 Thread Carlo Gulliani
yeah, i've found one f examples which demonstrating CIRippleTransition. thanks 




From: Nathan 
To: Carlo Gulliani 
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, February 1, 2009 11:12:20 PM
Subject: Re: theoretical, can i use the same wave effect, which i can see when 
i adding new widget in dashboard?

Back when I was trying to find tutorials/examples to learn CA, one of the links 
said it replicated the dashboard ripple effect. I never clicked on the link but 
it just came up in a google search. Try finding that.

Good luck, Nate

On Feb 1, 2009, at 1:24 PM, Carlo Gulliani  wrote:

> hi all, how can i use (make) the wave effect like in dashboard when i adding 
> new widget? i'm trying to find info in google but i've not result. any ideas?
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/lipton_lover%40mac.com
> 
> This email sent to lipton_lo...@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