Superscript attribute with CATextLayer

2008-10-20 Thread Stephan Michels
Hi,
I have the problem if I use super/subscript within an attributed string, then
it doesn't seems to work with CATextLayer, and I don't know why.

I tried NSSuperscriptAttributeName and NSBaselineOffsetAttributeName

  string = [[NSMutableAttributedString alloc] init];
  [string beginEditing];
  [string replaceCharactersInRange:NSMakeRange(0,0) withString:@CO2];
  [string addAttribute:NSFontAttributeName value:[NSFont
controlContentFontOfSize:12] range:NSMakeRange(0,3)];
  [string addAttribute:NSForegroundColorAttributeName value:[NSColor
blackColor] range:NSMakeRange(0,3)];

  [string addAttribute:NSUnderlineStyleAttributeName value:[NSNumber
numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0,2)];

  // first case
  [string addAttribute:NSSuperscriptAttributeName value:[NSNumber
numberWithInt:-1] range:NSMakeRange(2,1)];
  // second case
  //[string addAttribute:NSBaselineOffsetAttributeName value:[NSNumber
numberWithInt:-5] range:NSMakeRange(2,1)];
  // third case
  //[string subscriptRange:NSMakeRange(2, 1)];

  [string endEditing];

It works perfectly with drawAtPoint:

- (void)drawRect:(NSRect)rect {
[string drawAtPoint:NSMakePoint(10, 20)];
}

But not with a CATextLayer

- (void)awakeFromNib {
self.wantsLayer = YES;

layer = [CATextLayer layer];
layer.string = string;
layer.bounds = CGRectMake(0, 0, layer.preferredFrameSize.width,
layer.preferredFrameSize.height);
layer.position = CGPointMake(10, 150);
layer.borderWidth = 1;
layer.anchorPoint = CGPointMake(0,0);

[self.layer addSublayer:layer];
}

Does anyone know how to solve it or have an explanation why it doesn't work?

Thank you,
Stephan Michels.
___

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

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

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

This email sent to [EMAIL PROTECTED]


[ANN] InputMethodKit backporting component for OS X 10.4 Tiger

2008-10-20 Thread Lukhnos D. Liu

Hi All,

InputMethodKit Backporting Component, or IMK-Tiger for short, helps
input method developers backport their IMK-based input method apps to
OS X 10.4 Tiger. It is what we use to backport the latest OpenVanilla,
a popular input method toolset in Taiwan, to 10.4.

You can find the project at:

  http://code.google.com/p/imk-tiger/

A summary:

OS X 10.5 introduced InputMethodKit (IMK), arguably the best OS-level
input method framework in the industry. IMK is pure Cocoa and greatly
simplifies input method development with a client-server design,  
powered by
Objective-C's distributed object mechanism. Input method developers  
only need
to talk to a very slim and object-oriented interface to provide input  
method

service to OS X. This allows developers to concentrate on algorithms and
user experience. On other platforms, OS X 10.4 included, input method
development involves many platform-specific details and debugging  
headaches

that can be a big distraction.

There is a catch--IMK is Leopard-only. In a market like Taiwan, where
Traditional Chinese is the main written language, there are still  
45%-55%

of users still having their Tiger machines around, and this is a market
we want to continue supporting.

What if we could replicate IMK on Tiger? In fact we can and have. IMK- 
Tiger

is the result. We're now working on an IMK-based OpenVanilla, and using
IMK-Tiger to build the Tiger version.

Please find the details in the project home mentioned above. We have  
supplied
a sample project, with a working, IMK-based input method (SimpleIME)  
and

necessary project settings to produce a TSM-based counterpart.

Note that we call it a backporting component, not a library, because  
it is not
as trivial as linking to a library and voilà. But the crux is to  
customize

IMK-Tiger's ComponentConfig.h so that the TSM component provided can
establish connection to your IMK server process (and launch it if it  
hasn't).
But once you have finished knitting everything together, you can  
concentrate

on improving your IMK-based code.

For now IMK-Tiger doesn't support -[IMKInputController  
recognizedEvents:]

and -[IMKInputController currentKeyboardLayout], and you must implement
-[IMKInputController handleEvent:client:] to handle the keyboard event.

IMK-Tiger is open source released under the BSD License. Feedback and
participation are welcome and appreciated.

Thanks!

d.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Pointing in the right direction for an XCode 3 pref pane.

2008-10-20 Thread Adam Penny

Hi Nick,

Yes, I've tried that and it gave me the little '+' symbol in green,  
which is always a good sign, but it proceed to do nothing.


Here's my header file, just in case that's where the problem lies:

#import PreferencePanes/PreferencePanes.h


@interface WopolPref : NSPreferencePane
{
IBOutlet NSTextField *broadcastIP;
IBOutlet NSTableView *printerSpec;
IBOutlet NSTableView *serverSpec;
}

- (void) mainViewDidLoad;

@end

I understand from Apple's docs on the subject that I'll also need an  
initWithBundle action as well, but I got the impression that this was  
enough just to get the outlets hooked up with IB.


Thanks again,

Adam

On Oct20, 2008, at 1:59 AM, Nick Zitzmann wrote:



On Oct 19, 2008, at 9:33 AM, Adam Penny wrote:

Having constructed a preference subclass with the appropiate  
outlets corresponding to those I've placed in the nib file, I'm  
getting an NSObject and setting it's class to the preference pane  
subclass with my outlets in it, but this seems to be giving me an  
unexpected choice of outlets when I'm trying to connect them.  I  
was hoping to see the outlets broadcastIP, printers and servers.  
Instead I see _FirstKeyView, _InitialKeyView, _LastKeyView window  
and New Referencing Outlet. Am I supposed to use something other  
than an NSObject when it's a preference pane in order to make  
connections?



Have you tried manually loading the header into IB by dragging the  
file onto the nib window? IB is supposed to automatically loads  
headers, but sometimes it doesn't.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: what do you use to make icons and similar?

2008-10-20 Thread Peter N Lewis
I need a make a few icons and other graphics for my app, simple 
stuff like a small yellow triangle with an invisible background. I'm 
totally and completely graphically challenged which never helps. I 
can't find a simple (preferably free!) drawing program which will 
let me make stuff like this. What does everyone use for these things?


Another option to try is Opacity http://likethought.com/opacity/. 
You can create your icons in a vector drawing like manner and then it 
renders them to various sizes.


Enjoy,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.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 [EMAIL PROTECTED]


stringWithFormat

2008-10-20 Thread Ron Green


stringWithFormat: returns an NSString that is autoreleased. I know  
this because I read it in Hillegasses book. But since this does not  
seem to be covered in the documentation, if I had not read it in a  
book, how would I discover that the NSString was autoreleased?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Pointing in the right direction for an XCode 3 pref pane.

2008-10-20 Thread Adam Penny

Hi again,

Sorry, in my naivité I had expected the drag and drop to do more, but  
having just created a new NSObject in IB and pointed at the wopolpref  
class I now discover that it dragging and dropping has done the trick.


Thank you very much!

Adam
On Oct20, 2008, at 1:59 AM, Nick Zitzmann wrote:



On Oct 19, 2008, at 9:33 AM, Adam Penny wrote:

Having constructed a preference subclass with the appropiate  
outlets corresponding to those I've placed in the nib file, I'm  
getting an NSObject and setting it's class to the preference pane  
subclass with my outlets in it, but this seems to be giving me an  
unexpected choice of outlets when I'm trying to connect them.  I  
was hoping to see the outlets broadcastIP, printers and servers.  
Instead I see _FirstKeyView, _InitialKeyView, _LastKeyView window  
and New Referencing Outlet. Am I supposed to use something other  
than an NSObject when it's a preference pane in order to make  
connections?



Have you tried manually loading the header into IB by dragging the  
file onto the nib window? IB is supposed to automatically loads  
headers, but sometimes it doesn't.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: stringWithFormat

2008-10-20 Thread Roland King

Ron Green wrote:



stringWithFormat: returns an NSString that is autoreleased. I know  
this because I read it in Hillegasses book. But since this does not  
seem to be covered in the documentation, if I had not read it in a  
book, how would I discover that the NSString was autoreleased?

___



because it's covered in the documentation.

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html

and pages linked from there.

Which has reminded me that copy is in there and now I think I have a 
memory leak in something I've been writing. 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 [EMAIL PROTECTED]


Re: stringWithFormat

2008-10-20 Thread Conor


You create an object using a method whose name begins with “alloc”  
or “new” or contains “copy” (for example, alloc, newObject, or  
mutableCopy).


Many classes provide methods of the form +className... that you can  
use to obtain a new instance of the class. Often referred to as  
“convenience constructors”, these methods create a new instance of the  
class, initialize it, and return it for you to use. Although you might  
think you are responsible for releasing objects created in this  
manner, that is not the case according to the policy Cocoa set—the  
method name does not contain alloc or copy, or begin with new.  
Because the class creates the new object, it is responsible for  
disposing of the new object


file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html

Conor___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMetadataQuery question

2008-10-20 Thread Timothy Larkin
There is only one way I have figured out to have a date as the RHS of  
a predicate, which I found by looking at an example of a date  
predicate produced by IB as part of a predicate binding. The date has  
to be cast to a float. This


[NSString stringWithFormat:@CAST(%f, \NSDate\), [date  
timeIntervalSinceReferenceDate]];


produces a string which can be used to build a predicate.

--
Timothy Larkin
Abstract Tools
Caroline, NY

On Oct 19, 2008, at 9:39 PM, Timothy Reaves wrote:

	I'm trying to write a query where the meta data in question is an  
NSDate stored as a binary plist.  Everything I am doing is failing.   
I have tried '(myKey  %@, date] where date is an instance of  
NSDate, where it is a NSTimeInterval, and a string.  Nothing returns  
data (or even calls my callback).





PGP.sig
Description: This is a digitally signed message part
___

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

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

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

