CA: fillMode and rotation animation . . .

2008-11-11 Thread Michael A. Crawford
I have a number of layers that use rotation animation about the Z- 
axis.  Whenever the animation(s) complete the layer returns to the  
original state (zero rotational offset).  I set the fillMode attribute  
to be kCAFillModeForwards in order to preserve the layer in its  
transformed state but this does not help.  I must not correctly  
understand how fillMode is to be used.  Anyone have a suggestion as to  
how I can achieve the desired result and have the result of the  
animation stick?


-Michael
--
The united stand.  The divided get played.

-- Bernie MAC




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

NSTableView text color of cells in highlighted rows unreadable

2008-11-11 Thread Alexander Reichstadt

Hi,

I am trying to turn off the highlight color. I subclassed NSTableView  
and NSTextAttachmentCell. In my tv-subclass I override - 
(void)highlightSelectionInClipRect:(NSRect)theClipRect and use  
clearColor to draw the selected rows which works. But I haven't found  
the way to draw the text in black regardless of the row's hightlight- 
state, so it continues to write the cell content in white on a white  
background whenever it's highlighted.


Can someone please point me into the right direction?

Thanks
Alexander

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Information request on Iphone for playing pls files

2008-11-11 Thread Arnab Ganguly
Hi All,
Just curious to know, is it possible to listen to shoutcast radio stations
in Iphone ... what is the application it uses for this?
If it is posted in wrong forum sorry for the inconvenience caused.If
possible please give me information about the correct list.

Thanks in advance
Arnab
___

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

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

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

This email sent to [EMAIL PROTECTED]


[OT] Re: Information request on Iphone for playing pls files

2008-11-11 Thread Roland King

not the right forum, this is for discussing cocoa development on iPhone.

I used google

http://www.google.com/search?hl=enrls=com.microsoft%3A*q=google+iphone+shoutcast+itunes+store


Arnab Ganguly wrote:


Hi All,
Just curious to know, is it possible to listen to shoutcast radio stations
in Iphone ... what is the application it uses for this?
If it is posted in wrong forum sorry for the inconvenience caused.If
possible please give me information about the correct list.

Thanks in advance
Arnab
___

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

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

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

This email sent to [EMAIL PROTECTED]
 



___

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

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

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

This email sent to [EMAIL PROTECTED]


MEETING: Chicago CocoaHeads/CAWUG Tuesday November 11th

2008-11-11 Thread Bob Frank

Just a reminder, hope to see you tonight.

The Chicago CocoaHeads / Chicago Cocoa and WebObjects User Group  
(CAWUG) is holding our next meeting Tuesday, November 11th, at 7:00  
PM at the Apple Store on Michigan Ave.



Agenda:
- Introductions  Announcements
- Your first cocoa project, overview of Apple's developer tools
- adjournment to O'Toole's

When:   
Tuesday, November 11th, 7:00 PM

Where:
Apple Store Michigan Avenue
679 North Michigan Ave. (at the corner of Huron  Michigan Ave.)
Chicago, IL 60611
	 	http://maps.google.com/maps?f=qhl=engeocode=q=679+North+Michigan 
+Ave.+Chicago,+IL 
+60611sll=37.0625,-95.677068sspn=45.688268,90.615234ie=UTF8z=16iwlo 
c=addr

http://tinyurl.com/Michigan-Ave-Apple-Store
(in case long URL gets cut)


- Continuing on with the theme last months presentation, Bob will  
discuss how use the tools to get started with your first project  
using the developer tools on the Mac Platform.



- O'Tooles

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



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.



Future meetings dates and tentative topics:  12/9/08, 1/13/09


CAWUG Resources

Mail list: http://groups.google.com/group/cawug
Google Site: http://groups.google.com/group/cawug
Web Site: http://www.cawug.org/
RSS feed: http://www.cawug.org/rss.xml

http://ical.mac.com/chicagobob/Chicago-CocoaHeads-CAWUG
webcal://ical.mac.com/chicagobob/Chicago-CocoaHeads-CAWUG.ics

Cocoa Heads web site:
http://cocoaheads.org/us/ChicagoIllinois/index.html


Hope to see you at the meeting.

-Bob

___

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

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

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

This email sent to [EMAIL PROTECTED]


Play/Pause, rew/ff keys ...

2008-11-11 Thread I. Savant

List:

  Does anyone have experience intercepting the play/pause and rew/ff  
(seek back / seek forward) keys on some keyboards? Particularly, the  
MacBook / MacBook Pro keyboards?


  These keys control iTunes and QuickTime just fine when they're  
running but I'd like to intercept them myself as well. Assuming I'm  
using the right terms, I don't see any mention in the archives, on  
cocoadev.com, or anything useful on the web at large.


  I've tried capturing the events in the raw but they never make it  
to the app, so I poked around in the Keyboard  Mouse (Keyboard  
Shortcuts) system prefs. The only use I see of F8 (the play/pause key  
on the latest MacBook) requires pressing the fn key to trigger it  
since simply pressing the keys unmodified is not considered F1-Fn.


  So I was hoping someone else had figured this out. :-)

--
I.S.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CA: fillMode and rotation animation . . .

2008-11-11 Thread Matt Long

You also need to set it to not remove the animation on completion.

[animation setRemovedOnCompletion:NO]

-Matt

On Nov 11, 2008, at 1:00 AM, Michael A. Crawford wrote:

I have a number of layers that use rotation animation about the Z- 
axis.  Whenever the animation(s) complete the layer returns to the  
original state (zero rotational offset).  I set the fillMode  
attribute to be kCAFillModeForwards in order to preserve the layer  
in its transformed state but this does not help.  I must not  
correctly understand how fillMode is to be used.  Anyone have a  
suggestion as to how I can achieve the desired result and have the  
result of the animation stick?


-Michael
--
The united stand.  The divided get played.

-- Bernie MAC


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread Jason Sallis

You might want to check out this Active Record implementation:

http://github.com/aptiva/activerecord/tree/master

- Jason

On 11-Nov-08, at 8:41 AM, malcom wrote:


The program engine itself should run both on iPhone and Mac platform
so I can't use CoreData (and in fact the same thing is for DataCrux).
I'm looking at sqlitepersistentobjects but seems to be in beta. Anyone
used it yet?

On Tue, Nov 11, 2008 at 1:52 PM, I. Savant  
[EMAIL PROTECTED] wrote:

I'm searching for a things like ActiveRecord for Ruby in Objective-C
(but I don't want to use Core-Data).
Anyone can point me to the right solution? I've taken a look at
http://www.cocoadev.com/index.pl?DataCrux but seems to be  
adbandoned.


Why would you be alright with using something like DataCrux but not  
Core

Data? Core Data is supported by Apple, built into the OS, actively
maintained, extensible (in terms of store type) and very well  
integrated

with the API.

This is just my own curiosity ... is there a specific reason Core  
Data will

not work for you?

--
I.S.







--
Apple ADC Member and Indie Developer
http://www.malcom-mac.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


a newbie question

2008-11-11 Thread Michael

I am working from one of the numerous books in Obj C.
My question, which I have asked at another list, is about  the method  
init.
Firstly, here is the code, stripped somewhat of irrelevant  
( hopefully ) code.




/* #import Foundation/Foundation.h */
#import stdio.h
#import objc/Object.h



@interface Fraction : Object
{
int Numerator;
int Denominator;
}

-() methodsToImplementFraction;

@end

@implementation Fraction;

- ( void) methods{
doStuffHere;
}


@end




int main (int argc, const char * argv[]) {


Fraction *myFraction;
myFraction= [Fraction alloc];
myFraction= [Fraction init];  /*  ???  */


return 0;

}



My question is this. As I step through the debugger in Xcode, it is  
not that obvious that any change occurs with the code marked /*   ???   
*/. So, my question is , is there some fundamental thing that init  
does  ( for example, the member variables seem to be initialized with  
the alloc method) and it obviously does...else it would not be  
emphasized as much as it is...or will this become obvious later as I  
work through more Obj-C.

Thanks in advance.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Any way to detect firstResponder changes?

2008-11-11 Thread Keary Suska


On Nov 11, 2008, at 9:31 AM, Uli Kusterer wrote:


On 11.11.2008, at 17:04, Ken Tozier wrote:
I have a custom NSView subclass that contains, among other things,  
an NSTableView and need to know when focus changes happen so I can  
highlight the the view correctly. I tried setting up a KVO observer  
on NSWindw's firstResponder, but it appears that windows don't  
report this change.



I think NSWindow sends an NSNotification in that case. At the least,  
it would send a method to its delegate.



I don't believe this is the case, except maybe for the field editor  
notification, but that wouldn't fire in all cases. windowDidUpdate:  
may be sent, but probably really often so the method needs to be  
pretty efficient.


Another option--just theorizing, as I have never done it--may be to  
subclass NSWindow and overrride -selectNextKeyView:, –  
selectPreviousKeyView:, and/or -makeFirstResponder:.


HTH,

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread Dave DeLong
I would also like to know this.  I tried fiddling around with an as- 
low-as-I-could-go CGEventTap a while ago to try and intercept them,  
but they never showed up in the callback.  Ditto on the volume and  
eject keys.


I think these buttons may work on the same principle as secure  
textfields.  They somehow get re-routed around the standard event route.


Dave

On Nov 11, 2008, at 8:25 AM, I. Savant wrote:


List:

 Does anyone have experience intercepting the play/pause and rew/ff  
(seek back / seek forward) keys on some keyboards? Particularly, the  
MacBook / MacBook Pro keyboards?


 These keys control iTunes and QuickTime just fine when they're  
running but I'd like to intercept them myself as well. Assuming I'm  
using the right terms, I don't see any mention in the archives, on  
cocoadev.com, or anything useful on the web at large.


 I've tried capturing the events in the raw but they never make it  
to the app, so I poked around in the Keyboard  Mouse (Keyboard  
Shortcuts) system prefs. The only use I see of F8 (the play/pause  
key on the latest MacBook) requires pressing the fn key to trigger  
it since simply pressing the keys unmodified is not considered F1-Fn.


 So I was hoping someone else had figured this out. :-)

--
I.S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread Jeff LaMarche

Here's another one to consider:

http://code.google.com/p/sqlitepersistentobjects/

It's similar to ActiveRecord, but is designed to be zero- 
configuration. I tend to think of it as reverse-ActiveRecord because  
instead of populating the object based on the database table, we  
create the database table based on the properties. Basically, your  
class becomes both your class and its own migration.


It's still in active development, but the basic functionality work  
quite well and it's very easy to set up, no configuration steps  
necessary, just subclass an existing class instead of NSObject, and  
set up Objective-C properties for everything that should be persisted,  
the framework will do the rest - call save, to save, use a class  
method to load or query.




On Tue, Nov 11, 2008 at 1:52 PM, I. Savant  
[EMAIL PROTECTED] wrote:

I'm searching for a things like ActiveRecord for Ruby in Objective-C
(but I don't want to use Core-Data).
Anyone can point me to the right solution? I've taken a look at
http://www.cocoadev.com/index.pl?DataCrux but seems to be adbandoned.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread I. Savant

On Nov 11, 2008, at 8:57 AM, Devon Ferns wrote:


Maybe he wants to use it where there is no Core Data i.e. iPhone.


  A salient point - it's hard to tell sometimes, given the odd rules  
surrounding the whole iPhone discussion on cocoa-dev thing. ;-)


  OP, is this why?

--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread I. Savant

On Nov 11, 2008, at 12:01 PM, Bill Monk wrote:


This worked for me:
http://www.rogueamoeba.com/utm/archives/MediaKeys.m


  Thanks, Bill, it looks promising. I was worried about the need for  
being multiple-keyboard-layout-aware but if the keys are merely  
defines in a header, it's probably safe to assume they're reasonably  
stable across keyboards.


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread I. Savant

On Nov 11, 2008, at 12:35 PM, Kevin Gessner wrote:


