Re: cocoa-dev vs. Apple's dev forums?

2010-03-08 Thread Jesse Armand
 Mailing list over forum any day. Don't make me hunt a bunch of forums every 
 day! x lists, one convenient interface (Mail.app).

 But my biggest beef: a closed forum will not be indexed by Google. So even if 
 you pay up and the dev forum has a great answer, you will not find it using 
 Google.

 Gerd


I have to say, I agree with this opinion. It seems like I'm one of the
classic developers.

Jesse Armand

(http://jessearmand.com)
___

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

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

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

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


Re: NSDocumentController subclass not instantiated first? [SOLVED]

2010-03-08 Thread Keith Blount
Hi,

Many thanks for your replies, much appreciated - they have helped me track and 
solve the problem, so I’m very grateful.

 My app does it this way and it has always worked without any special work 
 needed. I'm not sure what your problem is, but doing it this way works for 
 me, suggesting that the documentation is at least accurate.

Thanks Graham. Sorry if I was unclear - I wasn’t trying to suggest it was a 
problem with the docs; I was just trying to clarify what I had tried.

 It's important to make a distinction between +initialize (the class
method which is sent by the runtime the first time a class is sent a
message) and -init (the instance method used to initialize an object).

Yes, I was trying to find out which class got called first, but obviously 
NSDocumentController would receive +initialize before its subclass no matter 
what anyway, so NSLogging there wasn’t all that useful. As it turns out, 
though, it was an +initialize problem with my app delegate (see below).

 Can you set a symbolic breakpoint on 'sharedDocumentController' and simply 
 find out when and where it's first called?

*Coughs with embarrassment.* Well, yes, I could, but that would save me posting 
questions I should have been able to solve myself. :) That was indeed exactly 
what I needed to do, thank you. As soon as I set a breakpoint on 
-[NSDocumentController sharedDocumentController], I saw that in the cases where 
my subclass wasn’t getting loaded first, -sharedDocumentController was being 
called by NSColorPanel, not by my code. This told me instantly what was wrong.

My app adds a custom colour list using NSColorPanel’s -attachColorList:, but I 
had set this up in my application delegate’s +initialize method - I’ve no idea 
why I had put it there (which should just initialise my default preference 
values) rather than in -applicationDidFinishLaunching:, but I had, and that was 
the problem. As my app delegate and document controller subclass are both 
top-level objects in MainMenu.nib, there’s no guarantee which will be 
instantiated first, which explains why I was seeing apparently random 
behaviour: if my document controller subclass was instantiated first, then it 
became the shared document controller and my templates panel worked fine; but 
if my app delegate was instantiated first, then its +initialize method called 
through to NSColorPanel, which in turn called through to 
-sharedDocumentController, thus instantiating a standard NSDocumentController 
before my custom subclass could be used. (This was further
 obscured by the fact that NSColorPanel only calls on NSDocumentController if 
it needs to restore a selection in one of its tables, because that will then 
call down the responder chain to check if anything needs to change colour, I 
believe.)

So, moving my colour list creation code to -applicationDidFinishLaunching: 
(where it should have been in the first place) fixed it.

Many thanks again for the help,

All the best,
Keith


- Original Message 
From: Kyle Sluder kyle.slu...@gmail.com
To: Keith Blount keithblo...@yahoo.com
Cc: cocoa-dev@lists.apple.com
Sent: Mon, March 8, 2010 1:10:14 AM
Subject: Re: NSDocumentController subclass not instantiated first?

On Sun, Mar 7, 2010 at 4:09 PM, Keith Blount keithblo...@yahoo.com wrote:
 Running some test NSLogs, it certainly seems that NSDocumentController’s 
 -initialize method is called before that of my application delegate - 
 although I’m not entirely sure that is telling or not. I’ve been through my 
 code looking for calls to NSDocumentController, trying to find any calls that 
 could conceivably occur before MainMenu.nib gets initiated, but so far I’m 
 stumped.

It's important to make a distinction between +initialize (the class
method which is sent by the runtime the first time a class is sent a
message) and -init (the instance method used to initialize an object).

As Quincy says, set a breakpoint on -sharedDocumentController. If that
doesn't work, you could load your app up in Instruments and use the
Object Graph template to find out where the first NSDocumentController
instance is allocated.

--Kyle Sluder




___

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

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

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

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


NSApp question

2010-03-08 Thread Rick C.
hello,

i have a question regarding this line:

[NSApp activateIgnoringOtherApps:YES];

now i know this will activate the app, but for example if the main window of 
the app is closed should it cause the window to show?  i think it would not, 
but it seems some people claim that it does.  as a note, this is used without 
sending a makeKeyAndOrderFront to the main window.  thank you for your input,

rick


  
___

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

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

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

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


Re: problems loading a sound with NSSound

2010-03-08 Thread Keith Blount
NSSound doesn't respond to -initWithContentsOfFile: (it responds to 
-initWithContentsOfFile:byReference:), so you should be seeing errors on the 
console if that is how you are trying to init your NSSound object. (Also note 
that in the code you posted there is a memory leak, so it would be better to 
return [sound autorelease]).

I'm not sure why you need the -getSound: method at all, though - what is wrong 
with NSSound's -soundNamed:?

NSSound *logoSound = [NSSound soundNamed:@logoSound];
[logoSound play];

All the best,
Keith


- Original Message 

Hello,

I added a sound file to the resources of my project ( logoSound.AIF )

I use this function to load the resource:

-(NSSound*) getSound:(NSString *) sndValue {
NSBundle *bundle = [ NSBundle bundleForClass: [ self class ] ];
NSString *sndName = [ bundle pathForResource: sndValue ofType: @aif ];
NSSound *sound = [ [ NSSound alloc ] 
  initWithContentsOfFile: sndName ];
return sound;
} // getSound


I do this to load the sound file:

NSSound *logoSound = [self getSound: @logoSound];

I try:
[logoSound play];

but the sound doesn't play


what happend?


thanks


  
___

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

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

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

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


Re: IsReadableFileAtPath

2010-03-08 Thread gMail.com
Hi, thanks to all of you.
After some days trynign and thinking, I have used lstat to check the
filePermissions because I need to check thousands files per session.
However I realized that Permissions and isReadableFile or isWritableFile or
isDeletableFile are two different things, so please may you tell me whether
my methods here below are right or wrong? Short version:

IsReadableFile:filePath
 cPath = [mManager fileSystemRepresentationWithPath:filePath];
lstat(cPath, sb);
return ((sb.st_mode  S_IRUSR) != 0);

IsWritableFile:filePath
//I check here the ParentFolder of the filePath
parentFolder = [filePath stringByDeletingLastPathComponent];
cPath = [mManager fileSystemRepresentationWithPath:parentFolder];
lstat(cPath, sb);
return ((sb.st_mode  (S_IWUSR | S_IXUSR)) != 0);

IsDeletableFile:filePath
the same as IsWritableFile:filePath above

Will these methods work on any volume mounted on my desktop?
(e.g. Local volume, remote volume, disk image volume, on webdav, smb, ftp,
afp, hfs, on remote win disk...)

Thanks
Leo


 Da: Kevin Perry kpe...@apple.com
 Data: Mon, 1 Mar 2010 11:37:06 -0800
 A: gMail.com mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: IsReadableFileAtPath
 
 
 -Kevin
 
 On Mar 1, 2010, at 11:20 AM, gMail.com wrote:
 
 Hi,
 I need to check whether a file or a symlink could be really copied.
 I have just seen that the Cocoa API isReadableFileAtPath traverses the
 symlink, so, in case the target file is not readable, my app doesn't copy
 the symlink, while the Finder can properly do. So my app does wrong.
 
 The question is:
 How can I understand whether a file or symlink can really be copied?
 I have seen that isReadableFileAtPath uses the C command access which
 indeed traverses the symlink. So I cannot use it. So, any idea?
 And I wouldn't use the Carbon APIs because I need to compile for 64 bit.
 Thank you.
 
 Leonardo
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kperry%40apple.com
 
 This email sent to kpe...@apple.com
 


___

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

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

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

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


Re: reading text rom Pages doc

2010-03-08 Thread Keith Blount
Hi,

As others have pointed out, there is no way to read .pages documents as the 
.pages format is proprietary and unpublished. Some of the specs were published 
here:

http://developer.apple.com/mac/library/documentation/AppleApplications/Conceptual/iWork2-0_XML/Chapter02/02Pages.html

But the Pages section hasn't been updated since 2005 and the .pages format has 
changed since then - and moreover the above makes it very clear that the XML 
scheme is unlikely to be published properly and that you shouldn't rely on it 
for writing your own importers.

So the only way is to tell your users to export to RTF or Word format, or, as 
Paul suggests, try using AppleScript. There is one other possibility, but it's 
an ugly hack and could break if the Pages format changes. Depending on whether 
the user chooses Include preview in document or not, .pages files will either 
have a PDF file containing all their documents inside the QuickLook folder in 
the project package (recent .pages files are zip archives), or QuickLook will 
generate HTML to show the preview. So you could try extracting the PDF file 
from the .pages QuickLook folder and loading the text from that. If that 
doesn't work (because the user hasn't chosen Include preview for that 
document), you could (on 10.6) use QuickLook to load a preview and try to 
navigate down the view hierarchy to find the WebView and extract the HTML. But 
this is fragile and if Pages '10 changes the way the QuickLook preview is 
generated, it will break - and it will be
 different for past versions of the format too.

(I get a lot of outraged e-mails from new users demanding to know why my text 
app doesn't support the .pages format, which is why I considered the above. But 
it's pretty nasty so I'm just resigned to telling them to export to RTF.)

All the best,
Keith


- Original Message 

Hi
I am reading text  from Word docs without problems using the NSTextView method 
readRTFDFromFile. 
Trying to read text  from Pages documents with file extension .pages fail an 
returns empty strings. The same document saved in Word format works fine.
I was trying the NSString method stringWithContentsOfFile with various 
encodings but I get only garbage.
What is going wrong? I think it must be a simple way in Apple's Xcode to read 
Docs written with Apples Pages application.
Thanks for every response
Ruedi Heimlicher


  
___

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

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

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

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


Re: IsReadableFileAtPath

2010-03-08 Thread Jeremy Pereira

On 8 Mar 2010, at 11:32, gMail.com wrote:

 Hi, thanks to all of you.
 After some days trynign and thinking, I have used lstat to check the
 filePermissions because I need to check thousands files per session.
 However I realized that Permissions and isReadableFile or isWritableFile or
 isDeletableFile are two different things, so please may you tell me whether
 my methods here below are right or wrong? Short version:

That depends on the semantics you want for isReadableFile: and isWriteableFile: 
 The code as written checks if the owner of the file can read or write it.  
However, you probably want to know if the currently running process can read or 
write it which may have a different answer if the owner of the process is not 
the same as the owner of the file.

isDeleteableFile: is wrong.  You need to check whether you have write access to 
the directory containing the file.  See below script:

monica:~ jeremyp$ mkdir foo
monica:~ jeremyp$ cd foo
monica:foo jeremyp$ touch foo
monica:foo jeremyp$ chmod -w .
monica:foo jeremyp$ ls -la
total 0
dr-xr-xr-x3 jeremyp  staff   102  8 Mar 11:49 .
drwx--+ 115 jeremyp  staff  3910  8 Mar 11:49 ..
-rw-r--r--1 jeremyp  staff 0  8 Mar 11:49 foo
monica:foo jeremyp$ rm foo
rm: foo: Permission denied
  


 
 IsReadableFile:filePath
 cPath = [mManager fileSystemRepresentationWithPath:filePath];
lstat(cPath, sb);
return ((sb.st_mode  S_IRUSR) != 0);
 
 IsWritableFile:filePath
//I check here the ParentFolder of the filePath
parentFolder = [filePath stringByDeletingLastPathComponent];
cPath = [mManager fileSystemRepresentationWithPath:parentFolder];
lstat(cPath, sb);
return ((sb.st_mode  (S_IWUSR | S_IXUSR)) != 0);
 
 IsDeletableFile:filePath
the same as IsWritableFile:filePath above
 
 Will these methods work on any volume mounted on my desktop?
 (e.g. Local volume, remote volume, disk image volume, on webdav, smb, ftp,
 afp, hfs, on remote win disk...)
 
 Thanks
 Leo
 
 
 Da: Kevin Perry kpe...@apple.com
 Data: Mon, 1 Mar 2010 11:37:06 -0800
 A: gMail.com mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: IsReadableFileAtPath
 
 
 -Kevin
 
 On Mar 1, 2010, at 11:20 AM, gMail.com wrote:
 
 Hi,
 I need to check whether a file or a symlink could be really copied.
 I have just seen that the Cocoa API isReadableFileAtPath traverses the
 symlink, so, in case the target file is not readable, my app doesn't copy
 the symlink, while the Finder can properly do. So my app does wrong.
 
 The question is:
 How can I understand whether a file or symlink can really be copied?
 I have seen that isReadableFileAtPath uses the C command access which
 indeed traverses the symlink. So I cannot use it. So, any idea?
 And I wouldn't use the Carbon APIs because I need to compile for 64 bit.
 Thank you.
 
 Leonardo
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kperry%40apple.com
 
 This email sent to kpe...@apple.com
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
 
 This email sent to a...@jeremyp.net


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

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

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

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

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


NSCollectionView and animating spinner crash

2010-03-08 Thread David Hoerl
I am getting consistent crashes when a newly created 
NSCollectionViewItem has a view with an animating spinner (the animation 
property is enabled through bindings that kick in immediately on 
creation). It happens on 10.5 as well as 10.6. [ rdar://7727603 bug has 
demo project included].


Log messages:
3/8/10 8:48:33 AM	NSCollectionViewCrash[27069]	unlockFocus called too 
many time.

... (lots of these, then)
3/8/10 8:48:33 AM	NSCollectionViewCrash[27069]	Unlocking Focus on wrong 
view (NSProgressIndicator: 0x100263230), expected NSView: 0x100262d20


If anyone has found a workaround to this problem I'd love to hear about it!

David
___

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

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

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

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


what is the difference between open /Applications/TextEdit.app and /Applications/TextEdit.app/Contents/MacOS/TextEdit

2010-03-08 Thread Arun
Hi All,

What is the difference between the following two commands

1.  open /Applications/TextEdit.app
2. /Applications/TextEdit.app/Contents/MacOS/TextEdit

Both launches TextEdit.app if i type both the commands in Terminal. Also in
Leopard if i use open then i can't pass any program arguments to my cocoa
app.
So is there only one way (type 2) to pass command line arguments to cocoa
app in Leopard

Thanks
Arun KA
___

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

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

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

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


Re: what is the difference between open /Applications/TextEdit.app and /Applications/TextEdit.app/Contents/MacOS/TextEdit

2010-03-08 Thread Charles Srstka
On Mar 8, 2010, at 9:17 AM, Arun wrote:

 Hi All,
 
 What is the difference between the following two commands
 
 1.  open /Applications/TextEdit.app
 2. /Applications/TextEdit.app/Contents/MacOS/TextEdit
 
 Both launches TextEdit.app if i type both the commands in Terminal. Also in
 Leopard if i use open then i can't pass any program arguments to my cocoa
 app.
 So is there only one way (type 2) to pass command line arguments to cocoa
 app in Leopard

The ‘open’ command will do the same thing that double-clicking the app in the 
Finder would do, so if the app’s already open, it will simply bring that app to 
the front (and open a new document if there’s not already a window open). 
Executing the binary itself can lead to multiple instances of the same app 
being open.

Note that the ‘open’ command is just a wrapper around APIs provided by the 
system, so in a Cocoa app, it would make more sense to use those directly 
instead of fork/execing a command-line program. You can either use the 
LaunchServices APIs found in 
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Headers/LSOpen.h,
 or if you prefer a nice easy-to-use Objective-C wrapper, NSWorkspace has a 
decent number of openURL:, openFile:, and launchApplication: methods for you to 
choose from.

Charles___

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

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

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

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


Re: reading text rom Pages doc