This email sent to [EMAIL PROTECTED]

Custom button cells for NSMatrix

2008-10-20 Thread norio

Hi,

I'm trying to make a custom cell object for NSMatrix which behaves  
like radio button, this is, when you press the second cell, the second  
cell is highlighting still.


Would you tell me which method I need to override?

Thank you.

Norio

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Custom button cells for NSMatrix

2008-10-20 Thread Ricky Sharp
This is actually quite difficult. I can send you details later today.  
In my case, I needed accessibility and mimic the Aqua radio buttons in  
terms of all their behaviors.


I ended up subclassing NSMatrix and NSActionCell. I could not get a  
subclass of NSButtonCell in an NSMatrix to work completely.


Sent from my iPhone

On Oct 20, 2008, at 6:19 AM, norio [EMAIL PROTECTED] wrote:


Hi,

I'm trying to make a custom cell object for NSMatrix which behaves  
like radio button, this is, when you press the second cell, the  
second cell is highlighting still.


Would you tell me which method I need to override?

Thank you.

Norio

___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: what do you use to make icons and similar?

2008-10-20 Thread Dave DeLong

If you don't have skill, pay somebody to do it.


Not always an option, even if desirable.


For those of who do want to go with the paid route, our CocoaHeads  
group keeps a list of some of the Mac-oriented graphic designers we've  
found and/or used in the past.  Feel free to register on the site and  
add to it:


http://cocoaheads.byu.edu/wiki/graphic-artists-and-designers

Dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is there a character limit in (NSString* title) and (NSString* message) in NSBeginCriticalAlertSheet dialog?

2008-10-20 Thread Michael Ash
On Sun, Oct 19, 2008 at 11:30 PM, Lance Kwan [EMAIL PROTECTED] wrote:
 Is there a character limit in (NSString* title) and (NSString* message) in 
 NSBeginCriticalAlertSheet dialog?

 or there is limited characters for (NSString* message)?

There is no limit aside from the inherent limits created by limited
memory. Of course your user's screen is only so big, and as far as I
know the Cocoa alert functions do not create scroll bars when their
contents get too large, so you'll want to make sure that you keep the
window small enough that the whole thing can be read.

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 [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread Michael Ash
On Mon, Oct 20, 2008 at 1:35 AM, j o a r [EMAIL PROTECTED] wrote:
 Some general suggestions for best practices wrt. optimizations:

1)  Measure first
2)  Implement supposed optimization
3)  Measure to see the impact of the code change
4)  Based on the result of #3, either scrap your changes, or
 document the optimized code

And don't forget step 0:

0) Don't even bother

A lot of people optimize code that's already plenty fast. A lot of
people optimize code that *hasn't even been written yet*. This is
foolish. Write your code to be easy to understand and as bug-free as
you can get it. And then, only if it's not running as fast as you need
it to, should you even start to consider the possibility of thinking
about beginning to investigate optimizing the code.

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 [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread graham . lee
Michael Ash wrote on 20/10/2008 15:31:01:

 On Mon, Oct 20, 2008 at 1:35 AM, j o a r [EMAIL PROTECTED] wrote:
  Some general suggestions for best practices wrt. optimizations:
 
 1)  Measure first
 2)  Implement supposed optimization
 3)  Measure to see the impact of the code change
 4)  Based on the result of #3, either scrap your changes, 
or
  document the optimized code
 
 And don't forget step 0:
 
 0) Don't even bother
 
 A lot of people optimize code that's already plenty fast. A lot of
 people optimize code that *hasn't even been written yet*. This is
 foolish. Write your code to be easy to understand and as bug-free as
 you can get it. And then, only if it's not running as fast as you need
 it to, should you even start to consider the possibility of thinking
 about beginning to investigate optimizing the code.

I think that's only frequently, not usually or always, the approach to 
take. For instance if you have a specific performance requirement, and 
when you prototype the proposed solution you find the performance to be 
way off the requirement, it's best to go back to the boxes on the paper. 
Even Instruments is unlikely to help you get your slow design orders of 
magnitude faster, nor your bloated design orders of magnitude more svelt.

I've been involved on a project like that in a previous job, where we had 
a requirement to process thousands of things/sec and our existing solution 
was capable of tens/sec. Rather than see what we could eke out of our 
solution, we went back to the whiteboard and optimised the design. In that 
case, this was not a foolish thing to do.

Cheers,
Graham.



-- 
Graham Lee
Senior Macintosh Software Engineer, Sophos

Tel: 01235 540266 (Direct)
Web: http://www.sophos.com
Sophos - Security and Control

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon,
OX14 3YP, United Kingdom.

Company Reg No 2096520. VAT Reg No GB 348 3873 20.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread Jason Stephenson

DKJ wrote:
Since mutable arrays and dictionaries expand as required when new 
objects are added, when should one use -initWithCapacity: methods?


I have used it when my program can figure out roughly how many items 
will be in the mutable object to begin with.


Say my program is pulling some data from a database table and there are 
64 rows in the table when I go to initialize a NSMutableArray to hold 
the data rows from the table. In that case, I'd use -initWithCapacity: 
to indicate that there are about to be 64 objects inserted into the array.


If my program can't know how many items will go in the object at the 
start, then I won't bother using it.


I've never checked if it speeds things up or not, but it seems like the 
time to use it when you know how much data you'll be putting in the 
object at the start.


Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


lockFocus error

2008-10-20 Thread DKJ
I have a custom view in a window, set as an instance of MyView, and  
connected to my controller as an IBOutlet theView. When I do this in  
the controller's awakeFromNib method:


[theView lockFocus];

I get this error:

*** Assertion failure in -[MyView lockFocus], /SourceCache/AppKit/ 
AppKit-949.35/AppKit.subproj/NSView.m:4755

An uncaught exception was raised
-[MyView(0x139a20) lockFocus] failed with window=0x135f70,  
windowNumber=-1, [self isHiddenOrHasHiddenAncestor]=0
*** Terminating app due to uncaught exception  
'NSInternalInconsistencyException', reason: '-[MyView(0x139a20)  
lockFocus] failed with window=0x135f70, windowNumber=-1, [self  
isHiddenOrHasHiddenAncestor]=0'



The window's visible at launch box is checked in IB, so shouldn't it  
be available when awakeFromNib is called?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] How do people use and contribute to this list?

2008-10-20 Thread Michael Gardner

On Oct 19, 2008, at 10:18 PM, Scott Ribe wrote:
The view unread only option is the reason I haven't switched to  
Mail and

still use Entourage.


You know you can sort by unread status by clicking on the 'unread'  
column in Mail, right? It's not exactly the same, but it works well  
for me.


-Michael
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread Roland King


On Oct 20, 2008, at 10:31 PM, Michael Ash wrote:


On Mon, Oct 20, 2008 at 1:35 AM, j o a r [EMAIL PROTECTED] wrote:

Some general suggestions for best practices wrt. optimizations:

  1)  Measure first
  2)  Implement supposed optimization
  3)  Measure to see the impact of the code change
  4)  Based on the result of #3, either scrap your changes,  
or

document the optimized code


And don't forget step 0:

0) Don't even bother

A lot of people optimize code that's already plenty fast. A lot of
people optimize code that *hasn't even been written yet*. This is
foolish. Write your code to be easy to understand and as bug-free as
you can get it. And then, only if it's not running as fast as you need
it to, should you even start to consider the possibility of thinking
about beginning to investigate optimizing the code.

Mike
___


I'm not sure I totally agree with step 0. I think there is value in  
understanding how your code is going to run, or is going to run most  
times, and picking constructs which are clearly efficient if it's  
really not more work to do so and it represents the data you're  
working with.


I was working on something similar this weekend, converting a wire  
protocol into NSStrings, bytes were 100% guaranteed ascii. I could  
have converted the entire original data to one string, then split it  
into an array of strings on certain characters, then put it together  
again, and were it unicode or something similar, I would have. But  
instead I scanned the byte array once, found the bits I wanted and  
made the final strings the first time around using the string  
constructors from void*/length. It was no more code, it took a bit of  
thought about the data structure but it does avoid a load of creation,  
copying and destruction of strings.


I think that's just good programming. If I know when I'm creating an  
array that it's going to have 139 elements but I'm going to add them  
one by one, I'm going to make an array with capacity for 139 elements  
right up front. If I don't, then I'm going to trust the framework to  
do the best job it can and take the overhead.


Premature optimisation is a fuzzy line, it's easy to go overboard with  
it, but there's definitely a place for considering whether the code  
you're writing is going to create 10 objects, them copy them 8 times  
to something else, instead of making one of the right size the first  
time and filling it once.


That said once I'm done I always run the optimization tools at the  
end, but I do program with some thought of efficiency in mind. 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread I. Savant
On Mon, Oct 20, 2008 at 11:37 AM, Roland King [EMAIL PROTECTED] wrote:

 I'm not sure I totally agree with step 0. I think there is value in
 understanding how your code is going to run, or is going to run most times,
 and picking constructs which are clearly efficient if it's really not more
 work to do so and it represents the data you're working with.

  Agreed. The laptops! Won't somebody PLEASE think of the LAPTOPS!

  Sure, our desktops are fast and the difference in 'extra work saved'
is usually imperceptible, but my laptop thanks you for your judicious
use of reasonably-optimized code. Mobile users need you to not waste
their battery power on pointless code execution.

  (... he says while running Screensaver As Desktop on his MBP ...)

--
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 [EMAIL PROTECTED]


Custom CALayer Action as animation key?

2008-10-20 Thread Patrick Mau

Good afternoon,

I have implemented a layer-based view that acts as the layer delegate  
and defines a layer action named test.
Afterwards I create a CABasic animation to animate the test property.  
If you look at the line marked 'THIS WORKS,
you'll see that sending setValue:forKey triggers a message  
runActionForKey:object:arguments,
but using the property for a basic animation will not trigger the  
CAAction.