I can give y'all some code if you're needing.


  Sure, the more the merrier! :-)

--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE : a newbie question

2008-11-11 Thread Etienne Guérard
You should derive your classes from NSObject, not from Object.
You normally don't have to #include objc/Object.h.
Where did you find such an example?

The alloc method basically does a calloc of the appropriate instance size.
The init method of NSObject does nothing.
It's good practive to always call an init metod in your own constructor and 
when you create a new object.
So all you have to do is this:

Fraction *myFraction = [[Fraction alloc] init];

Don't forget to (auto)release this object when you're done.


 Message d'origine

I am working from one of the numerous books in Obj C.
My question, which I have asked at another list, is about  the method  
init.
Firstly, here is the code, stripped somewhat of irrelevant  
( hopefully ) code.



/* #import Foundation/Foundation.h */
#import stdio.h
#import objc/Object.h



@interface Fraction : Object
{
int Numerator;
int Denominator;
}

-() methodsToImplementFraction;

@end

@implementation Fraction;

- ( void) methods{
doStuffHere;
}


@end




int main (int argc, const char * argv[]) {


Fraction *myFraction;
myFraction= [Fraction alloc];
myFraction= [Fraction init];  /*  ???  */


return 0;

}

 

My question is this. As I step through the debugger in Xcode, it is  
not that obvious that any change occurs with the code marked /*   ???   
*/. So, my question is , is there some fundamental thing that init  
does  ( for example, the member variables seem to be initialized with  
the alloc method) and it obviously does...else it would not be  
emphasized as much as it is...or will this become obvious later as I  
work through more Obj-C.
Thanks in advance.


This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RE : a newbie question

2008-11-11 Thread Michael de Haan


On Nov 11, 2008, at 9:21 AM, Etienne Guérard wrote:


You should derive your classes from NSObject, not from Object.
You normally don't have to #include objc/Object.h.
Where did you find such an example?



It is from Steve Kochan's book ...which is basically an  introduction  
to Objective C.





The alloc method basically does a calloc of the appropriate instance  
size.

The init method of NSObject does nothing.
It's good practive to always call an init metod in your own  
constructor and when you create a new object.

So all you have to do is this:

Fraction *myFraction = [[Fraction alloc] init];

Don't forget to (auto)release this object when you're done.






Thank you.___

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

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

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

This email sent to [EMAIL PROTECTED]


another n00b question -- addObserver weirdness

2008-11-11 Thread John Zorko


Hello, all ...

I'm experiencing weird issues with addObserver / removeObserver.  I  
log when I add observers, as well as when I try to remove them, but I  
sometimes (not always) get an exception when I remove an observer:


2008-11-11 10:05:49.939 Magnatune[1382:20b] creating and starting  
audio engine to play mp3 stream http://he3.magnatune.com/all/02-La%20Febre%20(Uccellini)-Altri%20Stromenti.mp3
2008-11-11 10:05:49.962 Magnatune[1382:20b] audio engine created --  
streamer is 90fe00

2008-11-11 10:05:49.970 Magnatune[1382:20b] adding observers ... 11d3b0
2008-11-11 10:05:49.983 Magnatune[1382:ae93] AudioStreamer - 
startInternal ...

2008-11-11 10:05:50.002 Magnatune[1382:20b] playing stream 1
2008-11-11 10:05:50.534 Magnatune[1382:20b] AudioStreamer -stop() called
2008-11-11 10:05:50.539 Magnatune[1382:20b] AudioStreamer -stop()  
finished


... the crash:

2008-11-11 10:05:51.538 Magnatune[1382:20b] *** Terminating app due to  
uncaught exception 'NSRangeException', reason: 'Cannot remove an  
observer MagnatuneAppDelegate 0x11d3b0 for the key path  
buffersEmpty from AudioStreamer 0x90fe00 because it is not  
registered as an observer.'


The MagnatuneAppDelegate address (11d3b0) is the same, so i'm adding  
observers to / removing observers from the same (and only) instance.   
Why does Cocoa then think that I didn't add the buffersEmpty  
observer when I clearly did?


The crash happens here, in the MagnatuneAppDelegate -stopStream method:

- (void)stopStream
{
if (streamer)
{   
[streamer removeObserver:self forKeyPath:@buffersEmpty];
[streamer stop];
}
}

... and MagnatuneAppDelegate spawns the streamer thread like this:

- (void)playStream:(UInt32)streamIndexToPlay
{
	NSLog(@playStream -- current thread ID: %x, [NSThread  
currentThread]);


.   
.
.

if (streamIndexToPlay  [self countOfCurrentSongList])
{
self.donePlaying = false;
		Song *streamToPlay = [self  
objectInCurrentSongListAtIndex:streamIndexToPlay];


NSString *address = @http://he3.magnatune.com/all/;;
address = [address stringByAppendingString:streamToPlay.mp3];

.   
.
.

		NSURL *url = [NSURL URLWithString:[address  
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
		NSLog(@creating and starting audio engine to play mp3 stream %s,  
[[url description] UTF8String]);


streamer = [[AudioStreamer alloc] initWithURL:url];
NSLog(@audio engine created -- streamer is %x, streamer);
NSLog(@adding observers ... %x, self);
		[streamer addObserver:self forKeyPath:@isPlaying options:0  
context:nil];
		[streamer addObserver:self forKeyPath:@failed options:0  
context:nil];
		[streamer addObserver:self forKeyPath:@buffersEmpty options:0  
context:nil];

[streamer start];
}

.
.
.
}

The AudioStreamer -start method is:

- (void)start
{
	streamerThread = [[NSThread alloc] initWithTarget:self  
selector:@selector(startInternal) object:nil];


[[NSNotificationCenter defaultCenter] addObserver:self

  selector:@selector(threadStopped)

  name:NSThreadWillExitNotification

  object:streamerThread];
[streamerThread start];

	MagnatuneAppDelegate *appDelegate = (MagnatuneAppDelegate *) 
[[UIApplication sharedApplication] delegate];

appDelegate.playbackThreadFinished = false;
}

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com











___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread Peter Maurer

 So I was hoping someone else had figured this out. :-)


A quick look at this list's archive reveals this post ...

http://lists.apple.com/archives/cocoa-dev/2007/Aug/msg00499.html

... by yours truly, which was later followed by Rogue Amoeba's  
aforementioned take on this. Look here for the explanation they posted  
for the code Bill linked to earlier:


http://www.rogueamoeba.com/utm/posts/Article/mediaKeys-2007-09-29-17-00.html 



Kevin is right, though: To get this to work the way it _should_ work,  
you'll need an NX_SYSDEFINED event tap. The only working solution  
posted online that I'm aware of is available from a German developers  
discussion board, namely here:


http://www.osxentwicklerforum.de/thread.php?postid=76534

Use the code from the 8th post in that thread (the one that starts  
with Relief... finally!), but use ...


CFRunLoopAddSource(runLoop, eventSrc, kCFRunLoopCommonModes);

... instead of ...

CFRunLoopAddSource(runLoop, eventSrc, kCFRunLoopDefaultMode);

... in line 27 of the second code segment.

Cheers,

Peter.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView text color of cells in highlighted rows unreadable

2008-11-11 Thread Corbin Dunn


On Nov 11, 2008, at 12:40 AM, Alexander Reichstadt wrote:


Hi,

I am trying to turn off the highlight color. I subclassed  
NSTableView and NSTextAttachmentCell. In my tv-subclass I override - 
(void)highlightSelectionInClipRect:(NSRect)theClipRect and use  
clearColor to draw the selected rows which works.


Instead of doing that, just don't call super, and have the method be  
empty.


But I haven't found the way to draw the text in black regardless of  
the row's hightlight-state, so it continues to write the cell  
content in white on a white background whenever it's highlighted.


Override -preparedCellAtColumn:row:, call super, and on the resulting  
cell call setBackgroundStyle:NSBackgroundStyleLight. Or,  
alternatively, in the cell subclass have the -interiorBackgroundStyle  
always return NSBackgroundStyleLight.


In your cell subclass, override -highlightColor:withFrame: and return  
nil.


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread I. Savant

On Nov 11, 2008, at 1:40 PM, Peter Maurer wrote:


So I was hoping someone else had figured this out. :-)


A quick look at this list's archive reveals this post ...

http://lists.apple.com/archives/cocoa-dev/2007/Aug/msg00499.html

... by yours truly, which was later followed by Rogue Amoeba's  
aforementioned take on this. Look here for the explanation they  
posted for the code Bill linked to earlier:


  Can you tell me what terms you used in your quick look? It wasn't  
so quick for me (an hour). It's probably because I was unfamiliar with  
the term media keys which seems to open up the very world I was  
looking for. I had followed terms anywhere from play/rewind/fast  
forward/seek to function keys, etc. and ended up deep in unrelated  
cocoa-dev posts and notebook-specific tech notes (on the ADC site)  
before I gave up and posted here.


The only working solution posted online that I'm aware of is  
available from a German developers discussion board, namely here:


http://www.osxentwicklerforum.de/thread.php?postid=76534


  Great, thanks!

--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread I. Savant