2010-03-08 Thread Charles Srstka
On Mar 8, 2010, at 5:43 AM, Keith Blount wrote:

 Hi,
 
 As others have pointed out, there is no way to read .pages documents as the 
 .pages format is proprietary and unpublished. Some of the specs were 
 published here:
 
 http://developer.apple.com/mac/library/documentation/AppleApplications/Conceptual/iWork2-0_XML/Chapter02/02Pages.html
 
 But the Pages section hasn't been updated since 2005 and the .pages format 
 has changed since then - and moreover the above makes it very clear that the 
 XML scheme is unlikely to be published properly and that you shouldn't rely 
 on it for writing your own importers.
 
 So the only way is to tell your users to export to RTF or Word format, or, as 
 Paul suggests, try using AppleScript. There is one other possibility, but 
 it's an ugly hack and could break if the Pages format changes. Depending on 
 whether the user chooses Include preview in document or not, .pages files 
 will either have a PDF file containing all their documents inside the 
 QuickLook folder in the project package (recent .pages files are zip 
 archives), or QuickLook will generate HTML to show the preview. So you could 
 try extracting the PDF file from the .pages QuickLook folder and loading the 
 text from that. If that doesn't work (because the user hasn't chosen Include 
 preview for that document), you could (on 10.6) use QuickLook to load a 
 preview and try to navigate down the view hierarchy to find the WebView and 
 extract the HTML. But this is fragile and if Pages '10 changes the way the 
 QuickLook preview is generated, it will break - and it will be
 different for past versions of the format too.
 
 (I get a lot of outraged e-mails from new users demanding to know why my text 
 app doesn't support the .pages format, which is why I considered the above. 
 But it's pretty nasty so I'm just resigned to telling them to export to RTF.)

I am somewhat surprised that Cocoa includes support for Microsoft’s competing 
file formats, but not Apple’s own. I’ve just filed a bug report on this - 
anyone else who also finds this odd should perhaps do the same. It certainly 
seems to be in Apple’s best interest for the Pages format to be more 
accessible, in order to make Pages more useful as a word processor.

Charles___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread David Blanton

You never need to call anything to result in display.


Apparently you do as the custom view containing two buttons placed in  
the tool bar is not displayed.
The docs for -validate indicate that -setEnabled should be called if  
the custom view is a control and that NStoolbarItem has no idea on how  
to validate a custom view containing 'complex' controls. Did that,  
don't work.


So, it is not the workman it is the tool. Proven by how long it took  
Apple to include toolbar support in IB and the fact that there is not  
one answer or example anywhere on how to do what is supposed to be  
trivial.  Ergo, I stand by may statement that a trivial task in MFC is  
consuming lots of time to do in Cocoa. Does that not point to either  
poor tool design or poor documentation?


You can't blame the Toyota drivers for sudden acceleration when Toyota  
recalled 'the tool' to fix the problem.  Analogous situation here.


So I ask again, how does one display a custom view containing controls  
in a toolbar?


-db


On Mar 5, 2010, at 2:53 PM, Kyle Sluder wrote:

On Fri, Mar 5, 2010 at 10:45 AM, David Blanton  
aired...@tularosa.net wrote:
I have called every possible method on the view and the controls  
for them to
display.  Never see anything and in fact the second time through - 
validate

EXC_BAD_ACCESS is thrown.


You never need to call anything to result in display. Your involvement
with drawing extends merely to marking a dirty region; AppKit takes
care of calling all of your drawing methods. If you are trying to
force drawing, you are doing something very, very wrong.

You have a memory management bug somewhere, most likely in your
validation method. Turn on zombies, run in Instruments, and find out
where.

So two hours later I still cannot display a custom view containing  
buttons
in an NSToolbar. Something that in MFC is trivial is near  
impossible with
Cocoa. The Windows guys here are laughing their ... off at my  
inability to

accomplish a trivial MFC task in a Cocoa equivalent.


A poor workman blames his tools.

--Kyle Sluder





___

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

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

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

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


Weird Bug Report on 10.5

2010-03-08 Thread Brent Smith
I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6

I cant seem to deduce the problem b/c its crashing on events that AppKit is 
calling, and nothing that I am calling.

Any help would be greatly appreciated.

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
Crashed Thread:  1