So here's my simple question. What is needed to animate a generic  
property named test?
Did I mis-read the documentation and wrongly assumed that any property  
can be used as

long as there's a CAAction?

By the way, changing the keyPath to something like  
bounds.size.width works as expected.


The small zip is at:

http://oscar.homelinux.net/layer.zip

Please don't mind the coding style.

Thanks a lot,
Patrick

--- Small excerpt ---

/* Debug invocation of CAAction */
- (void) runActionForKey:(NSString *)key object:(id)object arguments: 
(NSDictionary *)dict

{
NSLog(@runActionForKey:\[EMAIL PROTECTED] object:%p arguments:%p, key,  
object, dict);

}

/* Get the CAAction for test, or nil for all others */
- (idCAAction) actionForLayer:(CALayer *)theLayer forKey:(NSString  
*)theKey

{
id res = [theLayer.actions valueForKey:theKey];
NSLog(@actionForLayer:%p forKey:\[EMAIL PROTECTED] = %p, theLayer, theKey,  
res);

return res;
}

/* Create the layer, initialize action, animate test property */
- (void) createLayer {
// ...
content = [CALayer layer];
content.actions = [NSDictionary  
dictionaryWithObjectsAndKeys:self, @test, nil];

// ...
[content setDelegate:self];
[content setNeedsDisplay];

// THIS WORKS!
[content setValue:[NSNumber numberWithInt:19] forKey:@test];

// THIS does not work.
CABasicAnimation *anim = [CABasicAnimation animation];
anim.keyPath = @self.test;
anim.duration = 1.0;
anim.repeatCount = 1.0e100;
anim.autoreverses = YES;
anim.fromValue = [NSNumber numberWithFloat:0.0];
anim.toValue = [NSNumber numberWithFloat:1.0];
[content addAnimation:anim forKey:@test];
}

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread Nick Zitzmann


On Oct 20, 2008, at 9:21 AM, DKJ wrote:

I have a custom view in a window, set as an instance of MyView, and  
connected to my controller as an IBOutlet theView. When I do this in  
the controller's awakeFromNib method:


[theView lockFocus];



Out of curiosity, why are you locking focus on a view in -awakeFromNib?

Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread Andy Lee

On Oct 20, 2008, at 11:37 AM, Roland King wrote:
I think there is value in understanding how your code is going to  
run, or is going to run most times, and picking constructs which are  
clearly efficient if it's really not more work to do so and it  
represents the data you're working with.


Of course, no discussion of NSArray capacities would be complete  
without a mention of this post on ridiculousfish:


http://ridiculousfish.com/blog/?p=27

--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread DKJ


On 20 Oct, 2008, at 08:59, Nick Zitzmann wrote:

Out of curiosity, why are you locking focus on a view in - 
awakeFromNib?


I'm just practising with views and animations.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread Nick Zitzmann


On Oct 20, 2008, at 10:09 AM, DKJ wrote:


I'm just practising with views and animations.



Generally, you don't call -lockFocus on a view unless you have a very  
good reason. As you've already found out, -lockFocus will raise  
exceptions if things aren't set exactly right. Instead, you do all  
your drawing in -drawRect:, and call -setNeedsDisplay:  friends when  
you need to refresh part of the view.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: How can I launch Preview.app from my application for collection of images

2008-10-20 Thread Randall Meadows

On Oct 16, 2008, at 10:04 AM, Fritz Anderson wrote:


On 16 Oct 2008, at 10:48 AM, Alexander Shmelev wrote:

I have set of images, how can i open Preview.app from my Cocoa  
application to display them all?


See -[NSWorkspace openFile:withApplication:]. If your images are in  
memory only, you'll have to save them in temporary files. I don't  
know of a way to make Preview display an image that isn't in a file.


Tangential to the OP, but might be worth the electrons:

Preview can display the contents of the clipboard (when it contains  
image data) by using File - New From Clipboard (cmd-N).  (The OP  
might be able to managed this via scripting, but the new files in  
Preview won't be related or linked to the images in the original app  
in any meaningful way.)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] How do people use and contribute to this list?

2008-10-20 Thread Benjamin Stiglitz
 Can anyone offer any advice or suggestions? Or should I settle for the
 cumbersome digest mode?

I’ve found that a combination of procmail rules on my IMAP box and Mutt
compiled with the ignore-thread patch [1] work quite well for me. I
haven’t found a MUA which beats Mutt for reading mailing lists (and
indeed that’s all I usually use it for).

-Ben

[1]: http://ben.at.tanjero.com/patches/ignore-thread-1.5.18.patch
 There are some bugs in the updated version of this patch, but it
 works well enough for my intended uses.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Pointing in the right direction for an XCode 3 pref pane.

2008-10-20 Thread Adam Penny


On Oct20, 2008, at 10:55 AM, Adam Penny wrote:


Hi again,

Sorry, in my naivité I had expected the drag and drop to do more,  
but having just created a new NSObject in IB and pointed at the  
wopolpref class I now discover that it dragging and dropping has  
done the trick.


Thank you very much!

Adam
On Oct20, 2008, at 1:59 AM, Nick Zitzmann wrote:



On Oct 19, 2008, at 9:33 AM, Adam Penny wrote:

Having constructed a preference subclass with the appropiate  
outlets corresponding to those I've placed in the nib file, I'm  
getting an NSObject and setting it's class to the preference pane  
subclass with my outlets in it, but this seems to be giving me an  
unexpected choice of outlets when I'm trying to connect them.  I  
was hoping to see the outlets broadcastIP, printers and servers.  
Instead I see _FirstKeyView, _InitialKeyView, _LastKeyView window  
and New Referencing Outlet. Am I supposed to use something other  
than an NSObject when it's a preference pane in order to make  
connections?



Have you tried manually loading the header into IB by dragging the  
file onto the nib window? IB is supposed to automatically loads  
headers, but sometimes it doesn't.


Nick Zitzmann
http://www.chronosnet.com/




Hi again everyone,

Having made a bit of progress, I thought I'd go back and read the  
document at http://developer.apple.com/documentation/UserExperience/Conceptual/PreferencePanes/Tasks/Creation.html#/ 
/apple_ref/doc/uid/2709 carefully to make sure I'm dotting the i's  
and crossing the t's as far as structure and strategy is concerned.


Wrt the above document I have a few things that I'd be grateful if  
somebody could clarify for me?


The document mentions:
6)'In the Classes pane, select the NSPreferencePane class and create a  
subclass of it. Rename it to whatever you want. This is a global  
property within the preference application, so include a unique prefix  
in the name as described in “Preventing Name Conflicts.”'


So in this case the class should be called UkCoPennynetWopolController?

It went to say that you could have an extra header file with something  
like this in it to save a bit of  time:


#define SoundPref ComApplePreferenceSoundPref
#define AlertController ComApplePreferenceSoundAlertController
#define MicrophoneController ComApplePreferenceSoundMicrophoneController
so presumably I should write for the above.
#define WopolController UkCoPennynetWopolController
and then refer to it in my code just as WopolController. Just to  
check, but does that extra definitions header need any frameworks  
imported into it, or the #define statements only?
My final query is simply that I'm not sure what class to use for  
reading and writing the plist corresponding to my string and two dicts  
to and from /Library/Preferences/uk.co.pennynet.wopol.plist? I was  
going to use PropertyListSerialization, but scouting around I got the  
impression that this is a bit of a faux pas. Then I saw  
NSUserDefaults, which seems good, but not quite right either. So I'm a  
bit stuck on that bit.

Thank you again.
Adam




___

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

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

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

This email sent to [EMAIL PROTECTED]


[MEET] LA CocoaHeads Thursday 10/23 7:30pm

2008-10-20 Thread Rob Ross

Hey LA CocoaHeads.

Next week we continue our study group meeting for the Aaron Hillegass  
book Cocoa Programming for Mac OS X, 3rd Edition.


http://search.barnesandnoble.com/Cocoa-Programming-for-Mac-OS-X/Aaron-Hillegass/e/9780321503619/?itm=1

We'll be covering chapters 10-12. Please jot down any question you  
come up with during your reading.


We meet at the offices of E! Entertainment at 7:30pm.

Our meeting location is

5750 Wilshire Blvd
Los Angeles, CA 90036.

Here's a google map of the location:

http://www.google.com/maps?f=qhl=enq=5750+Wilshire+Blvd,+Los+Angeles+CA+90036ie=UTF8z=15om=1iwloc=addr

Free street parking is available. I'd suggest trying Masselin Ave,  
which is one block East of Courtyard Place.


We meet near the lobby of the West building at 5750 Wilshire Blvd, on  
the West side of Courtyard Place. There are picknick tables in front  
of the lobby and we'll gather there starting at 7:20pm. From there we  
go inside and up to conference room 3A at around 7:45pm .


If you arrive late, please ask the building security personnel in the  
lobby to direct you to the E! Security office, and they will be able  
to contact the group in conference room 3A and send someone down to  
meet you.


Rob Ross, Lead Software Engineer
E! Networks

---
Beware of he who would deny you access to information, for in his  
heart he dreams himself your master. -- Commissioner Pravin Lal




___

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

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

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

This email sent to [EMAIL PROTECTED]


Question about tackling a project

2008-10-20 Thread Dustin Dembrosky
I'm working on a application in Xcode and I'm trying to figure out how  
to start.  All I need to get working is to make a grid, the size 6x6.   
The size of the grid would look like a chess board.  Next I need to  
get a image or a sprite, to fit within one of the cells and just be  
able to jump from cell to cell.


I need to set it up in a way that later on, information could be  
placed in the cells and retrieved by navigating the sprite over to a  
cell, but that can be done later by me.


Does the board need to be made as a .png?

Many Thanks,

Dustin Dembrosky
Email: [EMAIL PROTECTED]
Twitter: DasutinD



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about tackling a project