I'm searching for a things like ActiveRecord for Ruby in Objective-C
(but I don't want to use Core-Data).
Anyone can point me to the right solution? I've taken a look at
http://www.cocoadev.com/index.pl?DataCrux but seems to be adbandoned.


  Why would you be alright with using something like DataCrux but not  
Core Data? Core Data is supported by Apple, built into the OS,  
actively maintained, extensible (in terms of store type) and very well  
integrated with the API.


  This is just my own curiosity ... is there a specific reason Core  
Data will not work for you?


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Gregory Weston

Iceberg-Dev wrote:


I need to get a NSImage of the generic bundle icon. (Mac OS X 10.4 or
later)

I'm currently using this:

[[NSImage alloc] initWithContentsOfFile:@/System/Library/
CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns]

because:

- NSFileTypeForHFSTypeCode('BNDL') does not work. It returns a
generic document icon.

- I haven't found an appropriate constant for  
NSFileTypeForHFSTypeCode.


- I can't rely on -[NSWorkspace iconForFileType:@.bundle] because,
for instance, as soon as Microsoft Word is installed, icons
for .bundle can display a Word bundle icon instead of the correct one.

- I haven't found so far a better solution while googling for one.

Question:

Is there a better way to retrieve the generic bundle icon?


I think you have to start by defining - for us but maybe also for  
yourself - what you mean by the generic bundle icon because I  
certainly wouldn't have assumed you meant the icon for a kernel  
extension or for 'plugin (code) modules' as that icon implies. Since  
there are no real implications about what the salient contents of a  
bundle are, I'd've thought the generic document icon was it.


What are you really trying to illustrate with this icon? Are you sure  
the Lego® block is the right thing 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 [EMAIL PROTECTED]


Re: cocoa binding for the data maintained by the other thread.

2008-11-11 Thread Steven Riggs
Sure it will but use an array controller to link up the array with the  
table view.


Steven Riggs

On Nov 11, 2008, at 9:15 AM, Andrew wrote:


Hi, I have read some documents about the Cocoa Bindings. And I got a
question here for more comments.

  If I use the cocoa binding technology in my application, my
application must fully follow a Model-View-Controller paradigm. The  
views
display and edit that data, and controllers mediate between the two.  
So, if
the data is not edited through the view, just be maintained by  
background

threads, will the cocoa binding not effect?

  I have an application, which  will  create another secondary  
thread
to search the network service, for example, the network printer, the  
thread
will add the printer list to my data filed, like a NSArray object.  
The there

is a table view in the UI which used to show the printer list.

  In this case, it seems that the cocoa binding can not sync the
tableview and the NSArray, am I right?



Thanks

Xiaogang Li



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: another n00b question -- addObserver weirdness

2008-11-11 Thread Quincey Morris

On Nov 11, 2008, at 10:35, John Zorko wrote:

2008-11-11 10:05:51.538 Magnatune[1382:20b] *** Terminating app due  
to uncaught exception 'NSRangeException', reason: 'Cannot remove an  
observer MagnatuneAppDelegate 0x11d3b0 for the key path  
buffersEmpty from AudioStreamer 0x90fe00 because it is not  
registered as an observer.'


The MagnatuneAppDelegate address (11d3b0) is the same, so i'm adding  
observers to / removing observers from the same (and only)  
instance.  Why does Cocoa then think that I didn't add the  
buffersEmpty observer when I clearly did?


The crash happens here, in the MagnatuneAppDelegate -stopStream  
method:


- (void)stopStream
{
if (streamer)
{   
[streamer removeObserver:self forKeyPath:@buffersEmpty];
[streamer stop];
}
}


With the code you've shown, it appears you'd crash exactly like that  
if 'stopSteam' was called twice. If that's a possibility, you'd want  
something like:



- (void)stopStream
{
if (streamer)
{   
[streamer removeObserver:self forKeyPath:@buffersEmpty];
[streamer stop];
streamer = nil; // add appropriate memory management here, of 
course

}
}


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RE : How are we supposed to retrieve th e generic bundle icon?

2008-11-11 Thread Iceberg-Dev


On Nov 11, 2008, at 6:17 PM, Etienne Guérard wrote:

Did you take a look at IconServices GetIconRef() function using one  
of the generic Finder icons constant?



I did. That's part of the because: section.

On Nov 11, 2008, at 8:15 PM, Gregory Weston wrote:

What are you really trying to illustrate with this icon? Are you  
sure the Lego® block is the right thing to show?


Standard Apple Plugins that use this icon. Yes, I'm sure.


 Message d'origine
De: [EMAIL PROTECTED] de la part  
de Iceberg-Dev

Date: mar. 11/11/2008 17:36
À: cocoa-dev@lists.apple.com
Objet : How are we supposed to retrieve the generic bundle icon?

I need to get a NSImage of the generic bundle icon. (Mac OS X 10.4 or
later)

I'm currently using this:

[[NSImage alloc] initWithContentsOfFile:@/System/Library/
CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns]

because:

- NSFileTypeForHFSTypeCode('BNDL') does not work. It returns a
generic document icon.

- I haven't found an appropriate constant for  
NSFileTypeForHFSTypeCode.





___

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

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

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

This email sent to [EMAIL PROTECTED]


RE : RE : a newbie question

2008-11-11 Thread Etienne Guérard
 Maybe it's an illustrative example, not a real one.
Anyway you'd better stick to NSObject.
Object is used to implement the metaclass class hierachy inside the ObjC 
runtime.
You normally don't play with it. ;)  

EG

 Message d'origine
De: [EMAIL PROTECTED] de la part de Michael de Haan
Date: mar. 11/11/2008 19:32
À: cocoa-dev@lists.apple.com
Objet : Re: RE : a newbie question
 

On Nov 11, 2008, at 9:21 AM, Etienne Guérard wrote:

 You should derive your classes from NSObject, not from Object.
 You normally don't have to #include objc/Object.h.
 Where did you find such an example?


It is from Steve Kochan's book ...which is basically an  introduction  
to Objective C.



 The alloc method basically does a calloc of the appropriate instance  
 size.
 The init method of NSObject does nothing.
 It's good practive to always call an init metod in your own  
 constructor and when you create a new object.
 So all you have to do is this:

 Fraction *myFraction = [[Fraction alloc] init];

 Don't forget to (auto)release this object when you're done.





Thank you.___

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

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

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

This email sent to [EMAIL PROTECTED]



This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RE : RE : a newbie question

2008-11-11 Thread Michael de Haan


On Nov 11, 2008, at 12:16 PM, Etienne Guérard wrote:


 Maybe it's an illustrative example, not a real one.
Anyway you'd better stick to NSObject.
Object is used to implement the metaclass class hierachy inside the  
ObjC runtime.

You normally don't play with it. ;)



thanks for your input. I am sure I will be back with more questions,  
as I work my way through this book.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Search field menu resets

2008-11-11 Thread Robert Mullen
I have a controller in which I setup a menu for a search field in a  
toolbar. The search field is set to return the whole search string. I  
have a procedure that looks basically like this:


-(void)setupSearchMenu
{
NSMenu *cellMenu = [[[NSMenu alloc] initWithTitle:@Search Menu]  
autorelease];


NSMenuItem *item;

item = [[[NSMenuItem alloc] initWithTitle:@Item 1  
action:@selector(setSearchCategoryFrom:) keyEquivalent:@]  
autorelease];


[item setTarget:self];
[item setTag:0];
[item setState:1];
[cellMenu insertItem:item atIndex:0];

item = [[[NSMenuItem alloc] initWithTitle:@Item 2  
action:@selector(setSearchCategoryFrom:) keyEquivalent:@]  
autorelease];


[item setTarget:self];
[item setTag:1];
[item setState:0];
[cellMenu insertItem:item atIndex:1];

id searchCell = [searchField cell]; 
[searchCell setSearchMenuTemplate:cellMenu];
}

The procedure is fired only when the view in question becomes visible  
by user action (I have verified this with NSLog statements.) After  
this initialization takes place I flip check boxes to indicate what  
search mode a user is in as they make selections from the menu. This  
state is maintained right up to the point where enter is hit or the X  
in the search field is clicked at which point the menu reverts back to  
its initial state. This throws it out of sync with what the user has  
selected and I don't think the menu should change just because one  
search instance is triggered. Changing is the users decision. Is this  
behavior normal or am I doing something wrong in the construction of  
this menu or configuration of the search field?


TIA.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RE : How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Kyle Sluder
On Tue, Nov 11, 2008 at 2:50 PM, Iceberg-Dev [EMAIL PROTECTED] wrote:
 Standard Apple Plugins that use this icon. Yes, I'm sure.

Are you attempting to use this icon for your own purposes, like
plugins for your own app?  If so, Apple used to provide a set of icon
templates in Photoshop format that you can customize and associate
with your app's own plugin bundle UTI.  You can find a copy of it at
http://www.cocoadev.com/index.pl?AquaIconKit .  It only contains
templates up to 128x128, but you can scale up the 128x128 template to
512x512 to get the layout right, then apply your customizations on top
of the 512x512 image from the standard bundle icns file.

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


Re: a newbie question

2008-11-11 Thread Paul Bruneau

On Nov 11, 2008, at 3:16 PM, Etienne Guérard wrote:


Maybe it's an illustrative example, not a real one.
Anyway you'd better stick to NSObject.
Object is used to implement the metaclass class hierachy inside the  
ObjC runtime.

You normally don't play with it. ;)


It is a real example, but it is from the section that is teaching  
straight ObjC. Cocoa doesn't really get introduced into that book  
until chapter 14 Introduction to the Foundation Framework.


On page 313 he says In all the programs up to this point, you used  
the root object Object. The Foundation framework uses a different root  
object called NSObject. You'll get there soon.


So original poster, probably the Obj-C mailing list might be a better  
place to ask about Kochan examples until you get to chapter 14.


Good luck, it's a fine book. I was in your shoes 1.5 years ago. Read  
Hillegass next.___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Gregory Weston

Iceberg-Dev wrote:


On Nov 11, 2008, at 8:15 PM, Gregory Weston wrote:


What are you really trying to illustrate with this icon? Are you
sure the Lego® block is the right thing to show?


Standard Apple Plugins that use this icon. Yes, I'm sure.


Perhaps I'm missing something, but why not then retrieve the icon for  
the file rather than for the type? Or if the file doesn't actually  
exist, use NSWorkspace's iconForFileType: with the extension (such as  
@kext).___


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

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

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

This email sent to [EMAIL PROTECTED]


How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Iceberg-Dev
I need to get a NSImage of the generic bundle icon. (Mac OS X 10.4 or  
later)


I'm currently using this:

[[NSImage alloc] initWithContentsOfFile:@/System/Library/ 
CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns]


because:

- NSFileTypeForHFSTypeCode('BNDL') does not work. It returns a  
generic document icon.


- I haven't found an appropriate constant for NSFileTypeForHFSTypeCode.

- I can't rely on -[NSWorkspace iconForFileType:@.bundle] because,  
for instance, as soon as Microsoft Word is installed, icons  
for .bundle can display a Word bundle icon instead of the correct one.


- I haven't found so far a better solution while googling for one.

Question:

Is there a better way to retrieve the generic bundle icon?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 10.4 square button backgrounds go white when clicked

2008-11-11 Thread Matthew Mashyna

On Nov 6, 2008, at 10:49 AM, Matthew Mashyna wrote:

I have some square buttons along the top of a textured window. The  
window does not have an NSToolbar. These buttons have images (pngs)  
with transparent backgrounds on them. When I click on them on 10.5  
they darken and look good. On 10.4 the backgrounds turn white and  
look bad. iTunes doesn't do this on 10.4 so I must have something  
set wrong in Interface Builder but I can't figure out what. Any  
ideas ?



Matt
___

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

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

This email sent to [EMAIL PROTECTED]

After a lot of trial and error I discovered that in order to get my  
buttons to display properly when pressed they need to be boarder-less,  
textured, momentary change and without an alternate image. Has nothing  
to do with the textured window. Putting a boarder-less, textured  
button in any non-white view causes it to show a white background on  
10.4 unless you set the attributes as above.


Matt

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RE : How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Iceberg-Dev


On Nov 11, 2008, at 9:39 PM, Kyle Sluder wrote:

On Tue, Nov 11, 2008 at 2:50 PM, Iceberg-Dev  
[EMAIL PROTECTED] wrote:

Standard Apple Plugins that use this icon. Yes, I'm sure.


Are you attempting to use this icon for your own purposes, like
plugins for your own app?


No, I'm not. I just want to display it in a case very similar to the  
Finder Info Window.



___

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

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

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

This email sent to [EMAIL PROTECTED]


MEETING: CocoaHeads Nov 13: Intro to iPhone SDK

2008-11-11 Thread j o a r

As announced on Theocacao:

http://theocacao.com/document.page/597

=
Michael Jurewitz, Apple's Developer and Performance Tools Evangelist,  
will presentIntroduction to iPhone Development at CocoaHeads Silicon  
Valley this Thursday, November 13 at 7:00pm. This meeting will be at  
Intuit (Quicken/QuickBooks) headquarters in Mountain View.


Michael is graciously sharing some of his time with us between stops  
on Apple's iPhone Tech Talk World Tour, so we'd love to have everyone  
come out and show support for the group this Thursday night.


Our typical meeting places have been undergoing a number of  
rearrangements, so we're very thankful to Intuit offering to host us  
this month. This likely will not be our typical location in the  
future, but I'm personally always up for a field trip.


Inuit is located at 2535 Garcia Ave in Mountain View, and our location  
is the Darwin room in Building 1 (sorry for the lack of map here).


We're not allowed to record video or audio for this event, so if you  
want to see it, you have to come down in person. See you there.

=

And, don't forget NSCoderNight in Campbell tonight!

Cheers,

j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread malcom
The program engine itself should run both on iPhone and Mac platform
so I can't use CoreData (and in fact the same thing is for DataCrux).
I'm looking at sqlitepersistentobjects but seems to be in beta. Anyone
used it yet?

On Tue, Nov 11, 2008 at 1:52 PM, I. Savant [EMAIL PROTECTED] wrote:
 I'm searching for a things like ActiveRecord for Ruby in Objective-C
 (but I don't want to use Core-Data).
 Anyone can point me to the right solution? I've taken a look at
 http://www.cocoadev.com/index.pl?DataCrux but seems to be adbandoned.

  Why would you be alright with using something like DataCrux but not Core
 Data? Core Data is supported by Apple, built into the OS, actively
 maintained, extensible (in terms of store type) and very well integrated
 with the API.

  This is just my own curiosity ... is there a specific reason Core Data will
 not work for you?

 --
 I.S.






-- 
Apple ADC Member and Indie Developer
http://www.malcom-mac.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: a newbie question

2008-11-11 Thread Michael de Haan
Paul...thank you for that info. I was not aware there is a specific  
OBJ-C mailing list, but will go there, for a few chapters, at any  
rate!!  :-)