Thread 0:
0   com.apple.CoreText  0x7fff81842e86 CTFontCopyAttribute 
+ 0
1   com.apple.AppKit0x7fff8390c578 -[NSFontManager 
weightOfFont:] + 138
2   com.apple.AppKit0x7fff83870070 -[NSFontManager 
convertFont:toHaveTrait:] + 167
3   com.apple.AppKit0x7fff83c57f85 -[NSTableView 
_groupCellAttributesWithDefaults:highlighted:] + 324
4   com.apple.AppKit0x7fff83c58108 -[NSTableView 
_groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 94
5   com.apple.AppKit0x7fff83c58300 -[NSTableView 
_addGroupRowAttributesToCell:withData:highlighted:] + 146
6   com.apple.AppKit0x7fff837bb22a -[NSTableView 
preparedCellAtColumn:row:] + 609
7   com.apple.AppKit0x7fff837baf09 -[NSTableView 
_drawContentsAtRow:column:withCellFrame:] + 48
8   com.apple.AppKit0x7fff837bae7c -[NSOutlineView 
_drawContentsAtRow:column:withCellFrame:] + 96
9   com.apple.AppKit0x7fff837ba3cb -[NSTableView 
drawRow:clipRect:] + 871
10  com.apple.AppKit0x7fff8375d68e -[NSTableView 
drawRowIndexes:clipRect:] + 356
11  com.apple.AppKit0x7fff8375d521 -[NSOutlineView 
drawRowIndexes:clipRect:] + 125
12  com.apple.AppKit0x7fff8375c053 -[NSTableView 
drawRect:] + 2353
13  com.apple.AppKit0x7fff837eea6f -[NSView 
_drawRect:clip:] + 3703
14  com.apple.AppKit0x7fff837ed555 -[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
15  com.apple.AppKit0x7fff837ed922 -[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
16  com.apple.AppKit0x7fff837ed922 -[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
17  com.apple.AppKit0x7fff837ed922 -[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
18  com.apple.AppKit0x7fff837ebc82 -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 874
19  com.apple.AppKit0x7fff837ecbfb -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 4835
20  com.apple.AppKit0x7fff837ecbfb -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 4835
21  com.apple.AppKit0x7fff837ecbfb -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 4835
22  com.apple.AppKit0x7fff837eb4e4 -[NSThemeFrame 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 328
23  com.apple.AppKit0x7fff837e7d4a -[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
24  com.apple.AppKit0x7fff83725617 -[NSView 
displayIfNeeded] + 1190
25  com.apple.AppKit0x7fff8372510c -[NSWindow 
displayIfNeeded] + 82
26  com.apple.AppKit0x7fff83724f9c 
_handleWindowNeedsDisplay + 417
27  com.apple.CoreFoundation0x7fff80f933ea 
__CFRunLoopDoObservers + 506
28  com.apple.CoreFoundation0x7fff80f946b4 CFRunLoopRunSpecific 
+ 836
29  com.apple.HIToolbox 0x7fff818ced0e 
RunCurrentEventLoopInMode + 278
30  com.apple.HIToolbox 0x7fff818ceb44 
ReceiveNextEventCommon + 322
31  com.apple.HIToolbox 0x7fff818ce9ef 
BlockUntilNextEventMatchingListInMode + 79
32  com.apple.AppKit0x7fff83722e70 _DPSNextEvent + 603
33  com.apple.AppKit0x7fff837227b1 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
34  com.apple.AppKit0x7fff8371c523 -[NSApplication run] 
+ 434
35  com.apple.AppKit0x7fff836e92f0 NSApplicationMain + 
373
36  com.grasscove.wildapp   0x00011544 start + 52

Thread 1 Crashed:
0   libobjc.A.dylib 0x7fff82979aef objc_msgSend + 63
1   com.apple.Foundation0x7fff805e3d35 __NSThread__main__ + 
1157
2   libSystem.B.dylib   0x7fff8043be8b _pthread_start + 316
3   libSystem.B.dylib   0x7fff8043bd4d thread_start + 13

Thread 2:
0   libSystem.B.dylib   

Re: Weird Bug Report on 10.5

2010-03-08 Thread Steve Bird

On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:

 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit is 
 calling, and nothing that I am calling.

Notice that it's thread ONE that crashed, not thread ZERO.

Appkit's not involved.




 
 Any help would be greatly appreciated.
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
 Crashed Thread:  1
 
 Thread 0:
 0   com.apple.CoreText0x7fff81842e86 CTFontCopyAttribute 
 + 0
 1   com.apple.AppKit  0x7fff8390c578 -[NSFontManager 
 weightOfFont:] + 138
 2   com.apple.AppKit  0x7fff83870070 -[NSFontManager 
 convertFont:toHaveTrait:] + 167
 3   com.apple.AppKit  0x7fff83c57f85 -[NSTableView 
 _groupCellAttributesWithDefaults:highlighted:] + 324
 4   com.apple.AppKit  0x7fff83c58108 -[NSTableView 
 _groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 94
 5   com.apple.AppKit  0x7fff83c58300 -[NSTableView 
 _addGroupRowAttributesToCell:withData:highlighted:] + 146
 6   com.apple.AppKit  0x7fff837bb22a -[NSTableView 
 preparedCellAtColumn:row:] + 609
 7   com.apple.AppKit  0x7fff837baf09 -[NSTableView 
 _drawContentsAtRow:column:withCellFrame:] + 48
 8   com.apple.AppKit  0x7fff837bae7c -[NSOutlineView 
 _drawContentsAtRow:column:withCellFrame:] + 96
 9   com.apple.AppKit  0x7fff837ba3cb -[NSTableView 
 drawRow:clipRect:] + 871
 10  com.apple.AppKit  0x7fff8375d68e -[NSTableView 
 drawRowIndexes:clipRect:] + 356
 11  com.apple.AppKit  0x7fff8375d521 -[NSOutlineView 
 drawRowIndexes:clipRect:] + 125
 12  com.apple.AppKit  0x7fff8375c053 -[NSTableView 
 drawRect:] + 2353
 13  com.apple.AppKit  0x7fff837eea6f -[NSView 
 _drawRect:clip:] + 3703
 14  com.apple.AppKit  0x7fff837ed555 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
 15  com.apple.AppKit  0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 16  com.apple.AppKit  0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 17  com.apple.AppKit  0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 18  com.apple.AppKit  0x7fff837ebc82 -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 874
 19  com.apple.AppKit  0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 20  com.apple.AppKit  0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 21  com.apple.AppKit  0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 22  com.apple.AppKit  0x7fff837eb4e4 -[NSThemeFrame 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 328
 23  com.apple.AppKit  0x7fff837e7d4a -[NSView 
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
 24  com.apple.AppKit  0x7fff83725617 -[NSView 
 displayIfNeeded] + 1190
 25  com.apple.AppKit  0x7fff8372510c -[NSWindow 
 displayIfNeeded] + 82
 26  com.apple.AppKit  0x7fff83724f9c 
 _handleWindowNeedsDisplay + 417
 27  com.apple.CoreFoundation  0x7fff80f933ea 
 __CFRunLoopDoObservers + 506
 28  com.apple.CoreFoundation  0x7fff80f946b4 CFRunLoopRunSpecific 
 + 836
 29  com.apple.HIToolbox   0x7fff818ced0e 
 RunCurrentEventLoopInMode + 278
 30  com.apple.HIToolbox   0x7fff818ceb44 
 ReceiveNextEventCommon + 322
 31  com.apple.HIToolbox   0x7fff818ce9ef 
 BlockUntilNextEventMatchingListInMode + 79
 32  com.apple.AppKit  0x7fff83722e70 _DPSNextEvent + 603
 33  com.apple.AppKit  0x7fff837227b1 -[NSApplication 
 nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
 34  com.apple.AppKit  0x7fff8371c523 -[NSApplication run] 
 + 434
 35  com.apple.AppKit  0x7fff836e92f0 NSApplicationMain + 
 373
 36  com.grasscove.wildapp 0x00011544 start + 52
 
 Thread 1 Crashed:
 0   libobjc.A.dylib   0x7fff82979aef objc_msgSend + 63
 1   com.apple.Foundation  0x7fff805e3d35 __NSThread__main__ + 
 1157
 2   libSystem.B.dylib 0x7fff8043be8b 

Re: reading text rom Pages doc

2010-03-08 Thread Keith Blount
Hi,

I filed an enhancement request on this back in November 2007, #ID 5597713, 
asking for NSAttributedString additions that would read and write .pages files. 
(One of the most common questions I get from new users is why my app can import 
Microsoft formats but not Apple's own.)

Regarding my earlier suggestion that you could probably hack it through 
QuickLook, please disregard that. I looked at this again and found that broke 
with Pages '09, and it was an ugly hack anyway. The best way to achieve this 
currently is definitely by AppleScript, by batch converting any .pages files 
passed to the app to temporary RTF or RTFD files and then opening those 
instead. But obviously that requires telling the user that your app will open 
Pages, and that the user has Pages installed.

All the best,
Keith




From: Charles Srstka cocoa...@charlessoft.com
To: Keith Blount keithblo...@yahoo.com
Cc: cocoa-dev@lists.apple.com; r.heimlic...@bluewin.ch
Sent: Mon, March 8, 2010 4:35:50 PM
Subject: Re: reading text rom Pages doc


On Mar 8, 2010, at 5:43 AM, Keith Blount wrote:

Hi,

As others have pointed out, there is no way to read .pages documents as the 
.pages format is proprietary and unpublished. Some of the specs were published 
here:

http://developer.apple.com/mac/library/documentation/AppleApplications/Conceptual/iWork2-0_XML/Chapter02/02Pages.html

But the Pages section hasn't been updated since 2005 and the .pages format has 
changed since then - and moreover the above makes it very clear that the XML 
scheme is unlikely to be published properly and that you shouldn't rely on it 
for writing your own importers.

So the only way is to tell your users to export to RTF or Word format, or, as 
Paul suggests, try using AppleScript. There is one other possibility, but it's 
an ugly hack and could break if the Pages format changes. Depending on whether 
the user chooses Include preview in document or not, .pages files will 
either have a PDF file containing all their documents inside the QuickLook 
folder in the project package (recent .pages files are zip archives), or 
QuickLook will generate HTML to show the preview. So you could try extracting 
the PDF file from the .pages QuickLook folder and loading the text from that. 
If that doesn't work (because the user hasn't chosen Include preview for 
that document), you could (on 10.6) use QuickLook to load a preview and try to 
navigate down the view hierarchy to find the WebView and extract the HTML. But 
this is fragile and if Pages '10 changes the way the QuickLook preview is 
generated, it will break - and it will be
different for past versions of the format too.

(I get a lot of outraged e-mails from new users demanding to know why my text 
app doesn't support the .pages format, which is why I considered the above. 
But it's pretty nasty so I'm just resigned to telling them to export to RTF.)

I am somewhat surprised that Cocoa includes support for Microsoft’s competing 
file formats, but not Apple’s own. I’ve just filed a bug report on this - 
anyone else who also finds this odd should perhaps do the same. It certainly 
seems to be in Apple’s best interest for the Pages format to be more 
accessible, in order to make Pages more useful as a word processor.

Charles



___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Eric Gorr
You almost certainly have a data source assigned to your table that is being 
called as the table is trying to draw itself. Perhaps something has gone wrong 
in there...?


On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:

 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit is 
 calling, and nothing that I am calling.
 
 Any help would be greatly appreciated.
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
 Crashed Thread:  1
 
 Thread 0:
 0   com.apple.CoreText0x7fff81842e86 CTFontCopyAttribute 
 + 0
 1   com.apple.AppKit  0x7fff8390c578 -[NSFontManager 
 weightOfFont:] + 138
 2   com.apple.AppKit  0x7fff83870070 -[NSFontManager 
 convertFont:toHaveTrait:] + 167
 3   com.apple.AppKit  0x7fff83c57f85 -[NSTableView 
 _groupCellAttributesWithDefaults:highlighted:] + 324
 4   com.apple.AppKit  0x7fff83c58108 -[NSTableView 
 _groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 94
 5   com.apple.AppKit  0x7fff83c58300 -[NSTableView 
 _addGroupRowAttributesToCell:withData:highlighted:] + 146
 6   com.apple.AppKit  0x7fff837bb22a -[NSTableView 
 preparedCellAtColumn:row:] + 609
 7   com.apple.AppKit  0x7fff837baf09 -[NSTableView 
 _drawContentsAtRow:column:withCellFrame:] + 48
 8   com.apple.AppKit  0x7fff837bae7c -[NSOutlineView 
 _drawContentsAtRow:column:withCellFrame:] + 96
 9   com.apple.AppKit  0x7fff837ba3cb -[NSTableView 
 drawRow:clipRect:] + 871
 10  com.apple.AppKit  0x7fff8375d68e -[NSTableView 
 drawRowIndexes:clipRect:] + 356
 11  com.apple.AppKit  0x7fff8375d521 -[NSOutlineView 
 drawRowIndexes:clipRect:] + 125
 12  com.apple.AppKit  0x7fff8375c053 -[NSTableView 
 drawRect:] + 2353
 13  com.apple.AppKit  0x7fff837eea6f -[NSView 
 _drawRect:clip:] + 3703
 14  com.apple.AppKit  0x7fff837ed555 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
 15  com.apple.AppKit  0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 16  com.apple.AppKit  0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 17  com.apple.AppKit  0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 18  com.apple.AppKit  0x7fff837ebc82 -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 874
 19  com.apple.AppKit  0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 20  com.apple.AppKit  0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 21  com.apple.AppKit  0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 22  com.apple.AppKit  0x7fff837eb4e4 -[NSThemeFrame 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 328
 23  com.apple.AppKit  0x7fff837e7d4a -[NSView 
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
 24  com.apple.AppKit  0x7fff83725617 -[NSView 
 displayIfNeeded] + 1190
 25  com.apple.AppKit  0x7fff8372510c -[NSWindow 
 displayIfNeeded] + 82
 26  com.apple.AppKit  0x7fff83724f9c 
 _handleWindowNeedsDisplay + 417
 27  com.apple.CoreFoundation  0x7fff80f933ea 
 __CFRunLoopDoObservers + 506
 28  com.apple.CoreFoundation  0x7fff80f946b4 CFRunLoopRunSpecific 
 + 836
 29  com.apple.HIToolbox   0x7fff818ced0e 
 RunCurrentEventLoopInMode + 278
 30  com.apple.HIToolbox   0x7fff818ceb44 
 ReceiveNextEventCommon + 322
 31  com.apple.HIToolbox   0x7fff818ce9ef 
 BlockUntilNextEventMatchingListInMode + 79
 32  com.apple.AppKit  0x7fff83722e70 _DPSNextEvent + 603
 33  com.apple.AppKit  0x7fff837227b1 -[NSApplication 
 nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
 34  com.apple.AppKit  0x7fff8371c523 -[NSApplication run] 
 + 434
 35  com.apple.AppKit  0x7fff836e92f0 NSApplicationMain + 
 373
 36  com.grasscove.wildapp 0x00011544 start + 52
 
 Thread 1 Crashed:
 0   libobjc.A.dylib   0x7fff82979aef objc_msgSend + 63
 1   com.apple.Foundation  0x7fff805e3d35 

Re: Weird Bug Report on 10.5

2010-03-08 Thread Brent Smith
The datasource is being hooked up with bindings and core data.
 maybe there is something that just doesnt work on 10.5 with bindings and CD?


On Mar 8, 2010, at 9:03 AM, Eric Gorr wrote:

 You almost certainly have a data source assigned to your table that is being 
 called as the table is trying to draw itself. Perhaps something has gone 
 wrong in there...?
 
 
 On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:
 
 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit is 
 calling, and nothing that I am calling.
 
 Any help would be greatly appreciated.
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
 Crashed Thread:  1
 
 Thread 0:
 0   com.apple.CoreText   0x7fff81842e86 CTFontCopyAttribute 
 + 0
 1   com.apple.AppKit 0x7fff8390c578 -[NSFontManager 
 weightOfFont:] + 138
 2   com.apple.AppKit 0x7fff83870070 -[NSFontManager 
 convertFont:toHaveTrait:] + 167
 3   com.apple.AppKit 0x7fff83c57f85 -[NSTableView 
 _groupCellAttributesWithDefaults:highlighted:] + 324
 4   com.apple.AppKit 0x7fff83c58108 -[NSTableView 
 _groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 94
 5   com.apple.AppKit 0x7fff83c58300 -[NSTableView 
 _addGroupRowAttributesToCell:withData:highlighted:] + 146
 6   com.apple.AppKit 0x7fff837bb22a -[NSTableView 
 preparedCellAtColumn:row:] + 609
 7   com.apple.AppKit 0x7fff837baf09 -[NSTableView 
 _drawContentsAtRow:column:withCellFrame:] + 48
 8   com.apple.AppKit 0x7fff837bae7c -[NSOutlineView 
 _drawContentsAtRow:column:withCellFrame:] + 96
 9   com.apple.AppKit 0x7fff837ba3cb -[NSTableView 
 drawRow:clipRect:] + 871
 10  com.apple.AppKit 0x7fff8375d68e -[NSTableView 
 drawRowIndexes:clipRect:] + 356
 11  com.apple.AppKit 0x7fff8375d521 -[NSOutlineView 
 drawRowIndexes:clipRect:] + 125
 12  com.apple.AppKit 0x7fff8375c053 -[NSTableView 
 drawRect:] + 2353
 13  com.apple.AppKit 0x7fff837eea6f -[NSView 
 _drawRect:clip:] + 3703
 14  com.apple.AppKit 0x7fff837ed555 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
 15  com.apple.AppKit 0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 16  com.apple.AppKit 0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 17  com.apple.AppKit 0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 18  com.apple.AppKit 0x7fff837ebc82 -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 874
 19  com.apple.AppKit 0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 20  com.apple.AppKit 0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 21  com.apple.AppKit 0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 22  com.apple.AppKit 0x7fff837eb4e4 -[NSThemeFrame 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 328
 23  com.apple.AppKit 0x7fff837e7d4a -[NSView 
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
 24  com.apple.AppKit 0x7fff83725617 -[NSView 
 displayIfNeeded] + 1190
 25  com.apple.AppKit 0x7fff8372510c -[NSWindow 
 displayIfNeeded] + 82
 26  com.apple.AppKit 0x7fff83724f9c 
 _handleWindowNeedsDisplay + 417
 27  com.apple.CoreFoundation 0x7fff80f933ea 
 __CFRunLoopDoObservers + 506
 28  com.apple.CoreFoundation 0x7fff80f946b4 CFRunLoopRunSpecific 
 + 836
 29  com.apple.HIToolbox  0x7fff818ced0e 
 RunCurrentEventLoopInMode + 278
 30  com.apple.HIToolbox  0x7fff818ceb44 
 ReceiveNextEventCommon + 322
 31  com.apple.HIToolbox  0x7fff818ce9ef 
 BlockUntilNextEventMatchingListInMode + 79
 32  com.apple.AppKit 0x7fff83722e70 _DPSNextEvent + 603
 33  com.apple.AppKit 0x7fff837227b1 -[NSApplication 
 nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
 34  com.apple.AppKit 0x7fff8371c523 -[NSApplication run] 
 + 434
 35  com.apple.AppKit 0x7fff836e92f0 NSApplicationMain + 
 373
 36  com.grasscove.wildapp0x00011544 start + 52
 
 

Re: Weird Bug Report on 10.5

2010-03-08 Thread Eric Gorr
ooo...good point. I missed that too.

Problems involving objc_msgSend can usually be caught by reproducing the crash 
with zombies enabled.



On Mar 8, 2010, at 12:02 PM, Steve Bird wrote:

 
 On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:
 
 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit is 
 calling, and nothing that I am calling.
 
 Notice that it's thread ONE that crashed, not thread ZERO.
 
 Appkit's not involved.
 
 
 
 
 
 Any help would be greatly appreciated.
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
 Crashed Thread:  1
 
 Thread 0:
 0   com.apple.CoreText   0x7fff81842e86 CTFontCopyAttribute 
 + 0
 1   com.apple.AppKit 0x7fff8390c578 -[NSFontManager 
 weightOfFont:] + 138
 2   com.apple.AppKit 0x7fff83870070 -[NSFontManager 
 convertFont:toHaveTrait:] + 167
 3   com.apple.AppKit 0x7fff83c57f85 -[NSTableView 
 _groupCellAttributesWithDefaults:highlighted:] + 324
 4   com.apple.AppKit 0x7fff83c58108 -[NSTableView 
 _groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 94
 5   com.apple.AppKit 0x7fff83c58300 -[NSTableView 
 _addGroupRowAttributesToCell:withData:highlighted:] + 146
 6   com.apple.AppKit 0x7fff837bb22a -[NSTableView 
 preparedCellAtColumn:row:] + 609
 7   com.apple.AppKit 0x7fff837baf09 -[NSTableView 
 _drawContentsAtRow:column:withCellFrame:] + 48
 8   com.apple.AppKit 0x7fff837bae7c -[NSOutlineView 
 _drawContentsAtRow:column:withCellFrame:] + 96
 9   com.apple.AppKit 0x7fff837ba3cb -[NSTableView 
 drawRow:clipRect:] + 871
 10  com.apple.AppKit 0x7fff8375d68e -[NSTableView 
 drawRowIndexes:clipRect:] + 356
 11  com.apple.AppKit 0x7fff8375d521 -[NSOutlineView 
 drawRowIndexes:clipRect:] + 125
 12  com.apple.AppKit 0x7fff8375c053 -[NSTableView 
 drawRect:] + 2353
 13  com.apple.AppKit 0x7fff837eea6f -[NSView 
 _drawRect:clip:] + 3703
 14  com.apple.AppKit 0x7fff837ed555 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
 15  com.apple.AppKit 0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 16  com.apple.AppKit 0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 17  com.apple.AppKit 0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 18  com.apple.AppKit 0x7fff837ebc82 -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 874
 19  com.apple.AppKit 0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 20  com.apple.AppKit 0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 21  com.apple.AppKit 0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 22  com.apple.AppKit 0x7fff837eb4e4 -[NSThemeFrame 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 328
 23  com.apple.AppKit 0x7fff837e7d4a -[NSView 
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
 24  com.apple.AppKit 0x7fff83725617 -[NSView 
 displayIfNeeded] + 1190
 25  com.apple.AppKit 0x7fff8372510c -[NSWindow 
 displayIfNeeded] + 82
 26  com.apple.AppKit 0x7fff83724f9c 
 _handleWindowNeedsDisplay + 417
 27  com.apple.CoreFoundation 0x7fff80f933ea 
 __CFRunLoopDoObservers + 506
 28  com.apple.CoreFoundation 0x7fff80f946b4 CFRunLoopRunSpecific 
 + 836
 29  com.apple.HIToolbox  0x7fff818ced0e 
 RunCurrentEventLoopInMode + 278
 30  com.apple.HIToolbox  0x7fff818ceb44 
 ReceiveNextEventCommon + 322
 31  com.apple.HIToolbox  0x7fff818ce9ef 
 BlockUntilNextEventMatchingListInMode + 79
 32  com.apple.AppKit 0x7fff83722e70 _DPSNextEvent + 603
 33  com.apple.AppKit 0x7fff837227b1 -[NSApplication 
 nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
 34  com.apple.AppKit 0x7fff8371c523 -[NSApplication run] 
 + 434
 35  com.apple.AppKit 0x7fff836e92f0 NSApplicationMain + 
 373
 36  com.grasscove.wildapp0x00011544 start + 52
 
 Thread 1 Crashed:
 0   libobjc.A.dylib  0x7fff82979aef 

Re: Weird Bug Report on 10.5

2010-03-08 Thread Dave DeLong
Like Steve Bird said, it's not your GUI thread that crashed, it's the thread 
you've created via NSThread.  Perhaps it's trying to invoke a selector on a 
deallocated object or something?

Dave

On Mar 8, 2010, at 10:05 AM, Brent Smith wrote:

 The datasource is being hooked up with bindings and core data.
 maybe there is something that just doesnt work on 10.5 with bindings and CD?


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Modeling a seat reservation: iPhone

2010-03-08 Thread Gustavo Pizano
Hello all, 

I was reading some older post about something similar. What I want to achieve 
is that I have a room with seats and I want to check the seats to reserve. Now 
I did something alike in Cocoa retrieving  the view under the hitTest, then I 
got the id of the view (custom identification) and then I new which number 
shall I reserve.

Btu for iPhone I dunno how big this process might be, Im talking about 220 - 
250 seats. I was thinking in  placing inside a UIScrollView my map of seats and 
a button with a tag identifier for each seat in a button grid, but im not happy 
with having so many buttons.

Then I thought making CGPaths, but then to check which path contains the touch 
point...  :S:S:S  not nice.

Any idea how can I achieve this in a fancy easy solution?

knowing that the server will tell me whats reserve already I must color each 
seat and don't allow touch events on that area, or well at least don't respond 
to them.

Thx in advance for any help


Gustavo


___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Brent Smith
The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine with 
10.5 on it?


On Mar 8, 2010, at 9:06 AM, Eric Gorr wrote:

 ooo...good point. I missed that too.
 
 Problems involving objc_msgSend can usually be caught by reproducing the 
 crash with zombies enabled.
 
 
 
 On Mar 8, 2010, at 12:02 PM, Steve Bird wrote:
 
 
 On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:
 
 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit is 
 calling, and nothing that I am calling.
 
 Notice that it's thread ONE that crashed, not thread ZERO.
 
 Appkit's not involved.
 
 
 
 
 
 Any help would be greatly appreciated.
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
 Crashed Thread:  1
 
 Thread 0:
 0   com.apple.CoreText  0x7fff81842e86 CTFontCopyAttribute 
 + 0
 1   com.apple.AppKit0x7fff8390c578 -[NSFontManager 
 weightOfFont:] + 138
 2   com.apple.AppKit0x7fff83870070 -[NSFontManager 
 convertFont:toHaveTrait:] + 167
 3   com.apple.AppKit0x7fff83c57f85 -[NSTableView 
 _groupCellAttributesWithDefaults:highlighted:] + 324
 4   com.apple.AppKit0x7fff83c58108 -[NSTableView 
 _groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 94
 5   com.apple.AppKit0x7fff83c58300 -[NSTableView 
 _addGroupRowAttributesToCell:withData:highlighted:] + 146
 6   com.apple.AppKit0x7fff837bb22a -[NSTableView 
 preparedCellAtColumn:row:] + 609
 7   com.apple.AppKit0x7fff837baf09 -[NSTableView 
 _drawContentsAtRow:column:withCellFrame:] + 48
 8   com.apple.AppKit0x7fff837bae7c -[NSOutlineView 
 _drawContentsAtRow:column:withCellFrame:] + 96
 9   com.apple.AppKit0x7fff837ba3cb -[NSTableView 
 drawRow:clipRect:] + 871
 10  com.apple.AppKit0x7fff8375d68e -[NSTableView 
 drawRowIndexes:clipRect:] + 356
 11  com.apple.AppKit0x7fff8375d521 -[NSOutlineView 
 drawRowIndexes:clipRect:] + 125
 12  com.apple.AppKit0x7fff8375c053 -[NSTableView 
 drawRect:] + 2353
 13  com.apple.AppKit0x7fff837eea6f -[NSView 
 _drawRect:clip:] + 3703
 14  com.apple.AppKit0x7fff837ed555 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
 15  com.apple.AppKit0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 16  com.apple.AppKit0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 17  com.apple.AppKit0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 18  com.apple.AppKit0x7fff837ebc82 -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 874
 19  com.apple.AppKit0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 20  com.apple.AppKit0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 21  com.apple.AppKit0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 22  com.apple.AppKit0x7fff837eb4e4 -[NSThemeFrame 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 328
 23  com.apple.AppKit0x7fff837e7d4a -[NSView 
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
 24  com.apple.AppKit0x7fff83725617 -[NSView 
 displayIfNeeded] + 1190
 25  com.apple.AppKit0x7fff8372510c -[NSWindow 
 displayIfNeeded] + 82
 26  com.apple.AppKit0x7fff83724f9c 
 _handleWindowNeedsDisplay + 417
 27  com.apple.CoreFoundation0x7fff80f933ea 
 __CFRunLoopDoObservers + 506
 28  com.apple.CoreFoundation0x7fff80f946b4 CFRunLoopRunSpecific 
 + 836
 29  com.apple.HIToolbox 0x7fff818ced0e 
 RunCurrentEventLoopInMode + 278
 30  com.apple.HIToolbox 0x7fff818ceb44 
 ReceiveNextEventCommon + 322
 31  com.apple.HIToolbox 0x7fff818ce9ef 
 BlockUntilNextEventMatchingListInMode + 79
 32  com.apple.AppKit0x7fff83722e70 _DPSNextEvent + 603
 33  com.apple.AppKit0x7fff837227b1 -[NSApplication 
 nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
 34  com.apple.AppKit0x7fff8371c523 -[NSApplication run] 
 + 434
 35  com.apple.AppKit0x7fff836e92f0 NSApplicationMain + 
 373
 36  com.grasscove.wildapp  

Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 8:56 AM, David Blanton aired...@tularosa.net wrote:
 Apparently you do as the custom view containing two buttons placed in the
 tool bar is not displayed.

There is no reason to believe that the solution to your problem is to
manually provoke -display. That's not how drawing works in AppKit. You
have made an erroneous leap of logic.

 The docs for -validate indicate that -setEnabled should be called if the
 custom view is a control and that NStoolbarItem has no idea on how to
 validate a custom view containing 'complex' controls. Did that, don't work.

So you assume the solution is to manually draw the control? No, the
solution is to figure out why your code isn't working. Perhaps it has
something to do with the glaring memory management bug you have
written that manifests itself as an EXC_BAD_ACCESS exception.

But since you have posted no code, and have made no indication that
you have attempted to find the problem, nobody can offer more specific
advice.

 So, it is not the workman it is the tool. Proven by how long it took Apple
 to include toolbar support in IB and the fact that there is not one answer
 or example anywhere on how to do what is supposed to be trivial.  Ergo, I
 stand by may statement that a trivial task in MFC is consuming lots of time
 to do in Cocoa. Does that not point to either poor tool design or poor
 documentation?

No, it points to someone who is being obstinate and refusing to learn.

 You can't blame the Toyota drivers for sudden acceleration when Toyota
 recalled 'the tool' to fix the problem.  Analogous situation here.

Your lack of understanding and refusal to engage in basic
troubleshooting procedure is in no way analogous to a design flaw in a
formally specified realtime system.

 So I ask again, how does one display a custom view containing controls in a
 toolbar?

I ask you again, what have you tried?

--Kyle Sluder
___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Brent Smith
I am doing one NSThread method which basically phones home. However thats in my 
appDelegate, in the init method, and it only runs once. I cant really see my 
appDelegate being unallocated when the app starts?

On Mar 8, 2010, at 9:12 AM, Dave DeLong wrote:

 Like Steve Bird said, it's not your GUI thread that crashed, it's the thread 
 you've created via NSThread.  Perhaps it's trying to invoke a selector on a 
 deallocated object or something?
 
 Dave
 
 On Mar 8, 2010, at 10:05 AM, Brent Smith wrote:
 
 The datasource is being hooked up with bindings and core data.
 maybe there is something that just doesnt work on 10.5 with bindings and CD?
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/liarepmi%40hack3r.com
 
 This email sent to liare...@hack3r.com

___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Eric Gorr
Well, you can partition your HD and install Leopard on the other partition. 
There is no need to use a different computer.

But, yes, your best bet is likely to be able to reproduce the crash yourself.

Of course, you could try running your app with Zombies enabled under 10.6. You 
may be able to spot the problem and it is certainly worth a shot.



On Mar 8, 2010, at 12:17 PM, Brent Smith wrote:

 The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine 
 with 10.5 on it?
 
 
 On Mar 8, 2010, at 9:06 AM, Eric Gorr wrote:
 
 ooo...good point. I missed that too.
 
 Problems involving objc_msgSend can usually be caught by reproducing the 
 crash with zombies enabled.
 
 
 
 On Mar 8, 2010, at 12:02 PM, Steve Bird wrote:
 
 
 On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:
 
 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit 
 is calling, and nothing that I am calling.
 
 Notice that it's thread ONE that crashed, not thread ZERO.
 
 Appkit's not involved.
 
 
 
 
 
 Any help would be greatly appreciated.
 
 Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
 Exception Codes: KERN_INVALID_ADDRESS at 0x00049459e5c8
 Crashed Thread:  1
 
 Thread 0:
 0   com.apple.CoreText 0x7fff81842e86 CTFontCopyAttribute 
 + 0
 1   com.apple.AppKit   0x7fff8390c578 -[NSFontManager 
 weightOfFont:] + 138
 2   com.apple.AppKit   0x7fff83870070 -[NSFontManager 
 convertFont:toHaveTrait:] + 167
 3   com.apple.AppKit   0x7fff83c57f85 -[NSTableView 
 _groupCellAttributesWithDefaults:highlighted:] + 324
 4   com.apple.AppKit   0x7fff83c58108 -[NSTableView 
 _groupCellAttributedStringForString:withDefaultAttributes:highlighted:] + 
 94
 5   com.apple.AppKit   0x7fff83c58300 -[NSTableView 
 _addGroupRowAttributesToCell:withData:highlighted:] + 146
 6   com.apple.AppKit   0x7fff837bb22a -[NSTableView 
 preparedCellAtColumn:row:] + 609
 7   com.apple.AppKit   0x7fff837baf09 -[NSTableView 
 _drawContentsAtRow:column:withCellFrame:] + 48
 8   com.apple.AppKit   0x7fff837bae7c -[NSOutlineView 
 _drawContentsAtRow:column:withCellFrame:] + 96
 9   com.apple.AppKit   0x7fff837ba3cb -[NSTableView 
 drawRow:clipRect:] + 871
 10  com.apple.AppKit   0x7fff8375d68e -[NSTableView 
 drawRowIndexes:clipRect:] + 356
 11  com.apple.AppKit   0x7fff8375d521 -[NSOutlineView 
 drawRowIndexes:clipRect:] + 125
 12  com.apple.AppKit   0x7fff8375c053 -[NSTableView 
 drawRect:] + 2353
 13  com.apple.AppKit   0x7fff837eea6f -[NSView 
 _drawRect:clip:] + 3703
 14  com.apple.AppKit   0x7fff837ed555 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1227
 15  com.apple.AppKit   0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 16  com.apple.AppKit   0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 17  com.apple.AppKit   0x7fff837ed922 -[NSView 
 _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2200
 18  com.apple.AppKit   0x7fff837ebc82 -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 874
 19  com.apple.AppKit   0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 20  com.apple.AppKit   0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 21  com.apple.AppKit   0x7fff837ecbfb -[NSView 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 4835
 22  com.apple.AppKit   0x7fff837eb4e4 -[NSThemeFrame 
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
  + 328
 23  com.apple.AppKit   0x7fff837e7d4a -[NSView 
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3008
 24  com.apple.AppKit   0x7fff83725617 -[NSView 
 displayIfNeeded] + 1190
 25  com.apple.AppKit   0x7fff8372510c -[NSWindow 
 displayIfNeeded] + 82
 26  com.apple.AppKit   0x7fff83724f9c 
 _handleWindowNeedsDisplay + 417
 27  com.apple.CoreFoundation   0x7fff80f933ea 
 __CFRunLoopDoObservers + 506
 28  com.apple.CoreFoundation   0x7fff80f946b4 CFRunLoopRunSpecific 
 + 836
 29  com.apple.HIToolbox0x7fff818ced0e 
 RunCurrentEventLoopInMode + 278
 30  com.apple.HIToolbox0x7fff818ceb44 
 ReceiveNextEventCommon + 322
 31  com.apple.HIToolbox0x7fff818ce9ef 
 BlockUntilNextEventMatchingListInMode + 79
 32  com.apple.AppKit  

Re: Weird Bug Report on 10.5

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 9:17 AM, Brent Smith liare...@hack3r.com wrote:
 The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine 
 with 10.5 on it?

If you're supporting 10.5, you should have a 10.5 machine (or at least
a bootable volume) at the ready for situations just like this.

You have a bug on both platforms, but so far it's only manifested
itself as a crash on 10.5. You should fix your threading bug. We can't
help with that without seeing your code.

--Kyle Sluder
___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Steve Bird

On Mar 8, 2010, at 12:17 PM, Brent Smith wrote:

 The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine 
 with 10.5 on it?

What else is different between your machine and the crashed machine?

Perhaps it's fast CPU vs. slow.
Perhaps it's x86 vs. PPC.




 
 
 On Mar 8, 2010, at 9:06 AM, Eric Gorr wrote:
 
 ooo...good point. I missed that too.
 
 Problems involving objc_msgSend can usually be caught by reproducing the 
 crash with zombies enabled.
 
 
 
 On Mar 8, 2010, at 12:02 PM, Steve Bird wrote:
 
 
 On Mar 8, 2010, at 11:57 AM, Brent Smith wrote:
 
 I am getting an EXC_BAD_ACCESS on 10.5 only, it works fine in 10.6
 
 I cant seem to deduce the problem b/c its crashing on events that AppKit 
 is calling, and nothing that I am calling.
 
 Notice that it's thread ONE that crashed, not thread ZERO.
 
 Appkit's not involved.


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


___

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

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

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

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


Re: NSApp question

2010-03-08 Thread Quincey Morris
On Mar 8, 2010, at 03:03, Rick C. wrote:

 i have a question regarding this line:
 
 [NSApp activateIgnoringOtherApps:YES];
 
 now i know this will activate the app, but for example if the main window of 
 the app is closed should it cause the window to show?  i think it would not, 
 but it seems some people claim that it does.  as a note, this is used without 
 sending a makeKeyAndOrderFront to the main window.  thank you for your input,

It seems like the easiest way to find out would be to try it.

The trouble with following random claims by some people is that they're as 
likely to be wrong as to be right. Or they may be talking about something else. 
In a *document-based* app, activating the app when there are no document 
windows open will (by default) cause a new untitled document window to be 
opened.

However, you seem to talking about a non-document-based app. In that case, the 
behavior seems unlikely, if for no other reason than there's no formal concept 
of the main window -- in the sense of a primary window. (Presumably you don't 
mean in the isMainWindow sense, since closed windows can't be main windows in 
the isMainWindow sense.) So, the frameworks would have no basis on which to 
choose which closed window to show.


___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Sean McBride
On 3/8/10 12:22 PM, Eric Gorr said:

Well, you can partition your HD and install Leopard on the other
partition. There is no need to use a different computer.

Not necessarily.  Newer Macs only support 10.6.  Another option is to
run 10.5 (Server) in a virtual machine.

--

Sean McBride, B. Eng s...@rogue-research.com
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 arch...@mail-archive.com


[MEET] Chicago CocoaHeads / CAWUG tomorrow 7:00 @ Apple Store

2010-03-08 Thread Bob Frank

Hi all,

Chicago CocoaHeads / CAWUG is holding our next meeting Tuesday, March  
9th, at 7:00 PM at the Apple Store on Michigan Ave. in the 2nd floor  
theater.



Agenda:
- NSConference recap
- CoreData Pro  Con
- adjournment to O'Toole's

When:   
Tuesday, March 9th, 7:00 PM

Where:
Apple Store Michigan Avenue
679 North Michigan Ave. (at the corner of Huron  Michigan Ave.)
Chicago, IL 60611
http://tinyurl.com/Michigan-Ave-Apple-Store   (Google Maps URL)


- Ben on NSConference

	Ben Gottlieb (Stand Alone Software - Crosswords app) is going to  
recap the awesomeness that was NSConference last month and make all of  
us homebodies jealous about what we missed.



- Core Data Pro  Con:

Core Data is pretty awesome, but sometimes you need the speed and  
flexibility that direct SQLite access provides.  I'll be talking about  
how to use Objective-C wrappers around SQLite, when to use them,  and  
some optimizations you can do to get the most out of SQLite


Recently, Brent Simmons caused a little bit of a firestorm with this  
blog post http://inessential.com/2010/02/26/on_switching_away_from_core_data 
 about switching away from Core Data, and that inspired several  
responses:


http://inessential.com/2010/02/26/core_data_post_follow-up_notes
http://rentzsch.tumblr.com/post/414252963/brent-switching-away-from-core-data
http://cocoawithlove.com/2010/02/differences-between-core-data-and.html
http://www.manton.org/2010/02/i_dont_use.html

Ben Gottlieb and Chris Cieslak (Electropuf.com - Buster bus tracking  
app) will be discussing the pros  cons of Core Data and when it is  
good to use it and when it might be appropriate to consider not using  
it as well as some other persistence frameworks, for example:


http://code.google.com/p/flycode/source/browse/trunk/fmdb
http://github.com/hillegass/BNRPersistence

Ben:
Core Data Rocks: Fire and Forget Storage
Chris:
Ok well sometimes you Core Data isn't for you, just use SQLite!


- O'Tooles

	We will continue our discussions at our local watering hold Timothy  
O'Toole's at 622 Fairbanks (2 blocks east of the store).



Future Meeting Dates:

CocoaHeads: April 13th - 2nd Floor
(7:00-8:00 @ Apple Store, 2nd floor theater)

NSCoder Chicago: March 22nd - 4th Floor
(6:00 - 9:00 @ Apple Store, 4th floor studio)


We also wish to thank the folks who run the theater space at the Apple  
store for letting us have our meetings there, and Jonathan 'Wolf'  
Rentzsch for helping out so often.  Thanks all.


Also, if you are working on a project and would like to talk about it   
briefly / promote it, I think it would be fun for people to hear  
about  other people's projects. Please email me off line and you can  
talk at  a future meeting or would like a book to review we would  
welcome that too.


___

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

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

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

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


CA transition suddenly too fast

2010-03-08 Thread Fritz Anderson
I have a layer-hosting view, with the tree extending to about 60 layers total. 
In particular I have two one-sided card views with three CATextLayer 
sublayers each. They are in the same frame, and backless; I switch between them 
by doing an x-axis rotation so it appears that the two make a single card that 
flips over to reveal the content. Simultaneously with the flip, I change the 
content of a CAShapeLayer, and destroy-and-create about a dozen CALayers that 
contain 3 CATextLayers each. 

If it helps you visualize it, the shape layer is the route of a bus, and the 
numerous layers with text layers represent bus stops with arrival times. The 
card layers show the name, number, and direction of the currently-displayed 
route.

I've changed the bus-stop layers from being single CATextLayers (bad layout) to 
CALayers with text sublayers). That approximately quadrupled the stop-related 
layers. 

Since then, the card flip has become almost instantaneous. You can see the 
edges move if you look carefully, but the visual effect of a flip is 
essentially gone. 

I had thought that setting the duration property on the card layers to 1.0 
might have some good effect. Strangely, it had the effect of keeping them from 
displaying at all.

I'm fairly new to Core Animation; I haven't yet gotten into CAAnimation. I'd 
like to get the gradual transition back. Is there something I can fix?

— F

___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Matt Neuburg
On Mon, 8 Mar 2010 09:17:51 -0800, Brent Smith liare...@hack3r.com said:
The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine with
10.5 on it?

That is not a Cocoa question; you should really be raising this on the Xcode
list. But if you are just after advice, my experience is that one cannot
develop reliably for 10.x with a machine running 10.x on which test. You
don't have to develop *on* that machine, though. m.

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



___

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

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

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

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


Re: Modeling a seat reservation: iPhone

2010-03-08 Thread Quincey Morris
On Mar 8, 2010, at 09:13, Gustavo Pizano wrote:

 I was reading some older post about something similar. What I want to achieve 
 is that I have a room with seats and I want to check the seats to reserve. 
 Now I did something alike in Cocoa retrieving  the view under the hitTest, 
 then I got the id of the view (custom identification) and then I new which 
 number shall I reserve.
 
 Btu for iPhone I dunno how big this process might be, Im talking about 220 - 
 250 seats. I was thinking in  placing inside a UIScrollView my map of seats 
 and a button with a tag identifier for each seat in a button grid, but im not 
 happy with having so many buttons.
 
 Then I thought making CGPaths, but then to check which path contains the 
 touch point...  :S:S:S  not nice.
 
 Any idea how can I achieve this in a fancy easy solution?
 
 knowing that the server will tell me whats reserve already I must color each 
 seat and don't allow touch events on that area, or well at least don't 
 respond to them.

Using hundreds of buttons seems a bit heavy-handed even for the Mac, let alone 
iPhone. Any kind of one-subview-per-seat solution seems undesirable.

Even constructing hundreds of paths to hit-test screen locations seems like 
overkill.

If you have a room with seats, likely the room has a small number of sections 
(maybe only one) in which seats are laid out in a grid. Therefore you only need 
to keep the bounds of each section. It should be straightforward to translate a 
touch location into a grid position mathematically.

Or, in the worst case, keep each seat as a separate rectangle and test the 
touch location against the rectangles.

If you need non-rectangular hit testing, then it's still likely better to test 
against rectangular bounds rects first, and test against a more complex shape 
only when the first test succeeds.



___

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

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

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

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


Re: CA transition suddenly too fast

2010-03-08 Thread Fritz Anderson
On 8 Mar 2010, at 11:46 AM, Fritz Anderson wrote:

 I've changed the bus-stop layers from being single CATextLayers (bad layout) 
 to CALayers with text sublayers). That approximately quadrupled the 
 stop-related layers. 
 
 Since then, the card flip has become almost instantaneous. You can see the 
 edges move if you look carefully, but the visual effect of a flip is 
 essentially gone. 

H'm. After running a few minutes, I find that the transition is back to normal. 

I'd still like to know what was causing the problem, because I take it as a 
sign I don't have adequate control over my application.

A possible consideration: Transitions between routes is done on an NSTimer 
handler. My route iterator does one or more synchronous downloads [NSData 
dataWithContentsOfURL:], parses some XML, distributes the results among some 
Core Data objects, and then updates the map layers. I don't have any control 
over the responsiveness of the server.*

The point is, I'm out of the standard runloop mode for a second or so before I 
start the animations and return to the runloop. Is that a possible explanation?

— F

---
*  I'm aware that, to paraphrase the Frankenstein monster, synchronous bad, 
asynchronous good, but factoring my iteration and error handling into several 
methods is a treat I've reserved for later.

___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Steve Bird

On Mar 8, 2010, at 12:49 PM, Matt Neuburg wrote:

 my experience is that one cannot
 develop reliably for 10.x with a machine running 10.x on which test. 

Maybe change with to without, and I'd agree with you


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


___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Matt Neuburg
On or about 3/8/10 10:14 AM, thus spake Steve Bird sb...@culverson.com:

 
 On Mar 8, 2010, at 12:49 PM, Matt Neuburg wrote:
 
 my experience is that one cannot
 develop reliably for 10.x with a machine running 10.x on which test.
 
 Maybe change with to without, and I'd agree with you

Maybe. Or it could be a Freudian slip - perhaps my unconscious thinks that
development is just plain impossible. :) m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring  Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread David Blanton
Ok. Let me back up and repeat myself.  I sure would like to solve this  
problem.


Using IB I have added a Custom View from the Views  Cells Layout  
Views to the Allowed Toolbar Items palette.  To this view I have added  
two Square Buttons from the Views  Cells Buttons selection. I then  
dragged this view to the toolbar.  Here is a picture: http://highrolls.net/Picture 
 1.png


When I build and run the view is not visible.  So I read about  
validating tool bar items:


View item validation
Validation for view items is not automatic because a view item can be  
of unknown complexity. To implement validation for a view item, you  
must subclass NSToolbarItem and override validate (because  
NSToolbarItem’s implementation of validate does nothing for view  
items). In your override method, do the validation specific to the  
behavior of the view item and then enable or disable whatever you want  
in the contents of the view accordingly. If the view is an NSControl  
you can call setEnabled:, which will in turn call setEnabled: on the  
control.


In the absence of a custom menu form representation, NSToolbar by  
default disables a view item’s overflow menu item.



I have sub classed as suggested:

@interface View : NSToolbarItem {
@public

}

@end


@implementation View

- (void)validate {  

[self setEnabled:YES];

}

@end


and set this class to be the class of the enclosing tool bar item:  http://highrolls.net/Picture 
 2.png


The buttons do not display.

I then added outlets for the buttons and tried to enable them (yes, I  
realize that I if they were disabled I would see them in a disabled  
state) but I am grasping at straws now.  Doing this caused  
EXEC_BAD_ACCESS the second time validate was called.



@interface View : NSToolbarItem {
@public

IBOutlet NSButton* m_button1;
IBOutlet NSButton* m_button2;

}

@end
@implementation View

- (void)validate {  

[self setEnabled:YES];
[m_button1 setEnabled:YES];
[m_button2 setEnabled:YES];

}

@end

I am not sure how much more specific I can be.

Thanks.

-db






On Mar 8, 2010, at 10:21 AM, Kyle Sluder wrote:

On Mon, Mar 8, 2010 at 8:56 AM, David Blanton  
aired...@tularosa.net wrote:
Apparently you do as the custom view containing two buttons placed  
in the

tool bar is not displayed.


There is no reason to believe that the solution to your problem is to
manually provoke -display. That's not how drawing works in AppKit. You
have made an erroneous leap of logic.

The docs for -validate indicate that -setEnabled should be called  
if the

custom view is a control and that NStoolbarItem has no idea on how to
validate a custom view containing 'complex' controls. Did that,  
don't work.


So you assume the solution is to manually draw the control? No, the
solution is to figure out why your code isn't working. Perhaps it has
something to do with the glaring memory management bug you have
written that manifests itself as an EXC_BAD_ACCESS exception.

But since you have posted no code, and have made no indication that
you have attempted to find the problem, nobody can offer more specific
advice.

So, it is not the workman it is the tool. Proven by how long it  
took Apple
to include toolbar support in IB and the fact that there is not one  
answer
or example anywhere on how to do what is supposed to be trivial.   
Ergo, I
stand by may statement that a trivial task in MFC is consuming lots  
of time
to do in Cocoa. Does that not point to either poor tool design or  
poor

documentation?


No, it points to someone who is being obstinate and refusing to learn.

You can't blame the Toyota drivers for sudden acceleration when  
Toyota

recalled 'the tool' to fix the problem.  Analogous situation here.


Your lack of understanding and refusal to engage in basic
troubleshooting procedure is in no way analogous to a design flaw in a
formally specified realtime system.

So I ask again, how does one display a custom view containing  
controls in a

toolbar?


I ask you again, what have you tried?

--Kyle Sluder




___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 10:58 AM, David Blanton aired...@tularosa.net wrote:
 @implementation View

I would not recommend using this as the name for your NSView subclass,
since ObjC lacks namespaces. I doubt there's still a View class
hanging around anywhere, but it's safer to prefix it with some
initialism of your own.

 - (void)validate {
 [self setEnabled:YES];
 }

First of all, as the documentation you quoted explains, -validate is
an NSToolbarItem method, not an NSView method. If you want custom
validation logic for your view-based NSToolbarItem, you must subclass
NSToolbarItem and override -validate.

But since you're not actually doing any validation logic, there's no
need to implement custom validation at all, at least until you provide
an overflow menu representation for your toolbar item (which as the
documentation describes is disabled by default).

 and set this class to be the class of the enclosing tool bar item:

Looks like you changed your NSToolbarItem into a View by mistake.

--Kyle Sluder
___

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

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

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

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


Proper control for a list of actions

2010-03-08 Thread Dave DeLong
Hi everyone,

I'm recreating a rules interface (ie, under these conditions, perform those 
actions).  I have an NSPredicateEditor in place for the conditions portion, and 
it's working great.  However, I'm wondering what would be most appropriate to 
use for the actions area.

My initial reaction would be NSRuleEditor, except I'm not sure how I'd 
integrate it.  The documentation for NSRuleEditor is full of stuff about 
criteria and whatnot, and I'm not really sure how that applies.  If I could get 
it to work, I think NSRuleEditor would be the best option because of the visual 
consistency between it and the predicate editor.

My next reaction would be to use an NSPredicateEditor, but disallow compound 
predicates (except for the initial AND).   I'm familiar with 
NSPredicateEditor, so this (I think) would be the easiest option.  It also 
(obviously) has the advantage of visual consistency with the other predicate 
editor.

I then thought I could build one using an NSTableView, but that seems overly 
complex and overkill, and it wouldn't necessarily be visually consistent with 
the predicate editor (without some serious graphics work).

So:  Is NSRuleEditor the thing to use?  If so, how?

Thanks,

Dave

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Custom View in Toolbar

2010-03-08 Thread David Blanton

You did not look at what I provided.

@interface View : NSToolbarItem {
@public

}

@end


@implementation View

- (void)validate {  

[self setEnabled:YES];

}

@end


View is a subclass of NSToolbarItem.  So validate is being called on  
the NSToolbarItem.


I believe you have no clue about any of this so I will end the  
discussion.


Thanks for the run around.

-db


On Mar 8, 2010, at 12:10 PM, Kyle Sluder wrote:

On Mon, Mar 8, 2010 at 10:58 AM, David Blanton  
aired...@tularosa.net wrote:

@implementation View


I would not recommend using this as the name for your NSView subclass,
since ObjC lacks namespaces. I doubt there's still a View class
hanging around anywhere, but it's safer to prefix it with some
initialism of your own.


- (void)validate {
[self setEnabled:YES];
}


First of all, as the documentation you quoted explains, -validate is
an NSToolbarItem method, not an NSView method. If you want custom
validation logic for your view-based NSToolbarItem, you must subclass
NSToolbarItem and override -validate.

But since you're not actually doing any validation logic, there's no
need to implement custom validation at all, at least until you provide
an overflow menu representation for your toolbar item (which as the
documentation describes is disabled by default).


and set this class to be the class of the enclosing tool bar item:


Looks like you changed your NSToolbarItem into a View by mistake.

--Kyle Sluder




___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Quincey Morris
On Mar 8, 2010, at 10:58, David Blanton wrote:

 When I build and run the view is not visible.  So I read about validating 
 tool bar items:
 
 [snip]
 
 I have sub classed as suggested:
 
 @interface View : NSToolbarItem {
 @public
 
 }
 
 @end
 
 
 @implementation View
 
 - (void)validate {
 
   [self setEnabled:YES];
 
 }
 
 @end
 
 
 and set this class to be the class of the enclosing tool bar item:  
 http://highrolls.net/Picture 2.png
 
 The buttons do not display.

Yes, but I don't see how you're getting from the view contents not being 
visible to playing around with validation. Disabled buttons aren't invisible, 
they're dimmed. Therefore, if they're invisible, it's unlikely that validation 
is at fault. Or, at least, that isn't where I'd start looking.

 I then added outlets for the buttons and tried to enable them (yes, I realize 
 that I if they were disabled I would see them in a disabled state) but I am 
 grasping at straws now.  Doing this caused EXEC_BAD_ACCESS the second time 
 validate was called.


Yes, and it seems very likely that what's causing the crash at this point is 
related to why the buttons aren't visible. Prime suspect is a memory management 
error.

If, for example, a reference to the toolbar item's view isn't being retained 
properly, the view and its contents would get deallocated. That would certainly 
result in nothing being drawn, and would very likely cause the exact crash you 
describe.

A repeatable crash is your best friend when trying to solve a problem like 
this. If you find out why, the chances are you'll have found the original issue 
too.


___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 11:19 AM, David Blanton aired...@tularosa.net wrote:
 You did not look at what I provided.

Yes, I did. But I got confused by your second screenshot and got it in
my head that you had the view itself selected when you in fact had the
toolbar item selected. So that was in fact my error.

But my point still stands: you're doing nothing of consequence in your
override of -validate, so it needn't exist at all. It's not the source
of your problem.

 I believe you have no clue about any of this so I will end the discussion.

Wow. Not only do you bask in the glory of your own ignorance about how
AppKit drawing works, and refuse to acknowledge the bug that has been
pointed out to you by Quincey Morris as well as myself, but you turn
around and personally insult my knowledge?

You're a class act.

--Kyle Sluder
___

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

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

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

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


is as high as mine

2010-03-08 Thread David Blanton
Your overall knowledge was not being questioned, but if you had first  
hand knowledge of this approach I am sure I would know of it by now.  
That is all.


I'll figure this out and post a comprehensive solution when I have time.

-db



On Mar 8, 2010, at 12:45 PM, Kyle Sluder wrote:

On Mon, Mar 8, 2010 at 11:19 AM, David Blanton  
aired...@tularosa.net wrote:

You did not look at what I provided.


Yes, I did. But I got confused by your second screenshot and got it in
my head that you had the view itself selected when you in fact had the
toolbar item selected. So that was in fact my error.

But my point still stands: you're doing nothing of consequence in your
override of -validate, so it needn't exist at all. It's not the source
of your problem.

I believe you have no clue about any of this so I will end the  
discussion.


Wow. Not only do you bask in the glory of your own ignorance about how
AppKit drawing works, and refuse to acknowledge the bug that has been
pointed out to you by Quincey Morris as well as myself, but you turn
around and personally insult my knowledge?

You're a class act.

--Kyle Sluder





___

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

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

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

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


Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Neil Clayton

Hello All!

I seem unable to align text when drawing using drawAt:point.  The NSTextView 
shows it OK (so the attributes appear correct), but drawing of the text doesn't 
show alignment...

My code is:

- (void) awakeFromNib {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(updateText:) 
name:NSTextViewDidChangeTypingAttributesNotification object:nil];
[nc addObserver:self selector:@selector(updateText:) 
name:NSTextDidChangeNotification object:nil];

NSString *str = @This is a test\nAnd this text should be right 
aligned\nBut for some reason, in the image, isn't;
NSMutableParagraphStyle *pStyle = [[NSMutableParagraphStyle new] 
autorelease];
[pStyle setAlignment:NSRightTextAlignment];
NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:pStyle, NSParagraphStyleAttributeName, nil];
NSAttributedString *as = [[[NSAttributedString alloc] 
initWithString:str attributes:attrs] autorelease];
[[text textStorage] setAttributedString:as];
}

- (void) updateText:(NSNotification*)aNotification {
[self textChanged:self];
}

- (IBAction) textChanged:(id)sender {
NSAttributedString *string = [text attributedString];
NSSize bounds = [string size];

if(bounds.width  0  bounds.height  0) {
NSImage *image = [[[NSImage alloc] initWithSize:bounds] 
autorelease];
[image lockFocus];
@try {
[string drawAtPoint:NSZeroPoint];
} @finally {
[image unlockFocus];
}

[view setImage:image];
} else {
[view setImage:nil];
}
}

A sample of what I see when I run this is here:
http://dl.dropbox.com/u/421935/DrawingText/DrawingTest.png

I must be missing something really obvious.  Any ideas?

Neil Clayton
n...@cloudnine.net.nz




___

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

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

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

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


Re: Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Kevin Wojniak
You could try using -[NSMutableAttributedString setAlignment:range:]


On Mar 8, 2010, at 12:27 PM, Neil Clayton wrote:

 
 Hello All!
 
 I seem unable to align text when drawing using drawAt:point.  The NSTextView 
 shows it OK (so the attributes appear correct), but drawing of the text 
 doesn't show alignment...
 
 My code is:
 
 - (void) awakeFromNib {
   NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
   [nc addObserver:self selector:@selector(updateText:) 
 name:NSTextViewDidChangeTypingAttributesNotification object:nil];
   [nc addObserver:self selector:@selector(updateText:) 
 name:NSTextDidChangeNotification object:nil];
   
   NSString *str = @This is a test\nAnd this text should be right 
 aligned\nBut for some reason, in the image, isn't;
   NSMutableParagraphStyle *pStyle = [[NSMutableParagraphStyle new] 
 autorelease];
   [pStyle setAlignment:NSRightTextAlignment];
   NSDictionary *attrs = [NSDictionary 
 dictionaryWithObjectsAndKeys:pStyle, NSParagraphStyleAttributeName, nil];
   NSAttributedString *as = [[[NSAttributedString alloc] 
 initWithString:str attributes:attrs] autorelease];
   [[text textStorage] setAttributedString:as];
 }
 
 - (void) updateText:(NSNotification*)aNotification {
   [self textChanged:self];
 }
 
 - (IBAction) textChanged:(id)sender {
   NSAttributedString *string = [text attributedString];
   NSSize bounds = [string size];
   
   if(bounds.width  0  bounds.height  0) {
   NSImage *image = [[[NSImage alloc] initWithSize:bounds] 
 autorelease];
   [image lockFocus];
   @try {
   [string drawAtPoint:NSZeroPoint];
   } @finally {
   [image unlockFocus];
   }
   
   [view setImage:image];
   } else {
   [view setImage:nil];
   }
 }
 
 A sample of what I see when I run this is here:
 http://dl.dropbox.com/u/421935/DrawingText/DrawingTest.png
 
 I must be missing something really obvious.  Any ideas?
 
 Neil Clayton
 n...@cloudnine.net.nz
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.com

___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Andy Lee
On Monday, March 08, 2010, at 11:56AM, David Blanton aired...@tularosa.net 
wrote:
 So two hours later I still cannot display a custom view containing  
 buttons
 in an NSToolbar. Something that in MFC is trivial is near  
 impossible with
 Cocoa. The Windows guys here are laughing their ... off at my  
 inability to
 accomplish a trivial MFC task in a Cocoa equivalent.

I must say, just speaking for myself, nothing kills my motivation to help 
someone more than to hear this complaint.

Let's assume the absolute worst: that there is a flaw in Cocoa -- some 
egregious combination of poor design, bugginess, or inadequate documentation -- 
that is causing your particular problem.  I can sympathize with being 
frustrated.  I can sympathize with being angry at Apple (I'm not saying you 
are, but I could sympathize if you were, since I get angry at Apple sometimes 
too).

What I can't sympathize with is the inability to deal with foolish taunts from 
Windows coworkers, and the expectation that sharing this information will drive 
us all to try harder to rescue you.  My feeling is, if you're so embarrassed to 
be a Cocoa developer, why not go to Windows?  Then you can join the chorus of 
nyah-nyah's aimed at us poor suckers.


 A poor workman blames his tools.

I haven't investigated your particular problem so I wouldn't have put it this 
way myself.  But I did have a negative reaction with a similar gist.  Again, 
just speaking for myself.

--Andy

___

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

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

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

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


Re: Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Kevin Wojniak
Never mind, ignore that. Use drawInRect instead of drawAtPoint. My guess is 
that when when you draw at a point, Cocoa obviously doesn't have a boundary to 
right (or center) align the text to, so it just defaults to left-aligned.


On Mar 8, 2010, at 12:36 PM, Kevin Wojniak wrote:

 You could try using -[NSMutableAttributedString setAlignment:range:]
 
 
 On Mar 8, 2010, at 12:27 PM, Neil Clayton wrote:
 
 
 Hello All!
 
 I seem unable to align text when drawing using drawAt:point.  The NSTextView 
 shows it OK (so the attributes appear correct), but drawing of the text 
 doesn't show alignment...
 
 My code is:
 
 - (void) awakeFromNib {
  NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
  [nc addObserver:self selector:@selector(updateText:) 
 name:NSTextViewDidChangeTypingAttributesNotification object:nil];
  [nc addObserver:self selector:@selector(updateText:) 
 name:NSTextDidChangeNotification object:nil];
  
  NSString *str = @This is a test\nAnd this text should be right 
 aligned\nBut for some reason, in the image, isn't;
  NSMutableParagraphStyle *pStyle = [[NSMutableParagraphStyle new] 
 autorelease];
  [pStyle setAlignment:NSRightTextAlignment];
  NSDictionary *attrs = [NSDictionary 
 dictionaryWithObjectsAndKeys:pStyle, NSParagraphStyleAttributeName, nil];
  NSAttributedString *as = [[[NSAttributedString alloc] 
 initWithString:str attributes:attrs] autorelease];
  [[text textStorage] setAttributedString:as];
 }
 
 - (void) updateText:(NSNotification*)aNotification {
  [self textChanged:self];
 }
 
 - (IBAction) textChanged:(id)sender {
  NSAttributedString *string = [text attributedString];
  NSSize bounds = [string size];
  
  if(bounds.width  0  bounds.height  0) {
  NSImage *image = [[[NSImage alloc] initWithSize:bounds] 
 autorelease];
  [image lockFocus];
  @try {
  [string drawAtPoint:NSZeroPoint];
  } @finally {
  [image unlockFocus];
  }
  
  [view setImage:image];
  } else {
  [view setImage:nil];
  }
 }
 
 A sample of what I see when I run this is here:
 http://dl.dropbox.com/u/421935/DrawingText/DrawingTest.png
 
 I must be missing something really obvious.  Any ideas?
 
 Neil Clayton
 n...@cloudnine.net.nz
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.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/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.com

___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Richard Somers

On Mar 8, 2010, at 11:58 AM, David Blanton wrote:


I sure would like to solve this problem.


Check this thread out from about one year ago. It sounds similar to  
your problem.


 Subject: NSToolbarItem with custom view in Interface Builder 3  
(Leopard)


 http://lists.apple.com/archives/cocoa-dev/2009/May//msg00600.html

--Richard

___

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

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

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

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


NSNumberFormatter dropping trailing zeros?

2010-03-08 Thread Ryan Stephens
Hi all,

I'm trying to use an NSNumberFormatter to format the text of a
UITextField as a user enters characters.  The issue I'm currently
having is that the number formatter always drops a trailing zero.  For
example, see the following code:

- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string
{
NSNumberFormatter *formatter = [[[NSNumberFormatter alloc] init]
autorelease];
[formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:[NSLocale currentLocale]];

NSString *currentValue = [[formatter
numberFromString:textField.text] stringValue];
NSLog(@current value: %@, currentValue);
}

Assuming currentLocal == en_US and textField.text == $2.30,
[formatter numberFromString:textField.text] returns 2.3.  I'd like it
to return 2.30, so that after removing the decimal point from
currentValue, appending string (assuming string = 0) and inserting
the decimal point again, currentValue would be 23.00 and [formatter
stringFromNumber:[NSDecimalNumber
decimalNumberWithString:currentValue]] would return $23.00.

I've tried adjusting a few properties of the NSNumberFormatter
(setMinimumFractionsDigits: 2 and setMinimumSignificantDigits: 3 to be
specific), but that didn't seem to make any impact similar to the
change I'm looking for.  My only other thought would be to try and
adjust roundingIncrement, but I'm not sure what value I'd be looking
to use.  The NSNumberFormatter docs, Data Formatting Guide and Google
don't seem to be providing any other hints.  Any advice?

Thanks,
Ryan
___

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

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

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

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


Re: Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Neil Clayton
Ta daaa!

And that was it! thank you.

drawRect works just fine.

Neil

On 9/03/2010, at 10:02 AM, Kevin Wojniak wrote:

 Never mind, ignore that. Use drawInRect instead of drawAtPoint. My guess is 
 that when when you draw at a point, Cocoa obviously doesn't have a boundary 
 to right (or center) align the text to, so it just defaults to left-aligned.

___

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

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

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

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


Re: Unable to right align text when drawing via [NSAttributedString drawAt:]

2010-03-08 Thread Kyle Sluder
On Mon, Mar 8, 2010 at 1:26 PM, Neil Clayton n...@cloudnine.net.nz wrote:
 drawRect works just fine.

I'm guessing that if all you were doing is what you've shown, you
wouldn't really need this code at all. :)

But you might want to consider building a text system stack and
reusing it, rather than using -drawInRect: which just has to use a
temporary text system anyway.

--Kyle Sluder
___

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

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

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

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


short question but I don't know how to describe it

2010-03-08 Thread Marx Bievor
Hi,

I can substitute a String with %@ and an int with %d... like in return @Hi I 
am %@ and %d years old, name, age;
what is the right command to substitute a bool and a float? I cannot find any 
reference at apple's docs.

does anyone have a list of those commands?

thank you!
-M___

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

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

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

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


NSServices - Validation bug

2010-03-08 Thread tresa


Hi ,

 

   
I have some queries regarding Services menu validation . I would
like to enable different services provided by my
app based on whether a file or folder is

 

selected in the Finder. I have set NSFilenamesPboardType  as the send type for 
the
services.I have gone through
the 
- (id) validRequestorForSendType:(NSString*)sendType returnType:(NSString 
*)returnType
method but my issue is that the validation there
seems to be 
done based on the sendType and return type. In my case , the
selected file and folder
pasteboard type is the same and I cannot determine whether

 

the selected item in the Finder is a file or folder during the
validation process(This is before the actual service gets invoked i.e when the
services menu is being shown to the user )?
So my question
is that is there any way I can get 
some info about the selected item in the Finder and
validate the different service menus offered by my application based on some 
info regarding the item rather than
the basic

 

validation
of the send and return types ?

 



 

Thanks and regards,

 

Tresa.

 

___

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

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

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

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


Re: reading text rom Pages doc

2010-03-08 Thread Ruedi Heimlicher
Hi
Thanks for all advices. I found a workarround to open and read the file with 
applescript. This is also possible from within Xcode, but very pedantically. I 
only have to read in some names from a list. No interest in text attributes. I 
offer the user to import name lists as .doc and .txt files and wanted to add 
also .pages files.
I just wonder why there is no function in Cocoa to import such text as it is 
possible with MS files.
Ruedi Heimlicher

___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Jon Pugh
At 9:56 AM -0700 3/8/10, David Blanton wrote:
So I ask again, how does one display a custom view containing controls in a 
toolbar?

Typically, all views are told to draw themselves via - [view setNeedsDisplay: 
YES]

Jon
___

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

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

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

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


Re: Weird Bug Report on 10.5

2010-03-08 Thread Jon Pugh
At 9:17 AM -0800 3/8/10, Brent Smith wrote:
The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine 
with 10.5 on it?

According to the Internet, some people have had success running 10.5 under 
VMWare on 10.6.

For example:
http://blog.rectalogic.com/2008_08_01_archive.html

Jon
___

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

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

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

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


Creating NSOutlineView programmatically

2010-03-08 Thread Zack Bartel

Hi Everyone,

I am trying to create an NSOutlineView programmatically inside of an  
NSDrawer. I am using the example datasource from /Developer/Examples/ 
AppKit/OutlineView the FileSystemItem.
My issue is that although the root item is displayed in the  
OutlineView, it is not expandable and does not show any of the  
children. The datasource is identical to the one in the Apple example  
so I'm guessing my issue is the way I am creating the NSOutlineView in  
code rather than in IB. The result is that I see an outlineview with  
one item (the root item) with one table column header and no expand  
icons. If anyone can see something I'm doing wrong I would very much  
appreciate the help

My code is attached.

Thank you ahead of time!
Zack


NSView *contentView = [win contentView];
[contentView setAutoresizesSubviews:YES];


outlineView = [[NSOutlineView alloc] initWithFrame: [contentView  
frame]];


//DataSource. code is attached below
ZBFSDataSource *ds = [[ZBFSDataSource alloc] init];
[outlineView setDataSource: ds];


NSTableColumn *c = [[NSTableColumn alloc] initWithIdentifier: @NAME];
[c setEditable: NO];
[c setMinWidth: 150.0];
[outlineView addTableColumn: c];
[c release];

[outlineView reloadData];

scrollView = [[NSScrollView alloc] initWithFrame: [outlineView frame]];
[scrollView setDocumentView: outlineView];
[scrollView setAutoresizesSubviews: YES];

NSDrawer *drawer = [[NSDrawer alloc]  
initWithContentSize:NSMakeSize(200.0, 400.0) preferredEdge:NSMinXEdge];

[drawer setParentWindow: win];
[drawer setContentView: scrollView];
[drawer open];


DataSource:

- (NSInteger)outlineView:(NSOutlineView *)outlineView  
numberOfChildrenOfItem:(id)item {

return (item == nil) ? 1 : [item numberOfChildren];
}

- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable: 
(id)item {

return (item == nil) ? YES : ([item numberOfChildren] != -1);
}

- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index  
ofItem:(id)item {
return (item == nil) ? [FileSystemItem rootItem] :  
[(FileSystemItem *)item childAtIndex:index];

}

- (id)outlineView:(NSOutlineView *)outlineView  
objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {

return (item == nil) ? @/ : (id)[item relativePath];
}


___

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

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

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

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


Re: short question but I don't know how to describe it

2010-03-08 Thread Nick Zitzmann

On Mar 7, 2010, at 5:07 PM, Marx Bievor wrote:

 I can substitute a String with %@ and an int with %d... like in return @Hi I 
 am %@ and %d years old, name, age;
 what is the right command to substitute a bool and a float? I cannot find any 
 reference at apple's docs.

You generally want to use %f for floats and doubles. An ObjC BOOL is a signed 
8-bit character type, so %hhd ought to work.

 does anyone have a list of those commands?

No, but you do if you have the developer tools. Type man 3 printf in the 
terminal to see what you can do with format strings.

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 arch...@mail-archive.com


Re: reading text rom Pages doc

2010-03-08 Thread Charles Srstka
On Mar 8, 2010, at 10:12 AM, Ruedi Heimlicher wrote:

 Hi
 Thanks for all advices. I found a workarround to open and read the file with 
 applescript. This is also possible from within Xcode, but very pedantically. 
 I only have to read in some names from a list. No interest in text 
 attributes. I offer the user to import name lists as .doc and .txt files and 
 wanted to add also .pages files.
 I just wonder why there is no function in Cocoa to import such text as it is 
 possible with MS files.
 Ruedi Heimlicher

The Pages ’09 format includes a QuickLook/Preview.pdf file inside the ZIP 
archive. If you fed this into PDFDocument and then called its -string method, 
you could get the raw text of the document. However, this is, of course, 
somewhat messy, and could easily break if Apple changes the format such that it 
no longer includes that PDF file.

Charles___

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

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

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

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


Re: short question but I don't know how to describe it

2010-03-08 Thread Ed Wynne


On Mar 8, 2010, at 4:55 PM, Nick Zitzmann wrote:

On Mar 7, 2010, at 5:07 PM, Marx Bievor wrote:

I can substitute a String with %@ and an int with %d... like in  
return @Hi I am %@ and %d years old, name, age;
what is the right command to substitute a bool and a float? I  
cannot find any reference at apple's docs.


You generally want to use %f for floats and doubles. An ObjC BOOL is  
a signed 8-bit character type, so %hhd ought to work.


A much better and future-proof (translation: more paranoid) strategy  
with printf-style format strings, as used by NSString, is to  
explicitly upcast integer parameters to known compatible types. Ie.,  
for a BOOL or any other type of signed integer use %d,(int)value  
instead of relying %hhd that is specific to today's types. Tomorrow  
when BOOL is changed in some way, the upcast will still work and be  
just as correct.


-Ed

___

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

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

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

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


Re: [NSTableview] can't make selected text stay black

2010-03-08 Thread Corbin Dunn

On Mar 5, 2010, at 2:25 PM, Kent Hauser wrote:

 Hi,
 
 I'm trying to make a NSTableView selected row not look selected. I
 subclassed NSTableView  added the following class  delegate methods:
 
 // remove selection indication
 - (void)highlightSelectionInClipRect:(NSRect)clipRect
 {
NSLog (@%s, __FUNCTION__);
 }
 
 // change selected cell text color (delegate method)
 - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
 forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
 {
NSLog (@%s, __FUNCTION__);
if ([cell respondsToSelector:@selector(setTextColor:)])
[(id)cell setTextColor:[NSColor blackColor]];
 }
 
 While the hightlightSelection method does it's job, my delegate method
 doesn't paint the text black. (However, if I use redColor, I get red text).
 
 What am I missing?

How about this: [tableView 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone] ?

--corbin


___

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

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

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

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


Re: NSNumberFormatter dropping trailing zeros?

2010-03-08 Thread Fritz Anderson

On 8 Mar 2010, at 3:06 PM, Ryan Stephens wrote:

 Hi all,
 
 I'm trying to use an NSNumberFormatter to format the text of a
 UITextField as a user enters characters.  The issue I'm currently
 having is that the number formatter always drops a trailing zero.  For
 example, see the following code:
 
 - (BOOL)textField:(UITextField *)textField
 shouldChangeCharactersInRange:(NSRange)range
 replacementString:(NSString *)string
 {
NSNumberFormatter *formatter = [[[NSNumberFormatter alloc] init]
 autorelease];
[formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:[NSLocale currentLocale]];
 
NSString *currentValue = [[formatter
 numberFromString:textField.text] stringValue];
NSLog(@current value: %@, currentValue);
 }
 
 Assuming currentLocal == en_US and textField.text == $2.30,
 [formatter numberFromString:textField.text] returns 2.3.  I'd like it
 to return 2.30

But numberFromString: returns an NSNumber, which represents a numeric value, 
not a string. There's no difference in _numeric_ value between 2.3 and 2.30. 
There is a stringValue method for NSNumber, but it's a convenience method that 
gets you a generic, not-for-a-particular-purpose representation of the value.

The presence, or absence, or having-passed-through of an NSNumberFormatter 
doesn't change the value of the NSNumber.

If you want to do arithmetic with the NSNumber, you could take the doubleValue 
and work on that. It would be better for your purposes to work with an 
NSDecimalNumber; use setGeneratesDecimalNumbers: on the formatter.* Do all your 
arithmetic with NSDecimalNumber methods, and then use the formatter to convert 
the result to NSString.

— F


* The docs that introduce the method discourage using it, but I don't see a 
cleaner way to go from string to decimal.

___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Graham Cox

On 06/03/2010, at 5:45 AM, David Blanton wrote:

 Something that in MFC is trivial is near impossible with Cocoa. The Windows 
 guys here are laughing their ... off at my inability to accomplish a trivial 
 MFC task in a Cocoa equivalent.

It's not near impossible, it's straightforward. I've got an example of this 
in my app, where I put two text fields in a custom view in a toolbar item. 
Worked without a hitch as far as I recall, and reviewing the code I can't see 
that I needed to jump through any special hoops. They may be laughing at your 
inability (they sound like jerks) but that reflects on Cocoa how exactly?

--Graham


___

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

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

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

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


Re: Creating NSOutlineView programmatically

2010-03-08 Thread Kevin Wojniak
You may need to use setOutlineTableColumn: method to set the outline column 
specifically.


On Mar 8, 2010, at 1:07 PM, Zack Bartel wrote:

 Hi Everyone,
 
 I am trying to create an NSOutlineView programmatically inside of an 
 NSDrawer. I am using the example datasource from 
 /Developer/Examples/AppKit/OutlineView the FileSystemItem.
 My issue is that although the root item is displayed in the OutlineView, it 
 is not expandable and does not show any of the children. The datasource is 
 identical to the one in the Apple example so I'm guessing my issue is the way 
 I am creating the NSOutlineView in code rather than in IB. The result is that 
 I see an outlineview with one item (the root item) with one table column 
 header and no expand icons. If anyone can see something I'm doing wrong I 
 would very much appreciate the help
 My code is attached.
 
 Thank you ahead of time!
 Zack
 
 
 NSView *contentView = [win contentView];
 [contentView setAutoresizesSubviews:YES];
 
 
 outlineView = [[NSOutlineView alloc] initWithFrame: [contentView frame]];
 
 //DataSource. code is attached below
 ZBFSDataSource *ds = [[ZBFSDataSource alloc] init];
 [outlineView setDataSource: ds];
 
   
 NSTableColumn *c = [[NSTableColumn alloc] initWithIdentifier: @NAME];
 [c setEditable: NO];
 [c setMinWidth: 150.0];
 [outlineView addTableColumn: c];
 [c release];
 
 [outlineView reloadData];
 
 scrollView = [[NSScrollView alloc] initWithFrame: [outlineView frame]];
 [scrollView setDocumentView: outlineView];
 [scrollView setAutoresizesSubviews: YES];
 
 NSDrawer *drawer = [[NSDrawer alloc] initWithContentSize:NSMakeSize(200.0, 
 400.0) preferredEdge:NSMinXEdge];
 [drawer setParentWindow: win];
 [drawer setContentView: scrollView];
 [drawer open];
 
 
 DataSource:
 
 - (NSInteger)outlineView:(NSOutlineView *)outlineView 
 numberOfChildrenOfItem:(id)item {
return (item == nil) ? 1 : [item numberOfChildren];
 }
 
 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
return (item == nil) ? YES : ([item numberOfChildren] != -1);
 }
 
 - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index 
 ofItem:(id)item {
return (item == nil) ? [FileSystemItem rootItem] : [(FileSystemItem *)item 
 childAtIndex:index];
 }
 
 - (id)outlineView:(NSOutlineView *)outlineView 
 objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
return (item == nil) ? @/ : (id)[item relativePath];
 }
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.com

___

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

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

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

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


UIImageView animationImages problem

2010-03-08 Thread patrick machielse
I'm trying to run small, full screen, 1 second long animations using the 
UIImageView animationImages property. The animation consists of a maximum of 9 
frames, running at 18 frames per second. UIImages are re-used in the image 
array to conserve memory. Each time an animation runs, a new set of images is 
first assigned to the UIImageView and then -startAnimation is called.

My controller's code:

[self preloadAnimation]; /* sets up the animationImages */
[imageView startAnimating];

The problem I experiece is that the animation is not smooth. Most of the time 
there is a short delay, after which the first frames are 'rushed' out to catch 
up with 'animated time'. Sometimes the animation doesn't run at all.

I've found that the following helps to work around this:

[self preloadAnimation];
[imageView startAnimating];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate 
dateWithTimeIntervalSinceNow:1.0/FPS]];
[imageView stopAnimating];
[imageView startAnimating];

It seems that starting animation just for a short while triggers all images to 
be loaded into memory before the animation starts running. Although it works 
for the moment, it looks quite fragile and not something I want to use in my 
final code.

Is there a better solution to get animationImages to work reliably? Am I doing 
something wrong? Can I force loading of my UIImage array 'by hand'?

patrick___

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

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

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

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


EventLoop

2010-03-08 Thread Tony Romano
I have an application that updates the image on a cell.  Sometimes I present a 
modal sheet right after I setImage.  This code is executing in an action sent 
from the NSMatrix containing the cells.  The behavior I am seeing is the sheet 
rendering occurs then the image is updated.  I suspect since the event loop 
hasn't run prior to my call to beginSheetModalForWindow, the messages to update 
the cell image are not being processed. 

I've done a fair bit of research looking into the event loop and nothing pops 
out as the best method.  Any thoughts?

TIA,
-tony


___

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

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

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

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


Re: EventLoop

2010-03-08 Thread Paul Sanders
Calling -[NSView displayIfNeeded] on the NSMatrix before you 
display the modal sheet might do what you want.  You might also 
need to call -[NSWindow flushWindow] on the window containing 
the NSMatrix, but try it first without.  Unnecessary flushes 
hurt performance.

Paul Sanders.

- Original Message - 
From: Tony Romano tony...@hotmail.com
To: Cocoa Developers Cocoa-dev@lists.apple.com
Sent: Monday, March 08, 2010 10:49 PM
Subject: EventLoop


I have an application that updates the image on a cell. 
Sometimes I present a modal sheet right after I setImage.  This 
code is executing in an action sent from the NSMatrix containing 
the cells.  The behavior I am seeing is the sheet rendering 
occurs then the image is updated.  I suspect since the event 
loop hasn't run prior to my call to beginSheetModalForWindow, 
the messages to update the cell image are not being processed.

I've done a fair bit of research looking into the event loop and 
nothing pops out as the best method.  Any thoughts?

TIA,
-tony



___

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

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

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

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


Re: [NSTableview] can't make selected text stay black

2010-03-08 Thread Kent Hauser
On Mon, Mar 8, 2010 at 12:20 PM, Corbin Dunn corb...@apple.com wrote:


 On Mar 5, 2010, at 2:25 PM, Kent Hauser wrote:

  Hi,
 
  I'm trying to make a NSTableView selected row not look selected. I
  subclassed NSTableView  added the following class  delegate methods:
 


 How about this: [tableView
 setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone] ?

 --corbin



This is exactly what I want -- but it's SL only. I've been trying to find a
10.5 solution as well. But NSTextFieldCell seems determined to hightlight
itself (bold  white) no matter how I ask it not to.  Any help would be
greatly appreciated.

Thanks.

Kent
___

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

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

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

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


Re: short question but I don't know how to describe it

2010-03-08 Thread Marx Bievor
Thanks to everyone who answered me. I appreciate your effort.
-M
Am 08.03.2010 um 23:16 schrieb Ed Wynne:

 
 On Mar 8, 2010, at 4:55 PM, Nick Zitzmann wrote:
 On Mar 7, 2010, at 5:07 PM, Marx Bievor wrote:
 
 I can substitute a String with %@ and an int with %d... like in return @Hi 
 I am %@ and %d years old, name, age;
 what is the right command to substitute a bool and a float? I cannot find 
 any reference at apple's docs.
 
 You generally want to use %f for floats and doubles. An ObjC BOOL is a 
 signed 8-bit character type, so %hhd ought to work.
 
 A much better and future-proof (translation: more paranoid) strategy with 
 printf-style format strings, as used by NSString, is to explicitly upcast 
 integer parameters to known compatible types. Ie., for a BOOL or any other 
 type of signed integer use %d,(int)value instead of relying %hhd that is 
 specific to today's types. Tomorrow when BOOL is changed in some way, the 
 upcast will still work and be just as correct.
 
 -Ed
 

___

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

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

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

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


Re: [NSTableview] can't make selected text stay black

2010-03-08 Thread Kevin Wojniak
What about overriding the drawTitleXXX method and just draw the text yourself?


On Mar 8, 2010, at 3:15 PM, Kent Hauser wrote:

 On Mon, Mar 8, 2010 at 12:20 PM, Corbin Dunn corb...@apple.com wrote:
 
 
 On Mar 5, 2010, at 2:25 PM, Kent Hauser wrote:
 
 Hi,
 
 I'm trying to make a NSTableView selected row not look selected. I
 subclassed NSTableView  added the following class  delegate methods:
 
 
 
 How about this: [tableView
 setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone] ?
 
 --corbin
 
 
 
 This is exactly what I want -- but it's SL only. I've been trying to find a
 10.5 solution as well. But NSTextFieldCell seems determined to hightlight
 itself (bold  white) no matter how I ask it not to.  Any help would be
 greatly appreciated.
 
 Thanks.
 
 Kent
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.com

___

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

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

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

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


Re: Creating NSOutlineView programmatically

2010-03-08 Thread Zack Bartel

Thank you, Kevin. That was exactly what I was missing

Thanks!!

On Mar 8, 2010, at 2:37 PM, Kevin Wojniak wrote:

You may need to use setOutlineTableColumn: method to set the outline  
column specifically.



On Mar 8, 2010, at 1:07 PM, Zack Bartel wrote:


Hi Everyone,

I am trying to create an NSOutlineView programmatically inside of  
an NSDrawer. I am using the example datasource from /Developer/ 
Examples/AppKit/OutlineView the FileSystemItem.
My issue is that although the root item is displayed in the  
OutlineView, it is not expandable and does not show any of the  
children. The datasource is identical to the one in the Apple  
example so I'm guessing my issue is the way I am creating the  
NSOutlineView in code rather than in IB. The result is that I see  
an outlineview with one item (the root item) with one table column  
header and no expand icons. If anyone can see something I'm doing  
wrong I would very much appreciate the help

My code is attached.

Thank you ahead of time!
Zack


NSView *contentView = [win contentView];
[contentView setAutoresizesSubviews:YES];


outlineView = [[NSOutlineView alloc] initWithFrame: [contentView  
frame]];


//DataSource. code is attached below
ZBFSDataSource *ds = [[ZBFSDataSource alloc] init];
[outlineView setDataSource: ds];


NSTableColumn *c = [[NSTableColumn alloc] initWithIdentifier:  
@NAME];

[c setEditable: NO];
[c setMinWidth: 150.0];
[outlineView addTableColumn: c];
[c release];

[outlineView reloadData];

scrollView = [[NSScrollView alloc] initWithFrame: [outlineView  
frame]];

[scrollView setDocumentView: outlineView];
[scrollView setAutoresizesSubviews: YES];

NSDrawer *drawer = [[NSDrawer alloc]  
initWithContentSize:NSMakeSize(200.0, 400.0)  
preferredEdge:NSMinXEdge];

[drawer setParentWindow: win];
[drawer setContentView: scrollView];
[drawer open];


DataSource:

- (NSInteger)outlineView:(NSOutlineView *)outlineView  
numberOfChildrenOfItem:(id)item {

  return (item == nil) ? 1 : [item numberOfChildren];
}

- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable: 
(id)item {

  return (item == nil) ? YES : ([item numberOfChildren] != -1);
}

- (id)outlineView:(NSOutlineView *)outlineView child: 
(NSInteger)index ofItem:(id)item {
  return (item == nil) ? [FileSystemItem rootItem] :  
[(FileSystemItem *)item childAtIndex:index];

}

- (id)outlineView:(NSOutlineView *)outlineView  
objectValueForTableColumn:(NSTableColumn *)tableColumn byItem: 
(id)item {

  return (item == nil) ? @/ : (id)[item relativePath];
}


___

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

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

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


This email sent to kain...@kainjow.com




___

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

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

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

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


Re: Custom View in Toolbar

2010-03-08 Thread Gregory Weston
David Blanton wrote:

 So, it is not the workman it is the tool. Proven by how long it took  
 Apple to include toolbar support in IB and the fact that there is not  
 one answer or example anywhere on how to do what is supposed to be  
 trivial.  Ergo, I stand by may statement that a trivial task in MFC is  
 consuming lots of time to do in Cocoa. Does that not point to either  
 poor tool design or poor documentation?

Your statement is flawed, both as a matter of fact and of logic. Nothing about 
the scenario or circumstances you describe proves the tool is flawed.

I just sat down and attempted to accomplish what you're describing. It took 15 
minutes and well under a dozen lines of code. Given that I've done nothing with 
toolbars in the past, I consider this to meet the colloquial definition of 
trivial. Your original question was this: What am I not enabling to keep 
this from being visible?

I submit that the question is flawed. You shouldn't be asking what you've 
neglected to do. You should be looking at what you *are* doing that's 
preventing proper operation. And that's not going to be answered here based on 
the amount of code I've seen you post.
___

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

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

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

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


Re: short question but I don't know how to describe it

2010-03-08 Thread Clark Cox
On Mon, Mar 8, 2010 at 2:16 PM, Ed Wynne ar...@phasic.com wrote:

 On Mar 8, 2010, at 4:55 PM, Nick Zitzmann wrote:

 On Mar 7, 2010, at 5:07 PM, Marx Bievor wrote:

 I can substitute a String with %@ and an int with %d... like in return
 @Hi I am %@ and %d years old, name, age;
 what is the right command to substitute a bool and a float? I cannot find
 any reference at apple's docs.

 You generally want to use %f for floats and doubles. An ObjC BOOL is a
 signed 8-bit character type, so %hhd ought to work.

 A much better and future-proof (translation: more paranoid) strategy with
 printf-style format strings, as used by NSString, is to explicitly upcast
 integer parameters to known compatible types.

For types smaller than int, there is no need to explicitly cast; the
standard guarantees that such values are converted to int (or unsigned
int)  implicitly. In fact, the 'h' and 'hh' modifiers are completely
redundant and are ignored when passed to printf-like functions (their
only real use is in scanf).

Given:

char c = ...;

All of the following are identical:

printf(%hhd, c);
printf(%hd, c);
printf(%d, c);

-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Objective-C Garbage Collection problems

2010-03-08 Thread Josh de Lioncourt

This is a very perplexing problem. I hope someone can shed some light on it.

1. I have a project which uses an open source framework which is already 
compiled.

2. The open source framework, in its own Xcode project, compiles just fine 
whether Objective-C garbage colection is set to supported or unsupported. No 
problems.

3. In my project, (a very very simple project meant for example purposes), 
everything compiles and runs just fine if garbage collection is set to 
unsupported.

4. When garbage collection is supported, everything builds, but I receive this 
message when the app launches:
GDB: Data Formatters temporarily unavailable, will re-try after a 'continue'. 
(Not safe to call dlopen at this time.)

I'm exceptionally confused. I don't actually think the framework is the 
problem. The code compiles and runs fine when garbage collection is 
unsupported, so I don't think there's anything wrong there either.

Is there another build setting I need to change that I'm missing somewhere?

Thanks guys.

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 arch...@mail-archive.com


Re: short question but I don't know how to describe it

2010-03-08 Thread Greg Parker
On Mar 8, 2010, at 3:54 PM, Clark Cox wrote:
 For types smaller than int, there is no need to explicitly cast; the
 standard guarantees that such values are converted to int (or unsigned
 int)  implicitly. In fact, the 'h' and 'hh' modifiers are completely
 redundant and are ignored when passed to printf-like functions 

... unless you're printing signed variables using %x, for one. 

% cat test.c
#include stdio.h
int main() {
short x = -1;
printf(hx 0x%hx\n, x);
printf(x  0x%x\n, x);
return 0;
}
% cc test.c
% ./a.out
hx 0x
x  0x

(Hint: Implicit promotion to int, and sign extension.)


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: short question but I don't know how to describe it

2010-03-08 Thread Clark Cox
On Mon, Mar 8, 2010 at 4:04 PM, Greg Parker gpar...@apple.com wrote:
 On Mar 8, 2010, at 3:54 PM, Clark Cox wrote:
 For types smaller than int, there is no need to explicitly cast; the
 standard guarantees that such values are converted to int (or unsigned
 int)  implicitly. In fact, the 'h' and 'hh' modifiers are completely
 redundant and are ignored when passed to printf-like functions

 ... unless you're printing signed variables using %x, for one.

If you're printing signed variables using %x, then you're doing it wrong :)
%x requires an unsigned value.


-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Using Core Data in Command Line utility

2010-03-08 Thread Paul Johnson
I've created an Xcode project using the Command Line Tool template
with the Type set to Core Data.

I defined an Entity with 3 Properties. Two of the Properties are
strings and one is an integer (Int 16).

I fetch data from 3 files read from the internet and use a scanner
which extracts the strings. The integer is an index identifying the
file.

In the innermost scanner loop, I am trying to use
NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext, to create an
NSManagedObject which I then want to populate with the two strings and
the integer using [object setValue:forKey:]

The problem I'm having is the line that tries to store the integer:
[object setValue:i forKey:@fileIndex];

I get the compiler error Passing argument 1 of 'setValueforKey'
makes pointer from integer without a cast.

Can anyone tell me how to fix this? I'm also wondering if I'm using
the correct methods to accomplish the task.
___

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

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

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

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


Re: Using Core Data in Command Line utility

2010-03-08 Thread Roland King



Paul Johnson wrote:


In the innermost scanner loop, I am trying to use
NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext, to create an
NSManagedObject which I then want to populate with the two strings and
the integer using [object setValue:forKey:]

The problem I'm having is the line that tries to store the integer:
[object setValue:i forKey:@fileIndex];

I get the compiler error Passing argument 1 of 'setValueforKey'
makes pointer from integer without a cast.

Can anyone tell me how to fix this? I'm also wondering if I'm using
the correct methods to accomplish the task.
___


setValue:forKey takes an id (NSObject*) not an integer. You need to wrap 
your integer into an NSNumber, [ NSNumber numberWithInt:i ] and set that.

___

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

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

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

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


Re: Using Core Data in Command Line utility

2010-03-08 Thread Jim Correia
On Mar 8, 2010, at 8:44 PM, Paul Johnson wrote:

 The problem I'm having is the line that tries to store the integer:
 [object setValue:i forKey:@fileIndex];
 
 I get the compiler error Passing argument 1 of 'setValueforKey'
 makes pointer from integer without a cast”.

-setValue:forKey: takes an object for the value parameter. You have to pass an 
object - in this case our integer boxed in an NSNumber object.

 Can anyone tell me how to fix this? I'm also wondering if I'm using
 the correct methods to accomplish the task.

You should also take a look Core Data’s dynamically generated accessor methods. 
These are typically what you should be using to set and access properties on 
your managed objects.

Jim

___

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

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

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

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


NSImage change of behaviour?

2010-03-08 Thread Graham Cox
Not sure if this is a bug or not, but it's certainly something that seems to 
have changed and I can find no mention of it in the release notes or elsewhere.

Typically when making an image for use as a drag image, I draw a bunch of 
things into an image, then copy it to itself with 50% alpha. This has always 
worked fine, using the following general approach:

NSImage* image = [[NSImage alloc] initWithSize:]

[image lockFocus];

// ... draw a bunch of stuff ...

// copy to self at 50% opacity
[image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy 
fraction:0.5];
[image unlockFocus];


I'm now finding that I don't get the semi-transparent image, but just a fully 
opaque image. I can workaround it like so:

NSImage* image = [[NSImage alloc] initWithSize:]

[image lockFocus];

// ... draw a bunch of stuff ...

[image unlockFocus];

[image lockFocus];
[image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy 
fraction:0.5];
[image unlockFocus];


So the extra unlock/lock seems to trigger some internal change that allows the 
transparent effect to work, but that wasn't needed in the past.

Anyone care to comment? Maybe the old way was always broken and it worked by 
chance, or maybe a change to image functionality didn't anticipate this usage 
pattern...

--Graham


___

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

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

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

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


Re: Objective-C Garbage Collection problems

2010-03-08 Thread Quincey Morris
On Mar 8, 2010, at 16:01, Josh de Lioncourt wrote:

 1. I have a project which uses an open source framework which is already 
 compiled.
 
 2. The open source framework, in its own Xcode project, compiles just fine 
 whether Objective-C garbage colection is set to supported or unsupported. No 
 problems.
 
 3. In my project, (a very very simple project meant for example purposes), 
 everything compiles and runs just fine if garbage collection is set to 
 unsupported.
 
 4. When garbage collection is supported, everything builds, but I receive 
 this message when the app launches:
 GDB: Data Formatters temporarily unavailable, will re-try after a 'continue'. 
 (Not safe to call dlopen at this time.)
 
 I'm exceptionally confused. I don't actually think the framework is the 
 problem. The code compiles and runs fine when garbage collection is 
 unsupported, so I don't think there's anything wrong there either.

It's not entirely clear how the framework has been written. If your application 
is set to use garbage collection, then it requires its frameworks to use 
garbage collection too. In that case, you must:

-- Build the framework with its GC build setting set to 'supported' or 
'required'. This causes the compiler to emit object code that's aware of strong 
and weak references, for example.

-- Ensure that the framework actually has source code to support GC. This 
involves arranging for references to objects and GC memory to be maintained so 
as to give them proper lifetimes. The compiler can't do that for you, in 
general.

Therefore, if the framework isn't coded for GC compatibility, it's likely going 
to be unusable at runtime in a GC app, no matter how you set the build settings.

Was the framework written with code for both GC and non-GC environments?


___

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

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

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

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


Re: Using Core Data in Command Line utility

2010-03-08 Thread Paul Johnson
Thanks for the quick reply, Roland. That's exactly what I needed to
solve the problem.

A couple of side questions:
1. Another way to archive the data is to use dataOfType:error: and I
wonder if one way is preferable over the other.
2. I use the save: method to write the data and there are two files
created: a .mom file that describes the data model and an sqlite file
containing the actual data. Another program is going to read the data
file and I'm assuming only the sqlite file needs to be read (and the
.mom file just ignored). To read the data I plan to use
readFromData:ofType:error:. Instead of the save: method when would one
archive the data using dataOfType:error:?

On Mon, Mar 8, 2010 at 7:48 PM, Roland King r...@rols.org wrote:


 Paul Johnson wrote:

 In the innermost scanner loop, I am trying to use
 NSEntityDescription
 insertNewObjectForEntityForName:inManagedObjectContext, to create an
 NSManagedObject which I then want to populate with the two strings and
 the integer using [object setValue:forKey:]

 The problem I'm having is the line that tries to store the integer:
 [object setValue:i forKey:@fileIndex];

 I get the compiler error Passing argument 1 of 'setValueforKey'
 makes pointer from integer without a cast.

 Can anyone tell me how to fix this? I'm also wondering if I'm using
 the correct methods to accomplish the task.
 ___

 setValue:forKey takes an id (NSObject*) not an integer. You need to wrap
 your integer into an NSNumber, [ NSNumber numberWithInt:i ] and set that.

___

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

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

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

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


Re: NSApp question

2010-03-08 Thread Rick C.


thanks for the reply!  yes i asked because according to my testing using 
activateIgnoringOtherApps does not show a window that is not visible.  it will 
definitely bring to the front a window that is already visible.  and in this 
case i am not using makeKeyAndOrderFront which i know will also show a window.  
i have not used makeMainWindow and though it is not a document-based app by 
design i do have it setup where clicking the dock icon will show my main 
window by sending a message to that window.  but i believe that's unrelated 
correct me if i'm wrong.

according to some reports at the stage i'm calling activateIgnoringOtherApps 
the main window is being shown although previously hidden, and the dock icon 
is not being clicked.  the reports seem reliable but i cannot reproduce it 
myself no matter what i do.  so i was looking for some input.  thank you very 
much for your time,

rick






From: Quincey Morris quinceymor...@earthlink.net
To: cocoa-dev cocoa-dev@lists.apple.com
Sent: Tue, March 9, 2010 1:35:56 AM
Subject: Re: NSApp question

On Mar 8, 2010, at 03:03, Rick C. wrote:

 i have a question regarding this line:
 
 [NSApp activateIgnoringOtherApps:YES];
 
 now i know this will activate the app, but for example if the main window of 
 the app is closed should it cause the window to show?  i think it would not, 
 but it seems some people claim that it does.  as a note, this is used without 
 sending a makeKeyAndOrderFront to the main window.  thank you for your input,

It seems like the easiest way to find out would be to try it.

The trouble with following random claims by some people is that they're as 
likely to be wrong as to be right. Or they may be talking about something else. 
In a *document-based* app, activating the app when there are no document 
windows open will (by default) cause a new untitled document window to be 
opened.

However, you seem to talking about a non-document-based app. In that case, the 
behavior seems unlikely, if for no other reason than there's no formal concept 
of the main window -- in the sense of a primary window. (Presumably you don't 
mean in the isMainWindow sense, since closed windows can't be main windows in 
the isMainWindow sense.) So, the frameworks would have no basis on which to 
choose which closed window to show.


___

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

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

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

This email sent to jo_p...@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 arch...@mail-archive.com


Determining bounds of a glyph

2010-03-08 Thread Philip White
Sorry, that's not a very good subject title. Here's what I'm giving myself a 
headache trying to do:

For a fixed-pitch font I want to generate images of various glyphs for use in 
OpenGL. I may be generating large numbers of such images so I don't want to use 
the NSString/NSAttributedString convenience drawing methods. I want each image 
to have the same dimensions and have the glyphs correctly positioned in them 
such that if I draw the images immediately next to each other they will be 
correctly laid out.

Here's some of what I've tried.
I figure the image size needs to have the proportions (in terms of the font)
width = maximum advancement (which should be the same advancement for 
all glyphs)
height = font ascender + absolute value of font descender

I'm not interested in laying out more than one line so I figure I needn't 
concern myself with the leading.

My first problem is that for a given image size with the above proportions, I'm 
not sure how to exactly size the font correctly. I tried using the following, 
starting with a font size I know to be smaller than I want:

//set the textStorage to a test string. Fonts we are using are fixed 
width so it doesn't matter what
[textStorage addAttribute:NSFontAttributeName value:font 
range:NSMakeRange(0,[textStorage length])];
[textStorage replaceCharactersInRange:NSMakeRange(0,[textStorage 
length]) withString:@w];

NSRect bounds = [layoutManager boundingRectForGlyphRange:[layoutManager 
glyphRangeForTextContainer:textContainer]

 inTextContainer:textContainer];
float multiplier = imageWidth/bounds.size.width;

font = [[NSFontManager sharedFontManager] convertFont:font toSize:[font 
pointSize]*multiplier];
[textStorage addAttribute:NSFontAttributeName value:font 
range:NSMakeRange(0,[textStorage length])];

However, when I draw the glyph with Courier as the font, it doesn't fit 
vertically, though it looks sized correctly horizontally. When I draw it with 
Monaco, there seems to be excess vertical space, though maybe Monaco has an 
especially tall glyph that I don't know about.

My next problem is how to draw it correctly. I'm having the best luck drawing 
the glyph with an NSBezierPath but that seems unnecessary to me. With 
NSBezierPath I start by positioning using the moveTo: method, setting the 
location to (0, imageHeight*abs(descender)/(ascender+abs(descender)), then 
getting the glyph from the layout manager and adding that to the path. This 
seems to position glyphs pretty consistently.

However, if I used NSLayoutManager's drawGlyphsForGlyphRange:atPoint: using the 
point (0,0), the vertical placement of the glyphs is all crazy, way up high out 
mainly out of the image. I figure that the leading is shifting it up but 
sending the leading message to an NSFont representing courier reports a 
leading of zero, so why the shift there?. Also, Courier and Monaco are 
positioned on very different baselines using this method.

Sorry that was so long. What metrics am I missing here? What don't I understand 
about how the layout manager positions glyphs vertically relative to the point 
you give it? And how do I correctly size my image to contain the glyph?

Oh man, I've got to stop working on this now, I'm going to have glyph 
nightmares tonight…

Many thanks,
  Philip White

P.S. I'm doing all of my drawing into an 
NSBitmapImageRep___

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

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

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

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


Re: NSImage change of behaviour?

2010-03-08 Thread Ken Ferry
Hi Graham,

I don't think the problem is exactly what is described here.  A test app
behaves as expected.  http://homepage.mac.com/kenferry/temp/ImageTest.zip.

However, I could believe that what your seeing does have something to do
with locking focus on an image and then drawing from that image into itself.
 Quoth the release notes:

Another issue we've seen is with clients calling -lockFocus on an image,
then drawing the image elsewhere before calling -unlockFocus. This no longer
works. The NSImage itself is not modified until -unlockFocus is called, as
described above.

That is, in 10.6, you're drawing the image as it was prior to the
-lockFocus.  It's sort of like a double buffer.

Drawing an image while focus is locked on it should be avoided.  There are
probably lots of ways to get the effect your app wants (most more readable
than the following), but a direct way to halve the alpha channel is to draw
with DestinationIn mode.

NSCompositeDestinationIn

Destination image wherever both images are opaque, and transparent
elsewhere. (R = D*Sa)

Result = Destination * source alpha.  Destination is the color that is
already there, source is the new color you're drawing.

[[[NSColor clearColor] colorWithAlphaComponent:0.5] set];

NSRectFillUsingOperation(imBounds, NSCompositeDestinationIn);

-Ken

On Mon, Mar 8, 2010 at 6:25 PM, Graham Cox graham@bigpond.com wrote:

 Not sure if this is a bug or not, but it's certainly something that seems
 to have changed and I can find no mention of it in the release notes or
 elsewhere.

 Typically when making an image for use as a drag image, I draw a bunch of
 things into an image, then copy it to itself with 50% alpha. This has always
 worked fine, using the following general approach:

 NSImage* image = [[NSImage alloc] initWithSize:]

 [image lockFocus];

 // ... draw a bunch of stuff ...

 // copy to self at 50% opacity
 [image drawAtPoint:NSZeroPoint fromRect:NSZeroRect
 operation:NSCompositeCopy fraction:0.5];
 [image unlockFocus];


 I'm now finding that I don't get the semi-transparent image, but just a
 fully opaque image. I can workaround it like so:

 NSImage* image = [[NSImage alloc] initWithSize:]

 [image lockFocus];

 // ... draw a bunch of stuff ...

 [image unlockFocus];

 [image lockFocus];
 [image drawAtPoint:NSZeroPoint fromRect:NSZeroRect
 operation:NSCompositeCopy fraction:0.5];
 [image unlockFocus];


 So the extra unlock/lock seems to trigger some internal change that allows
 the transparent effect to work, but that wasn't needed in the past.

 Anyone care to comment? Maybe the old way was always broken and it worked
 by chance, or maybe a change to image functionality didn't anticipate this
 usage pattern...

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

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

___

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

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

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

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


Re: problems loading a sound with NSSound

2010-03-08 Thread Jonathan Chacón
Hello,


this works great!
NSSound *logoSound = [NSSound soundNamed: @logoSound];
[logoSound play];


thanks!

regards
Jonathan Chacón


El 08/03/2010, a las 12:20, Keith Blount escribió:

 NSSound doesn't respond to -initWithContentsOfFile: (it responds to 
 -initWithContentsOfFile:byReference:), so you should be seeing errors on the 
 console if that is how you are trying to init your NSSound object. (Also note 
 that in the code you posted there is a memory leak, so it would be better to 
 return [sound autorelease]).
 
 I'm not sure why you need the -getSound: method at all, though - what is 
 wrong with NSSound's -soundNamed:?
 
 NSSound *logoSound = [NSSound soundNamed:@logoSound];
 [logoSound play];
 
 All the best,
 Keith
 
 
 - Original Message 
 
 Hello,
 
 I added a sound file to the resources of my project ( logoSound.AIF )
 
 I use this function to load the resource:
 
 -(NSSound*) getSound:(NSString *) sndValue {
NSBundle *bundle = [ NSBundle bundleForClass: [ self class ] ];
NSString *sndName = [ bundle pathForResource: sndValue ofType: @aif ];
NSSound *sound = [ [ NSSound alloc ] 
  initWithContentsOfFile: sndName ];
return sound;
 } // getSound
 
 
 I do this to load the sound file:
 
 NSSound *logoSound = [self getSound: @logoSound];
 
 I try:
 [logoSound play];
 
 but the sound doesn't play
 
 
 what happend?
 
 
 thanks
 
 
 

___

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

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

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

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


NSTableViewDropAbove visual remnant

2010-03-08 Thread Steve Cronin
Folks;

I have a tableView which is working pretty handily.

I support a form of import by dropping a text file on it.
The backing arrayController returns an NSTableViewDropAbove for UI 
feedback purposes.
(the row the file is dropped on (or above) doesn't actually matter)
I chose NSTableViewDropAbove because DropOn might cause some to feel 
that a replacement would occur….

When I have complete the import process I call rearrangeObjects and all is well 
there is a bound filter predicate in the windowController

EXCEPT the targetting indicator in the tableView remains visible…

How do I clear this?

Thanks for your consideration,
Steve___

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

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

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

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


Re: NSImage change of behaviour?

2010-03-08 Thread Graham Cox

On 09/03/2010, at 3:53 PM, Ken Ferry wrote:

 Drawing an image while focus is locked on it should be avoided.  There are 
 probably lots of ways to get the effect your app wants (most more readable 
 than the following), but a direct way to halve the alpha channel is to draw 
 with DestinationIn mode.  


Thanks Ken, that works very nicely. Seems readable enough to me... 

--Graham


___

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

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

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

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


NSTextView attachments and context menus

2010-03-08 Thread Martin Hewitson
Dear list,

I have an NSTextView which support dragging files in, either to create a link 
to the file, or to add the file as an attachment. So far so good. 

Now I want to offer the user a context menu to perform operations on the 
attachment (open, save, etc). So far I was unable to find a way to intercept a 
'right-click' on the nstextview to offer a custom context menu. What I did get 
working is the single left-click version by implementing 
textView:clickedOnCell:inRect:atIndex: in the text view's delegate. In that 
method I create a context menu and show it at the mouse location using NSMenu's 
popUpContextMenu:withEvent:forView:. That works, but with one problem. The 
context menu that appears has two additional menu items: Import Image and 
Capture Selection from Screen. So I have three questions:

1) Is there a better way to achieve what I want?
2) Where do these additional menu items come from? Are they services?
3) How could I do this with a right-click instead of a single-click?

I have another question about attachments, but I'll post that separately.

Thanking you in advance,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

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