2008-10-20 Thread Michael Paluszek

Look at this sample code

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

Sincerely,

Mike

On Oct 20, 2008, at 11:49 AM, Dustin Dembrosky wrote:

I'm working on a application in Xcode and I'm trying to figure out  
how to start.  All I need to get working is to make a grid, the size  
6x6.  The size of the grid would look like a chess board.  Next I  
need to get a image or a sprite, to fit within one of the cells and  
just be able to jump from cell to cell.


I need to set it up in a way that later on, information could be  
placed in the cells and retrieved by navigating the sprite over to a  
cell, but that can be done later by me.


Does the board need to be made as a .png?

Many Thanks,

Dustin Dembrosky
Email: [EMAIL PROTECTED]
Twitter: DasutinD



___

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

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

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

This email sent to [EMAIL PROTECTED]


--
Michael Paluszek
Princeton Satellite Systems
33 Witherspoon Street
Princeton, NJ 08542-3207
Phone (609) 279-9606
Fax (609) 279-9607
[EMAIL PROTECTED]
www.psatellite.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 [EMAIL PROTECTED]


[[Moderator] How do people use and contribute to the list

2008-10-20 Thread Scott Anguish

I think that the original poster probably has their answer now.

You can't effectively follow (let a lone contribute) simply using the  
digest version of the list.


Once you subscribe to the individual mails there are many ways of  
sorting them.


- mail.app
- procmail
- gmail and labeling
- a combination there of.

neither digest mode nor RSS are valuable modes of taking part (as  
opposed to simply following along)


thanks for everyone's participation

scott
[moderator]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How can I launch Preview.app from my application for collection of images

2008-10-20 Thread Fritz Anderson

On 20 Oct 2008, at 11:21 AM, Randall Meadows wrote:


Tangential to the OP, but might be worth the electrons:

Preview can display the contents of the clipboard (when it contains  
image data) by using File - New From Clipboard (cmd-N).  (The OP  
might be able to managed this via scripting, but the new files in  
Preview won't be related or linked to the images in the original app  
in any meaningful way.)


I looked for a scripting solution, but Script Editor says Preview is  
not scriptable, which is a bit odd.


— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.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 [EMAIL PROTECTED]


Re: Custom button cells for NSMatrix

2008-10-20 Thread Benjamin Dobson

Highlighting each cell in a matrix will let you change the image for it.

On 20 Oct 2008, at 12:19:04, norio wrote:


Hi,

I'm trying to make a custom cell object for NSMatrix which behaves  
like radio button, this is, when you press the second cell, the  
second cell is highlighting still.


Would you tell me which method I need to override?

Thank you.

Norio


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Superscript attribute with CATextLayer

2008-10-20 Thread Stephan Michels
2008/10/20 Scott Anguish [EMAIL PROTECTED]:
 what is the result?  do you have an image you can link to?

The result is that superscript attribute seems to be completely ignored.

I made a simple test project with a TextView (top), a CATextLayer(middle)
and with drawAtPoint:(bottom)

Screenshot:
http://rapidshare.com/files/155887033/TestView.png.html

Code:
http://rapidshare.com/files/155887694/AttributedStringTest.zip.html

I noticed that also other attributes are ignored like background color.

Stephan Michels.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Screen not redrawing - SOLVED

2008-10-20 Thread Russ

Got it! Windows were getting inadvertently and indirectly created with 
NSBackingStoreRetained. Hadn't caught it because used backingLocation instead 
of backingType and got wished-for answer(2) from wrong call.  Presto all is 
cheerier and I plough ahead.



- Original Message 
From: Russ [EMAIL PROTECTED]
To: cocoa-dev@lists.apple.com
Sent: Monday, October 20, 2008 1:30:57 PM
Subject: Re: Screen not redrawing


Still having trouble getting my screen redraw to come to life. Very odd---

1) The window title bar isn't getting redrawn right either when a different 
app's menu steps on it.
2) If I use the normal NSView instead of my subclassed version, still doesn't 
work. 
3) If I replace my subclassed drawRect with a simple fill-rectangle routine 
(using bounds) that increments the color each time it is drawn, then I see that 
a) my drawRect isn't the problem, and b) when I resize the window, I'm getting 
plenty of redraws in the portion being expanded with the new color, but the 
rest of the window interior is not changing.
4) Switched to compile/run 32-bit instead of 64-bit, no change.

Is a delegate for NSApp required? Haven't set one up yet. There must be some 
requirement that is tripping me up.


Answers to earlier postings:

 Check to make sure [window isFlushWindowDisabled] is NO and [window  
 isAutodisplay] is YES.

Yes

 Also, try dropping a standard control (e.g. a button) in and see if it  
 redraws to the pressed state when you press it.

No, stone cold dead. Some issues I'd seen initially on that were minor 
support-code glitches due to as-yet-unimplemented functionality. 

Try [NSWindow flushWindow]

No effect



 This is another common symptom of using 'rect' as the view's bounds.  Are you 
 *sure* 100% positively that you are ignoring this?

Yes, never makes it out of the drawRect routine --- which is just a call to the 
drawing routine which does the whole view. The rect looks to be the full view 
most of the time anyway.

  What is your window backing store type ? (What does [myWindow backingType] 
 return).

Buffered


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___

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

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

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

This email sent to [EMAIL PROTECTED]


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___

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

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

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

This email sent to [EMAIL PROTECTED]


How to draw a Recessed Button Shadow

2008-10-20 Thread Dalzhim Dalzhim
Hello,

I am currently trying to subclass NSPopUpButton while keeping compatibility
with Mac OS 10.4 in order to add the possibility of choosing the color of
the highlight when the mouse is placed over the button, including gradient
fills.  The problem is that neither NSPopUpButton or NSPopUpButtonCell seem
to provide public methods to draw the border of the button or the image with
the arrows.  Only the title of the button can be drawed using a public
method while handling the rest of the drawing in a subclass.

Because of this, I have tried reproducing the border myself and I cannot
seem to find a way to do it properly.  I have tried many solutions by
stroking different colors with various types of shadows and I still am not
satisfied with the result.

Does any of you have an idea of how to easily reproduce this kind of control
with the added functionality I am looking for?  Am I on the right path?


regards



-Dalzhim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Return and Enter don't behave in Text Field (Newb)

2008-10-20 Thread John Velman
This must have a simple answer, but I can't find it.

I have several text fields in in a window.  I've set the nextKeyView as I
like it, and tabbing works.  But pressing enter or return highlights the
whole cell as selected, rather than ending editing of that cell as I
believe it should.

I used caveman debugging in the following way: 

I made files owner the delegate for the text field in one of the boxes.  In
Files Owner, I put in the delegate 

- (BOOL)control:(NSControl *)control 
textView:(NSTextView *)aTextView 
doCommandBySelector:(SEL)aSelector

Here I test for which selector (either return or enter gives
insertNewline:).   I also test aTextView with isFieldEditor, which
returns 1 (YES);

Now the documentation says of isFieldEditor:

quote
Return Value YES if the text views sharing the receiver’s layout manager
behave as field editors, NO otherwise.

Discussion Field editors interpret Tab, Shift-Tab, and Return (Enter) as
cues to end editing and possibly to change the first responder. Non-field
editors instead accept these characters as text input. See Text Fields,
Text Views, and the Field Editor for more information on field editors. By
default, text views don’t behave as field editors.

/quote

So where can I look to find out why my field editor is not behaving as a
field editor?

Thanks,

John Velman

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Return and Enter don't behave in Text Field (Newb)

2008-10-20 Thread Aki Inoue

John,

End editing doesn't necessarily mean losing focus in terms of  
behavior visually users can see.
In this case, NSTextField does end editing, but calls -selectAll:  
immediately afterwards to keep the focus.


Discussion Field editors interpret Tab, Shift-Tab, and Return  
(Enter) as

cues to end editing and possibly to change the first responder.


Notice possibly in the sentence.  Return (Enter) does not change the  
first responder.


Aki

On 2008/10/20, at 11:49, John Velman wrote:


This must have a simple answer, but I can't find it.

I have several text fields in in a window.  I've set the nextKeyView  
as I
like it, and tabbing works.  But pressing enter or return highlights  
the

whole cell as selected, rather than ending editing of that cell as I
believe it should.

I used caveman debugging in the following way:

I made files owner the delegate for the text field in one of the  
boxes.  In

Files Owner, I put in the delegate

- (BOOL)control:(NSControl *)control
   textView:(NSTextView *)aTextView
   doCommandBySelector:(SEL)aSelector

Here I test for which selector (either return or enter gives
insertNewline:).   I also test aTextView with isFieldEditor,  
which

returns 1 (YES);

Now the documentation says of isFieldEditor:

quote
Return Value YES if the text views sharing the receiver’s  
layout manager

behave as field editors, NO otherwise.

Discussion Field editors interpret Tab, Shift-Tab, and Return  
(Enter) as
cues to end editing and possibly to change the first responder. Non- 
field
editors instead accept these characters as text input. See Text  
Fields,
Text Views, and the Field Editor for more information on field  
editors. By

default, text views don’t behave as field editors.

/quote

So where can I look to find out why my field editor is not behaving  
as a

field editor?

Thanks,

John Velman

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Launchd timeout messages

2008-10-20 Thread Tom Fortmann
I need help debugging a problem with a long running daemon running under
launchd.  The daemon is being repeatedly killed and restarted.  The daemon
follows all of the rules for running under launchd.  It is starting
successfully, but then receives a SIGTERM signal after a few seconds
(assumedly from launchd).  At the same time I am also seeing
com.xcapesolutions.mydaemon[3231]: timeout errors in /var/log/system.log
(again assumedly from launchd).

 

The following is my current plist file:

 

?xml version=1.0 encoding=UTF-8?

!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd;

plist version=1.0