Michael.


On Nov 11, 2008, at 12:44 PM, Paul Bruneau wrote:


On Nov 11, 2008, at 3:16 PM, Etienne Guérard wrote:


Maybe it's an illustrative example, not a real one.
Anyway you'd better stick to NSObject.
Object is used to implement the metaclass class hierachy inside the  
ObjC runtime.

You normally don't play with it. ;)


It is a real example, but it is from the section that is teaching  
straight ObjC. Cocoa doesn't really get introduced into that book  
until chapter 14 Introduction to the Foundation Framework.


On page 313 he says In all the programs up to this point, you used  
the root object Object. The Foundation framework uses a different  
root object called NSObject. You'll get there soon.


So original poster, probably the Obj-C mailing list might be a  
better place to ask about Kochan examples until you get to chapter 14.


Good luck, it's a fine book. I was in your shoes 1.5 years ago. Read  
Hillegass next.___


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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTokenField Represented Objects

2008-11-11 Thread Jason Wiggins

Hello all,

I'm having a bit of trouble with NSTokenFields and represented objects.
What I am trying to achieve is to create a predicate from text entered  
in a token field. It goes like this:
User enters text, gets a completion if necessary, types tokenising  
character, token created, user presses a start button, the token's  
represented object returns a uti for inclusion in the predicate.


The token field has completions for substring method implemented in  
its delegate as such:


- (NSArray *)tokenField:(NSTokenField *)tokenField  
completionsForSubstring:(NSString *)substring indexOfToken: 
(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex {

...
else if (tokenField == fileTypeTokenField) {
		NSArray *matchingFileTypes = [[fileTypeArray  
valueForKey:@description] filteredArrayUsingPredicate:[NSPredicate  
predicateWithFormat:@SELF beginswith[cd] %@, substring]];

return matchingFileTypes;
...

fileTypeArray is an array of dictionaries comprising a description key  
and a UTI key.


All is good for the user entering some text in the token field and  
getting matches for the substring. The user types the tokenising  
character and the token is created. But now it seems there is no  
connection to the dictionary object. The class of the represented  
object is now NSCFString not NSDictionary.


I also have this delegate method implemented:

- (NSString *)tokenField:(NSTokenField *)tokenField  
displayStringForRepresentedObject:(id)representedObject {

if (tokenField == fileTypeTokenField) {
return representedObject;
}
}

Do I have to implement tokenField:representedObjectForEditingString: ?  
If so how?


Any ideas or thoughts would be greatly appreciated.

Regards,
Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSplitView can't expand once collapsed

2008-11-11 Thread Qi Liu
Hi,
  At first, I think just as you mentioned, and I want to file a bug too.
  But the view being collapsed is not actually being collapsed, it is just
being set *HIDDEN*, and its size remains unchanged. Suppose the splitview is
horizontal and we have 2 views, leftView and rightView. We overrided the
following code:
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview
{
return YES;
}
- (float)splitView:(NSSplitView *)sender
constrainMinCoordinate:(float)proposedMin ofSubviewAt:(NSInteger)offset
{
return proposedMin + 100.0;
}
- (float)splitView:(NSSplitView *)sender
constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(NSInteger)offset
{
return proposedMax - 100.0;
}

If we want to collapse/expand leftView, we better invoke following function:
- (IBAction)collapse:(id)sender
{
 NSView * leftview = [[splitview subviews] objectAtIndex:0];
 NSView * rightview = [[splitview subviews] objectAtIndex:1];
 NSRect leftFrame = [leftview frame];
 NSRect rightFrame = [rightview frame];
 rightFrame.origin.x = [splitview dividerThickness];
 rightFrame.size.width += leftFrame.size.width;
 [leftview setHidden:YES];
 [rightview setFrame:rightFrame];
}
- (IBAction)expand:(id)sender
{
 NSView * leftview = [[splitview subviews] objectAtIndex:0];
 NSView * rightview = [[splitview subviews] objectAtIndex:1];
 NSRect leftFrame = [leftview frame];
 NSRect rightFrame = [rightview frame];
 rightFrame.size.width -= leftFrame.size.width;
 rightFrame.origin.x = leftFrame.size.width + [splitview dividerThickness];
 [leftview setHidden:NO];
 [rightview setFrame:rightFrame];
}

  Personally I don't think setting width of leftview to zero is a good idea.
Hope this can be helpful.

=
Qi Liu
--Stay Hungry. Stay Foolish.
--You've got to find what you love.
=


 On Sat, Mar 01, 2003 at 09:04:37PM -0800, matt neuburg wrote:
 * I think I'm seeing a bug, as follows.*
 * *
 * I have an NSSplitView with two subviews. If I collapse one of the*
 * subviews programatically (i.e. I set its height to zero, so that the
 user*
 * sees only the other subview), then I can expand it again later*
 * programatically (e.g. I set both subviews to have the same height, and*
 * adjust subviews).*
 * *
 * But if (via the delegate methods) I permit the user to collapse a
 subview*
 * by hand, I can't find a way to expand it again programatically.
 Everything*
 * I try gives funky results, wrong sizes, drawing glitches, and so on. If
 *
 * anyone has counterexample code showing that there is a way to expand a*
 * subview that the user has collapsed, I'd like to see it. Thanks - m.*

 Yup, this is a total mess. Horizontal splits are even worse as you
 can't even uncollapse from code after a programmatic collapse. This
 is my workaround, though it would need to be adapted for your
 purposes.

 http://cocoa.mamasam.com/COCOADEV/2003/02/2/57202.php

 Please file a bug on this issue (I did, #3179051, which is not marked
 as a duplicate).

 --
 =Nicholas Riley [EMAIL PROTECTED] | http://www.uiuc.edu/ph/www/njriley
 Pablo Research Group, Department of Computer Science and
 Medical Scholars Program, University of Illinois at Urbana-Champaign
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread Ben Lachman
I noodled around with this for SousChef, and it's fairly straight  
forward to get the events (I can provide code if desired).  However  
the problem I ran into was that I couldn't stop the events from also  
going to iTunes like the QT player does.  So its not too helpful since  
a person using SousChef hits ffwd and SousChef would advance to the  
next step, however iTunes would also advance to the next song.  Has  
anyone had any luck eating these events as they come in?


-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: [EMAIL PROTECTED]
twitter: @benlachman
mobile: 740.590.0009

On Nov 11, 2008, at 12:01 PM, Bill Monk wrote:


  Does anyone have experience intercepting the play/pause and rew/ff
(seek back / seek forward) keys on some keyboards? Particularly, the
MacBook / MacBook Pro keyboards?


This worked for me:

http://www.rogueamoeba.com/utm/archives/MediaKeys.m

Basically, subclass NSApplication, override -sendEvent:, and look  
for the special keys you want, as defined in
IOKit/hidsystem/ev_keymap.h. They include play/pause/stop, volume  
up/down, screen brightness up/dow, etc.



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Any way to detect firstResponder changes?

2008-11-11 Thread Uli Kusterer

On 11.11.2008, at 17:04, Ken Tozier wrote:
I have a custom NSView subclass that contains, among other things,  
an NSTableView and need to know when focus changes happen so I can  
highlight the the view correctly. I tried setting up a KVO observer  
on NSWindw's firstResponder, but it appears that windows don't  
report this change.



 I think NSWindow sends an NSNotification in that case. At the least,  
it would send a method to its delegate.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Iceberg-Dev


On Nov 11, 2008, at 9:44 PM, Gregory Weston wrote:


Iceberg-Dev wrote:


On Nov 11, 2008, at 8:15 PM, Gregory Weston wrote:


What are you really trying to illustrate with this icon? Are you
sure the Lego® block is the right thing to show?


Standard Apple Plugins that use this icon. Yes, I'm sure.


Perhaps I'm missing something, but why not then retrieve the icon  
for the file rather than for the type?


I don't want to display a custom icon if someone eventually copy- 
pasted one on the bundle.


Or if the file doesn't actually exist, use NSWorkspace's  
iconForFileType: with the extension (such as @kext).


I would if this was reliable. But it's apparently not as described  
with .bundle vs Microsoft Word.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How are we supposed to retrieve the generic bundle icon?

2008-11-11 Thread Stephen J. Butler
On Tue, Nov 11, 2008 at 3:34 PM, Iceberg-Dev [EMAIL PROTECTED] wrote:
 On Nov 11, 2008, at 9:44 PM, Gregory Weston wrote:
 Perhaps I'm missing something, but why not then retrieve the icon for the
 file rather than for the type?

 I don't want to display a custom icon if someone eventually copy-pasted one
 on the bundle.

The question is not really whether you want to display a custom icon,
but rather if the user wants one displayed. If they went to the
trouble to change the icon, I imagine they really want it changed
everywhere.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Any way to detect firstResponder changes?

2008-11-11 Thread Ken Tozier

Hi

I have a custom NSView subclass that contains, among other things, an  
NSTableView and need to know when focus changes happen so I can  
highlight the the view correctly. I tried setting up a KVO observer on  
NSWindw's firstResponder, but it appears that windows don't report  
this change.


I'd like to do this without resorting to subclassing dozens of class  
to broadcast when they receive a becomeFirstResponder or  
resignFirstResponder message. What is the best way to go about  
detecting responder changes in subviews of a custom view?


Thanks for any help
___

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

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

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

This email sent to [EMAIL PROTECTED]


System Preferences Pane: CGWindowContextCreate error

2008-11-11 Thread Rich Catalano
I'm working on a System Preferences Pane. It opens fine on some  
computers, but on other Macs (all running 10.5.5), the preference pane  
refuses to load and simply hangs, spitting the following into the  
console:


11/9/08 8:38:50 PM [0x0-0x31031].com.apple.systempreferences[369] Sun  
Nov 9 20:38:50 Macintosh.local System Preferences[369] Error: Failed  
to create window context device
11/9/08 8:38:50 PM [0x0-0x31031].com.apple.systempreferences[369] Sun  
Nov 9 20:38:50 Macintosh.local System Preferences[369] Error:  
CGWindowContextCreate: failed to create context delegate.
11/9/08 8:38:55 PM [0x0-0x31031].com.apple.systempreferences[369] Sun  
Nov 9 20:38:55 Macintosh.local System Preferences[369] Error: Failed  
to create window context device

Any ideas why this is happening?

Thanks.
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE : Any way to detect firstResponder changes ?

2008-11-11 Thread Etienne Guérard

You should use the highlighting provided by the focus ring. 
-[NSView setFocusRinType:]

 Message d'origine
I have a custom NSView subclass that contains, among other things, an  
NSTableView and need to know when focus changes happen so I can  
highlight the the view correctly. I tried setting up a KVO observer on  
NSWindw's firstResponder, but it appears that windows don't report  
this change.

I'd like to do this without resorting to subclassing dozens of class  
to broadcast when they receive a becomeFirstResponder or  
resignFirstResponder message. What is the best way to go about  
detecting responder changes in subviews of a custom view?



This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread I. Savant

On Nov 11, 2008, at 10:27 AM, Dave DeLong wrote:

I would also like to know this.  I tried fiddling around with an as- 
low-as-I-could-go CGEventTap a while ago to try and intercept them,  
but they never showed up in the callback.  Ditto on the volume and  
eject keys.


  I haven't gone that far yet. Thought I'd post first. :-)

I think these buttons may work on the same principle as secure  
textfields.  They somehow get re-routed around the standard event  
route.


  I'm thinking the same thing ... but they come out somewhere since  
iTunes and QuickTime Player get them. So far it's still more  
encouraging than hopeless. ;-)


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE : How are we supposed to retrieve the gene ric bundle icon?

2008-11-11 Thread Etienne Guérard
Did you take a look at IconServices GetIconRef() function using one of the 
generic Finder icons constant?


 Message d'origine
De: [EMAIL PROTECTED] de la part de Iceberg-Dev
Date: mar. 11/11/2008 17:36
À: cocoa-dev@lists.apple.com
Objet : How are we supposed to retrieve the generic bundle icon?
 
I need to get a NSImage of the generic bundle icon. (Mac OS X 10.4 or  
later)

I'm currently using this:

[[NSImage alloc] initWithContentsOfFile:@/System/Library/ 
CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns]

because:

- NSFileTypeForHFSTypeCode('BNDL') does not work. It returns a  
generic document icon.

- I haven't found an appropriate constant for NSFileTypeForHFSTypeCode.

- I can't rely on -[NSWorkspace iconForFileType:@.bundle] because,  
for instance, as soon as Microsoft Word is installed, icons  
for .bundle can display a Word bundle icon instead of the correct one.

- I haven't found so far a better solution while googling for one.

Question:

Is there a better way to retrieve the generic bundle icon?


___

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

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

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

This email sent to [EMAIL PROTECTED]



This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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

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

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

This email sent to [EMAIL PROTECTED]


How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Alexander Shmelev

Hello

I have custom NSView, and want to draw whole NSImage inside some  
custom rectangular area of NSView.
I tried to use [NSImage drawInRect:...] but result does not fit  
desired rectangular area of NSView.



My code:

- (void) setPreviewWidth:(float)width height:(float)height
{
margin = width / 25;

maxScanArea = NSMakeRect(margin, margin, width, height);
	canvasArea = NSMakeRect(0, 0, width + 2.0 * margin, height + 2.0 *  
margin);

[self setBounds:canvasArea];
}

- (void) drawRect:(NSRect)rect
{


// Drawing image in preview
if (image) {
NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [image size];

[image drawInRect:maxScanArea
 fromRect:imageRect
operation:NSCompositeSourceOver
 fraction:1];
		// I want image to be drawn in maxScanArea rect, but it is drawn in  
[self bounds] rect.


}
}

Could you advise how can I draw exactly inside maxScanArea NSRect in  
NSView?



BR, Alexander.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Rotating a QTMovie doesn't work the way it used to

2008-11-11 Thread Peter Maurer

I don't know anything about the old QuickTime APIs. But I would
suggest the new way to do this is use Core Animation.


Thanks for the suggestion!

I wasn't too keen on using layers for this, and fortunately, it turned  
out that I can still rotate single QuickTime tracks successfully. And  
I guess that's precisely what the QuickTime Player does, too. Looking  
back, I wonder why I didn't try doing it that way in the first place.


So, to recap, just in case anyone else ever gets stuck on a similar  
issue:


1. With current QuickTime versions (such as QuickTime 7.5.5, which I'm  
currently testing against), you can't rotate an entire movie's matrix  
successfully anymore. This used to work with earlier QuickTime versions.


2. However, you can still rotate its tracks by getting their matrices  
via GetTrackMatrix(), rotating those, and setting them via  
SetTrackMatrix().


Cheers,

Peter.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSlider value?

2008-11-11 Thread Nick Zitzmann


On Nov 11, 2008, at 3:17 PM, Mr. Gecko wrote:


Short Question How can I get the value and set the value for NSSlider?



-doubleValue and -setDoubleValue:.

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSlider value?

2008-11-11 Thread Andrew Farmer

On 11 Nov 08, at 14:17, Mr. Gecko wrote:

Short Question How can I get the value and set the value for NSSlider?


NSSlider is a subclass of NSControl, so it inherits all the getter and  
setter methods from that class. The two you're probably most  
interested in are floatValue and setFloatValue:.

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSSlider value?

2008-11-11 Thread Mr. Gecko

Short Question How can I get the value and set the value for NSSlider?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Ken Ferry
Hi Alexander,

Your code will draw the image in maxScanArea.  You should probably
look for a bug elsewhere.

I like to replace complex drawing with simple color fills when
debugging drawing location issues.  At least it limits what could go
wrong.

-Ken

On Tue, Nov 11, 2008 at 2:17 PM, Alexander Shmelev [EMAIL PROTECTED] wrote:
 Hello

 I have custom NSView, and want to draw whole NSImage inside some custom
 rectangular area of NSView.
 I tried to use [NSImage drawInRect:...] but result does not fit desired
 rectangular area of NSView.


 My code:

 - (void) setPreviewWidth:(float)width height:(float)height
 {
margin = width / 25;

maxScanArea = NSMakeRect(margin, margin, width, height);
canvasArea = NSMakeRect(0, 0, width + 2.0 * margin, height + 2.0 *
 margin);
[self setBounds:canvasArea];
 }

 - (void) drawRect:(NSRect)rect
 {


// Drawing image in preview
if (image) {
NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [image size];

[image drawInRect:maxScanArea
 fromRect:imageRect
operation:NSCompositeSourceOver
 fraction:1];
// I want image to be drawn in maxScanArea rect, but it is
 drawn in [self bounds] rect.

}
 }

 Could you advise how can I draw exactly inside maxScanArea NSRect in NSView?


 BR, Alexander.
 ___

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

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


ActiveRecord on Cocoa

2008-11-11 Thread malcom
Hello List,
I'm searching for a things like ActiveRecord for Ruby in Objective-C
(but I don't want to use Core-Data).
Anyone can point me to the right solution? I've taken a look at
http://www.cocoadev.com/index.pl?DataCrux but seems to be adbandoned.
Thanks
___

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

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

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

This email sent to [EMAIL PROTECTED]


A bit of a dumb question, but I need to know...

2008-11-11 Thread Jean-Nicolas Jolivet
I'm using the quick time framework in my App (QTKit/QTKit.h) for 
QTMovies and QTMovieView etc...


Do I need to distribute it with my app (i.e. add a new Copy build 
phase), or can I safely assume that everyone with OS X Tiger has the 
framework already?? (My app will require Tiger at least)...


Jean-Nicolas Jolivet
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSlider value?

2008-11-11 Thread Graham Cox


On 12 Nov 2008, at 9:17 am, Mr. Gecko wrote:


Short Question How can I get the value and set the value for NSSlider?



Since NSSlider is a subclass of NSControl it supports the substantial  
list of methods there to get/set its value.


hth, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSlider value?

2008-11-11 Thread Mr. Gecko

Lots of the same answers and it works, thanks.

On Nov 11, 2008, at 4:29 PM, Graham Cox wrote:



On 12 Nov 2008, at 9:17 am, Mr. Gecko wrote:

Short Question How can I get the value and set the value for  
NSSlider?



Since NSSlider is a subclass of NSControl it supports the  
substantial list of methods there to get/set its value.


hth, Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A bit of a dumb question, but I need to know...

2008-11-11 Thread Nathan
If I'm correct, it's a standard framework that everyone has. That  
being said, I've never used it myself so wait until an expert confirms  
or rebuked what said.

Nate

On Nov 11, 2008, at 5:28 PM, Jean-Nicolas Jolivet [EMAIL PROTECTED] 
 wrote:


I'm using the quick time framework in my App (QTKit/QTKit.h) for  
QTMovies and QTMovieView etc...


Do I need to distribute it with my app (i.e. add a new Copy build  
phase), or can I safely assume that everyone with OS X Tiger has the  
framework already?? (My app will require Tiger at least)...


Jean-Nicolas Jolivet
___

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

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

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


This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Alexander Shmelev

Hi, Ken

Thank you for answer.
But simple color filling was first what I have tried.
When I add following code inside -(void)drawRect method, it fills  
exactly maxScanArea:

[[NSColor whiteColor] set];
[NSBezierPath fillRect:maxScanArea];
But -(void)drawInRect:maxScanArea places picture outside maxScanArea.


My target is to implement NSImage preview window with drag-n-drop  
selection frame, like Select Tool in Preview.app. May be such custom  
control exists and I simply do not know about it. But until I find  
something suitable I have to deal with drawInRect:... issue.



On 12.11.2008, at 1:28, Ken Ferry wrote:


Hi Alexander,

Your code will draw the image in maxScanArea.  You should probably
look for a bug elsewhere.

I like to replace complex drawing with simple color fills when
debugging drawing location issues.  At least it limits what could go
wrong.

-Ken

On Tue, Nov 11, 2008 at 2:17 PM, Alexander Shmelev  
[EMAIL PROTECTED] wrote:

Hello

I have custom NSView, and want to draw whole NSImage inside some  
custom

rectangular area of NSView.
I tried to use [NSImage drawInRect:...] but result does not fit  
desired

rectangular area of NSView.


My code:

- (void) setPreviewWidth:(float)width height:(float)height
{
  margin = width / 25;

  maxScanArea = NSMakeRect(margin, margin, width, height);
  canvasArea = NSMakeRect(0, 0, width + 2.0 * margin, height +  
2.0 *

margin);
  [self setBounds:canvasArea];
}

- (void) drawRect:(NSRect)rect
{


  // Drawing image in preview
  if (image) {
  NSRect imageRect;
  imageRect.origin = NSZeroPoint;
  imageRect.size = [image size];

  [image drawInRect:maxScanArea
   fromRect:imageRect
  operation:NSCompositeSourceOver
   fraction:1];
  // I want image to be drawn in maxScanArea rect, but  
it is

drawn in [self bounds] rect.

  }
}

Could you advise how can I draw exactly inside maxScanArea NSRect  
in NSView?



BR, Alexander.
___

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

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread Devon Ferns

Maybe he wants to use it where there is no Core Data i.e. iPhone.

This was announced a few months back for storing in sqlite
http://code.google.com/p/sqlitepersistentobjects/

I haven't used it myself since I'm not sure if it's been enhanced to 
automatically alter the table if you have the table already and add new 
properties to your objects



Devon

I. Savant wrote:

I'm searching for a things like ActiveRecord for Ruby in Objective-C
(but I don't want to use Core-Data).
Anyone can point me to the right solution? I've taken a look at
http://www.cocoadev.com/index.pl?DataCrux but seems to be adbandoned.


  Why would you be alright with using something like DataCrux but not 
Core Data? Core Data is supported by Apple, built into the OS, actively 
maintained, extensible (in terms of store type) and very well integrated 
with the API.


  This is just my own curiosity ... is there a specific reason Core Data 
will not work for you?


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


cocoa binding for the data maintained by the other thread.

2008-11-11 Thread Andrew
Hi, I have read some documents about the Cocoa Bindings. And I got a
question here for more comments.

   If I use the cocoa binding technology in my application, my
application must fully follow a Model-View-Controller paradigm. The views
display and edit that data, and controllers mediate between the two. So, if
the data is not edited through the view, just be maintained by background
threads, will the cocoa binding not effect?

   I have an application, which  will  create another secondary thread
to search the network service, for example, the network printer, the thread
will add the printer list to my data filed, like a NSArray object. The there
is a table view in the UI which used to show the printer list. 

   In this case, it seems that the cocoa binding can not sync the
tableview and the NSArray, am I right?

 

Thanks

Xiaogang Li

 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread Kevin Gessner
An application of mine, FunctionFlip, does just this - it eats  
special key presses. I use a CGEventTap at kCGSessionEventTap. To get  
system events, you have to tell the tap to listen to NX_SYSDEFINED  
events. Then, if you want to stop the event, just return null from  
your callback. I can give y'all some code if you're needing.


HTH,
-- Kevin

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




On Nov 11, 2008, at 12:10 PM, Ben Lachman wrote:

I noodled around with this for SousChef, and it's fairly straight  
forward to get the events (I can provide code if desired).  However  
the problem I ran into was that I couldn't stop the events from also  
going to iTunes like the QT player does.  So its not too helpful  
since a person using SousChef hits ffwd and SousChef would advance  
to the next step, however iTunes would also advance to the next  
song.  Has anyone had any luck eating these events as they come in?


-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: [EMAIL PROTECTED]
twitter: @benlachman
mobile: 740.590.0009

On Nov 11, 2008, at 12:01 PM, Bill Monk wrote:


 Does anyone have experience intercepting the play/pause and rew/ff
(seek back / seek forward) keys on some keyboards? Particularly, the
MacBook / MacBook Pro keyboards?


This worked for me:

http://www.rogueamoeba.com/utm/archives/MediaKeys.m

Basically, subclass NSApplication, override -sendEvent:, and look  
for the special keys you want, as defined in
IOKit/hidsystem/ev_keymap.h. They include play/pause/stop, volume  
up/down, screen brightness up/dow, etc.



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A bit of a dumb question, but I need to know...

2008-11-11 Thread Nick Zitzmann


On Nov 11, 2008, at 3:28 PM, Jean-Nicolas Jolivet wrote:

Do I need to distribute it with my app (i.e. add a new Copy build  
phase), or can I safely assume that everyone with OS X Tiger has the  
framework already?? (My app will require Tiger at least)...



If a framework is in /System/Library/Frameworks, then you should never  
copy it into your bundle. The bundled framework will just waste space  
since it'll never be used anyway.


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Andy Lee

On Nov 11, 2008, at 5:17 PM, Alexander Shmelev wrote:

- (void) drawRect:(NSRect)rect
{


// Drawing image in preview
if (image) {
NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [image size];

[image drawInRect:maxScanArea
 fromRect:imageRect
operation:NSCompositeSourceOver
 fraction:1];
		// I want image to be drawn in maxScanArea rect, but it is drawn  
in [self bounds] rect.


}
}


I don't see a -setPreviewWidth:height: message anywhere.  Have you  
confirmed that it is indeed called?  I would put a breakpoint in both - 
setPreviewWidth:height: and -drawRect: and make sure the values of  
maxScanArea and bounds are what you expect.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Alexander Shmelev

Actually, I have one idea why this happens.
Maybe because usually width=8, height = 14 so [self bounds] returns  
NSRect(0,0,8.64,14.64). And
maxScanArea = NSRect(0.32, 0.32, 8, 14). So there can be some  
approximation to integer value, not float.


But it it is true, how to deal with this?

On 12.11.2008, at 1:28, Ken Ferry wrote:


Hi Alexander,

Your code will draw the image in maxScanArea.  You should probably
look for a bug elsewhere.

I like to replace complex drawing with simple color fills when
debugging drawing location issues.  At least it limits what could go
wrong.

-Ken

On Tue, Nov 11, 2008 at 2:17 PM, Alexander Shmelev  
[EMAIL PROTECTED] wrote:

Hello

I have custom NSView, and want to draw whole NSImage inside some  
custom

rectangular area of NSView.
I tried to use [NSImage drawInRect:...] but result does not fit  
desired

rectangular area of NSView.


My code:

- (void) setPreviewWidth:(float)width height:(float)height
{
  margin = width / 25;

  maxScanArea = NSMakeRect(margin, margin, width, height);
  canvasArea = NSMakeRect(0, 0, width + 2.0 * margin, height +  
2.0 *

margin);
  [self setBounds:canvasArea];
}

- (void) drawRect:(NSRect)rect
{


  // Drawing image in preview
  if (image) {
  NSRect imageRect;
  imageRect.origin = NSZeroPoint;
  imageRect.size = [image size];

  [image drawInRect:maxScanArea
   fromRect:imageRect
  operation:NSCompositeSourceOver
   fraction:1];
  // I want image to be drawn in maxScanArea rect, but  
it is

drawn in [self bounds] rect.

  }
}

Could you advise how can I draw exactly inside maxScanArea NSRect  
in NSView?



BR, Alexander.
___

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

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Drag Tabs, Custom Colors

2008-11-11 Thread Frank D. Engel, Jr.

Two questions:


1. What is the most likely approach for allowing tabs from NSTabViews  
to be dragged between tab views, possibly on different windows?


Ideally, I'd have subclasses like a DraggableTabItem and a  
DraggableToTabView or whatever which would enable this...


I'd like to be able to take the tabs themselves and allow them to be  
dragged around so that the user can somewhat customize the user  
interface of a complex program.


Even better if I can drag the tab out to nowhere (desktop/whatever)  
and trap that to create a new window (any drag that is far enough  
from the origin and does not land on a valid receiver, if I can  
locate where it was dragged to, would work for me here...



2. Is there any easy way to customize the colors used by Cocoa's  
controls to use neutral grays, like Apple's pro apps?  My current  
line of thought is the Developer color list; can I poseAsClass: the  
Cocoa class that is used to retrieve this and provide my own  
Developer list; if I drop an appropriately-named color list file into  
my bundle somewhere would it be used, etc...


Or do I really need to re-implement all of the controls in order to  
get this?



Any input or suggestions/pointers would be appreciated...



---
Frank D. Engel, Jr.  [EMAIL PROTECTED]

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep John 3:16
John 3:16 For God so loved the world, that he gave his only begotten  
Son, that whosoever believeth in him should not perish, but have  
everlasting life.

$


_
Veteran's Day Domain Sales: Hosting + Domain = US$5.95/year
Offer Ends: Nov 12, 2008.   http://www.doteasy.com 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: A bit of a dumb question, but I need to know...

2008-11-11 Thread Jean-Nicolas Jolivet

Thanks to both of you!

I guess I don't have to copy it after all! :)

Jean-Nicolas Jolivet


Jean-Nicolas Jolivet wrote:
I'm using the quick time framework in my App (QTKit/QTKit.h) for 
QTMovies and QTMovieView etc...


Do I need to distribute it with my app (i.e. add a new Copy build 
phase), or can I safely assume that everyone with OS X Tiger has the 
framework already?? (My app will require Tiger at least)...


Jean-Nicolas Jolivet
___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Alexander Shmelev
Yes, it is called outside my custom preview code. And values of  
maxScanArea, [self bounds] are correct.
Also if I replace [image drawInRect:...] with solid color fill  
[NSBezierPath fillRect:maxScanArea], everything works as I expect.


On 12.11.2008, at 1:53, Andy Lee wrote:


On Nov 11, 2008, at 5:17 PM, Alexander Shmelev wrote:

- (void) drawRect:(NSRect)rect
{


// Drawing image in preview
if (image) {
NSRect imageRect;
imageRect.origin = NSZeroPoint;
imageRect.size = [image size];

[image drawInRect:maxScanArea
 fromRect:imageRect
operation:NSCompositeSourceOver
 fraction:1];
		// I want image to be drawn in maxScanArea rect, but it is drawn  
in [self bounds] rect.


}
}


I don't see a -setPreviewWidth:height: message anywhere.  Have you  
confirmed that it is indeed called?  I would put a breakpoint in  
both -setPreviewWidth:height: and -drawRect: and make sure the  
values of maxScanArea and bounds are what you expect.


--Andy



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A bit of a dumb question, but I need to know...

2008-11-11 Thread Charles Steinman
If you look at the QTKit documentation, it will tell you what's been available 
since when. Some things have been there since 10.3, while others were added in 
10.5. However, I would not recommend distributing Apple's (or anyone else's) 
software with your app unless you have their permission.

Cheers,
Chuck


- Original Message 
 From: Jean-Nicolas Jolivet [EMAIL PROTECTED]
 To: cocoa-dev@lists.apple.com
 Sent: Tuesday, November 11, 2008 2:28:59 PM
 Subject: A bit of a dumb question, but I need to know...
 
 I'm using the quick time framework in my App (QTKit/QTKit.h) for QTMovies and 
 QTMovieView etc...
 
 Do I need to distribute it with my app (i.e. add a new Copy build phase), or 
 can 
 I safely assume that everyone with OS X Tiger has the framework already?? (My 
 app will require Tiger at least)...
 
 Jean-Nicolas Jolivet
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/acharlieblue%40yahoo.com
 
 This email sent to [EMAIL PROTECTED]



  
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Process Priority

2008-11-11 Thread Mr. Gecko
Ok I'm not sure if it worked, but when I change the priority in my app  
it stays the same for that app even after I relaunch my app so that is  
a good sign. Would you know of a good way to test it out so I know if  
it works?


Thanks,
Mr. Gecko
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to draw whole NSImage inside custom rect in NSView

2008-11-11 Thread Graham Cox


On 12 Nov 2008, at 9:56 am, Alexander Shmelev wrote:


Actually, I have one idea why this happens.
Maybe because usually width=8, height = 14 so [self bounds] returns  
NSRect(0,0,8.64,14.64). And
maxScanArea = NSRect(0.32, 0.32, 8, 14). So there can be some  
approximation to integer value, not float.


But it it is true, how to deal with this?



I have noticed some inaccuracy with NSImage when drawing into very  
small non-integer rectangles. I didn't investigate too deeply but it  
seemed to be related to caching the image into a bitmap which of  
course has to have a whole number of pixels. I found a workaround in  
my case which was to suppress caching and draw the image at a larger  
size, changing the CTM on the fly to place it into my destination  
area. I'm afraid this was about 18 months ago so I forget the details  
and I can't put my finger on the precise code in question - but that  
was the gist of it.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process Priority

2008-11-11 Thread Mr. Gecko
hmm it appears to say 0 for virtual pc. I wonder what virtual pc does  
because it seems to work.


On Nov 11, 2008, at 5:19 PM, Mr. Gecko wrote:

Ok I'm not sure if it worked, but when I change the priority in my  
app it stays the same for that app even after I relaunch my app so  
that is a good sign. Would you know of a good way to test it out so  
I know if it works?


Thanks,
Mr. Gecko


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play/Pause, rew/ff keys ...

2008-11-11 Thread Kevin Gessner
The pertinent methods, from my app's delegate. It listens for both  
regular and special key presses, so modify accordingly.



CGEventRef
myCGEventCallback(CGEventTapProxy proxy, CGEventType type,
  CGEventRef event, void *refcon)
{
// Paranoid sanity check.
	if ((type != kCGEventKeyDown)  (type != kCGEventKeyUp)  (type !=  
NX_SYSDEFINED))

return event;

NSEvent *e = [NSEvent eventWithCGEvent:event];

// We're getting a special event
if( ([e type] == NSSystemDefined  [e subtype] == 8) ) {
// do whatever you do with special events
// return NULL to kill the event
// we're getting a normal key event
} else if([e type] == NSKeyDown || [e type] == NSKeyUp) {
// do whatever you do with regular events
// return NULL to kill the event
}

return event;
}


- (void)listenForKeyEvents
{
  CFMachPortRef  eventTap, eventTapTest;
  CGEventMaskeventMask;
  CFRunLoopSourceRef runLoopSource;

  eventMask = ((1  kCGEventKeyDown) | (1  kCGEventKeyUp));

  // try creating an event tap just for keypresses. if it fails, we  
need Universal Access.
  eventTapTest = CGEventTapCreate(kCGSessionEventTap,  
kCGHeadInsertEventTap, 0,

  eventMask, myCGEventCallback, NULL);
  if (!eventTapTest) {
NSLog(@no tap);
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle:@Quit];
[alert setMessageText:@Could not create an event tap.];
	[alert setInformativeText:@Please enable \access for assistive  
devices\ in the Universal Access pane of System Preferences.];

[alert setAlertStyle:NSCriticalAlertStyle];
[alert runModal];
[NSApp terminate:self];
return;
  }
  // disable the test tap
  // causes a crash otherwise (infinite loop with the replacement  
events, probably)

  CGEventTapEnable(eventTapTest, false);

 // Create an event tap. We are interested in key presses and system  
defined keys.
 eventTap = CGEventTapCreate(kCGSessionEventTap,  
kCGHeadInsertEventTap, 0,
  CGEventMaskBit(NX_SYSDEFINED) | eventMask, myCGEventCallback,  
NULL);


  // Create a run loop source.
  runLoopSource = CFMachPortCreateRunLoopSource(
kCFAllocatorDefault, eventTap, 
0);

  // Add to the current run loop.
  CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource,
 kCFRunLoopCommonModes);

  // Enable the event tap.
  CGEventTapEnable(eventTap, true);

}