dict

   keyLabel/key

   stringcom.xcapesolutions.mydaemon/string

   keyDisabled/key

   false/

   keyProgramArguments/key

   array

  stringmydaemon/string

  string-d/string

   /array

   keyOnDemand/key

   true/

   keyRunAtLoad/key

   true/

   keyKeepAlive/key

   dict

  keySuccessfulExit/key

  false/

   /dict

   keyServiceIPC/key

   false/

/dict

/plist

 

I've tried it without the ServiceIPC key.  I also tried changing ServiceIPC
to true and adding the launchd checkin (as found in SampleD) but that fails
with permission denied errors.  Which I found some references too, but no
answers that fit my situation.

 

My next step is to dig in to the launchd source code, but before I take that
on I figured I would check if anyone else can help.

 

FYI - I know this is a little off the Cocoa topic, but I didn't see a more
appropriate developer list.  If one exist please forgive the intrusion and
point me in the right direction.

 

Tom Fortmann

Xcape Solutions

 

 

 

 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Launchd timeout messages

2008-10-20 Thread Jason Coco


On Oct 20, 2008, at 15:52 , Tom Fortmann wrote:

I need help debugging a problem with a long running daemon running  
under
launchd.  The daemon is being repeatedly killed and restarted.  The  
daemon

follows all of the rules for running under launchd.  It is starting
successfully, but then receives a SIGTERM signal after a few seconds
(assumedly from launchd).  At the same time I am also seeing
com.xcapesolutions.mydaemon[3231]: timeout errors in /var/log/ 
system.log

(again assumedly from launchd).


Try getting rid of the OnDemand flag since you're already using  
KeepAlive.


Your daemon isn't generating those timeout errors itself?

FYI - I know this is a little off the Cocoa topic, but I didn't see  
a more
appropriate developer list.  If one exist please forgive the  
intrusion and

point me in the right direction.


I usually post my launchd questions to the Darwin-dev list... the  
developer
of launchd at apple is pretty active on that list and helps out quite  
a bit.

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 [EMAIL PROTECTED]

RE: Launchd timeout messages

2008-10-20 Thread Tom Fortmann
Jason,

Thanks.  I will try removing the OnDemand key.  If that doesn't work I will
report on Darwin-dev list.

Thanks again,
Tom

-Original Message-
From: Jason Coco [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 20, 2008 3:14 PM
To: Tom Fortmann
Cc: cocoa-dev@lists.apple.com
Subject: Re: Launchd timeout messages


On Oct 20, 2008, at 15:52 , Tom Fortmann wrote:

 I need help debugging a problem with a long running daemon running  
 under
 launchd.  The daemon is being repeatedly killed and restarted.  The  
 daemon
 follows all of the rules for running under launchd.  It is starting
 successfully, but then receives a SIGTERM signal after a few seconds
 (assumedly from launchd).  At the same time I am also seeing
 com.xcapesolutions.mydaemon[3231]: timeout errors in /var/log/ 
 system.log
 (again assumedly from launchd).

Try getting rid of the OnDemand flag since you're already using  
KeepAlive.

Your daemon isn't generating those timeout errors itself?

 FYI - I know this is a little off the Cocoa topic, but I didn't see  
 a more
 appropriate developer list.  If one exist please forgive the  
 intrusion and
 point me in the right direction.

I usually post my launchd questions to the Darwin-dev list... the  
developer
of launchd at apple is pretty active on that list and helps out quite  
a bit.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Custom button cells for NSMatrix

2008-10-20 Thread Ricky Sharp


On Oct 20, 2008, at 6:23 AM, Ricky Sharp wrote:

This is actually quite difficult. I can send you details later  
today. In my case, I needed accessibility and mimic the Aqua radio  
buttons in terms of all their behaviors.


I ended up subclassing NSMatrix and NSActionCell. I could not get a  
subclass of NSButtonCell in an NSMatrix to work completely.



I originally attempted to create a custom radio button control around  
Nov 2004.  You can search the archives for a thread back then titled  
Tracking behavior of cells in NSMatrix.


There seemed to be some special code going on between NSMatrix and  
NSButtonCell that I could not duplicate.  There are probably many  
private methods at work.


Anyhow, my final solution was to do this:

subclass NSMatrix (this will be your radio button group)

In that subclass, I implemented mouseDown: to do the following:

- call convertPoint:fromView: to get the view's point that was clicked
- call getRow:column:forPoint: to see if point clicked any cells
- if it did, call cellAtRow:column: to get the cell instance.

Then it got tricky...

if the matrix didn't yet have a keyCell, I set the key cell to the one  
just clicked


I then fell into a local tracking loop by sending  
trackMouse:inRect:ofView:untilMouseUp: to the cell.


If the mouse was released inside the bounds of the cell being tracked...
- set the state of the original cell to NSOffsate and set the state of  
the tracked cell to NSOnState.


else...
- set the key cell to the original key cell before tracking was started.


Then, in a subclass of NSActionCell, I implemented:

trackMouse:inRect:ofView:untilMouseUp:

I maintained a flag in that class so I could query if the mouse was  
released in its bounds or not (used by the matrix's mouseDown: code  
above).


The subclass of NSActionCell of course handled all custom drawing too  
depending on state.



This implementation (plus more code not shown) gave me:

- custom drawing
- exact Aqua behaviors when dealing with mouse or full keyboard access
- bindings integration (e.g. selectedRadioTag)
- accessibility hooks

___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.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 [EMAIL PROTECTED]


Re: Launchd timeout messages

2008-10-20 Thread Shawn Erickson
On Mon, Oct 20, 2008 at 1:23 PM, Tom Fortmann
[EMAIL PROTECTED] wrote:
 Jason,

 Thanks.  I will try removing the OnDemand key.  If that doesn't work I will
 report on Darwin-dev list.

A list exists for launchd as well... launchd-dev

http://lists.macosforge.org/mailman/listinfo/launchd-dev

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Return and Enter don't behave in Text Field (Newb)

2008-10-20 Thread John Velman
Thanks, Aki, this helps clear some things up.  However, two questions:

1)  What does possibly depend on?  Surely its not random :-)  

2)  So, I gather that I should be able to get the behaviour I want by
putting in my delegate something like

   [[aTextView window] selectNextKeyView:[aTextView nextResponder]];

I tried this and it doesn't work.  Could be I'm sending the message to the
wrong object?

Thanks,

John Velman

On Mon, Oct 20, 2008 at 12:29:00PM -0700, Aki Inoue wrote:
 John,

 End editing doesn't necessarily mean losing focus in terms of behavior 
 visually users can see.
 In this case, NSTextField does end editing, but calls -selectAll: 
 immediately afterwards to keep the focus.

 Discussion Field editors interpret Tab, Shift-Tab, and Return (Enter) as
 cues to end editing and possibly to change the first responder.

 Notice possibly in the sentence.  Return (Enter) does not change the 
 first responder.

 Aki

 On 2008/10/20, at 11:49, John Velman wrote:

 This must have a simple answer, but I can't find it.

 I have several text fields in in a window.  I've set the nextKeyView as I
 like it, and tabbing works.  But pressing enter or return highlights the
 whole cell as selected, rather than ending editing of that cell as I
 believe it should.

 I used caveman debugging in the following way:

 I made files owner the delegate for the text field in one of the boxes.  
 In
 Files Owner, I put in the delegate

 - (BOOL)control:(NSControl *)control
textView:(NSTextView *)aTextView
doCommandBySelector:(SEL)aSelector

 Here I test for which selector (either return or enter gives
 insertNewline:).   I also test aTextView with isFieldEditor, which
 returns 1 (YES);

 Now the documentation says of isFieldEditor:

 quote
 Return Value YES if the text views sharing the receiver’s layout manager
 behave as field editors, NO otherwise.

 Discussion Field editors interpret Tab, Shift-Tab, and Return (Enter) as
 cues to end editing and possibly to change the first responder. Non-field
 editors instead accept these characters as text input. See Text Fields,
 Text Views, and the Field Editor for more information on field editors. By
 default, text views don’t behave as field editors.

 /quote

 So where can I look to find out why my field editor is not behaving as a
 field editor?

 Thanks,

 John Velman

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Properly supporting 'delete' key presses in NSTableView

2008-10-20 Thread Sean McBride
Hi all,

In 10.5, NSTableView handles many keypresses automatically: up arrow,
down arrow, page up, page down, home, end, and even 'type select'.

I also need to (robustly!) support the 'delete' key.

Overriding deleteBackward: (from NSResponder) doesn't seem to work.  For
some reason, it is never called.

What is the most correct way to support this?  I need the keypresses
that NSTableView already supports to continue working, and I need to
support custom key bindings (meaning the delete functionality may not be
mapped to the delete key).

My current best is the following, but I don't think it will support
custom keybindings.

- (void)keyDown:(NSEvent*)event
{
BOOL deleteKeyEvent = NO;

if ([event type] == NSKeyDown)
{
NSString* pressedChars = [event characters];
if ([pressedChars length] == 1)
{
unichar pressedUnichar =
[pressedChars characterAtIndex:0];

if ( (pressedUnichar == NSDeleteCharacter) ||
(pressedUnichar == 0xf728) )
{
deleteKeyEvent = YES;
}
}
}

// If it was a delete key, handle the event specially, otherwise call 
super.
if (deleteKeyEvent)
{
// This will end up calling deleteBackward: or deleteForward:.
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
else
{
[super keyDown:event];
}
}

Thanks for any suggestions,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Properly supporting 'delete' key presses in NSTableView

2008-10-20 Thread Corbin Dunn


On Oct 20, 2008, at 2:07 PM, Sean McBride wrote:


Hi all,

In 10.5, NSTableView handles many keypresses automatically: up arrow,
down arrow, page up, page down, home, end, and even 'type select'.

I also need to (robustly!) support the 'delete' key.

Overriding deleteBackward: (from NSResponder) doesn't seem to work.   
For

some reason, it is never called.


For various reasons, NSTableView doesn't implement - 
interpretKeyEvents:, that's why it isn't called.






What is the most correct way to support this?  I need the keypresses
that NSTableView already supports to continue working, and I need to
support custom key bindings (meaning the delete functionality may  
not be

mapped to the delete key).

My current best is the following, but I don't think it will support
custom keybindings.

- (void)keyDown:(NSEvent*)event
{
BOOL deleteKeyEvent = NO;

if ([event type] == NSKeyDown)
{
NSString* pressedChars = [event characters];
if ([pressedChars length] == 1)
{
unichar pressedUnichar =
   [pressedChars characterAtIndex:0];

if ( (pressedUnichar == NSDeleteCharacter) ||
   (pressedUnichar == 0xf728) )
{
deleteKeyEvent = YES;
}
}
}

	// If it was a delete key, handle the event specially, otherwise  
call super.

if (deleteKeyEvent)
{
// This will end up calling deleteBackward: or deleteForward:.
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
else
{
[super keyDown:event];
}
}


This will work well, and is the only good way to implement it.  
Ideally, you would only want to do this if there isn't an active type  
select going on, but there is no API to tell if that is happening or  
not. (As usual, feel free to log requests for that). Theoretically,  
backspacing while type selecting could undo the last character; in  
practice, that is a dangerous thing to do, since you might  
accidentally delete something you didn't intend to.


corbin


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Properly supporting 'delete' key presses in NSTableView

2008-10-20 Thread Sean McBride
On 10/20/08 2:27 PM, Corbin Dunn said:

 Overriding deleteBackward: (from NSResponder) doesn't seem to work.
 For
 some reason, it is never called.

For various reasons, NSTableView doesn't implement -
interpretKeyEvents:, that's why it isn't called.

Thanks for your reply Corbin!

I assume NSOutlineView is the same?

This will work well, and is the only good way to implement it.
Ideally, you would only want to do this if there isn't an active type
select going on, but there is no API to tell if that is happening or
not. (As usual, feel free to log requests for that). Theoretically,
backspacing while type selecting could undo the last character; in
practice, that is a dangerous thing to do, since you might
accidentally delete something you didn't intend to.

A few quickie followups, if I may:

- so will this actually work with custom keybindings?  Or is there just
no good way to support that?
- did I miss a constant for the backward delete char (an analogue to
NSDeleteCharacter)?  I'm using 0xf728, discovered via gdb. :(

Cheers,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Properly supporting 'delete' key presses in NSTableView

2008-10-20 Thread Dalzhim Dalzhim
This following episode of Late Night Cocoa gives a solution to this precise
problem of implementing the delete functionality on TableViews and
OutlineViews without having to subclass it.

http://www.mac-developer-network.com/podcasts/latenightcocoa/episode9/index.html

Hope it helps :)


-Dalzhim


2008/10/20 Sean McBride [EMAIL PROTECTED]

 On 10/20/08 2:27 PM, Corbin Dunn said:

  Overriding deleteBackward: (from NSResponder) doesn't seem to work.
  For
  some reason, it is never called.
 
 For various reasons, NSTableView doesn't implement -
 interpretKeyEvents:, that's why it isn't called.

 Thanks for your reply Corbin!

 I assume NSOutlineView is the same?

 This will work well, and is the only good way to implement it.
 Ideally, you would only want to do this if there isn't an active type
 select going on, but there is no API to tell if that is happening or
 not. (As usual, feel free to log requests for that). Theoretically,
 backspacing while type selecting could undo the last character; in
 practice, that is a dangerous thing to do, since you might
 accidentally delete something you didn't intend to.

 A few quickie followups, if I may:

 - so will this actually work with custom keybindings?  Or is there just
 no good way to support that?
 - did I miss a constant for the backward delete char (an analogue to
 NSDeleteCharacter)?  I'm using 0xf728, discovered via gdb. :(

 Cheers,

 --
 
 Sean McBride, B. Eng [EMAIL PROTECTED]
 Rogue Researchwww.rogue-research.com
 Mac Software Developer  Montréal, Québec, Canada


 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/dalzhim.mlist%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Screen not redrawing

2008-10-20 Thread Graham Cox


On 21 Oct 2008, at 4:30 am, Russ wrote:



Still having trouble getting my screen redraw to come to life. Very  
odd---


1) The window title bar isn't getting redrawn right either when a  
different app's menu steps on it.
2) If I use the normal NSView instead of my subclassed version,  
still doesn't work.
3) If I replace my subclassed drawRect with a simple fill-rectangle  
routine (using bounds) that increments the color each time it is  
drawn, then I see that a) my drawRect isn't the problem, and b) when  
I resize the window, I'm getting plenty of redraws in the portion  
being expanded with the new color, but the rest of the window  
interior is not changing.

4) Switched to compile/run 32-bit instead of 64-bit, no change.

Is a delegate for NSApp required? Haven't set one up yet. There must  
be some requirement that is tripping me up.



An NSApp delegate isn't required. I can't see how it would have any  
bearing on drawing anyway.


You mentioned that this is a Carbon or cross-platform port. Could  
there be some Carbon drawing calls that could be messing things up?  
For example manipulating the window's update and clip regions? They  
still exist... You'll want to make sure that in porting the code to  
Cocoa you eliminate anything that has to do with window/drawing  
management in the old code and only do Cocoa-based drawing.


I know you think the code is sensitive or difficult to post but  
without seeing at least the gist of it I don't think you'll be able to  
get much more help.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread Michael Ash
On Mon, Oct 20, 2008 at 10:40 AM,  [EMAIL PROTECTED] wrote:

 Michael Ash wrote on 20/10/2008 15:31:01:
 And don't forget step 0:

 0) Don't even bother

 A lot of people optimize code that's already plenty fast. A lot of
 people optimize code that *hasn't even been written yet*. This is
 foolish. Write your code to be easy to understand and as bug-free as
 you can get it. And then, only if it's not running as fast as you need
 it to, should you even start to consider the possibility of thinking
 about beginning to investigate optimizing the code.

 I think that's only frequently, not usually or always, the approach to take.
 For instance if you have a specific performance requirement, and when you
 prototype the proposed solution you find the performance to be way off the
 requirement, it's best to go back to the boxes on the paper. Even
 Instruments is unlikely to help you get your slow design orders of magnitude
 faster, nor your bloated design orders of magnitude more svelt.

 I've been involved on a project like that in a previous job, where we had a
 requirement to process thousands of things/sec and our existing solution was
 capable of tens/sec. Rather than see what we could eke out of our solution,
 we went back to the whiteboard and optimised the design. In that case, this
 was not a foolish thing to do.

Definitely usually. The vast majority of code simply isn't performance
critical. When looking at either LOC or time spent, most of it doesn't
need to worry about performance at all. Furthermore, this sort of
optimization usually refers to code-level micro optimizations, not
big design decisions, particularly in the context of this thread.

I'm not against optimization. Far from it, in fact: you get the best
results by concentrating your effort where it does the most good. And
than means ignoring speed in most of your code.

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 [EMAIL PROTECTED]


Re: Mutable arrays

2008-10-20 Thread Michael Ash
On Mon, Oct 20, 2008 at 11:45 AM, I. Savant [EMAIL PROTECTED] wrote:
 On Mon, Oct 20, 2008 at 11:37 AM, Roland King [EMAIL PROTECTED] wrote:

 I'm not sure I totally agree with step 0. I think there is value in
 understanding how your code is going to run, or is going to run most times,
 and picking constructs which are clearly efficient if it's really not more
 work to do so and it represents the data you're working with.

  Agreed. The laptops! Won't somebody PLEASE think of the LAPTOPS!

  Sure, our desktops are fast and the difference in 'extra work saved'
 is usually imperceptible, but my laptop thanks you for your judicious
 use of reasonably-optimized code. Mobile users need you to not waste
 their battery power on pointless code execution.

Doesn't matter what you're running, because I don't advocate ignoring
speed. Rather, I advocate a plan of action which produces the fastest
code in the end. The simple fact is that most code is already fast
enough, and should not be optimized. The effort that would go into
optimizing it should instead be directed to the code where it can
actually make a difference. The end result is an app that's faster
than if you optimized everything.

In the case of -initWithCapacity:, it's a very little effort being
expended. But it's also a very little gain being realized. So it's
better to leave off that little bit of mental effort altogether so
that it might later be used in a place where it can do some more good.

(And lastly, even obvious optimizations like preallocating memory
can backfire. And you'll never know if it backfired unless you have
both before and after measurements. So putting in the time to optimize
code up front can give you a worse overall result even for that
particular piece of code, let alone the entire app.)

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 [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread Graham Cox


On 21 Oct 2008, at 2:21 am, DKJ wrote:


When I do this in the controller's awakeFromNib method:

[theView lockFocus];



Then don't do it!

stuff like -lockFocus comes into the category of advanced  
techniques. 99% of Cocoa programmers will never need it. Move along  
now, nothing to see here...


hth,

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 [EMAIL PROTECTED]


Re: GDB Problems

2008-10-20 Thread Bridger Maxwell
I finally fixed (I think) the problem. All it took was for me to delete
~/Library/PreferencePanes/. I have no idea why this worked, as I have not
ever done any preference pane programming. I only had one file in
there (PlugSuit.prefPane).
I did not have to delete /Library/PreferencePanes/. Go figure. Anyway, I
hope this might help someone else should they be plagued with the same
issue.
Thank You,
Bridger Maxwell
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Properly supporting 'delete' key presses in NSTableView

2008-10-20 Thread Corbin Dunn


On Oct 20, 2008, at 2:49 PM, Dalzhim Dalzhim wrote:

This following episode of Late Night Cocoa gives a solution to this  
precise problem of implementing the delete functionality on  
TableViews and OutlineViews without having to subclass it.


http://www.mac-developer-network.com/podcasts/latenightcocoa/episode9/index.html

Hope it helps :)


Can you elaborate on what the episode recommends? (Sorry, I don't have  
time to listen through the 40 mins).


I recommend subclassing; and, in many ways, that is a fine solution.

Sean:


I assume NSOutlineView is the same?


Yes, it is.




- so will this actually work with custom keybindings?  Or is there  
just

no good way to support that?


I don't think so, since it is hardcoding the key. You might get some  
mileage from calling -interpretKeyEvents: yourself, but it may have  
side effects.




- did I miss a constant for the backward delete char (an analogue to
NSDeleteCharacter)?  I'm using 0xf728, discovered via gdb. :(



NSDeleteFunctionKey

-corbin




Cheers,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dalzhim.mlist%40gmail.com

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Return and Enter don't behave in Text Field (Newb)

2008-10-20 Thread Aki Inoue


On 2008/10/20, at 13:46, John Velman wrote:


Thanks, Aki, this helps clear some things up.  However, two questions:

1)  What does possibly depend on?  Surely its not random :-)

Well, I admit possibly is probably too vague to be useful 8-).

The behavior is controlled by the NSTextMovement key in the  
NSTextDidEndEditing notification.
If it's either NSTabTextMovement or NSBackTabTextMovement AND there is  
a valid key view in the corresponding direction, the focus moves to  
the next/previous key view.  Otherwise, it just invokes -selectText:  
to self.



2)  So, I gather that I should be able to get the behaviour I want by
putting in my delegate something like

  [[aTextView window] selectNextKeyView:[aTextView nextResponder]];

I tried this and it doesn't work.  Could be I'm sending the message  
to the

wrong object?
You should be able to do it inside  
control:textView:doCommandBySelector:.
Need to return YES to indicate that the text field should not handle  
the key event.


Aki




Thanks,

John Velman

On Mon, Oct 20, 2008 at 12:29:00PM -0700, Aki Inoue wrote:

John,

End editing doesn't necessarily mean losing focus in terms of  
behavior

visually users can see.
In this case, NSTextField does end editing, but calls -selectAll:
immediately afterwards to keep the focus.

Discussion Field editors interpret Tab, Shift-Tab, and Return  
(Enter) as

cues to end editing and possibly to change the first responder.


Notice possibly in the sentence.  Return (Enter) does not change  
the

first responder.

Aki

On 2008/10/20, at 11:49, John Velman wrote:


This must have a simple answer, but I can't find it.

I have several text fields in in a window.  I've set the  
nextKeyView as I
like it, and tabbing works.  But pressing enter or return  
highlights the

whole cell as selected, rather than ending editing of that cell as I
believe it should.

I used caveman debugging in the following way:

I made files owner the delegate for the text field in one of the  
boxes.

In
Files Owner, I put in the delegate

- (BOOL)control:(NSControl *)control
  textView:(NSTextView *)aTextView
  doCommandBySelector:(SEL)aSelector

Here I test for which selector (either return or enter gives
insertNewline:).   I also test aTextView with isFieldEditor,  
which

returns 1 (YES);

Now the documentation says of isFieldEditor:

quote
Return Value YES if the text views sharing the receiver’s  
layout manager

behave as field editors, NO otherwise.

Discussion Field editors interpret Tab, Shift-Tab, and Return  
(Enter) as
cues to end editing and possibly to change the first responder.  
Non-field
editors instead accept these characters as text input. See Text  
Fields,
Text Views, and the Field Editor for more information on field  
editors. By

default, text views don’t behave as field editors.

/quote

So where can I look to find out why my field editor is not  
behaving as a

field editor?

Thanks,

John Velman

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread DKJ

On 20 Oct, 2008, at 09:15, Nick Zitzmann wrote:
you do all your drawing in -drawRect:, and call -setNeedsDisplay:   
friends when you need to refresh part of the view.


Is this a good way of going about it? I subclassed NSView and defined  
the properties border_colour, fill_colour, and pic. These are  
initialised to nil. I then implemented drawRect: like this:



- (void)drawRect:(NSRect)rect {

if( border_colour )
{
[border_colour set];
[NSBezierPath strokeRect:[self bounds]];
}

if( fill_colour )
{
[fill_colour set];
[NSBezierPath fillRect:[self bounds]];
}

if( pic )
[pic drawInRect:[self bounds]
   fromRect:NSZeroRect
  operation:NSCompositeSourceOver
   fraction:1.0];
}

Now the controller can change the content of the view by assigning  
values to the properties.


But it still seems an awful lot has to be decided about the content of  
the view when the subclassing is done. Or am I missing something  
simple here?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread Graham Cox


On 21 Oct 2008, at 10:26 am, DKJ wrote:

Is this a good way of going about it? I subclassed NSView and  
defined the properties border_colour, fill_colour, and pic. These  
are initialised to nil. I then implemented drawRect: like this:



- (void)drawRect:(NSRect)rect {

if( border_colour )
{
[border_colour set];
[NSBezierPath strokeRect:[self bounds]];
}

if( fill_colour )
{
[fill_colour set];
[NSBezierPath fillRect:[self bounds]];
}

if( pic )
[pic drawInRect:[self bounds]
   fromRect:NSZeroRect
  operation:NSCompositeSourceOver
   fraction:1.0];
}

Now the controller can change the content of the view by assigning  
values to the properties.



Looks fine.


But it still seems an awful lot has to be decided about the content  
of the view when the subclassing is done. Or am I missing something  
simple here?



No, you're not missing anything. An empty NSView draws nothing at all,  
so of course you have to supply all of the content in your subclass.  
What would you expect it to do?


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: (Solved!) Return and Enter don't behave in Text Field (Newb)

2008-10-20 Thread John Velman
Thanks, Aki, for the explanation of the possibly.

I finally got the messages and receivers right to do it inside
control:textView:doCommandBySelector:.  I had some confusion between the
control, the text field, the window, but I think I understand now. Anyway,
it seems to be working!

Thanks for your help and patience.

John Velman

On Mon, Oct 20, 2008 at 04:09:20PM -0700, Aki Inoue wrote:

 On 2008/10/20, at 13:46, John Velman wrote:

 Thanks, Aki, this helps clear some things up.  However, two questions:

 1)  What does possibly depend on?  Surely its not random :-)
 Well, I admit possibly is probably too vague to be useful 8-).

 The behavior is controlled by the NSTextMovement key in the 
 NSTextDidEndEditing notification.
 If it's either NSTabTextMovement or NSBackTabTextMovement AND there is a 
 valid key view in the corresponding direction, the focus moves to the 
 next/previous key view.  Otherwise, it just invokes -selectText: to self.

 2)  So, I gather that I should be able to get the behaviour I want by
 putting in my delegate something like

   [[aTextView window] selectNextKeyView:[aTextView nextResponder]];

 I tried this and it doesn't work.  Could be I'm sending the message to the
 wrong object?
 You should be able to do it inside control:textView:doCommandBySelector:.
 Need to return YES to indicate that the text field should not handle the 
 key event.

 Aki



 Thanks,

 John Velman

 On Mon, Oct 20, 2008 at 12:29:00PM -0700, Aki Inoue wrote:
 John,

 End editing doesn't necessarily mean losing focus in terms of behavior
 visually users can see.
 In this case, NSTextField does end editing, but calls -selectAll:
 immediately afterwards to keep the focus.

 Discussion Field editors interpret Tab, Shift-Tab, and Return (Enter) as
 cues to end editing and possibly to change the first responder.

 Notice possibly in the sentence.  Return (Enter) does not change the
 first responder.

 Aki

 On 2008/10/20, at 11:49, John Velman wrote:

 This must have a simple answer, but I can't find it.

 I have several text fields in in a window.  I've set the nextKeyView as 
 I
 like it, and tabbing works.  But pressing enter or return highlights the
 whole cell as selected, rather than ending editing of that cell as I
 believe it should.

 I used caveman debugging in the following way:

 I made files owner the delegate for the text field in one of the boxes.
 In
 Files Owner, I put in the delegate

 - (BOOL)control:(NSControl *)control
   textView:(NSTextView *)aTextView
   doCommandBySelector:(SEL)aSelector

 Here I test for which selector (either return or enter gives
 insertNewline:).   I also test aTextView with isFieldEditor, which
 returns 1 (YES);

 Now the documentation says of isFieldEditor:

 quote
 Return Value YES if the text views sharing the receiver’s layout 
 manager
 behave as field editors, NO otherwise.

 Discussion Field editors interpret Tab, Shift-Tab, and Return (Enter) as
 cues to end editing and possibly to change the first responder. 
 Non-field
 editors instead accept these characters as text input. See Text Fields,
 Text Views, and the Field Editor for more information on field editors. 
 By
 default, text views don’t behave as field editors.

 /quote

 So where can I look to find out why my field editor is not behaving as a
 field editor?

 Thanks,

 John Velman

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread DKJ

On 20 Oct, 2008, at 16:32, Graham Cox wrote:

What would you expect it to do?



Suppose I wanted it to draw lines in response to user input. Would I  
put NSBezierPath methods in drawRect: and expose the relevant  
properties in the subclass? 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw a Recessed Button Shadow

2008-10-20 Thread Rob Keniger


On 21/10/2008, at 4:34 AM, Dalzhim Dalzhim wrote:

I am currently trying to subclass NSPopUpButton while keeping  
compatibility
with Mac OS 10.4 in order to add the possibility of choosing the  
color of
the highlight when the mouse is placed over the button, including  
gradient
fills.  The problem is that neither NSPopUpButton or  
NSPopUpButtonCell seem
to provide public methods to draw the border of the button or the  
image with

the arrows.  Only the title of the button can be drawed using a public
method while handling the rest of the drawing in a subclass.



NSPopupButtonCell is a subclass of NSMenuItemCell, which is itself a  
subclass of NSButtonCell. This means that it inherits all the methods  
of those classes. Have a look at:


- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
- (void)drawBorderAndBackgroundWithFrame:(NSRect)cellFrame inView: 
(NSView *)controlView


and friends.

--
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 [EMAIL PROTECTED]


@property and HeaderDoc

2008-10-20 Thread Jerry Krinock
The scripts menu in Xcode has some nice macros for generating  
HeaderDoc comments for classes, methods, etc.  Some of them need  
improvement, but I've gotten so that I use them every day.


But they don't know how to handle @property declarations.

As far as the programmer is concerned, even though they may be  
generated at run-time or whatever, an @property declaration states the  
existence of a getter and (unless readonly) a setter.  Correct?  So,  
would it make sense to have a menu script which would generate  
accessor method documentation from @property declarations?  When I  
design a non-trivial accessor, writing documentation helps me to make  
fewer mistakes.


Has anyone thought about making HeaderDoc support @property  
declarations?  Besides a new Xcode menu script to generate the  
HeaderDoc comment, I believe that the HeaderDoc generator tool would  
also need some code added to parse the declaration itself.


Jerry Krinock

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lockFocus error

2008-10-20 Thread Graham Cox


On 21 Oct 2008, at 10:48 am, DKJ wrote:


On 20 Oct, 2008, at 16:32, Graham Cox wrote:

What would you expect it to do?



Suppose I wanted it to draw lines in response to user input. Would I  
put NSBezierPath methods in drawRect: and expose the relevant  
properties in the subclass?



To draw lines, you can use NSBezierPath as a storage container in your  
view subclass. You need to:


1. Override -mouseDown: and -mouseDragged: to respond to the mouse
2. Accumulate lines in the NSBezierPath using its -lineToPoint: method  
for each new mouse point.
3. Mark the view for update using -setNeedsDisplay: or - 
setNeedsDisplayInRect:

4. Draw the path in -drawRect:

The NSBezierPath object would be owned by your view.

Depending on what you want, you could either clear the path using - 
removeAllPoints on the mouseDown, or maybe create a new path and add  
it to a list.


hth,

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 [EMAIL PROTECTED]


Using Core Animation to animate view properties?

2008-10-20 Thread Jim Correia
I have some view properties for which I'd like to use Core Animation  
to drive the animation.


In my old code, I used a subclass of NSAnimation which interpolated  
the target value and set the property on the view via KVO. This seems  
like a perfect use for CABasicAnimation and the animator proxy.


When using NSAnimation, if I needed to prematurely abort the  
animation, I could send -stopAnimation to my NSAnimation subclass. (I  
also had enough information at hand that it was trivial to fast  
forward the animated property to its target value if that was  
desirable.)


What mechanism do I have to

- know that a property animation is in progress
- abort it, if necessary
- fast forward it to the target value after abort, if desired

- 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 [EMAIL PROTECTED]


NSRulerView cusom hashMarks

2008-10-20 Thread josh hughes

Hi,

I need to alter the hashMarks of an NSRulerView so that the labels  
increment from 1 rather than the default: 0. As I understand it, this  
should be done by either subclassing NSRulerView and overriding  
drawHashMarkAndLabelsInRect: or using a delegate.


I must admit, I'm quite new to cocoa and don't have much experience  
with delegation so I decided to try subclassing instead.


The first problem I've run into in my subclass is that I can't access  
of the NSRulerView's instance variables as they are defined as  
private. I can however access details about measurementUnits by  
overriding NSRulerView's  
registerUnitWithName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle 
:


Should I be gathering this information in order to calculate my own  
hashMarks / labels etc.. or is there a much simpler way of doing things?


I would also be interested in understanding what the documentation  
means by using a delegate to create the custom markers?



Many thanx in advance.

Josh





___

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

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

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

This email sent to [EMAIL PROTECTED]


NSURL, NSURLRequest, and NSURLConnection

2008-10-20 Thread Robert Mullen
When sending a NSURLRequest to an secure website via NSURLConnection  
will the initial URL be encrypted or only the response? I have looked  
around at Apple's docs and am unclear.


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 [EMAIL PROTECTED]


Device Information from NSEvent?

2008-10-20 Thread Kevin Gessner
My application uses an event tap to capture keyboard events, and I'd  
like to know which device (i.e. which keyboard) each event comes from.  
Is there an sort of device-identifying information along with the  
CGEvent that a tap gets (or the related NSEvent)? I've looked at  
NSEvent's methods but none of them seem to be device-unique. Any help?


Thanks,
-- Kevin

Kevin Gessner
http://www.kevingessner.com
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Core Data saving / Leopard / The temporary directory at ...

2008-10-20 Thread Jonathan Freeman
Hello all,

I've got an odd saving issue that one of my beta users just found. I can 
replicate this on 10.5.5, and it's basically one cannot save a Core Data 
document with a specific series of events. I've done the google route and found 
a few other developers seeing this with no resolve. Any insight into this would 
be great and here's the following error in the logs:

The temporary directory at 
/private/var/folders/HA/HA4yqX+JH9mzFyLKrp721TI/TemporaryItems/(A Document 
Being Saved By anApp) could not be deleted.

This will save and Parent has to many relationship to Child, inverse. Child has 
relationship to Parent, inverse:
1. File New
2. Create Parent entity
3. File Save
3. Create Child entity
4. Create another Child entity
5. Create yet another Child entity
6. File Save
7. Delete a Child entity
8. File Save

This will NOT save:
1. File New
2. Create Parent entity
3. File Save
4. Create Child entity
5. Create another Child entity
6. Create yet another Child entity
7. Delete a Child entity
8. File Save (will not save, throws the error)

I've looked at the Managed Object Context with F-script and do not see any 
orphan relationships or entities. Everything appears to behave correctly.

Thanks so much for your time,
Jonathan Freeman



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURL, NSURLRequest, and NSURLConnection

2008-10-20 Thread Stephen J. Butler
On Mon, Oct 20, 2008 at 2:19 PM, Robert Mullen [EMAIL PROTECTED] wrote:
 When sending a NSURLRequest to an secure website via NSURLConnection will
 the initial URL be encrypted or only the response? I have looked around at
 Apple's docs and am unclear.

An HTTPS URL? Everything but the server name/port will be secure.
That's how the protocol works.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSRulerView cusom hashMarks

2008-10-20 Thread Graham Cox


On 21 Oct 2008, at 5:40 am, josh hughes wrote:


Hi,

I need to alter the hashMarks of an NSRulerView so that the labels  
increment from 1 rather than the default: 0. As I understand it,  
this should be done by either subclassing NSRulerView and overriding  
drawHashMarkAndLabelsInRect: or using a delegate.



Just call -setOriginOffset: with a suitable value to place the '1'  
mark where you want it. Of course you're really placing the '0' mark,  
but you can set it to some negative value as needed.


--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 [EMAIL PROTECTED]


Re: Custom CALayer Action as animation key?

2008-10-20 Thread Matt Long

Patrick,

I believe the only animatable properties are the ones explicitly  
labeled animatable in the documentation. That is why (I believe)  
there is a section labeled Animatable Properties in the Core  
Animation Programming guide. I think the reason is that you can't  
guarantee that your custom property is something that can be  
interpolated.


The only way that you can trigger an action for a custom key is to  
explicitly change the value for that key--which is why your call to  
[content setValue:[NSNumber numberWithInt:19] forKey:@test]; works.  
It is also why it worked when you specified bounds.size.width as this  
is an actual animatable property.


Hope that helps.

-Matt




On Oct 20, 2008, at 9:58 AM, Patrick Mau wrote:


Good afternoon,

I have implemented a layer-based view that acts as the layer  
delegate and defines a layer action named test.
Afterwards I create a CABasic animation to animate the test  
property. If you look at the line marked 'THIS WORKS,
you'll see that sending setValue:forKey triggers a message  
runActionForKey:object:arguments,
but using the property for a basic animation will not trigger the  
CAAction.


So here's my simple question. What is needed to animate a generic  
property named test?
Did I mis-read the documentation and wrongly assumed that any  
property can be used as

long as there's a CAAction?

By the way, changing the keyPath to something like  
bounds.size.width works as expected.


The small zip is at:

http://oscar.homelinux.net/layer.zip

Please don't mind the coding style.

Thanks a lot,
Patrick

--- Small excerpt ---

/* Debug invocation of CAAction */
- (void) runActionForKey:(NSString *)key object:(id)object arguments: 
(NSDictionary *)dict

{
   NSLog(@runActionForKey:\[EMAIL PROTECTED] object:%p arguments:%p, key,  
object, dict);

}

/* Get the CAAction for test, or nil for all others */
- (idCAAction) actionForLayer:(CALayer *)theLayer forKey:(NSString  
*)theKey

{
   id res = [theLayer.actions valueForKey:theKey];
   NSLog(@actionForLayer:%p forKey:\[EMAIL PROTECTED] = %p, theLayer, theKey,  
res);

   return res;
}

/* Create the layer, initialize action, animate test property */
- (void) createLayer {
   // ...
   content = [CALayer layer];
   content.actions = [NSDictionary  
dictionaryWithObjectsAndKeys:self, @test, nil];

   // ...
   [content setDelegate:self];
   [content setNeedsDisplay];

   // THIS WORKS!
   [content setValue:[NSNumber numberWithInt:19] forKey:@test];

   // THIS does not work.
   CABasicAnimation *anim = [CABasicAnimation animation];
   anim.keyPath = @self.test;
   anim.duration = 1.0;
   anim.repeatCount = 1.0e100;
   anim.autoreverses = YES;
   anim.fromValue = [NSNumber numberWithFloat:0.0];
   anim.toValue = [NSNumber numberWithFloat:1.0];
   [content addAnimation:anim forKey:@test];
}


___

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

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

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

This email sent to [EMAIL PROTECTED]