HTH,
-- Kevin

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


On Nov 11, 2008, at 1:13 PM, I. Savant wrote:


On Nov 11, 2008, at 12:35 PM, Kevin Gessner wrote:


I can give y'all some code if you're needing.


 Sure, the more the merrier! :-)

--
I.S.







___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drag Tabs, Custom Colors

2008-11-11 Thread Kyle Sluder
On Tue, Nov 11, 2008 at 5:58 PM, Frank D. Engel, Jr. [EMAIL PROTECTED] wrote:
 1. What is the most likely approach for allowing tabs from NSTabViews to be
 dragged between tab views, possibly on different windows?

Don't subclass NSTabView for this; it's not the expected UI and it
won't work.  Reparenting views inside a window is one thing, but
moving them to completely different windows is quite a different
proposition.  Your solution in this case is a UI element that doesn't
look like NSTabView and a controller sitting somewhere to reparent,
instantiate, and release views as they move around and between
windows.

 2. Is there any easy way to customize the colors used by Cocoa's controls
 to use neutral grays, like Apple's pro apps?

No.

 can I poseAsClass:

Don't use +poseAsClass:; it is deprecated.

 Or do I really need to re-implement all of the controls in order to get
 this?

Yes, you must re-implement all of this to get the custom behavior.  Or
you could just use standard UI controls and be done with it.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process Priority

2008-11-11 Thread Gary L. Wade
A priority of 0 is the default unless a process was launched by a process
that had a different priority, and then it would have that priority as well.

I'm afraid I don't follow what you're doing and what values you're seeing,
based on your use of that and my app.  You can use the Unix command ps
with the -o argument and parameter nice to view the priority of
processes.

On 11/11/2008 4:30 PM, Mr. Gecko [EMAIL PROTECTED] wrote:

 hmm it appears to say 0 for virtual pc. I wonder what virtual pc does
 because it seems to work.
 
 On Nov 11, 2008, at 5:19 PM, Mr. Gecko wrote:
 
 Ok I'm not sure if it worked, but when I change the priority in my
 app it stays the same for that app even after I relaunch my app so
 that is a good sign. Would you know of a good way to test it out so
 I know if it works?
 
 Thanks,
 Mr. Gecko
 


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: ActiveRecord on Cocoa

2008-11-11 Thread Colin Barrett
You might want to check out OmniDataObject from the OmniGroup. It
works on both the Mac and iPhone and is used in both OmniFocus Mac and
OmniFocus iPhone

http://www.omnigroup.com/developer/

-Colin

On Tue, Nov 11, 2008 at 2:47 AM, malcom [EMAIL PROTECTED] wrote:
 Hello List,
 I'm searching for a things like ActiveRecord for Ruby in Objective-C
 (but I don't want to use Core-Data).
 Anyone can point me to the right solution? I've taken a look at
 http://www.cocoadev.com/index.pl?DataCrux but seems to be adbandoned.
 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/dogcow%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drag Tabs, Custom Colors

2008-11-11 Thread John Pannell

Hi Frank-


1. What is the most likely approach for allowing tabs from  
NSTabViews to be dragged between tab views, possibly on different  
windows?


You could look at PSMTabBarControl... the most up-to-date work on it  
is in the maccode repository at Google Code:


http://code.google.com/p/maccode/source/browse/#svn/trunk/Utilities/ 
PSMTabBarControl


I keep some good examples and docs on my site, but the source code is  
getting stale (I don't believe my code does the fancy drag-to-make-new- 
window, for example)...


http://www.positivespinmedia.com/dev/PSMTabBarControl.html



Hope this helps!

John


John Pannell
Positive Spin Media
http://www.positivespinmedia.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A bit of a dumb question, but I need to know...

2008-11-11 Thread Andrew Farmer

On 11 Nov 08, at 15:17, Charles Steinman wrote:
If you look at the QTKit documentation, it will tell you what's been  
available since when. Some things have been there since 10.3, while  
others were added in 10.5. However, I would not recommend  
distributing Apple's (or anyone else's) software with your app  
unless you have their permission.


If nothing else, bundles from later versions of Mac OS are unlikely to  
work correctly on earlier versions.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Bindings alert issue

2008-11-11 Thread Jim Thomason
Here's a peculiar little case that I hope is easy to resolve.

Here's the case I ran into:

I had bound an NSTextField to an attribute of an object. The interface
at that point implied that the user could update the value in that
field, then immediately click a button to perform an action. The
problem was that the value wasn't updated yet, since the user hadn't
pressed enter. Just clicking the button apparently isn't enough for
the text field to lose focus and commit the changes.

To fix, I rewired to use an NSObjectController that pointed at my
object, and then bound through that instead of directly to the object.
Then, when my save: method was called, I first called
[myObjectController commitEditing] and checked its return value. If it
succeeded, then there were no validation errors and I continued
saving. If it failed, then I bowed out and presented the dialog to the
user to fix. Worked like a charm - either my field was saved or the
user got an error right away.

The problem is that when the button is pressed the error message
displays in a new window, whereas if the user were to hit enter, the
error message displays in a sheet.

I have a simple little test program to illustrate the issue:
http://www.bassetsoftware.com/osx/bindingsfail.zip

Type in any value to the field. If you type in Microsoft, it fails
with a validation error. If you type it in and hit Return, the error
displays in a sheet. If you type it in and hit the Save changes
button, it displays in a window. It's as if the object controller no
longer knows what window it's associated with, so the sheet displays
as a window instead.

Is there anything I can do differently to get my error to display in a
sheet? Because if there isn't something else I can do, I'm going to
consider this a bug and file a report.

Thanks,

-Jim.
___

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

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

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

This email sent to [EMAIL PROTECTED]


BOOL madness

2008-11-11 Thread Andre Masse

Hi,

I'm having trouble converting an object to a BOOL. In my window  
controller, I'm observing the model keyPath isDirty which is a BOOL.


version 1

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context 
{
if(object == model) {
if([keyPath isEqualToString:@isDirty]) {
			[self setDocumentEdited:[change  
objectForKey:NSKeyValueChangeNewKey]];


}
}

}

This doesn't work. No matter what the value of isDirty is,  
setDocumentEdited: is always called with YES;



So, I add some logging, flags and everything to see what's going on:

version 2

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context 
{
if(object == model) {
if([keyPath isEqualToString:@isDirty]) {
BOOL flag = [change  
objectForKey:NSKeyValueChangeNewKey];
			NSLog(@change value = %@, [change  
objectForKey:NSKeyValueChangeNewKey]);

if(flag) {
[self setDocumentEdited:YES];
}
else {
[self setDocumentEdited:NO];
}

}
}   
}

Now, the logging shows that [change  
objectForKey:NSKeyValueChangedNewKey] toggle between 0 and 1 according  
to the value of isDirty, but flag is always YES... I also tried using  
a plain c bool and got the same result (true). Any idea what I'm doing  
wrong?


Thanks,

Andre Masse

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Rob Keniger


On 12/11/2008, at 11:08 AM, Andre Masse wrote:

I'm having trouble converting an object to a BOOL. In my window  
controller, I'm observing the model keyPath isDirty which is a BOOL.



BOOL is not an object type. You need to use [myObject boolValue] to  
get a BOOL.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A bit of a dumb question, but I need to know...

2008-11-11 Thread Shawn Erickson
On Tue, Nov 11, 2008 at 4:54 PM, Andrew Farmer [EMAIL PROTECTED] wrote:
 On 11 Nov 08, at 15:17, Charles Steinman wrote:

 If you look at the QTKit documentation, it will tell you what's been
 available since when. Some things have been there since 10.3, while others
 were added in 10.5. However, I would not recommend distributing Apple's (or
 anyone else's) software with your app unless you have their permission.

 If nothing else, bundles from later versions of Mac OS are unlikely to work
 correctly on earlier versions.

...or stated a different way...

The API you develop against on the Mac is at the client side
(top-side) of frameworks / libraries, it isn't at the kernel boundary.
Anything below the framework/library interface boundary is private and
hence Apple is free to change things are they see fit. This means that
a framework from one version of Mac OS X may be incompatible (in fact
is likely to be incompatible) on any other version of Mac OS X.

This is why basically everything you link against on Mac OS X is
dynamically and not statically linked.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Roland King

[ [ change objectForKey:NSKeyValueChangeNewKey ] boolValue ]?

it's an object, not a bool, it prints as a bool because the object knows 
it's a bool, but you are just testing the object pointer which isn't 0x00


Andre Masse wrote:


Hi,

I'm having trouble converting an object to a BOOL. In my window  
controller, I'm observing the model keyPath isDirty which is a BOOL.


version 1

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context   
{

if(object == model) {
if([keyPath isEqualToString:@isDirty]) {
[self setDocumentEdited:[change  
objectForKey:NSKeyValueChangeNewKey]];
   
}

}

}


This doesn't work. No matter what the value of isDirty is,  
setDocumentEdited: is always called with YES;



So, I add some logging, flags and everything to see what's going on:

version 2

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context   
{

if(object == model) {
if([keyPath isEqualToString:@isDirty]) {
BOOL flag = [change  
objectForKey:NSKeyValueChangeNewKey];
NSLog(@change value = %@, [change  
objectForKey:NSKeyValueChangeNewKey]);

if(flag) {
[self setDocumentEdited:YES];
}
else {
[self setDocumentEdited:NO];
}

}
}   
}


Now, the logging shows that [change  
objectForKey:NSKeyValueChangedNewKey] toggle between 0 and 1 
according  to the value of isDirty, but flag is always YES... I also 
tried using  a plain c bool and got the same result (true). Any idea 
what I'm doing  wrong?


Thanks,

Andre Masse

___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Graham Cox


On 12 Nov 2008, at 12:08 pm, Andre Masse wrote:


Hi,

I'm having trouble converting an object to a BOOL. In my window  
controller, I'm observing the model keyPath isDirty which is a BOOL.


version 1

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context 
{
if(object == model) {
if([keyPath isEqualToString:@isDirty]) {
			[self setDocumentEdited:[change  
objectForKey:NSKeyValueChangeNewKey]];


}
}

}

This doesn't work. No matter what the value of isDirty is,  
setDocumentEdited: is always called with YES;

[]


Now, the logging shows that [change  
objectForKey:NSKeyValueChangedNewKey] toggle between 0 and 1  
according to the value of isDirty, but flag is always YES... I also  
tried using a plain c bool and got the same result (true). Any idea  
what I'm doing wrong?



Yes. The value of the BOOL is wrapped by an NSNumber object so that it  
can be stored by the change dictionary. You need to do this:


[self setDocumentEdited:[[change objectForKey:NSKeyValueChangeNewKey]  
boolValue]];


Note that wherever KVC/KVO returns a scalar value, it is wrapped in an  
NSValue or NSNumber as appropriate, and NSNull is substituted for nil.


hth, Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Charles Steinman
That's because you're getting an object pointer back, and any object pointer 
except for nil evaluates to true. Assuming you know it will only be one object 
inserted at a time, you'd want to do [[change 
objectForKey:NSKeyValueChangeNewKey] boolValue].

Cheers,
Chuck


- Original Message 
 From: Andre Masse [EMAIL PROTECTED]
 To: Cocoa Developers cocoa-dev@lists.apple.com
 Sent: Tuesday, November 11, 2008 5:08:20 PM
 Subject: BOOL madness
 
 Hi,
 
 I'm having trouble converting an object to a BOOL. In my window controller, 
 I'm 
 observing the model keyPath isDirty which is a BOOL.
 
 version 1
 
 - (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
  change:(NSDictionary *)change
 context:(void *)context
 {
 if(object == model) {
 if([keyPath isEqualToString:@isDirty]) {
 [self setDocumentEdited:[change 
 objectForKey:NSKeyValueChangeNewKey]];
 
 }
 }
 
 }
 
 This doesn't work. No matter what the value of isDirty is, setDocumentEdited: 
 is 
 always called with YES;
 
 
 So, I add some logging, flags and everything to see what's going on:
 
 version 2
 
 - (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
  change:(NSDictionary *)change
 context:(void *)context
 {
 if(object == model) {
 if([keyPath isEqualToString:@isDirty]) {
 BOOL flag = [change 
 objectForKey:NSKeyValueChangeNewKey];
 NSLog(@change value = %@, [change 
 objectForKey:NSKeyValueChangeNewKey]);
 if(flag) {
 [self setDocumentEdited:YES];
 }
 else {
 [self setDocumentEdited:NO];
 }
 
 }
 }
 }
 
 Now, the logging shows that [change objectForKey:NSKeyValueChangedNewKey] 
 toggle 
 between 0 and 1 according to the value of isDirty, but flag is always YES... 
 I 
 also tried using a plain c bool and got the same result (true). Any idea what 
 I'm doing wrong?
 
 Thanks,
 
 Andre Masse
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/acharlieblue%40yahoo.com
 
 This email sent to [EMAIL PROTECTED]



  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Andre Masse

Thanks a lot, this the method I was looking for.

Andre Masse

On Nov 11, 2008, at 20:11, Rob Keniger wrote:


BOOL is not an object type. You need to use [myObject boolValue] to  
get a BOOL.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bindings alert issue

2008-11-11 Thread Ashley Clark
If you want to make sure that the validation error is bound to the  
window regardless of how commitEditing is implemented you need to call  
commitEditingWithDelegate:didCommitSelector:contextInfo: and then in  
the method you pass in as the didCommitSelector you can check to see  
if there were any errors and then use  
presentError:modalForWindow:delegate:didRecoverSelector:contextInfo:  
to attach them to your window.


Whether commitEditing should be showing a separate window or a sheet  
is not documented anywhere that I see, whether that's a bug or a  
feature I'm not sure.



Ashley


On Nov 11, 2008, at 6:57 PM, Jim Thomason wrote:


Here's a peculiar little case that I hope is easy to resolve.

Here's the case I ran into:

I had bound an NSTextField to an attribute of an object. The interface
at that point implied that the user could update the value in that
field, then immediately click a button to perform an action. The
problem was that the value wasn't updated yet, since the user hadn't
pressed enter. Just clicking the button apparently isn't enough for
the text field to lose focus and commit the changes.

To fix, I rewired to use an NSObjectController that pointed at my
object, and then bound through that instead of directly to the object.
Then, when my save: method was called, I first called
[myObjectController commitEditing] and checked its return value. If it
succeeded, then there were no validation errors and I continued
saving. If it failed, then I bowed out and presented the dialog to the
user to fix. Worked like a charm - either my field was saved or the
user got an error right away.

The problem is that when the button is pressed the error message
displays in a new window, whereas if the user were to hit enter, the
error message displays in a sheet.

I have a simple little test program to illustrate the issue:
http://www.bassetsoftware.com/osx/bindingsfail.zip

Type in any value to the field. If you type in Microsoft, it fails
with a validation error. If you type it in and hit Return, the error
displays in a sheet. If you type it in and hit the Save changes
button, it displays in a window. It's as if the object controller no
longer knows what window it's associated with, so the sheet displays
as a window instead.

Is there anything I can do differently to get my error to display in a
sheet? Because if there isn't something else I can do, I'm going to
consider this a bug and file a report.

Thanks,

-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/aclark%40ghoti.org

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Jim Correia

On Nov 11, 2008, at 8:08 PM, Andre Masse wrote:

I'm having trouble converting an object to a BOOL. In my window  
controller, I'm observing the model keyPath isDirty which is a BOOL.


version 1

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context 
{
if(object == model) {
if([keyPath isEqualToString:@isDirty]) {
			[self setDocumentEdited:[change  
objectForKey:NSKeyValueChangeNewKey]];


}
}

}


I know this isn't the question you asked, nor the root of the problem  
you are having, but by way of saving you future pain, that is not the  
correct way to write an - 
observeValueForKeyPath:ofObject:change:context: method.


Always use a unique context. Use the context to determine if the  
message is for your (not object or keyPath comparisons.) Call super  
for all contexts that you do not recognize as yours.


Additional details available in the list archives.

Jim

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Andre Masse
I was looking everywhere for BOOL methods conversion and couldn't find  
any. Now I know why: BOOL is not an object type. Not sure how I could  
have found [myObject boolValue] though... Now that I know about it, I  
searched the documentation reference and found that is a method  
implemented by NSString and NSNumber. I suppose there's some kind of  
conversion from BOOL to NSString or NSNumber being done somewhere for  
putting this value in the change dictionary.


Thanks to all of you guys. That was quick :-)

Andre Masse
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Andre Masse

Thanks for pointing that out. I'll check the archives.

Andre Masse

On Nov 11, 2008, at 20:28, Jim Correia wrote:



I know this isn't the question you asked, nor the root of the  
problem you are having, but by way of saving you future pain, that  
is not the correct way to write an - 
observeValueForKeyPath:ofObject:change:context: method.


Always use a unique context. Use the context to determine if the  
message is for your (not object or keyPath comparisons.) Call super  
for all contexts that you do not recognize as yours.


Additional details available in the list archives.

Jim



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Andre Masse
For the sake of followers of this thread and after having read the  
archives, here's the final version:


static NSString *GHMainWindowControllerIsDirtyObservingContext;
...

- (void) observeValueForKeyPath:(NSString *)keyPath
   ofObject:(id)object
 change:(NSDictionary *)change
context:(void *)context 
{
if(context == GHMainWindowControllerIsDirtyObservingContext) {
		[self setDocumentEdited:[[change  
objectForKey:NSKeyValueChangeNewKey] boolValue]];

}
else {
		[super observeValueForKeyPath:keyPath ofObject:object change:change  
context:context];

}

}

Thanks to you all,

Andre Masse

PS: pretty long context name though :-)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Async alert

2008-11-11 Thread Dan Birns
I need an asynchronous alert panel.  My impression is that apple  
doesn't consider this an alert if it's aynchronous.


A couple ideas occur to me for how to solve this:

1) Put the alert in a separate thread.  But these seems to be a lot of  
effort to get around a purposeful design, and thus far I have no  
threads in my application, and would prefer to keep it that way.


2) Use an NSPanel, but how do I duplicate the look and feel of an  
NSAlert?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Custom Drawing Arbitrarily Long Lists (using NSTableView?)

2008-11-11 Thread James Williams
I'm working on a fairly simple application which will display a list of n
items. Right now, I'm displaying the items in an NSTableView, but I would
like to do something with a bit more pizazz.

Instead of a multi-column table, I want to make a single column list where
each entry in the list custom draws the information and controls it needs
(say a couple of labels, a checkbox, a small image, and a text field for
each item). Twitteriffic's interface is a pretty good example of the sort of
thing I'm going for.

In a different world, I would create a custom NSView subclass and add
NSTextField and NSButton views as subviews to my subclass; and then ask the
table view to use my NSView subclass to draw each row. Unfortunately,
NSTableView doesn't display NSView objects: it displays NSCell objects.

I've never worked with NSCell before so I'm sort of shooting in the dark.
NSCell doesn't seem to support subcells like NSView supports subviews. Would
I have to custom draw all of the UI elements I need and hand-code the click
responses and editing and such?

(My other idea would be to write a subclass of NSView which basically does
what NSTableView does; but using NSView objects instead of NSCell objects).

Both of my ideas seem like far too much work; which makes me think I'm
almost certainly doing it wrong. So what are my bad assumptions and how
would you do this?

Thanks

--James
___

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

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

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

This email sent to [EMAIL PROTECTED]


tableView:objectValueForTableColumn:row not being called

2008-11-11 Thread David Blanton

I have a table view  which  is contained in a split view

I set the data source for the table view

numberOfRowsInTableView is called

tableView:objectValueForTableColumn:row is called for each row.

later I change the data source.

numberOfRowsInTableView is called

tableView:objectValueForTableColumn:row  is never called

if I click the split view divider

tableView:objectValueForTableColumn:row is called for the new data  
source.


what could be the problem?




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bindings alert issue

2008-11-11 Thread Quincey Morris

On Nov 11, 2008, at 17:21, Ashley Clark wrote:

If you want to make sure that the validation error is bound to the  
window regardless of how commitEditing is implemented you need to  
call commitEditingWithDelegate:didCommitSelector:contextInfo: and  
then in the method you pass in as the didCommitSelector you can  
check to see if there were any errors and then use  
presentError:modalForWindow:delegate:didRecoverSelector:contextInfo:  
to attach them to your window.


Whether commitEditing should be showing a separate window or a sheet  
is not documented anywhere that I see, whether that's a bug or a  
feature I'm not sure.


commitEditing always uses a separate alert window because it is  
synchronous (doesn't return till the alert is dismissed). Only  
asynchronous things use sheets.


Remember also that bindings-triggered validation (via the  
validatekey method) uses a sheet, but only after the next pass  
through the run loop. And closing the window doesn't trigger anything  
by default. Or quitting the application. And there are interactions  
between undo and text fields that are actively being typed in.


The semantics of committing edits in a long-lived window like a  
document window seem rather tricky to me. In the end, I gave up trying  
to do it, and used dialogs (sheets) with good ol' OK and Cancel  
buttons instead.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Michael Ash
On Tue, Nov 11, 2008 at 8:36 PM, Andre Masse [EMAIL PROTECTED] wrote:
 I was looking everywhere for BOOL methods conversion and couldn't find any.
 Now I know why: BOOL is not an object type. Not sure how I could have found
 [myObject boolValue] though... Now that I know about it, I searched the
 documentation reference and found that is a method implemented by NSString
 and NSNumber. I suppose there's some kind of conversion from BOOL to
 NSString or NSNumber being done somewhere for putting this value in the
 change dictionary.

Key-Value Observing is built on top of Key-Value Coding, and KVC is
documented to box non-object scalars using NSNumber and NSValue:

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/DataTypes.html

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL madness

2008-11-11 Thread Andre Masse

Thanks a lot for the doc pointer.

Andre Masse

On Nov 11, 2008, at 21:12, Michael Ash wrote:


Key-Value Observing is built on top of Key-Value Coding, and KVC is
documented to box non-object scalars using NSNumber and NSValue:

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/DataTypes.html

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Async alert

2008-11-11 Thread Quincey Morris

On Nov 11, 2008, at 09:12, Dan Birns wrote:

I need an asynchronous alert panel.  My impression is that apple  
doesn't consider this an alert if it's aynchronous.


A couple ideas occur to me for how to solve this:

1) Put the alert in a separate thread.  But these seems to be a lot  
of effort to get around a purposeful design, and thus far I have no  
threads in my application, and would prefer to keep it that way.


2) Use an NSPanel, but how do I duplicate the look and feel of an  
NSAlert?


Well, you could display a small, ordinary window and then display an  
asynchronous alert sheet on that window.


But are non-modal alerts what you want, though? Alert windows are  
application-modal (that is, they block the entire application). Alert  
sheets are document-modal (that is, they block the window they're  
displayed on, which is often a document window). The key word here is  
block.


If your application puts up an alert and then just goes about its  
merry way, then you don't really have an alert, you have an  
informative message, and re-purposing an alert's purposeful design  
doesn't really send the appropriate user interface clues. Message  
windows of your own design, or a message panel in another window, or a  
single message window that can list multiple messages, might be a more  
useful choice.


Just an opinion ...


___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >