Re: Live image preview, huge memory usage...

2008-12-03 Thread Jean-Nicolas Jolivet

Thanks a lot for this code Rob!

Quick question (2 actually), right now Im drawing my CIImage in a  
custom view... would drawing the CIImage in my view's drawRect method  
achieve the same (leak-free) result as your piece of code??? i.e.  
something simple like:


// previewImage is an NSBitmapImageRep that exists already..
- (void)drawRect:(NSRect)rect {
	CIImage *outputImage = [[CIImage alloc] initWithData:[previewImage  
TIFFRepresentation]];


	[outputImage drawInRect: NSMakeRect(0, 0, [previewImage pixelsWide],  
[previewImage pixelsHigh])
   fromRect:NSMakeRect(0, 0, [previewImage pixelsWide],  
[previewImage pixelsHigh])

  operation:NSCompositeSourceOver
   fraction:1.0];

[outputImage release];
}


Second question; my app does batch image processing so eventually I  
will have to draw those CIImage offscreen.. (only for the Color  
Control Filter actually)... I assume I have to live with the leak??


J-N

On 3-Dec-08, at 3:10 AM, Rob Keniger wrote:



On 03/12/2008, at 5:34 PM, Jean-Nicolas Jolivet wrote:

Hmm I just found an older post that mentions a big memory leak  
problem when drawing CIImage offscreen I guess I'll have to do  
this differently...



Ah, you've just reminded me. There is a major leak in drawing  
CIImage offscreen but you can work around it by rendering to a  
CGImageRef in the context of the current window.


Here's the code:

//theImage is an existing NSImage
CIImage *outputImage = [CIImage imageWithData:[theImage   
TIFFRepresentation]];


//to draw the image processed by Core Image, we need to draw into  
an  on-screen graphics context
//this works around a bug in CIImage where drawing in off-screen  
graphics contexts causes a huge memory leak


//get the current window's graphics context so that we have an on- 
screen context
//usually we would use any view's window but generically you can  
just  ask for the main window
CIContext *ciContext = [[[NSApp mainWindow] graphicsContext]  
CIContext];

if(ciContext == nil)
{
NSLog(@The CIContext of the main window could not be accessed.
Bailing out of the image creation process.);
return;
}

CGAffineTransform transform;
transform = CGAffineTransformMakeTranslation(0.0,[outputImage   
extent].size.height);

transform = CGAffineTransformScale(transform, 1.0, -1.0);
outputImage = [outputImage imageByApplyingTransform:transform];

//render the CIIimage into a CGImageRef in the on-screen context
CGImageRef cgImage = [ciContext createCGImage:outputImage fromRect:  
[outputImage extent]];

// Draw the CGImageRef into the current context
if (cgImage != NULL)
{
	CGContextDrawImage ([[NSGraphicsContext currentContext]   
graphicsPort], [outputImage extent], cgImage);

CGImageRelease (cgImage);
}

--
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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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]


Controlled Font Substitution

2008-12-03 Thread Gerriet M. Denkmann


When NSTextView and its friends try to display characters and  
encounter a character not present in the current font (e.g. THAI  
CHARACTER MO MA in Monaco 10pt.) then they have to get a corresponding  
glyph from some other font.


The problem: they sometimes pick up a font which is not suitable.
Is there a way (system wide, per user, per application or using code)  
to control the order of fonts being searched for missing glyphs?


In my case Thai characters get displayed in UPC-Angsana (first font in  
~/Library/Fonts), which is a nice font, but rather small (Angsana  
10pt. looks rather like 6pt.).



Kind regards,

Gerriet.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Customizing menu drawing

2008-12-03 Thread Joe Ranieri
I'm attempting to draw custom menus as part of a kiosk application  
where normal Mac OS X menus would look out of place.


I can customize drawing of the individual menu items using a custom  
view (through -[NSMenuItem setView:]). However, there remains a region  
above and below the items where I can't draw. So I'm left with a menu  
with portions of the aqua appearance, and portions of my appearance -  
which is definitely not what I'm after.


http://sirg3.homeip.net/tmp/menus.png

I have a hunch it can be done by dropping down into the Carbon menu  
manager, but that's not supported and will break in 64-bit... Does  
anyone have any ideas?


-- Joe Ranieri
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


NSPersistentDocument packages update

2008-12-03 Thread Paul Tomlin
I'm looking for the current best practice for convincing  
NSPersistentDocument to work with document packages.


I've found quite a few references online[1] which indicate this is/was  
a known issue and there seem to be a few workarounds. What I'm  
wondering is if the stuff I've discovered is 'current', since I don't  
seem to be able to find anything circa 2008.


The current Apple docs still state that NSPD doesn't play nice with  
file wrappers, so I assume you still need to work around this issue  
and I've not seen an Apple Approved (tm) example.


A quick pointer to somewhere would be completely sufficient, I'm  
really just Googled out now :)


Thanks,

Paul

[1] 
http://acaro.wordpress.com/2007/07/19/core-data-persistent-packages-revisited/
[1] http://acaro.wordpress.com/2007/07/09/packages-and-core-data-documents/
[1] http://lists.apple.com/archives/cocoa-dev/2007/Jul/msg00103.html
[1] http://www.cocoadev.com/index.pl?NSPersistentDocumentAsPackage

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Get an Specific sublayer of a view.

2008-12-03 Thread Gustavo Pizano
Hello , well I dunno if this message will arrive to you guys, I have  
place 2 but got no answer, anyway with those 2 I managed to solve the  
problem.


I have a view which has 5 sub-layers, 6 in total with 1st layer which   
contains the other 5.
Now I want to  make a drag and drop operation, each of the 5 layers  
mentioned above contains an image, so I want to drag that image in  
another view of the app, so how can I get the exact layer im clicking  
on?, should I make some if-else statements to know where the mouse was  
clicked and see which layers has those points or  is there any simple  
workaround to achieve this goal.


Thanks a lot,.

Best regards


Gustavo

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Killing a Thread

2008-12-03 Thread Mahaboob



On 11/27/08 9:52 PM, Scott Ribe [EMAIL PROTECTED] wrote:

 When I'm calling the thread for second time, the animation speed of progress
 bar  get increased.
 
 It seems pretty clear that your function never terminates. As we all have
 been telling you, if the function returns the thread will exit. You need to
 examine things in the debugger and determine what the function is doing and
 why it does not end.

I'm using an NSTimer to fire the thread in regular intervals and I was not
released the timer after sending mails to all email id's. Now I release the
timer from  connectionTerminated:  method. Now the thread is exiting.I used
one stop and continue button in the progress window to to stop and continue
the animation. When I'm calling the thread second time and then clicking
stop button, then it is not stopping animation and then clicking continue,
the animation speed get increased abnormally. And also it take more time to
send emails.

I did the code like :

timer =  [[NSTimer scheduledTimerWithTimeInterval:(double)[txtTimeinterval
doubleValue] target:self selector:@selector(send:) userInfo:nil
repeats:YES]retain]; //to start the timer

And to invalidate I used
- (void) connectionTerminated: (NSNotification *) theNotification
{ 
NSLog(@Connection Terminated);
if(stopProgressWindow)
{
[timer invalidate];
[timerrelease];
[self backgroundThreadTerminate]
[deliveryProgressWindow close];
 }
RELEASE(_smtp);
}


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSPersistentDocument packages update

2008-12-03 Thread Mike Abdullah
My advice is not to bother. Just subclass NSDocument directly and  
implement the Core Data side of things there. It really isn't too much  
work.


Mike.

On 3 Dec 2008, at 09:42, Paul Tomlin wrote:

I'm looking for the current best practice for convincing  
NSPersistentDocument to work with document packages.


I've found quite a few references online[1] which indicate this is/ 
was a known issue and there seem to be a few workarounds. What I'm  
wondering is if the stuff I've discovered is 'current', since I  
don't seem to be able to find anything circa 2008.


The current Apple docs still state that NSPD doesn't play nice with  
file wrappers, so I assume you still need to work around this issue  
and I've not seen an Apple Approved (tm) example.


A quick pointer to somewhere would be completely sufficient, I'm  
really just Googled out now :)


Thanks,

Paul

[1] 
http://acaro.wordpress.com/2007/07/19/core-data-persistent-packages-revisited/
[1] http://acaro.wordpress.com/2007/07/09/packages-and-core-data-documents/
[1] http://lists.apple.com/archives/cocoa-dev/2007/Jul/msg00103.html
[1] http://www.cocoadev.com/index.pl?NSPersistentDocumentAsPackage

___

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

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

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

This email sent to [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]


Cant Load an Image into a CALayer

2008-12-03 Thread Gustavo Pizano

Hello, me again,
I have another problem I hadn't been able to solve, Im trying to load  
an image  which is in my bundle, and then put  it in a sublayer of the  
Custom View of my app.


I have been readign the previous posts and nothing seem to be working  
for me, I dunno what Im doing wrong, here is what Im doing.


- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
NSLog(@Initializing the  shps view panel);
shipsContainerLayer = [CALayer layer];
NSRect aux = [self convertRect:[self bounds] toView:nil];

CGRect aux2;
aux2.origin.x=aux.origin.x;
aux2.origin.y=aux.origin.y;
aux2.size.width=aux.size.width;
aux2.size.height=aux.size.height;   
shipsContainerLayer.frame = aux2;   
		NSImage * image = [[NSImage alloc]  
initByReferencingFile:@Destroyer.png];

if (image)
{
NSLog(@got image);

CGImageRefimageRef = NULL;
CGImageSourceRef  sourceRef;

			sourceRef = CGImageSourceCreateWithData((CFDataRef)[image  
TIFFRepresentation], NULL);

if(sourceRef) {
imageRef = 
CGImageSourceCreateImageAtIndex(sourceRef, 0, NULL);
CFRelease(sourceRef);
[shipsContainerLayer setContents:(id)imageRef];

}

}   

}
return self;
}



Trying to track down the problem I see there after I create the  
CGImageSourceRef  it doesnt go into the if statement, I dunno what its  
wrong.


Thanks if someone can help me in this one please.

Best regards

Gustavo
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Button title irregularities

2008-12-03 Thread Ricky Sharp


On Dec 2, 2008, at 7:15 PM, Randall Meadows wrote:


On Dec 2, 2008, at 5:31 PM, Aki Inoue wrote:


You're using Helveitca 12.0 as your label font.


Actually, it's:

(gdb) po labelFont
ArialMT 12.00 pt. P [] (0x001c0e30) fobj=0x162670a0, spc=3.33

Use [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize: 
[yourButton controlSize]]] instead.


And I'm using that because that's what my client used on their  
iPhone app, and they want the Mac app to have the exact same look  
and feel.


Please don't do this; the iPhone and desktop experience are _way_  
different and what you're doing makes no sense.


I recently had my iPhone app reviewed by some members of Apple's UI  
team at one of the tech talk conferences.  My situation was the  
opposite; moving an app from desktop to iPhone.  In some places, I  
fell into the trap of providing a UI that contained desktop-style  
metaphors.


Also keep in mind that an iPhone OS app is much more simplified in  
terms of functions than for the desktop.


Having said all that, on the iPhone OS, use the defined system  
controls, system fonts, etc.  Then, do the same for the desktop.


However, there are definitely some things you can do to both apps to  
ensure they come from the same tree.  Color schemes are very useful  
here.  For example, for my math app, Each mathematical operation was  
given a color.  These colors are used in various parts of the app.   
Some other purely graphical elements are also shared.


Finally, make sure to read both the Macintosh and iPhone Human  
Interface Guideline documents.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating a Bottom Bar on NSWindow

2008-12-03 Thread Ross Carter

There's also some info on bottom bars in the HIG. 
http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_4.html

On Dec 2, 2008, at 9:32 PM, Brandon Walkin wrote:

You can use my BWToolkit plugin for Interface Builder to add a  
bottom bar. The advantage to using the plugin rather than doing it  
programmatically (as Andre suggested) is that you'll be able to see  
the bottom bar in IB which makes it easy to position UI elements on  
or above it.


Here's a link: 
http://www.brandonwalkin.com/blog/2008/11/13/introducing-bwtoolkit/

-Brandon

On 2-Dec-08, at 7:59 PM, Mike Chambers wrote:


I am working on an app, and need to create a bottom bar for it.

I could not find any control or info on how to do this, but I noticed
that if I set the Appearance : Texture attribute to true in Interface
Builder (for the window), I seemed to get a bottom bar.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 reason to avoid GCC-4.2 for Leopard and later targeted code?

2008-12-03 Thread Robert Monaghan

How about with Tiger users? Do the applications work there, too?

Bob

Sent from my iPhone

On Dec 3, 2008, at 6:47 AM, Luca Ciciriello  
[EMAIL PROTECTED] wrote:


No Idea, but I use currently GCC-4.2 for my Apps. I've to say that  
my applications are C++ and Objective-C++ apps.

I haven't found any problem using GCC-4.2 on Leopard.

Luca.
www.mitosrl.com

 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Date: Wed, 3 Dec 2008 09:31:35 -0500
 Subject: Any reason to avoid GCC-4.2 for Leopard and later  
targeted code?


 I've run into an apparent codegen bug (related to Obj-C properties)
 that appears to be fixed in GCC-4.2.

 GCC-4 is still the system compiler on Leopard. For code targetting
 Leopard and later (linked against the 10.5 SDK) are there any  
gotchas
 or other issues I should be aware of before I switch over to using  
4.2

 to build?

 Jim
 ___
 Do not post admin requests to the list. They will be ignored.
 Xcode-users mailing list ([EMAIL PROTECTED])
 Help/Unsubscribe/Update your Subscription:
 
http://lists.apple.com/mailman/options/xcode-users/luca_ciciriello%40hotmail.com

 This email sent to [EMAIL PROTECTED]


Take your friends with you with Mobile Messenger. Click Here!
___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/bob%40gluetools.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 reason to avoid GCC-4.2 for Leopard and later targeted code?

2008-12-03 Thread Luca Ciciriello

Probably not. 
But we are speaking about linking against 10.5 SDK and in this framework I 
don't see any restriction to use GCC-4.2.
 
Luca.



From: [EMAIL PROTECTED]: [EMAIL PROTECTED]; [EMAIL PROTECTED]: Re: Any reason 
to avoid GCC-4.2 for Leopard and later targeted code?Date: Wed, 3 Dec 2008 
07:00:00 -0800
How about with Tiger users? Do the applications work there, too?

BobSent from my iPhone
On Dec 3, 2008, at 6:47 AM, Luca Ciciriello [EMAIL PROTECTED] wrote:


No Idea, but I use currently GCC-4.2 for my Apps. I've to say that my 
applications are C++ and Objective-C++ apps.I haven't found any problem using 
GCC-4.2 on Leopard. Luca.www.mitosrl.com From: [EMAIL PROTECTED] To: [EMAIL 
PROTECTED] Date: Wed, 3 Dec 2008 09:31:35 -0500 Subject: Any reason to avoid 
GCC-4.2 for Leopard and later targeted code?  I've run into an apparent 
codegen bug (related to Obj-C properties)  that appears to be fixed in 
GCC-4.2.  GCC-4 is still the system compiler on Leopard. For code 
targetting  Leopard and later (linked against the 10.5 SDK) are there any 
gotchas  or other issues I should be aware of before I switch over to using 
4.2  to build?  Jim ___ Do not 
post admin requests to the list. They will be ignored. Xcode-users mailing 
list ([EMAIL PROTECTED]) Help/Unsubscribe/Update your Subscription: 
http://lists.apple.com/mailman/options/xcode-users/luca_ciciriello%40hotmail.com
  This email sent to [EMAIL PROTECTED]

Take your friends with you with Mobile Messenger. Click Here! 

___Do not post admin requests to 
the list. They will be ignored.Xcode-users mailing list  ([EMAIL 
PROTECTED])Help/Unsubscribe/Update your 
Subscription:http://lists.apple.com/mailman/options/xcode-users/bob%40gluetools.comThis
 email sent to [EMAIL PROTECTED]
_
Get a bird’s eye view of the world with Multimap
http://clk.atdmt.com/GBL/go/115454059/direct/01/___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cant Load an Image into a CALayer

2008-12-03 Thread Benjamin Stiglitz
		NSImage * image = [[NSImage alloc]  
initByReferencingFile:@Destroyer.png];


Your conditional statement is failing because the image can't be  
located;

you need to pass the path to your image relative to the current working
directory; see the documentation:

http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/occ/instm/NSImage/initByReferencingFile: 



If this image is in your resources directory, you can use either
  [NSImage imageNamed:@Destroyer.png]
or
  [[NSImage alloc] initByReferencingFile:[[NSBundle mainBundle]  
pathForResource:@Destroyer ofType:@png]]


-Ben
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Rollover on custom Cells

2008-12-03 Thread Andreas Mayer


Am 29.11.2008 um 21:44 Uhr schrieb Gustavo Pizano:

Can somebody please give me and advise of what Im might be doing  
wrong?


No, because you didn't give any relevant information (aka source code).


or any efficient method to achieve this purpose ?


You may want to have a look at my AMButtonBar control which does  
something similar:


http://www.harmless.de/cocoa-code.php


Andreas


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURL bug with IPv6 addresses

2008-12-03 Thread Larry Campbell

I've opened radar #6414752.

- lc

On Dec 3, 2008, at 12:34 AM, Kyle Sluder wrote:


On Tue, Dec 2, 2008 at 10:59 PM, Larry Campbell
[EMAIL PROTECTED] wrote:
The first line is the correct, desired result; the next two are  
totally
borked. So is this just known to be broken? Or is there some way to  
get it

to work?


Interestingly enough, the documentation only refers to RFC 1808, which
in turn refers to RFC 1738, which only allows for IPv4 addresses.
This seems like it's just a matter of the standard being behind the
times.  File a bug!

--Kyle Sluder




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Customizing menu drawing

2008-12-03 Thread Benjamin Dobson

I can offer you just two options:
– Use Aqua menus.
– Draw a custom view instead of a menu.

Other people may have more ideas.

On 3 Dec 2008, at 08:57:35, Joe Ranieri wrote:

I'm attempting to draw custom menus as part of a kiosk application  
where normal Mac OS X menus would look out of place.


I can customize drawing of the individual menu items using a custom  
view (through -[NSMenuItem setView:]). However, there remains a  
region above and below the items where I can't draw. So I'm left  
with a menu with portions of the aqua appearance, and portions of my  
appearance - which is definitely not what I'm after.


http://sirg3.homeip.net/tmp/menus.png

I have a hunch it can be done by dropping down into the Carbon menu  
manager, but that's not supported and will break in 64-bit... Does  
anyone have any ideas?

___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Size of the resize indicator

2008-12-03 Thread Eric Gorr
I posted this question awhile ago, but never received a response. I  
asked the same question on another mailing list and received the  
answer that what I want to do is simply not possible.


If anyone has a solution that involves being able to use a NSPanel, I  
would be very interested.


I have filed a bug report - rdar://6414772


I'm pretty sure this cannot be done in Cocoa windows. If you see it  
in some panels, those are either using SPI or they aren's Cocoa  
windows. Also drawing it yourself is not possible using API, as the  
resize indicator is part of a private view class.


On 3 Dec 2008, at 4:29 PM, Eric Gorr wrote:

I would like to be able to use the mini version of a NSScrollView  
and have that scroll view extend into the bottom right corner of a  
resizable NSPanel where the resize indicator for the window is drawn.


Unfortunately, the resize indicator only seems to fit the regular  
sized version of a NSScrollView.


Now, I have seen palettes in other applications with a resize  
indicator which would fit nicely with the small version of a  
NSScrollView.


Does anyone know how to get a smaller resize indicator to  
automatically appear?


Is this something I will have to draw myself?

Are NSScrollViews only meant to be the 'regular' size?


If you need to see an example of what I am talking about, the  
problem can be easily reproduced using just interface builder. I  
have placed an example at:


http://ericgorr.net/resizeindicator.zip

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]


Determining unreleased objects after Quit

2008-12-03 Thread Jon C. Munson II
Namaste!

In my application, when I choose File-Quit, the application appears to
terminate.  HOWEVER, it doesn't.  SOMETHING(s) is(are) left unreleased.

Is there a handy way to determine what the object(s) is(are)? 

Peace, Love, and Light,
 

Jon C. Munson II
And Jesus looking upon them saith, With men it is impossible, but not with
God: for with God all things are possible. [Mark 10:27; KJV]
I sign Peace, Love, and Light for at least two reasons.  First, it is my
truest desire for this planet and her people to live in Peace, with Love,
and in the Light of God.  Second, to be an Ascended Master, one must Be.  As
I wish to Be an Ascended Master (someday if not sooner), I must also Be -
thus I choose to Be Peace, Love, and Light as much as I can for everyone and
am therefore reflecting those thoughts to 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]


Re: Determining unreleased objects after Quit

2008-12-03 Thread Nick Zitzmann


On Dec 3, 2008, at 9:38 AM, Jon C. Munson II wrote:

In my application, when I choose File-Quit, the application appears  
to
terminate.  HOWEVER, it doesn't.  SOMETHING(s) is(are) left  
unreleased.


Is there a handy way to determine what the object(s) is(are)?



Can you please elaborate? When you quit an app, all of its memory is  
released.


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: Determining unreleased objects after Quit

2008-12-03 Thread Michael Ash
On Wed, Dec 3, 2008 at 11:38 AM, Jon C. Munson II [EMAIL PROTECTED] wrote:
 Namaste!

 In my application, when I choose File-Quit, the application appears to
 terminate.  HOWEVER, it doesn't.  SOMETHING(s) is(are) left unreleased.

 Is there a handy way to determine what the object(s) is(are)?

Absolutely impossible. When your application process terminates, the
operating system frees all memory associated with it.

If you tell us what you're observing which makes you think that some
memory remains, perhaps we can tell you what's really going on.

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: Rollover on custom Cells

2008-12-03 Thread Gustavo Pizano

Hey Hello, thanks for the reply.
Well after a day of reading and working on it I figure it out how to  
do it. I dunno if I did it good, but so far its working, and the Leaks  
instrument program is showing no leaks, what Im concerned now its  
another issue with the images I want to show in the CALayers, I post  
the message, this time with code of what Im doing.


Thanks again.


Gustavo

On 3.12.2008, at 16:40, Andreas Mayer wrote:



Am 29.11.2008 um 21:44 Uhr schrieb Gustavo Pizano:

Can somebody please give me and advise of what Im might be doing  
wrong?


No, because you didn't give any relevant information (aka source  
code).



or any efficient method to achieve this purpose ?


You may want to have a look at my AMButtonBar control which does  
something similar:


http://www.harmless.de/cocoa-code.php


Andreas


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/gustavxcodepicora%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: Determining unreleased objects after Quit

2008-12-03 Thread Randall Meadows

On Dec 3, 2008, at 9:38 AM, Jon C. Munson II wrote:


Namaste!

In my application, when I choose File-Quit, the application appears  
to
terminate.  HOWEVER, it doesn't.  SOMETHING(s) is(are) left  
unreleased.


Is there a handy way to determine what the object(s) is(are)?


When your app quits, all of its memory used it released back to the  
system.  However, your deallocs and such will NOT be called, since  
that would be a waste of time since everything's going to be released  
back to the system anyway.  It's a shortcut, and usually is in your  
best interest.


It can, however, bite you in certain situations, specifically non- 
memory resources that you need to do something with at termination.   
In my case, I needed to release access to a camera, so I had to do  
some of my cleanup work in -applicationWillTerminate:.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Controlled Font Substitution

2008-12-03 Thread Aki Inoue
Mac OS X ships with Thonburi as the Thai system font, and that's the  
font usually you get for Thai character substitution.


The font substitution system is applying sophisticated algorithm to  
closely match font traits, and it appears it's causing the random  
fallback.
Probably the system should be smarter to offer more consistent  
fallback behavior so that apps are free from such worries.  Please  
file an enhancement request.


In the meantime, if you want to control the font substitution  
behavior, you can create fonts with NSFontDescriptor that has custom  
NSFontCascadeListAttribute.
Alternatively, you can post-process the system fallback result by  
overriding -[NSTextStorage fixFontAttributeInRange:].


Aki

On 2008/12/03, at 15:41, Gerriet M. Denkmann wrote:



When NSTextView and its friends try to display characters and  
encounter a character not present in the current font (e.g. THAI  
CHARACTER MO MA in Monaco 10pt.) then they have to get a  
corresponding glyph from some other font.


The problem: they sometimes pick up a font which is not suitable.
Is there a way (system wide, per user, per application or using  
code) to control the order of fonts being searched for missing glyphs?


In my case Thai characters get displayed in UPC-Angsana (first font  
in ~/Library/Fonts), which is a nice font, but rather small (Angsana  
10pt. looks rather like 6pt.).



Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Custom Window Resize Image

2008-12-03 Thread Mr. Gecko
Hello, I'm writing a custom window for my application, but I can't  
figure out how to make a custom resize image... Any help?


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: Cant Load an Image into a CALayer Solved

2008-12-03 Thread Gustavo Pizano
I just wanted to say tha tI solved the problem, I realize where I was  
making my mistake, I guess I was trying to put the image in the init  
method, and somehow it wasn't working (my guess is that in the init  
the view wasn't initialized yet), so I put it in the awakeFromNib  
method and it did Work.



thanks

Gustavo


On 3.12.2008, at 14:36, Gustavo Pizano wrote:


Hello, me again,
I have another problem I hadn't been able to solve, Im trying to  
load an image  which is in my bundle, and then put  it in a sublayer  
of the Custom View of my app.


I have been readign the previous posts and nothing seem to be  
working for me, I dunno what Im doing wrong, here is what Im doing.


- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
NSLog(@Initializing the  shps view panel);
shipsContainerLayer = [CALayer layer];
NSRect aux = [self convertRect:[self bounds] toView:nil];

CGRect aux2;
aux2.origin.x=aux.origin.x;
aux2.origin.y=aux.origin.y;
aux2.size.width=aux.size.width;
aux2.size.height=aux.size.height;   
shipsContainerLayer.frame = aux2;   
		NSImage * image = [[NSImage alloc]  
initByReferencingFile:@Destroyer.png];

if (image)
{
NSLog(@got image);

CGImageRefimageRef = NULL;
CGImageSourceRef  sourceRef;

			sourceRef = CGImageSourceCreateWithData((CFDataRef)[image  
TIFFRepresentation], NULL);

if(sourceRef) {
imageRef = 
CGImageSourceCreateImageAtIndex(sourceRef, 0, NULL);
CFRelease(sourceRef);
[shipsContainerLayer setContents:(id)imageRef];

}

}   

}
return self;
}



Trying to track down the problem I see there after I create the  
CGImageSourceRef  it doesnt go into the if statement, I dunno what  
its wrong.


Thanks if someone can help me in this one please.

Best regards

Gustavo


___

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

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

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

This email sent to [EMAIL PROTECTED]


Special Characters Edit Menu Item

2008-12-03 Thread David Blanton
I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


I want to remove this item ... is removing this item a good or bad  
practice?  If bad, why?





David Blanton





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


[NSTextView complete:] popup menu delay before hiding

2008-12-03 Thread Jesse Grosjean
When I hit F5 to do complete: in text edit the menu of completions
shows indefinitely, until I select an item or type a new letter. Same
thing happens when I do F5 in Safari's search field. But if I do F5 in
Xcodes's toolbar search field the popup of choices only shows for
about a second, and then automatically hides.

This leads to my problem. My application has the autohide behavior of
the completions list, but I want it to have the stay visible
indefinitely behavior. I assume that Text Edit has the default
behavior, but I can't seem to find where in my code I've set things up
so that the completions list hides after a few seconds.

Does anyone know how to make sure that NSTextViews popup menu of
completions stays visible until the user presses a new key?

Thanks,
Jesse
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Special Characters Edit Menu Item

2008-12-03 Thread Ken Thomases

On Dec 3, 2008, at 2:09 PM, David Blanton wrote:

I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


I want to remove this item ... is removing this item a good or bad  
practice?  If bad, why?


I can't make any appeal to authority, but I can say that I personally  
find it a bad choice in most situations.


If your app allows the entry of any relatively unconstrained text by  
the user, then the user may have many reasons for wanting to enter  
special characters.  That menu item is the most direct way to do  
that.  (By constrained I mean, for example, a phone number or other  
purely numeric input.  Or, I don't know, DNA sequences where only ATGC  
are legal.)


Why would you want to frustrate your users?

Regards,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Special Characters Edit Menu Item

2008-12-03 Thread David Duncan

On Dec 3, 2008, at 12:09 PM, David Blanton wrote:

I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


There is no sure fire way to remove this menu item.

I want to remove this item ... is removing this item a good or bad  
practice?  If bad, why?



It is not recommended, as it is part of the Mac OS X user experience,  
as it is provided to allow the user to easily enter special  
characters. Why do you want to remove it?

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Special Characters Edit Menu Item

2008-12-03 Thread Joseph Crawford
I do not understand why you would want to remove something that is put  
in place by Apple for a reason.


All of my OS X apps have that menu item, if I were to use that menu  
item and be used to all apps having it

I would hate your app for not having it.

Is there a real reason you wish to remove it or just because you dont  
find a use for it personally?



On Dec 3, 2008, at 3:24 PM, Ken Thomases wrote:


On Dec 3, 2008, at 2:09 PM, David Blanton wrote:

I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


I want to remove this item ... is removing this item a good or bad  
practice?  If bad, why?


I can't make any appeal to authority, but I can say that I  
personally find it a bad choice in most situations.


If your app allows the entry of any relatively unconstrained text by  
the user, then the user may have many reasons for wanting to enter  
special characters.  That menu item is the most direct way to do  
that.  (By constrained I mean, for example, a phone number or  
other purely numeric input.  Or, I don't know, DNA sequences where  
only ATGC are legal.)


Why would you want to frustrate your users?

Regards,
Ken

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/codebowl%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: Special Characters Edit Menu Item

2008-12-03 Thread David Blanton
There is no text entry capability in my app so this menu item looks  
like I don't know what I am doing.



On Dec 3, 2008, at 1:30 PM, Joseph Crawford wrote:

I do not understand why you would want to remove something that is  
put in place by Apple for a reason.


All of my OS X apps have that menu item, if I were to use that menu  
item and be used to all apps having it

I would hate your app for not having it.

Is there a real reason you wish to remove it or just because you  
dont find a use for it personally?



On Dec 3, 2008, at 3:24 PM, Ken Thomases wrote:


On Dec 3, 2008, at 2:09 PM, David Blanton wrote:

I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


I want to remove this item ... is removing this item a good or  
bad practice?  If bad, why?


I can't make any appeal to authority, but I can say that I  
personally find it a bad choice in most situations.


If your app allows the entry of any relatively unconstrained text  
by the user, then the user may have many reasons for wanting to  
enter special characters.  That menu item is the most direct way  
to do that.  (By constrained I mean, for example, a phone number  
or other purely numeric input.  Or, I don't know, DNA sequences  
where only ATGC are legal.)


Why would you want to frustrate your users?

Regards,
Ken

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/codebowl%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/airedale% 
40tularosa.net


This email sent to [EMAIL PROTECTED]




David Blanton





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Special Characters Edit Menu Item

2008-12-03 Thread Joseph Crawford
To any familiar mac user they will know ;)  it's the newcomers that  
will probably wonder, then again they will probably understand

once they see that ever app has it.


On Dec 3, 2008, at 3:35 PM, David Blanton wrote:

There is no text entry capability in my app so this menu item looks  
like I don't know what I am doing.



On Dec 3, 2008, at 1:30 PM, Joseph Crawford wrote:

I do not understand why you would want to remove something that is  
put in place by Apple for a reason.


All of my OS X apps have that menu item, if I were to use that menu  
item and be used to all apps having it

I would hate your app for not having it.

Is there a real reason you wish to remove it or just because you  
dont find a use for it personally?



On Dec 3, 2008, at 3:24 PM, Ken Thomases wrote:


On Dec 3, 2008, at 2:09 PM, David Blanton wrote:

I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


I want to remove this item ... is removing this item a good or  
bad practice?  If bad, why?


I can't make any appeal to authority, but I can say that I  
personally find it a bad choice in most situations.


If your app allows the entry of any relatively unconstrained text  
by the user, then the user may have many reasons for wanting to  
enter special characters.  That menu item is the most direct way  
to do that.  (By constrained I mean, for example, a phone number  
or other purely numeric input.  Or, I don't know, DNA sequences  
where only ATGC are legal.)


Why would you want to frustrate your users?

Regards,
Ken

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/codebowl 
%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/airedale%40tularosa.net

This email sent to [EMAIL PROTECTED]




David Blanton







___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Customizing menu drawing

2008-12-03 Thread Peter Ammon


On Dec 3, 2008, at 12:57 AM, Joe Ranieri wrote:

I'm attempting to draw custom menus as part of a kiosk application  
where normal Mac OS X menus would look out of place.


I can customize drawing of the individual menu items using a custom  
view (through -[NSMenuItem setView:]). However, there remains a  
region above and below the items where I can't draw. So I'm left  
with a menu with portions of the aqua appearance, and portions of my  
appearance - which is definitely not what I'm after.


http://sirg3.homeip.net/tmp/menus.png

I have a hunch it can be done by dropping down into the Carbon menu  
manager, but that's not supported and will break in 64-bit... Does  
anyone have any ideas?


There's no way to do this in Cocoa yet, sorry.

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


NSSavePanel mishandling extensions

2008-12-03 Thread Russ
I have a NSSavePanel set up for the user to select a file name to store a file. 
The  user can store it in several different formats. I have a NSPopUpButton 
configured to allow the user to select the desired format; upon a change, it 
calls the setRequiredFileType function with that single file type. 

But the panel does not seem to pay attention to any of this, it never displays 
or returns a file name with a file extension. The state of the Show extension 
checkbox does not matter.  I've checked that the popup delegate is getting 
called and setting the required filetype to the string with no dot.

I would implement a bit of the desired functionality myself, but NSSavePanel's 
-filename function is labeled such that it should only be called after the 
dialog has completed, and there appears to be no way to change the filename 
once the panel has started (ie to show the correct extension).

How is NSSavePanel supposed to work?   I could try groping around in the panel 
to locate the NSTextView or NSTextField for the file name, but that is crass 
and prone to problems later if not sooner. 

Do I HAVE to implement the delegate methods (isValidFilename?) to check the 
file extension for it if I supply an accessory view? In a spot where there is 
only a single valid file type, my code doesn't do the setAccessoryView and then 
the extension is showing up OK. It's using the same file extension array in 
both cases. The only change as far as the panel is concerned is whether or not 
an accessory view is set --- the behavior changes even if I don't change the 
popup button.  There are no  calls sent to the NSSavePanel -- the behavior has 
changed just based on the presence of the accessory view. (A bunch of calls get 
made to the popup button, but that doesn't do anything to the save panel---it 
only does the setRequiredFileType when the user changes the popup.)

If all else fails, I guess I'll have to prevent the panel from showing the Show 
Extensions box (never an extension visible), and tack on the correct extension 
manually upon completion. But that will mess up the existing-file checks I'd 
guess, so I'll have to waste some more time to replicate that too. It does not 
check a user-supplied extension against the specified one either. And the cocoa 
version will have to be less functional than the carbon version. 

10.5/64bit


  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Special Characters Edit Menu Item

2008-12-03 Thread David Blanton

OK.  I'll leave it.  Thanks all.

On Dec 3, 2008, at 1:29 PM, David Duncan wrote:


On Dec 3, 2008, at 12:09 PM, David Blanton wrote:

I searched the archives and found no useful information on how to  
remove the Special Characters menu item from the edit menu.


There is no sure fire way to remove this menu item.

I want to remove this item ... is removing this item a good or bad  
practice?  If bad, why?



It is not recommended, as it is part of the Mac OS X user  
experience, as it is provided to allow the user to easily enter  
special characters. Why do you want to remove it?

--
David Duncan
Apple DTS Animation and Printing





David Blanton





___

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

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

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

This email sent to [EMAIL PROTECTED]


[MEET] CocoaHeads Mac Developer Meetings

2008-12-03 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group.  We specialize
in Cocoa, but everything Mac programming related is welcome.

Why Should I Attend?
Meeting other Mac OS X developers in person is both fun and immensely
useful. There's no better way to learn Cocoa or get help with problems
than being around other people who are writing Mac software.

We usually have several Cocoa experts hanging around that are happy to
answer whatever questions they can. Bring your laptop and any code
you're working on.

Everyone is Welcome
Meetings are free and open to the public. Feel free to drop in even if
you've never attended or aren't currently using Cocoa. We usually have
a few new faces, so don't worry about being the odd one out.

Upcoming meetings:
Canada
Ottawa/Gatineau- Thursday, December 11, 2008 19:00.

Germany
Berlin- Thursday, December 11, 2008 19:00.
Frankfurt - Monday, December 1, 2008 20:00.
Munich- Thursday, December 11, 2008 19:30.

Malaysia
Kuala Lumpur- Saturday, December 20, 2008 17:30.

Netherlands
Amsterdam- Wednesday, December 10, 2008 19:00.

Sweden
Stockholm- Monday, December 1, 2008 18:30.

United States
Boston- Thursday, December 11, 2008 19:00.
Boulder- Tuesday, December 9, 2008 19:00.
Cleveland- Tuesday, December 12, 2006 19:00.
Colorado Springs- Thursday, December 11, 2008 19:00.
Des Monies- Thursday, December 11, 2008 19:00.
Fort Lauderdale- Wednesday, December 17, 2008 19:00.
Lake Forest- Wednesday, December 10, 2008 19:00.
New York- Thursday, December 11, 2008 18:00.
Portland- Wednesday, December 10, 2008 19:00.
San Diego- Thursday, December 11, 2008 19:00.
Silicon Valley- Possible meeting this month.
St. Louis- Saturday, December 27, 2008 14:00.


Please check the web site at http://cocoaheads.org for more
information including last-minute changes. Some chapters may have yet
to post their meeting for this month.


Steve
Silicon Valley CocoaHeads
http://cocoaheads.org
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSavePanel mishandling extensions

2008-12-03 Thread Corbin Dunn

Have you tried:

[savePanel setRequiredFileType:@txt];
[savePanel setAllowsOtherFileTypes:YES];

This is what TextEdit does. Does TextEdit work in a way similar to  
what you want to do?


-corbin


Le Dec 3, 2008 à 12:58 PM, Russ a écrit :

I have a NSSavePanel set up for the user to select a file name to  
store a file. The  user can store it in several different formats. I  
have a NSPopUpButton configured to allow the user to select the  
desired format; upon a change, it calls the setRequiredFileType  
function with that single file type.


But the panel does not seem to pay attention to any of this, it  
never displays or returns a file name with a file extension. The  
state of the Show extension checkbox does not matter.  I've checked  
that the popup delegate is getting called and setting the required  
filetype to the string with no dot.


I would implement a bit of the desired functionality myself, but  
NSSavePanel's -filename function is labeled such that it should only  
be called after the dialog has completed, and there appears to be no  
way to change the filename once the panel has started (ie to show  
the correct extension).


How is NSSavePanel supposed to work?   I could try groping around in  
the panel to locate the NSTextView or NSTextField for the file name,  
but that is crass and prone to problems later if not sooner.


Do I HAVE to implement the delegate methods (isValidFilename?) to  
check the file extension for it if I supply an accessory view? In a  
spot where there is only a single valid file type, my code doesn't  
do the setAccessoryView and then the extension is showing up OK.  
It's using the same file extension array in both cases. The only  
change as far as the panel is concerned is whether or not an  
accessory view is set --- the behavior changes even if I don't  
change the popup button.  There are no  calls sent to the  
NSSavePanel -- the behavior has changed just based on the presence  
of the accessory view. (A bunch of calls get made to the popup  
button, but that doesn't do anything to the save panel---it only  
does the setRequiredFileType when the user changes the popup.)


If all else fails, I guess I'll have to prevent the panel from  
showing the Show Extensions box (never an extension visible), and  
tack on the correct extension manually upon completion. But that  
will mess up the existing-file checks I'd guess, so I'll have to  
waste some more time to replicate that too. It does not check a user- 
supplied extension against the specified one either. And the cocoa  
version will have to be less functional than the carbon version.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Determining unreleased objects after Quit

2008-12-03 Thread Joseph Kelly


On Dec 3, 2008, at 9:06 AM, Randall Meadows wrote:


On Dec 3, 2008, at 9:38 AM, Jon C. Munson II wrote:


Namaste!

In my application, when I choose File-Quit, the application  
appears to
terminate.  HOWEVER, it doesn't.  SOMETHING(s) is(are) left  
unreleased.


Is there a handy way to determine what the object(s) is(are)?


When your app quits, all of its memory used it released back to the  
system.  However, your deallocs and such will NOT be called, since  
that would be a waste of time since everything's going to be  
released back to the system anyway.  It's a shortcut, and usually is  
in your best interest.


It can, however, bite you in certain situations, specifically non- 
memory resources that you need to do something with at termination.   
In my case, I needed to release access to a camera, so I had to do  
some of my cleanup work in -applicationWillTerminate:.


This is correct. I'm not sure exactly the mechanism -- and I suspect  
it has something to do with Mach ports owned by the process which are  
not shut down correctly -- but I've encountered a case where my app  
appears open in the Dock, but does not appear in the bsd, Process  
Manager, or Mach process lists. This only happens when the app  
terminates abnormally, and our shutdown sequence does not execute.


I've also noticed that aborting a Debug session in Xcode 3.1.1 will  
sometimes result in the app not quite going away, I presume also as a  
result of having mach ports in a weird state.


Joe K.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Binding/KVO question

2008-12-03 Thread Jean-Nicolas Jolivet
This might be an obvious question but I don't think I've ever had to  
do it...I'll try to keep the example as simple as possible:


I have 2 classes;

An AppController with a bunch of properties (lets say propA, probB and  
probC, all integers) that are bound to my main window's controls...  
(all sliders..) when the main windows sliders are changed, the  
properties of AppControllers are changed...


In the same NIB file I have a second window with a custom view inside  
(Let's call it MyCustomView, in MySecondWindow) is there a way for  
MyCustomView to have properties that will be bound to my  
AppController's propA, propB and propC so that MyCustomView is also  
notified when those properties are changed?


I am reading on Key-Value observing right now but it seems like if I  
want to add an observer on my AppController's properties in my  
CustomView's code I would need an instance to my AppController, which  
I haven't!


(both MySecondWindow and MyCustomView are outlets of my  
AppControllers...)


I'm sure there is an obvious way of doing it but right now I just  
can't see it...


Any help would be appreciated...

Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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]


Setting NSTableView column header with Cocoa bindings

2008-12-03 Thread Larry Campbell
I'm having trouble setting the column header title in an NSTableView  
using Cocoa bindings. No matter what my value method returns, the  
header title displays as a single open parenthesis. I know, by setting  
a breakpoint, that my value method is getting called. All other uses  
of bindings within the table (text color, value cell contents, etc.)  
behave as expected.


Has anyone else run into this? Is it a known bug?

- lc



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSSavePanel mishandling extensions

2008-12-03 Thread Russ

It works as desired when only a single permissible file extension is involved. 
(I have setAllowsOtherFileType:NO)

But
the issue is that the user has the option to save jpg, tif, bmp, png
etc files---a specific supported list of types; the popup selects which type 
will be saved, and the
extension needs to be modified accordingly, immediately if the Show
Extension box is on, and at the very least, later when the filename is
being locked in and the overwrite tests done. Users can change the
desired file type several times when the panel is open. This is a
builtin feature in Windows, btw, it's a bit silly to have to spend my time to 
reproduce
such a common function. Something like setAllowedFileTypes that takes an 
NSDictionary of extensions and user-readable equivalents would let NSSavePanel 
do this all by itself.

You can see somebody else having
problems with this on Mac Firefox, do a File/Save Page As--- you can change the
type, but they aren't updating the extension if you change to text.




- Original Message 
Sent: Wednesday, December 3, 2008 4:10:07 PM
Subject: Re: NSSavePanel mishandling extensions

Have you tried:

[savePanel setRequiredFileType:@txt];
[savePanel setAllowsOtherFileTypes:YES];

This is what TextEdit does. Does TextEdit work in a way similar to what you 
want to do?

-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: Binding/KVO question

2008-12-03 Thread Keary Suska


On Dec 3, 2008, at 2:35 PM, Jean-Nicolas Jolivet wrote:

In the same NIB file I have a second window with a custom view  
inside (Let's call it MyCustomView, in MySecondWindow) is there a  
way for MyCustomView to have properties that will be bound to my  
AppController's propA, propB and propC so that MyCustomView is also  
notified when those properties are changed?


Yes.

I am reading on Key-Value observing right now but it seems like if I  
want to add an observer on my AppController's properties in my  
CustomView's code I would need an instance to my AppController,  
which I haven't!



Yes. Since they are in the same nib, why not set an outlet to  
AppController?


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: Binding/KVO question

2008-12-03 Thread Kyle Sluder
On Wed, Dec 3, 2008 at 4:35 PM, Jean-Nicolas Jolivet
[EMAIL PROTECTED] wrote:
 An AppController with a bunch of properties (lets say propA, probB and
 probC, all integers) that are bound to my main window's controls... (all
 sliders..) when the main windows sliders are changed, the properties of
 AppControllers are changed...

You probably shouldn't be doing this.  You should instead bind your UI
elements to an instance of an NSController subclass, and then bind
that controller to the AppController.

Speaking of which, is AppController really a good name for what it's
doing?  Or is it really just an NSApplication delegate?

 In the same NIB file I have a second window with a custom view inside (Let's
 call it MyCustomView, in MySecondWindow) is there a way for MyCustomView to
 have properties that will be bound to my AppController's propA, propB and
 propC so that MyCustomView is also notified when those properties are
 changed?

A few things here:
1) This second window should probably be in a separate nib.
2) In order to expose bindings on a custom view, you have to package
that custom view in an IB plugin.  Good news is that IB3 is much
better about single-project plugins than IB2 was.  In those days, you
had to bundle and install your custom views in an IB palette; IB3
should see your plugin in your project and make it available for you
right away.
3) Once you've got that down, you would then bind this view's
properties to an NSController as well.

 I am reading on Key-Value observing right now but it seems like if I want to
 add an observer on my AppController's properties in my CustomView's code I
 would need an instance to my AppController, which I haven't!

If you were able to get to your AppController instance when binding
your sliders, and your other window is in the same nib, how could you
not be able to get a reference to the AppController when setting up
KVO in your custom view?  The worst you would have to do is add an
outlet on your view.

 (both MySecondWindow and MyCustomView are outlets of my AppControllers...)

Aha.  Following my advice above will introduce a retain cycle unless
you're careful.

--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: Writing Array of Dictionaries to Defaults (CFPreferences)

2008-12-03 Thread [EMAIL PROTECTED]

I will begin by saying that I figured this out at about 9:30 last night.


On Dec 1, 2008, at 7:08 PM, [EMAIL PROTECTED] wrote:

// Notifies of change of data in table view.  Make sure to reflect  
changes in datasource.
- (void)tableView:(NSTableView *)aTableView setObjectValue: 
(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row: 
(NSInteger)rowIndex

{
NSString *columnID = [aTableColumn identifier];
	NSMutableArray *scheduleArray = [NSMutableArray  
arrayWithArray:_schedules];


	// If deactivate time was edited, we create a new schedule with  
just that changed.

if ([columnID isEqualToString:kScheduleDeactivateString]) {
NSLog(@Deactivate anObject = %@, anObject);
		[[scheduleArray objectAtIndex:rowIndex] setDeactivate:(NSNumber *) 
[anObject intValue]];


What are you doing here?  You have an object (anObject).  Presumably  
you think it's an NSNumber.  Then, you ask for its intValue, which  
returns... an int.  An int is _not_ an object, of course.  You then  
cast that int to an NSNumber*, which is almost certainly wrong.  You  
then pass it to some method which is probably expecting a pointer to  
an actual object, not an int posing as a pointer.


The reason for the undefined object here (anObject) is that this  
method is actually a delegate method of NSTableView.  I was under the  
impression that the delegate methods must be used as is (the prototype  
anyway) because that's the message NSTableView is going to send to the  
delegate.  Depending on what table column was edited (as per the  
aTableColumn parameter) I need the object (presumably an NSString*  
since all of the table fields are text fields) to be either an  
NSString* or an NSNumber*.  I know intValue returns an int, and I'm  
perfectly aware that an int is not an object, that's obvious.  I did  
think there was some bridging in place, however, for NSNumber, but you  
are right, there isn't.  What I really needed was:


[NSNumber numberWithInt:[anObject intValue]]

After changing that part of the line, this part of the method worked  
without incident.




}
	// If activate time was edited, we create a new schedule with just  
that changed.

else if ([columnID isEqualToString:kScheduleActivateString]) {
NSLog(@Activate anObject = %@, anObject);
		[[scheduleArray objectAtIndex:rowIndex] setActivate:(NSNumber *) 
[anObject intValue]];


You do the same here.



}
	// If name was edited, we create a new schedule with just that  
changed.

else if ([columnID isEqualToString:kScheduleNameString]) {
NSLog(@Title anObject = %@, anObject);
		[[scheduleArray objectAtIndex:rowIndex] setTitle:(NSString  
*)anObject];

}

	// Iterate through the array to create a new one of  
NSDictionaries, not schedules.

NSMutableArray *tmpArray;


You have declared a pointer, but you haven't set it to point to  
anything, let alone anything meaningful.  It just contains garbage  
at this point.



for (Schedule *schedules in scheduleArray) {
[tmpArray addObject:[schedules toDictionary]];


You're calling methods on an uninitialized pointer.  This will  
probably crash.  If you're unlucky, the bug will be hidden by  
happenstance (tmpArray may happen to be nil because that's what was  
left on the stack).


You needed to initialize tmpArray to point to an actual  
NSMutableArray:


NSMutableArray* tmpArray = [NSMutableArray array];



NSLog(@Adding this to array %@, [schedules toDictionary]);
}

// Write the array to preferences in /Library/Preferences.
	CFPreferencesSetValue(ScheduleKey, (CFArrayRef)tmpArray,  
ApplicationID, kCFPreferencesAnyUser, kCFPreferencesCurrentHost);


Again, tmpArray doesn't contain anything meaningful.  So, attempting  
to write it out will have undefined results -- probably the crash  
you're seeing.


	CFPreferencesSynchronize(ApplicationID, kCFPreferencesAnyUser,  
kCFPreferencesCurrentHost);


}

The pref pane runs fine.  I can add items which calls my  
addSchedule method and just adds a blank item to the array.  When I  
edit the title, it appears to work fine from the gui, but nothing  
is written to the plist.  If I edit the activate or deactivate  
fields then I get the following error and System Preferences crashes.


12/1/08 6:39:59 PM System Preferences[2301] Adding this to array {
  activate = 100;
  deactivate = 1130;
  name = New Schedule;
}
12/1/08 6:39:59 PM System Preferences[2301] *** -[NSCFString  
stringValue]: unrecognized selector sent to instance 0x16e63740


Does anyone have any insight about writing array's of dicts to  
preferences?


You were also right about the array, I forgot those two little  
keywords, a simple oversight.  Instead of going through the mess of  
making an NSMutableArray and casting as a CFArrayRef, I decided to  
just make a CFArrayRef from the get go and ended 

Re: Binding/KVO question

2008-12-03 Thread Jean-Nicolas Jolivet
Well I'm trying to declare an outlet to my app controller in my custom  
view but as soon as I added it, the app wouldn't build anymore... (I  
get 2 errors, one where AppController declares an outlet to my custom  
view, and one where my custom view declares an outlet to my  
AppController)


Not sure why... there's no specific error messages (just Syntax Error  
before AppController and Syntax Error before CustomView



On 3-Dec-08, at 5:26 PM, Keary Suska wrote:



On Dec 3, 2008, at 2:35 PM, Jean-Nicolas Jolivet wrote:

In the same NIB file I have a second window with a custom view  
inside (Let's call it MyCustomView, in MySecondWindow) is there a  
way for MyCustomView to have properties that will be bound to my  
AppController's propA, propB and propC so that MyCustomView is also  
notified when those properties are changed?


Yes.

I am reading on Key-Value observing right now but it seems like if  
I want to add an observer on my AppController's properties in my  
CustomView's code I would need an instance to my AppController,  
which I haven't!



Yes. Since they are in the same nib, why not set an outlet to  
AppController?


HTH,

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



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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: Special Characters Edit Menu Item

2008-12-03 Thread Randy Bradley
David,

I think there must be a way since this menu item doesn¹t show up in my
Entourage compose mail window.To be honest, I never noticed this before.
It seems to me that there are many cases where special characters are not
appropriate.  If it really bothered me I guess I would try to delete all the
menu items at windowDidLoad or some such and then repopulate.




 I searched the archives and found no useful information on how to
 remove the Special Characters menu item from the edit menu.

 There is no sure fire way to remove this menu item.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Special Characters Edit Menu Item

2008-12-03 Thread Randall Meadows

On Dec 3, 2008, at 3:41 PM, Randy Bradley wrote:


David,

   I think there must be a way since this menu item doesn’t show up  
in my
Entourage compose mail window.To be honest, I never noticed this  
before.
It seems to me that there are many cases where special characters  
are not
appropriate.  If it really bothered me I guess I would try to delete  
all the

menu items at windowDidLoad or some such and then repopulate.


I'm guessing Entourage is not a Cocoa app?  That's probably why.

(And a mail compose window would definitely be a place where you'd  
want to be able to insert special characters...)___


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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Trouble with array controller - array

2008-12-03 Thread jmunson

Namaste!

OK, I'm confounded...

I've got an outlet (tblUser) that's an NSArrayController.  It is  
pointing at an Array Controller in my NIB called tblUser.  That is  
point at an Entity called tblUser.  The MOC is set up correctly.


In my code, I've assigned an (NSArray *) aUser to [tblUser  
arrangedObjects].  I then proceed to get a count of objects from the  
array ([aUser count]).  For some reason, I get a value of zero.  Yet,  
in another screen, same app, same instance, the count is correct at 1.  
 Same bits of code, only the names are a little different, but the  
syntax is the same.


Anyone care to posit theories as to why this might be happening?  Did  
I miss an intermediate step somewhere?


Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Binding/KVO question

2008-12-03 Thread Keary Suska


On Dec 3, 2008, at 3:39 PM, Jean-Nicolas Jolivet wrote:

Well I'm trying to declare an outlet to my app controller in my  
custom view but as soon as I added it, the app wouldn't build  
anymore... (I get 2 errors, one where AppController declares an  
outlet to my custom view, and one where my custom view declares an  
outlet to my AppController)


Not sure why... there's no specific error messages (just Syntax  
Error before AppController and Syntax Error before CustomView


There was some really good advice provided by other respondents, so I  
would take those into serious consideration. Anyway, do you declare a  
forward class (using @class directive) in each header file? If you  
don't do this or #import, the compiler won't know what classes you are  
referring to, and you will get the message you mention.




On 3-Dec-08, at 5:26 PM, Keary Suska wrote:



On Dec 3, 2008, at 2:35 PM, Jean-Nicolas Jolivet wrote:

In the same NIB file I have a second window with a custom view  
inside (Let's call it MyCustomView, in MySecondWindow) is there a  
way for MyCustomView to have properties that will be bound to my  
AppController's propA, propB and propC so that MyCustomView is  
also notified when those properties are changed?


Yes.

I am reading on Key-Value observing right now but it seems like if  
I want to add an observer on my AppController's properties in my  
CustomView's code I would need an instance to my AppController,  
which I haven't!



Yes. Since they are in the same nib, why not set an outlet to  
AppController?


HTH,

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



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.com




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]


Adding an application to the login items

2008-12-03 Thread Bill Janssen
I'm writing an installer that adds an application to the login items,
but my script (see below) keeps failing, with a bus error, like this:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.CoreFoundation0x96318aa7 CFStringGetLength + 39
1   com.apple.CoreFoundation0x963254b2 CFStringCompare + 18
2   com.apple.LaunchServices0x904e4b61 
LSSharedFileListInsertItemURL + 73
3   _objc.so0x00231855 ffi_call_SYSV + 53
4   _objc.so0x00231d6c ffi_call + 147
5   _objc.so0x0023f528 
PyObjCFormalProtocol_ForProtocol + 1551
6   org.python.python   0x0011fd3d PyObject_Call + 50
7   org.python.python   0x0018db1a PyEval_EvalFrameEx + 17904
8   org.python.python   0x0018f45b PyEval_EvalCodeEx + 1638
9   org.python.python   0x0018f548 PyEval_EvalCode + 87
10  org.python.python   0x001a69ec PyErr_Display + 1896
11  org.python.python   0x001a7016 PyRun_FileExFlags + 135
12  org.python.python   0x001a8982 PyRun_SimpleFileExFlags + 421
13  org.python.python   0x001b3c03 Py_Main + 3095
14  org.python.pythonapp0x1fca 0x1000 + 4042

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0xa07444ec  ebx: 0x96318a8a  ecx: 0x  edx: 0x0007
  edi: 0x01f10690  esi: 0x  ebp: 0xbfffe8c8  esp: 0xbfffe8b0
   ss: 0x001f  efl: 0x00010283  eip: 0x96318aa7   cs: 0x0017
   ds: 0x001f   es: 0x001f   fs: 0x   gs: 0x0037
  cr2: 0x

Here's the script -- any advice would be appreciated!

TIA, Bill
-

#!/usr/bin/python
# -*- mode: Python -*-

import os, sys

from Foundation import *
from AppKit import *
from LaunchServices import *

pool = NSAutoreleasePool.alloc().init()

try:
if len(sys.argv)  2:
sys.stderr.write(Usage: %s APPLICATIONPATH\n % sys.argv[0])
sys.exit(1)
if not os.path.isdir(sys.argv[1]):
sys.stderr.write(Specified application %s not an application.\n % 
sys.argv[1])
sys.exit(1)
url = CFURLRef.alloc().initWithString_(sys.argv[1])

props = NSDictionary.dictionaryWithObject_forKey_(True, 
kLSSharedFileListItemHidden)

login_items = LSSharedFileListCreate(
kCFAllocatorDefault, kLSSharedFileListSessionLoginItems, None)

NSLog(login_items are %s, url is %s, props are %s % (login_items, url, 
props))

v = LSSharedFileListInsertItemURL(login_items,
  kLSSharedFileListItemLast,
  None,
  None,
  url,
  props,
  None)
NSLog(v is %s % v)

finally:
del pool
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding an application to the login items

2008-12-03 Thread Jason Coco


On Dec 3, 2008, at 19:36 , Bill Janssen wrote:


I'm writing an installer that adds an application to the login items,
but my script (see below) keeps failing, with a bus error, like this:


You're dereferencing a null pointer. Assert that url is not null after  
CFURLRef.alloc()... returns.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Live image preview, huge memory usage...

2008-12-03 Thread Rob Keniger


On 03/12/2008, at 6:22 PM, Jean-Nicolas Jolivet wrote:

Quick question (2 actually), right now Im drawing my CIImage in a  
custom view... would drawing the CIImage in my view's drawRect  
method achieve the same (leak-free) result as your piece of code???  
i.e. something simple like:

snip


As far as I know, as long as you are drawing the CIImage to an on- 
screen context there will be no memory leak, so this should be fine if  
the view is in an on-screen window.


Second question; my app does batch image processing so eventually I  
will have to draw those CIImage offscreen.. (only for the Color  
Control Filter actually)... I assume I have to live with the leak??



No, just use the code I posted which will prevent the leak from  
occurring when drawing offscreen, you just have to get an existing on- 
screen context to draw into. The drawing itself happens offscreen, you  
are just borrowing the on-screen context. You could get the context  
from anywhere as long as it's a valid on-screen context - in the  
example I posted I used the main window's context ([[NSApp mainWindow]  
graphicsContext]) but this is not the only way to do it.


--
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: Adding an application to the login items

2008-12-03 Thread Bill Janssen
Jason Coco [EMAIL PROTECTED] wrote:

  I'm writing an installer that adds an application to the login items,
  but my script (see below) keeps failing, with a bus error, like this:
 
 You're dereferencing a null pointer. Assert that url is not null after  
 CFURLRef.alloc()... returns.

I believe you think url is NULL?  I write it to stdout, and it seems
good then.

Bill
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Live image preview, huge memory usage...

2008-12-03 Thread Jean-Nicolas Jolivet

Mmm I guess I was doing something wrong then!

When I tried the code you posted, my image covered my main window...  
which, I assumed was not the expected behavior hehe


(I did modify it a bit though... the thing is, I need to get a  
BitmapImageRep out of it and I'm not so sure how to do it with the  
code you posted...)


J-N


On 3-Dec-08, at 8:27 PM, Rob Keniger wrote:



On 03/12/2008, at 6:22 PM, Jean-Nicolas Jolivet wrote:

Quick question (2 actually), right now Im drawing my CIImage in a  
custom view... would drawing the CIImage in my view's drawRect  
method achieve the same (leak-free) result as your piece of code???  
i.e. something simple like:

snip


As far as I know, as long as you are drawing the CIImage to an on- 
screen context there will be no memory leak, so this should be fine  
if the view is in an on-screen window.


Second question; my app does batch image processing so eventually I  
will have to draw those CIImage offscreen.. (only for the Color  
Control Filter actually)... I assume I have to live with the leak??



No, just use the code I posted which will prevent the leak from  
occurring when drawing offscreen, you just have to get an existing  
on-screen context to draw into. The drawing itself happens  
offscreen, you are just borrowing the on-screen context. You could  
get the context from anywhere as long as it's a valid on-screen  
context - in the example I posted I used the main window's context  
([[NSApp mainWindow] graphicsContext]) but this is not the only way  
to do it.


--
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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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: Trouble with array controller - array

2008-12-03 Thread jmunson

Ne'er mind, it somehow fixed itself...

And I didn't change the code...

Weird...


Quoting [EMAIL PROTECTED]:


Namaste!

OK, I'm confounded...

I've got an outlet (tblUser) that's an NSArrayController.  It is
pointing at an Array Controller in my NIB called tblUser.  That is
point at an Entity called tblUser.  The MOC is set up correctly.

In my code, I've assigned an (NSArray *) aUser to [tblUser
arrangedObjects].  I then proceed to get a count of objects from the
array ([aUser count]).  For some reason, I get a value of zero.  Yet,
in another screen, same app, same instance, the count is correct at 1.
Same bits of code, only the names are a little different, but the
syntax is the same.

Anyone care to posit theories as to why this might be happening?  Did I
miss an intermediate step somewhere?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jmunson%40his.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]


Insertion bug in NSTreeController?

2008-12-03 Thread Rob Keniger

Hi all,
I have a very simple model object that I want to use as a tree node in  
an NSTreeNode hierarchy. It has a NSMutableArray that I am using as  
the children key for NSTreeController.


I'm having a problem when I call - 
insertObject:atArrangedObjectIndexPath: on NSTreeController where the  
new object is not inserted at the correct location in the model  
object's hierarchy if the indexPath has a length greater than 1 (i.e.  
for any levels lower than the root level).


What happens is that the new item is always added as the last item in  
the array of child objects, no matter what index path I set it to.


So if I have this hierarchy:

Item 1
Sub Item 1
Sub Item 2
Item 2

And I call -insertObject:atArrangedObjectIndexPath: with an indexPath  
of [0][0], the tree should look like this:


Item 1
New Item
Sub Item 1
Sub Item 2
Item 2

What's weird is that the new item is added in the correct location in  
the NSTreeController's arrangedObjects hierarchy of NSTreeNodes, but  
the underlying children array always adds the item at the end of the  
array:


Item 1
Sub Item 1
Sub Item 2
New Item
Item 2

The backtrace at insertion time is interesting because it's clear that  
the private class NSTreeControllerTreeNode is calling - 
insertObject:inSubNodesAtIndex: which is then calling the -addObject:  
method of NSKeyValueNotifyingMutableArray when it should really be  
called -insertObject:atIndex:, but of course I have no control over  
that.


#0 -[Item insertObject:inChildrenAtIndex:]
#1 -[NSKeyValueFastMutableArray insertObject:atIndex:]
#2 -[NSKeyValueFastMutableArray addObject:]
#3 -[NSKeyValueNotifyingMutableArray addObject:]
#4 -[NSTreeControllerTreeNode insertObject:inSubNodesAtIndex:]
#5 -[NSKeyValueFastMutableArray insertObject:atIndex:]
#6 -[NSTreeController  
_insertObject:atArrangedObjectIndexPath:objectHandler:]

#7 -[NSTreeController insertObject:atArrangedObjectIndexPath:]
#8 -[ItemTreeController add:]

Is this a bug, or am I doing something wrong in my implementation?

You can see the problem in action in this project:

http://menumachine.com/quickies/TreeControllerFail.zip

The project uses a very simple model object with an NSMutableArray to  
hold the children of the object, and a subclass of NSTreeController  
that modifies the -add: method.


To see the problem:
1. Disclose the second level of both outline views
2. Select SubItem 0
3. click the Add Item button.
Any help would be much appreciated, I have spent a long time trying to  
work out what I might be doing wrong.


--
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: NSSavePanel mishandling extensions

2008-12-03 Thread Rob Keniger


On 04/12/2008, at 8:09 AM, Russ wrote:


This is a
builtin feature in Windows, btw, it's a bit silly to have to spend  
my time to reproduce
such a common function. Something like setAllowedFileTypes that  
takes an NSDictionary of extensions and user-readable equivalents  
would let NSSavePanel do this all by itself.



Seems like a good idea to me, you should file a bug.

--
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: NSSavePanel mishandling extensions

2008-12-03 Thread Kyle Sluder
On Wed, Dec 3, 2008 at 10:05 PM, Rob Keniger [EMAIL PROTECTED] wrote:
 Seems like a good idea to me, you should file a bug.

To be honest, NSSavePanel and NSOpenPanel should be using UTIs for
this by now.  I don't know why they're not.

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


Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-03 Thread Ken Tozier

Hi

I'm working my way through the Distributed Objects documentation and  
am confused about when to use NSConnection, NSInputStream,  
NSOutputStream etc. The PictureBrowser example project doesn't even  
seem to use NSConnection and does its thing just fine. Reading the  
NSConnection docs, I notice the conspicuous absence of any method that  
actually allows the transfer of messages and data. It just seems like  
something that allows you to connect to something ... and then has not  
a single method to actually do anything with that connection.


I looked at several of the example projects but they're all over the  
map. Some use CF functions, some use raw BSD sockets, PictureBrowser  
uses NSNetService (something not even mentioned in the Distributed  
Object docs) So what is the overview of the function and  
interrelationships between these different parts and importantly, what  
exactly does one do with an NSConnection?


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]


Programmatically loading an NSImage via other field

2008-12-03 Thread jmunson

Namaste!

OK, I'm beat for the day...

I'm struggling with how to load an image into an NSImage via another  
field's value.


I have a field that contains a path  name of an image file.  The user  
can type it in or select it via OpenFile sheet.  This works just fine  
and I'm setting the underlying data object so the value persists.


Now, my question:  how do I get that value to propagate over to the image?

In Windows, I can monitor via the onChange event for the textbox.   
Piece of cake.


Here, though, I'm a bit perplexed.

I thought perhaps the textDidChange delegate method might do it (I put  
that in my File's Owner, and made the File's Owner a delegate of the  
NSTextField that contains the image name).  However, it doesn't fire  
e'en though the text clearly changes (onscreen).


So, how do I accomplish this should-be-easy feat?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 make a RunLoop patiently do nothing?

2008-12-03 Thread Chris Idou

I want to have a separate thread in my app which does time consuming things. I 
want to assign tasks to this thread using performSelector:onThread.

Now you can't have a runloop with no input sources, or it exits immediately. So 
how do I start a thread with a runloop that does nothing except patiently wait 
for performSelector:onThread: calls?





  Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=otherp2=aup3=tagline
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-03 Thread Sean McBride
[EMAIL PROTECTED] ([EMAIL PROTECTED]) on 2008-12-03 10:23 PM said:

I'm struggling with how to load an image into an NSImage via another
field's value.

I have a field that contains a path  name of an image file.  The user
can type it in or select it via OpenFile sheet.  This works just fine
and I'm setting the underlying data object so the value persists.

Now, my question:  how do I get that value to propagate over to the image?

When do you want it to? on every keypress? or when the user presses
return?  If the latter, use the action method.  The former could be
problematic from a usability point of view.  What if the folder has
files named Picture1 and Picture12?  When I have typed Picture1
you would start a slow operation before I want.  The latter is also
problematic because it requires the user to press return, and it's not
necessarily obvious that that is required.

Might I suggest using an NSPathControl (with NSPathStylePopUp) instead
of a textfield?  It would allow the user to drag and drop a file, or
choose one through an open panel.  It sends an action to its target when
the user provides a new file.  You could update your NSImage from the
action method.

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 make a RunLoop patiently do nothing?

2008-12-03 Thread Roland King

could you stick a useless, firing in a million years, timer in it?

how willl you eventually make it shut down even if you do do that, or 
will it just hang out there until the application terminates?


Chris Idou wrote:


I want to have a separate thread in my app which does time consuming things. I 
want to assign tasks to this thread using performSelector:onThread.

Now you can't have a runloop with no input sources, or it exits immediately. So 
how do I start a thread with a runloop that does nothing except patiently wait 
for performSelector:onThread: calls?





 Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=otherp2=aup3=tagline
___

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

Please do not post admin requests or moderator comments to the list.
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: How to make a RunLoop patiently do nothing?

2008-12-03 Thread Sean McBride
Chris Idou ([EMAIL PROTECTED]) on 2008-12-03 10:44 PM said:

I want to have a separate thread in my app which does time consuming
things. I want to assign tasks to this thread using performSelector:onThread.

Now you can't have a runloop with no input sources, or it exits
immediately. So how do I start a thread with a runloop that does nothing
except patiently wait for performSelector:onThread: calls?

Could you just add a timer to the runloop?  The timer could be periodic,
firing every 42 years.

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Programmatically loading an NSImage via other field

2008-12-03 Thread Ken Tozier

Something like this should get you in the ballpark

MyController : NSObject
{
IBOutlet NSTextField*imagePathField;
IBOutlet NSImageView*imageView;
}

// register controller to receive messages from the text field
- (void) awakeFromNib
{
[imagePathField setDelegate: self];
}

// when user hits return key, the text field calls this handler  
allowing you to respond

- (void) controlTextDidEndEditing:(NSNotification *) inNotification
{
// check message type
	if ([[inNotification name] isEqualToString:  
NSControlTextDidEndEditingNotification])

{
		// type OK, check which object sent message. (can be used to respond  
to multipe text fields)

if ([inNotification object] == imagePathField)
{
// get text from field and try to load it into a new 
image
			NSImage		*tempImage	= [NSImage imageWithContentsOfFIe:  
[imagePathField stringValue]];


// set the image in the image view
if (tempImage != nil)
[imageView setImage: tempImage];
}
}
}


On Dec 3, 2008, at 10:23 PM, [EMAIL PROTECTED] wrote:


Namaste!

OK, I'm beat for the day...

I'm struggling with how to load an image into an NSImage via another  
field's value.


I have a field that contains a path  name of an image file.  The  
user can type it in or select it via OpenFile sheet.  This works  
just fine and I'm setting the underlying data object so the value  
persists.


Now, my question:  how do I get that value to propagate over to the  
image?


In Windows, I can monitor via the onChange event for the textbox.   
Piece of cake.


Here, though, I'm a bit perplexed.

I thought perhaps the textDidChange delegate method might do it (I  
put that in my File's Owner, and made the File's Owner a delegate of  
the NSTextField that contains the image name).  However, it doesn't  
fire e'en though the text clearly changes (onscreen).


So, how do I accomplish this should-be-easy feat?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kentozier%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]


Re: How to make a RunLoop patiently do nothing?

2008-12-03 Thread Chris Idou
--- On Wed, 3/12/08, Roland King [EMAIL PROTECTED] wrote:
 could you stick a useless, firing in a million years, timer
 in it?

Ok.

 how will you eventually make it shut down even if you do
 do that, or will it just hang out there until the application
 terminates?

Good question. I had assumed that something like
[myThread performSelector:@selector(exit) onThread:myThread ...

would do the trick. Would this be a nice way to do it?




 
 Chris Idou wrote:
 
 I want to have a separate thread in my app which does
 time consuming things. I want to assign tasks to this thread
 using performSelector:onThread.
 
 Now you can't have a runloop with no input sources,
 or it exits immediately. So how do I start a thread with a
 runloop that does nothing except patiently wait for
 performSelector:onThread: calls?
 
 
 
 
 
   Start your day with Yahoo!7 and win a Sony Bravia
 TV. Enter now
 http://au.docs.yahoo.com/homepageset/?p1=otherp2=aup3=tagline
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments
 to the list.
 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]
   
 


  Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=otherp2=aup3=tagline
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 display simple dialog at application startup?

2008-12-03 Thread Sean McBride
Hi all,

From the 'should be easy department'... :)

I'd like my app to (sometimes) display a modal dialog at launch.  It
should appear before anything else, and no other interaction should be
possible until it is dismissed.  Something like the licence agreement
each new version of iTunes makes you accept...

So from applicationWillFinishLaunching:, I've tried NSAlert's runModal
and NSApplication's runModalForWindow.  Both mostly work.  But with the
latter, the initial untitled document never appears, and with the former
it appears before my dialog is dismissed.

My problem is, seemingly, with AppleEvents.  The 'application open'
event is either being handled too early or is discarded.

Surely there is a clean way to achieve this?

Thanks,

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 make a RunLoop patiently do nothing?

2008-12-03 Thread Sean McBride
Chris Idou ([EMAIL PROTECTED]) on 2008-12-03 11:00 PM said:

 how will you eventually make it shut down even if you do
 do that, or will it just hang out there until the application
 terminates?

Good question. I had assumed that something like
[myThread performSelector:@selector(exit) onThread:myThread ...

would do the trick. Would this be a nice way to do it?

Well, the docs for exit say Invoking this method should be avoided as
it does not give your thread a chance to clean up any resources it
allocated during its execution.

You said you wanted your thread to 'patiently wait for
performSelector:onThread: calls'?  When do you want it to stop waiting?
If at app quit time, then just leave it around.  If earlier, then just
send it a message to clean itself up (dealloc memory, etc.) and
invalidate the timer.  Then you are back to having no runloop sources
and voila.

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-03 Thread Ken Tozier

Thanks John. That cleared up a few things.

Ultimately, what I want to do, is talk directly to a MySQL database  
without the need for the MySQL libraries. The libraries target  
specific processors and OS versions which makes maintenance a royal  
pain. I was thinking I could bypass the whole library zoo by doing  
something ike the following


#define DEFAULT_MYSQL_PORT_NUMBER   3306
#define DEFAULT_HOST_NAME   @locahost

NSSocketPort	*socket			= [[NSSocketPort alloc] initRemoteWithTCPPort:  
DEFAULT_MYSQL_PORT_NUMBER host: DEFAULT_HOST_NAME];
NSConnection	*connection		= [[NSConnection alloc] initWithReceivePort:  
nil sendPort: socket];


In tests, this seemed to connect OK, but I take it from your  
explanation, that I would need to send objective C messages which MySQ  
doesn't grok. In this case, would I need to set up one or both of  
NSInputStream, NSOutputStream to send and receive data? Or would I  
have to go even lower into BSD socked land (a la PictureBrowser) to do  
this sort of thing?



On Dec 3, 2008, at 10:54 PM, John Pannell wrote:


Hi Ken-

I have spent a lot of time in those docs :-)  In a nutshell, here's  
how I see NSConnection and DO... properly set up, NSConnections on  
the server and client side can enable you to pretty much ignore the  
fact that two objects live in separate processes.  You'll just use  
regular obj-c messaging between them.  On the server side, you get a  
connection, assign it a root object, and advertise its presence:


NSConnection *theConnection = [NSConnection defaultConnection];
[theConnection setRootObject:myServerController];
if(![theConnection registerName:@myServerName]){
// undesirable, but unlikely
}

On the client side, you need to grab the server-side object (the  
vended object in the docs) like so...


id myServerObject = [[NSConnection  
rootProxyForConnectionWithRegisteredName:@myServerName host:nil]  
retain];


You might typically specify a communications protocol to use (an obj- 
c protocol that you create defining the messages that the server  
object understands), and also message the server with a reference to  
self (the client object) so the server can hang on to a reference to  
it...


[(NSDistantObject *)myServerObject  
setProtocolForProxy:@protocol(myServerProtocol)];

[myServerObject setClientObject:self];

(Note that setClientObject is something you implement yourself,  
can be named as desired, and its function is to retain a reference  
to the client object).  Now the server can send regular objective-c  
messages to the client object, and the client can send regular  
objective-c messages to the server object.  Both objects are  
represented by a stand-in instance of NSDistantObject in each  
other's address spaces.


Using NSConnection as above, you really don't need any of the other  
classes you mentioned.


Some caveats: Distributed Objects is not present in the iPhone OS,  
and I have encountered troubles (that did not have workarounds last  
I heard) when using DO with garbage collection.


Also to clarify, NSNetService is not directly related to DO, but  
might be more familiar to you as Bonjour - it is used to discover  
other processes that advertise their presence on the network.


Hope this helps!

John

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

On Dec 3, 2008, at 8:22 PM, Ken Tozier wrote:


Hi

I'm working my way through the Distributed Objects documentation  
and am confused about when to use NSConnection, NSInputStream,  
NSOutputStream etc. The PictureBrowser example project doesn't even  
seem to use NSConnection and does its thing just fine. Reading the  
NSConnection docs, I notice the conspicuous absence of any method  
that actually allows the transfer of messages and data. It just  
seems like something that allows you to connect to something ...  
and then has not a single method to actually do anything with that  
connection.


I looked at several of the example projects but they're all over  
the map. Some use CF functions, some use raw BSD sockets,  
PictureBrowser uses NSNetService (something not even mentioned in  
the Distributed Object docs) So what is the overview of the  
function and interrelationships between these different parts and  
importantly, what exactly does one do with an NSConnection?






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 display simple dialog at application startup?

2008-12-03 Thread Chris Idou

Maybe you could launch your own untitled document, if that's what you need?

--- On Wed, 3/12/08, Sean McBride [EMAIL PROTECTED] wrote:

 From: Sean McBride [EMAIL PROTECTED]
 Subject: How to display simple dialog at application startup?
 To: cocoa-dev@lists.apple.com
 Received: Wednesday, 3 December, 2008, 8:07 PM
 Hi all,
 
 From the 'should be easy department'... :)
 
 I'd like my app to (sometimes) display a modal dialog
 at launch.  It
 should appear before anything else, and no other
 interaction should be
 possible until it is dismissed.  Something like the licence
 agreement
 each new version of iTunes makes you accept...
 
 So from applicationWillFinishLaunching:, I've tried
 NSAlert's runModal
 and NSApplication's runModalForWindow.  Both mostly
 work.  But with the
 latter, the initial untitled document never appears, and
 with the former
 it appears before my dialog is dismissed.
 
 My problem is, seemingly, with AppleEvents.  The
 'application open'
 event is either being handled too early or is discarded.
 
 Surely there is a clean way to achieve this?
 
 Thanks,
 
 Sean
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to
 the list.
 Contact the moderators at
 cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com
 
 This email sent to [EMAIL PROTECTED]


  Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=otherp2=aup3=tagline
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Special Characters Edit Menu Item

2008-12-03 Thread Michael Ash
On Wed, Dec 3, 2008 at 5:41 PM, Randy Bradley
[EMAIL PROTECTED] wrote:
 David,

I think there must be a way since this menu item doesn¹t show up in my
 Entourage compose mail window.To be honest, I never noticed this before.
 It seems to me that there are many cases where special characters are not
 appropriate.  If it really bothered me I guess I would try to delete all the
 menu items at windowDidLoad or some such and then repopulate.

Consider that the special characters palette is system-wide, not
app-specific. A user may activate it in another app and then bring
yours up with the palette still available, even though it's not
appropriate. A user may also wish to activate it within your app
before switching to another app where it is appropriate, and will be
annoyed to find that you've removed the command.

Also consider that there's more to your app than just your code. For
example, it would be reasonable to use this palette to ender text into
the search box in the Help menu (although this doesn't actually work
on Leopard, it would seem) and there may be other text fields around
that you haven't explicitly created.

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: How to make a RunLoop patiently do nothing?

2008-12-03 Thread Michael Ash
On Wed, Dec 3, 2008 at 11:11 PM, Sean McBride [EMAIL PROTECTED] wrote:
 You said you wanted your thread to 'patiently wait for
 performSelector:onThread: calls'?  When do you want it to stop waiting?
 If at app quit time, then just leave it around.  If earlier, then just
 send it a message to clean itself up (dealloc memory, etc.) and
 invalidate the timer.  Then you are back to having no runloop sources
 and voila.

Don't do this. When the docs say that your runloop will exit when no
sources are installed on the runloop, this is a warning, not a guide
for how to make it exit. The system may install its own sources and
not remove them just because you want to exit, in which case your
thread will run forever. Worse, this may happen on an OS release later
than the one you tested with, causing your app to leak threads after
you've already shipped it.

The best way would probably be to do something like this:

NSDate *distantFuture = [NSDate distantFuture];
NSThread *myThread = [NSThread currentThread];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
while(![myThread isCancelled])
[runLoop runMode:NSDefaultRunLoopMode beforeDate:distantFuture];

Then to kill the thread, do [thread cancel] and then you'll have to
jog its runloop, so fire off a dummy message to it as well to make it
fall out and hit the while again and exit cleanly.

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]


Windows-Friendly Attachments

2008-12-03 Thread John MacMullin
I have the following NSAppleScript code that works as part of a loop  
that goes through an array to send emails with an attachment:


[emailStriptString setString:[NSString stringWithFormat:@tell  
application \Mail\\n set newMessage to make new outgoing message  
with properties {subject:\[EMAIL PROTECTED], content:\[EMAIL PROTECTED]  return}\n  tell  
newMessage\n set visible to true\n make new attachment with properties  
{file name:\[EMAIL PROTECTED]} at after last paragraph\n make new to recipient at  
end of to recipients with properties {name:\\, address:\[EMAIL PROTECTED]}\n end  
tell\n end tell\n, subject_String, body_String, [[email_Array  
objectAtIndex:i]objectAtIndex:email_PathTo_Attachment],  
recipient_String]];


First question: After Mail starts and creates the emails, I cannot  
determine from the email itself if the attachment is windows- 
friendly.  That option is checked in the mail program under the Edit- 
Attachments menu.  However, can one tell from looking at the email  
that it is windows-friendly?


Second, is there an attachment property that I can add to the above  
code to ensure that the attachment is windows-friendly?


Thanks,

John

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-03 Thread John Pannell

Hi Ken-

You've got it: the intent with NSConnection is to vend proxy objects  
and get proxy objects for the DO system, facilitating communication  
via obj-c messaging.


I can't speak from much experience on your other options.  Apple seems  
to provide a number of levels of networking abstraction - I can't  
speak to which would be best for your task... hopefully some others  
have better expertise!


John

On Dec 3, 2008, at 9:14 PM, Ken Tozier wrote:


Thanks John. That cleared up a few things.

Ultimately, what I want to do, is talk directly to a MySQL database  
without the need for the MySQL libraries. The libraries target  
specific processors and OS versions which makes maintenance a royal  
pain. I was thinking I could bypass the whole library zoo by doing  
something ike the following


#define DEFAULT_MYSQL_PORT_NUMBER   3306
#define DEFAULT_HOST_NAME   @locahost

NSSocketPort	*socket			= [[NSSocketPort alloc]  
initRemoteWithTCPPort: DEFAULT_MYSQL_PORT_NUMBER host:  
DEFAULT_HOST_NAME];
NSConnection	*connection		= [[NSConnection alloc]  
initWithReceivePort: nil sendPort: socket];


In tests, this seemed to connect OK, but I take it from your  
explanation, that I would need to send objective C messages which  
MySQ doesn't grok. In this case, would I need to set up one or both  
of NSInputStream, NSOutputStream to send and receive data? Or would  
I have to go even lower into BSD socked land (a la PictureBrowser)  
to do this sort of thing?



On Dec 3, 2008, at 10:54 PM, John Pannell wrote:


Hi Ken-

I have spent a lot of time in those docs :-)  In a nutshell, here's  
how I see NSConnection and DO... properly set up, NSConnections on  
the server and client side can enable you to pretty much ignore the  
fact that two objects live in separate processes.  You'll just use  
regular obj-c messaging between them.  On the server side, you get  
a connection, assign it a root object, and advertise its presence:


NSConnection *theConnection = [NSConnection defaultConnection];
[theConnection setRootObject:myServerController];
if(![theConnection registerName:@myServerName]){
// undesirable, but unlikely
}

On the client side, you need to grab the server-side object (the  
vended object in the docs) like so...


id myServerObject = [[NSConnection  
rootProxyForConnectionWithRegisteredName:@myServerName host:nil]  
retain];


You might typically specify a communications protocol to use (an  
obj-c protocol that you create defining the messages that the  
server object understands), and also message the server with a  
reference to self (the client object) so the server can hang on to  
a reference to it...


[(NSDistantObject *)myServerObject  
setProtocolForProxy:@protocol(myServerProtocol)];

[myServerObject setClientObject:self];

(Note that setClientObject is something you implement yourself,  
can be named as desired, and its function is to retain a reference  
to the client object).  Now the server can send regular objective-c  
messages to the client object, and the client can send regular  
objective-c messages to the server object.  Both objects are  
represented by a stand-in instance of NSDistantObject in each  
other's address spaces.


Using NSConnection as above, you really don't need any of the other  
classes you mentioned.


Some caveats: Distributed Objects is not present in the iPhone OS,  
and I have encountered troubles (that did not have workarounds last  
I heard) when using DO with garbage collection.


Also to clarify, NSNetService is not directly related to DO, but  
might be more familiar to you as Bonjour - it is used to discover  
other processes that advertise their presence on the network.


Hope this helps!

John

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]


custom view binding to NSTreeController

2008-12-03 Thread Matthew Johnson
I am creating a custom view which I would like to bind to  
NSTreeController.  I have tried observing both [treeController  
arrangedObjects] and [[treeController arrangedObjects] childNodes].   
Both seem to only notify that a change has occurred and do not provide  
any details about the change (insertion, removal, etc).  If this is  
the case, you would have to walk the entire tree every time a change  
happens in order to detect changes.  This seems like a pretty bad  
idea.  There must be a better way to do this.


I am hoping somebody can share an example of how to implement the  
observation necessary to create a custom view that binds to  
NSTreeController.  Does anybody have sample code?  Is anyone able to  
provide a high level idea of how NSOutlineView and NSBrowser do this?   
Is it even possible to do this efficiently with public API?


Thanks,
Matthew
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Beginner memory management question

2008-12-03 Thread Jacob Rhoden
I am not sure how one would go about working this, Im writing my first 
test os/x applications and I am thinking this is probably not right. 
Am I doing the retain in the correct place? I tried reading the 
documentation on NSTextField but it didnt give me a clue about if I 
needed to retain. (Infact stringValue is not even mentioned in the 
NSTextField documentation).


@interface StockListController : NSObject {
IBOutlet NSTextField* stockName;
NSString *newName;
}
-(IBAction) addStockItem:(id)sender;
@end

@implementation StockListController

-(IBAction) addStockItem:(id)sender {
if(newName == nil) [newName release];
newName = [stockName stringValue];
[newName retain];
}

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Correct location to store application data.

2008-12-03 Thread Jacob Rhoden
I have an application which contains a dictionary file of sorts. Users 
can add/alter/and remove entries from a dictionary. I assume I will have 
the default dictionary stored as part of the application bundle somehow, 
and I should be saving a copy of some sort in a second hidden location, 
ie it doesnt make sense to store it in the Documents folder.


Best regards,
Jacob
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Linking CFBundle with static libraries

2008-12-03 Thread frank

Hi All,

I'm developing a CFBundle plugin and would like to link it with some  
static libraries as I want only to distribute the CFBundle

without the need to also distribute shared libraries (.dylib).

The reason I have elected to use CFBundle is that I require the  
ability to load and unload plugins and as far as I have seen, this is

not possible with NSBundle. See: 
http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/Reference/reference.html

My plugin, written in C++, builds without any problems when I link to  
dynamic libraries but when I try to link to static  equivalents

I get the following error from gcc:

ld: absolute addressing (perhaps -mdynamic-no-pic) used in ___tcf_0  
from /Users/botmanx/Documents/src/trunk/Build/Debug/libboost- 
filesystem.a(error_code.o) not allowed in slidable image. Use '- 
read_only_relocs suppress' to enable text relocs


On seeing this, I added the '-read_only_relocs suppress' CFlag to my  
build options as the compiler suggested but the error remains.

Does anyone know how I might get around this problem?

Thanks in advance,
Frank





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


self = [super init];

2008-12-03 Thread EVS

self = [super init];

Why does the above  line of code not cause a memory leak or memory  
fault?


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


NSOutlineView initial expansion

2008-12-03 Thread Andrew Shamel
I've trolled through the archives looking for help on this, but I  
can't seem to find anything that quite works.  I'm trying to set it up  
such that an NSOutlineView starts out  fully expanded.  In the  
delegate, I have the following code:


- (void)awakeFromNib
{
[outline expandItem:nil expandChildren:YES];
}

I feel like I'm missing something rather obvious, since the same code  
works when it's attached to a button.  Is there a better place to put  
it than in awakeFromNib:?


Thank you so much both for your help and your patience.

Peace,

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: Custom Window Resize Image

2008-12-03 Thread Aby
Hi,

NSDrawNinePartImage may do the job...

Regards
Abin



On 12/4/08, Mr. Gecko [EMAIL PROTECTED] wrote:
 Hello, I'm writing a custom window for my application, but I can't figure
 out how to make a custom resize image... Any help?

  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/abinthomas.parecattil%40gmail.com

  This email sent to [EMAIL PROTECTED]



-- 
Aby
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: self = [super init];

2008-12-03 Thread Stephen J. Butler
On Wed, Dec 3, 2008 at 1:14 PM, EVS [EMAIL PROTECTED] wrote:
 self = [super init];

 Why does the above  line of code not cause a memory leak or memory fault?

Why do you think it should leak memory or cause a memory fault?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-03 Thread Michael Ash
On Wed, Dec 3, 2008 at 11:14 PM, Ken Tozier [EMAIL PROTECTED] wrote:
 Thanks John. That cleared up a few things.

 Ultimately, what I want to do, is talk directly to a MySQL database without
 the need for the MySQL libraries. The libraries target specific processors
 and OS versions which makes maintenance a royal pain. I was thinking I could
 bypass the whole library zoo by doing something ike the following

 #define DEFAULT_MYSQL_PORT_NUMBER   3306
 #define DEFAULT_HOST_NAME   @locahost

 NSSocketPort*socket = [[NSSocketPort alloc]
 initRemoteWithTCPPort: DEFAULT_MYSQL_PORT_NUMBER host: DEFAULT_HOST_NAME];
 NSConnection*connection = [[NSConnection alloc]
 initWithReceivePort: nil sendPort: socket];

 In tests, this seemed to connect OK, but I take it from your explanation,
 that I would need to send objective C messages which MySQ doesn't grok. In
 this case, would I need to set up one or both of NSInputStream,
 NSOutputStream to send and receive data? Or would I have to go even lower
 into BSD socked land (a la PictureBrowser) to do this sort of thing?

NSConnection is for distributed objects and nothing else. Despite the
name it is *not* a general-purpose IPC mechanism. As such, it only
works for talking to other Cocoa programs (and only if they're
prepared to accept distributed objects connections), so using it for
MySQL is Right Out.

If you create a pair of NSStreams with a socket then it provides you
with essentially a direct wrapper for the BSD socket stuff. (It is so
direct that the -read: and -write: methods have the exact same
semantics as the read() and write() functions despite not being
documented this way for at least one or two OS revisions.) I've found
NSStream to be the most convenient way for dealing with sockets in a
Cocoa app in most situations, but you can certainly feel free to hit
the BSD layer or use one of the other free sockets wrappers if you
prefer.

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: Beginner memory management question

2008-12-03 Thread Nick Zitzmann


On Dec 3, 2008, at 3:13 AM, Jacob Rhoden wrote:

I am not sure how one would go about working this, Im writing my  
first test os/x applications and I am thinking this is probably  
not right. Am I doing the retain in the correct place?


Yes, but that's not your problem.

I tried reading the documentation on NSTextField but it didnt give  
me a clue about if I needed to retain.


That's because the documentation has assumed you've read the rules for  
memory management. Read those rules ASAP, or turn on garbage  
collection and let the collector manage memory.


(Infact stringValue is not even mentioned in the NSTextField  
documentation).


That's because it's a method of NSControl, of which NSTextField is a  
subclass. And it's mentioned in the NSControl documentation.



-(IBAction) addStockItem:(id)sender {
   if(newName == nil) [newName release];


I think you meant to make that a !=, not a ==. Right now your code is  
calling -release if it is nil, which makes no sense.


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: Beginner memory management question

2008-12-03 Thread Luke Hiesterman
What you should do is declare newName as a property and then do  
self.newName = [stockName stringValue];


The synthesized property will take care of retaining and releasing for  
you.


Luke

Sent from my iPhone.

On Dec 3, 2008, at 2:13 AM, Jacob Rhoden [EMAIL PROTECTED] wrote:

I am not sure how one would go about working this, Im writing my  
first test os/x applications and I am thinking this is probably  
not right. Am I doing the retain in the correct place? I tried  
reading the documentation on NSTextField but it didnt give me a clue  
about if I needed to retain. (Infact stringValue is not even  
mentioned in the NSTextField documentation).


@interface StockListController : NSObject {
   IBOutlet NSTextField* stockName;
   NSString *newName;
}
-(IBAction) addStockItem:(id)sender;
@end

@implementation StockListController

-(IBAction) addStockItem:(id)sender {
   if(newName == nil) [newName release];
   newName = [stockName stringValue];
   [newName retain];
}

___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: self = [super init];

2008-12-03 Thread Luke Hiesterman

What makes you think that it would?

Sent from my iPhone.

On Dec 3, 2008, at 11:14 AM, EVS [EMAIL PROTECTED] wrote:


self = [super init];

Why does the above  line of code not cause a memory leak or memory  
fault?


___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Linking CFBundle with static libraries

2008-12-03 Thread Nick Zitzmann


On Dec 3, 2008, at 7:33 AM, frank wrote:

The reason I have elected to use CFBundle is that I require the  
ability to load and unload plugins and as far as I have seen, this is

not possible with NSBundle. See:


It doesn't matter; CFBundle and NSBundle are two sides of a coin. They  
aren't toll-free bridged, however.


And C and C++ bundles can be unloaded. In Tiger and earlier, Objective- 
C bundles couldn't be unloaded in any way whatsoever. I'm not sure if  
this was addressed in Leopard.


ld: absolute addressing (perhaps -mdynamic-no-pic) used in ___tcf_0  
from /Users/botmanx/Documents/src/trunk/Build/Debug/libboost- 
filesystem.a(error_code.o) not allowed in slidable image. Use '- 
read_only_relocs suppress' to enable text relocs


On seeing this, I added the '-read_only_relocs suppress' CFlag to my  
build options as the compiler suggested but the error remains.

Does anyone know how I might get around this problem?



Are you sure the static library was built correctly? Libraries of any  
sort cannot contain position-independent code, and that linker error  
suggests that the static library was compiled with the -mdynamic-no- 
pic option. Do you have the source code for the static library?


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: self = [super init];

2008-12-03 Thread Nathan Day
Usually self does not change, when the instance returned is different  
to the initially self then it is because the super init has decided  
that the initial self is not what it whats so it releases the  
initially self and returns a different object.


This can happen for singltons or cluster object or perhaps in a  
suation where the object represents some resource and if there is  
already an object for that resource the new instance is released and a  
retained version of the original instance is returned in its place.


On 04/12/2008, at 06:14 , EVS wrote:


self = [super init];

Why does the above  line of code not cause a memory leak or memory  
fault?


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%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: custom view binding to NSTreeController

2008-12-03 Thread Rob Keniger


On 03/12/2008, at 11:51 AM, Matthew Johnson wrote:

I am creating a custom view which I would like to bind to  
NSTreeController.  I have tried observing both [treeController  
arrangedObjects] and [[treeController arrangedObjects] childNodes].   
Both seem to only notify that a change has occurred and do not  
provide any details about the change (insertion, removal, etc).  If  
this is the case, you would have to walk the entire tree every time  
a change happens in order to detect changes.  This seems like a  
pretty bad idea.  There must be a better way to do this.


Not as far as I know, there's a bit of manual work in implementing  
this. I'd love to hear if anyone has a better way to do it.


I am hoping somebody can share an example of how to implement the  
observation necessary to create a custom view that binds to  
NSTreeController.  Does anybody have sample code?  Is anyone able to  
provide a high level idea of how NSOutlineView and NSBrowser do  
this?  Is it even possible to do this efficiently with public API?



You can definitely do it as I am doing it at present, although you can  
only do it in 10.5+ as NSTreeController is horribly broken in 10.4.


Here is some code, edited in mail:

@implementation NSTreeController (Additions)
//returns a flattened array of all the real objects in the tree.
//We use this to handle registration and deregistration of observers  
of the objects that are being managed

-(NSArray *) treeNodesAsArray:(NSArray*)nodes
{
NSMutableArray* theObjectArray=[NSMutableArray array];
for(NSTreeNode *node in nodes)
{
[theObjectArray addObject:[node representedObject]];
if([[node childNodes] count])
{
			[theObjectArray addObjectsFromArray:[self treeNodesAsArray:[node  
childNodes]]];

}
}
return theObjectArray;
}

-(NSArray*) representedObjects
{
if([self childrenKeyPath]==nil)
return nil;
NSArray* arrangedObjects=[self arrangedObjects];
if(arrangedObjects==nil)
return nil;
NSArray* childNodes=[[self arrangedObjects]childNodes];
if(childNodes==nil)
return nil;
return [self treeNodesAsArray:childNodes];
}
@end

Then, in your controller:

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object  
change:(NSDictionary *)change context:(void *)context

{
if (context == MyObservationContext)
{
NSArray *items = [treeController representedObjects];

//if there has been no change, don't do anything
if([items isEqualToArray:self.oldItems])
return;

//get the items that have been added to the array
NSMutableArray *newItems = [items mutableCopy];
[newItems removeObjectsInArray: self.oldItems];

NSMutableArray *removedItems = [self.oldItems mutableCopy];
[removedItems removeObjectsInArray:items];

//stop observing the removed items
[self stopObservingOldItemProperties:removedItems];

//start observing the new items
[self startObservingNewItemProperties:newItems];

		//store the current array of items as the old array so we can  
compare it next time

self.oldItems=items;

//do whatever UI adjustments you need to do
}


--
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: How to make a RunLoop patiently do nothing?

2008-12-03 Thread Adam R. Maxwell


On Dec 3, 2008, at 11:24 PM, Michael Ash wrote:


On Wed, Dec 3, 2008 at 11:11 PM, Sean McBride [EMAIL PROTECTED] wrote:

You said you wanted your thread to 'patiently wait for
performSelector:onThread: calls'?  When do you want it to stop  
waiting?
If at app quit time, then just leave it around.  If earlier, then  
just

send it a message to clean itself up (dealloc memory, etc.) and
invalidate the timer.  Then you are back to having no runloop sources
and voila.


Don't do this. When the docs say that your runloop will exit when no
sources are installed on the runloop, this is a warning, not a guide
for how to make it exit. The system may install its own sources and
not remove them just because you want to exit, in which case your
thread will run forever. Worse, this may happen on an OS release later
than the one you tested with, causing your app to leak threads after
you've already shipped it.

The best way would probably be to do something like this:

NSDate *distantFuture = [NSDate distantFuture];
NSThread *myThread = [NSThread currentThread];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
while(![myThread isCancelled])
   [runLoop runMode:NSDefaultRunLoopMode beforeDate:distantFuture];

Then to kill the thread, do [thread cancel] and then you'll have to
jog its runloop, so fire off a dummy message to it as well to make it
fall out and hit the while again and exit cleanly.


In addition to what Mike said, you should add an NSPort to ensure the  
runloop has at least one source, or it may exit immediately:


[runLoop addPort:[NSPort port] forMode:NSDefaultRunLoopMode];
while ( )...

Adding a timer as others suggested may work, but adding an NSPort is a  
fairly standard way to do this (the archives give examples of this).


--
Adam

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]

How to draw rounded Images

2008-12-03 Thread SridharRao M
Hi,
 How to draw rounded images (like application icons) for iPhone.

Regards,
SRIDHAR.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSOutlineView initial expansion

2008-12-03 Thread Ashley Clark
If your outline's data is being populated from an NSTreeController  
then the fetch isn't happening until the next iteration of the event  
loop. If I understand it correctly this is done so that it can present  
any errors as a sheet on your window.


Try delaying your call to expandItem: in your awakeFromNib.

- (void)expandAllItems {
[outline expandItem:nil expandChildren:YES];
}

- (void)awakeFromNib {
/* snip */

	[self performSelector:@selector(expandAllItems) withObject:nil  
afterDelay:0.0];

}

I believe that should work.

Ashley


On Dec 3, 2008, at 3:36 PM, Andrew Shamel wrote:

I've trolled through the archives looking for help on this, but I  
can't seem to find anything that quite works.  I'm trying to set it  
up such that an NSOutlineView starts out  fully expanded.  In the  
delegate, I have the following code:


- (void)awakeFromNib
{
[outline expandItem:nil expandChildren:YES];
}

I feel like I'm missing something rather obvious, since the same  
code works when it's attached to a button.  Is there a better place  
to put it than in awakeFromNib:?


Thank you so much both for your help and your patience.

Peace,

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/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: NSOutlineView initial expansion

2008-12-03 Thread Andrew Shamel

Ahh, brilliant!!  It worked a treat.

Thanks so much!




Try delaying your call to expandItem: in your awakeFromNib.

- (void)expandAllItems {
[outline expandItem:nil expandChildren:YES];
}

- (void)awakeFromNib {
/* snip */

	[self performSelector:@selector(expandAllItems) withObject:nil  
afterDelay:0.0];

}


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Correct location to store application data.

2008-12-03 Thread Nathan Day
If the data in the dictionary is simple you could perhaps look at  
NSUserDefaults, you could use your dictionary file to initialise  
NSUserDefaults, alternatively you could create a separate file in  
preferences. Be warned that you can only stick property list types in  
NSUserDefaults.



On 03/12/2008, at 21:20 , Jacob Rhoden wrote:

I have an application which contains a dictionary file of sorts.  
Users can add/alter/and remove entries from a dictionary. I assume I  
will have the default dictionary stored as part of the application  
bundle somehow, and I should be saving a copy of some sort in a  
second hidden location, ie it doesnt make sense to store it in the  
Documents folder.


Best regards,
Jacob
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%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]


[MEET] Cocoa Heads Sydney - Inaugural Christmas Drinks - Wednesday 17th at 6:30 pm

2008-12-03 Thread Mark Aufflick
Hi all,

You are cordially invited to the Cocoa Heads Sydney Inaugural
Christmas Drinks event with the following details.

Wednesday December 17th at 6:30 pm
Redoak Boutique Beer Cafe
201 Clarence Street, Sydney, NSW 2000 Australia

Map: http://is.gd/aakN
Bar food menu: http://www.redoak.com.au/03_00.html
Beer menu: http://www.redoak.com.au/02_00.html

The first planned regular meetup will be in January, so if you want to
help decide what night to meet on in addition to enjoying specialty
beers and tasting plates, you need to be there!

A gleaming pile of laptops will surely guide you, else call me on my
mobile: 0438 700 647.

The Sydney CocoHeads mailing list/google group/calendar etc. is at
http://groups.google.com/group/sydney-cocoaheads

Hope to see you there!

Cheers,

Mark.

-- 
Mark Aufflick
  contact info at http://mark.aufflick.com/about/contact
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc

2008-12-03 Thread Ken Tozier

Thanks Mike

Still trying to get my head around this stuff, but here's how I  
interpret what I need to do...


Create a connection to MySQL
#define DEFAULT_MYSQL_PORT_NUMBER   3306
	socket	= [[NSSocketPort alloc] initRemoteWithTCPPort:  
DEFAUT_MYSQL_PORT_NUMBER host: @some host];


Register as the delegate of the port
[socket setDelegate: self];

Add to run loop
	[[NSRunLoop mainRunLoop] addPort: socket forMode:  
NSDefaultRunLoopMode];


Here's where I lose the thread. As the delegate, do I need to implement
- (void) handlePortMessage:(NSPortMessage *) inPortMessage

Or, because I'm dealing with something that has no concept of  
NSPortMessage, do I need to use NSInput/NSOutput streams? If so, where  
in the process do I squeeze those in? Also very confused about which  
stream I would receive replies from MySQL (assuming I could  
successfully connect) If I send a message through an NSOutputStream,  
wouldn't MySQL send the reply back through the same stream? I don't  
see how it could do otherwise as it has no idea who the client app is,  
or how to connect and build it's own NSOutput stream with which to  
reply.


On Dec 4, 2008, at 12:23 AM, Michael Ash wrote:


NSConnection is for distributed objects and nothing else. Despite the
name it is *not* a general-purpose IPC mechanism. As such, it only
works for talking to other Cocoa programs (and only if they're
prepared to accept distributed objects connections), so using it for
MySQL is Right Out.

If you create a pair of NSStreams with a socket then it provides you
with essentially a direct wrapper for the BSD socket stuff. (It is so
direct that the -read: and -write: methods have the exact same
semantics as the read() and write() functions despite not being
documented this way for at least one or two OS revisions.) I've found
NSStream to be the most convenient way for dealing with sockets in a
Cocoa app in most situations, but you can certainly feel free to hit
the BSD layer or use one of the other free sockets wrappers if you
prefer.

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/kentozier%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]


Re: How to draw rounded Images

2008-12-03 Thread Peter N Lewis

 How to draw rounded images (like application icons) for iPhone.


The normal way is to create a rounded NSBezierPath, set the clipping, 
and then do your drawing.


I believe rounded rect NSBezierPath was added in 10.5.  I use the 
following category code for 10.4.


  NSBezierPath* myRoundedIconRect = [NSBezierPath 
bezierPathWithRoundedRect:NSInsetRect(itemRect,-0.5,-0.5) 
cornerRadius:kIAIconRadius];

  [myRoundedIconRect fill];


or

  [myRoundedRect addClip];
  // do whatever drawing you want

Don't forget to save and restore the NSGraphicsContext

  CGContextRef context = (CGContextRef)[[NSGraphicsContext 
currentContext] graphicsPort];

  CGContextSaveGState( context );

and

  CGContextRef context = (CGContextRef)[[NSGraphicsContext 
currentContext] graphicsPort];

  CGContextRestoreGState( context );

Sorry about the code formatting.

@implementation NSBezierPath (RoundedRect)

+ (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect 
cornerRadius:(float)radius {

NSBezierPath *result = [NSBezierPath bezierPath];
[result appendBezierPathWithRoundedRect:rect cornerRadius:radius];
return result;
}

- (void)appendBezierPathWithRoundedRect:(NSRect)rect 
cornerRadius:(float)radius {

if (!NSIsEmptyRect(rect)) {
  if (radius  0.0) {
  // Clamp radius to be no larger than half the rect's width or height.
  float clampedRadius = MIN(radius, 0.5 * MIN(rect.size.width, 
rect.size.height));


  NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect));
  NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect));
  NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect));

  [self moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))];
  [self appendBezierPathWithArcFromPoint:topLeft 
toPoint:rect.origin radius:clampedRadius];
  [self appendBezierPathWithArcFromPoint:rect.origin 
toPoint:bottomRight radius:clampedRadius];
  [self appendBezierPathWithArcFromPoint:bottomRight 
toPoint:topRightradius:clampedRadius];
  [self appendBezierPathWithArcFromPoint:topRight 
toPoint:topLeft radius:clampedRadius];

  [self closePath];
  } else {
  // When radius == 0.0, this degenerates to the simple case of a 
plain rectangle.

  [self appendBezierPathWithRect:rect];
  }
}
}

@end

Enjoy,
   Peter.

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

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Special Characters Edit Menu Item

2008-12-03 Thread Benjamin Dobson


On 4 Dec 2008, at 04:17:22, Michael Ash wrote:


Consider that the special characters palette is system-wide, not
app-specific. A user may activate it in another app and then bring
yours up with the palette still available, even though it's not
appropriate. A user may also wish to activate it within your app
before switching to another app where it is appropriate, and will be
annoyed to find that you've removed the command.

Also consider that there's more to your app than just your code. For
example, it would be reasonable to use this palette to ender text into
the search box in the Help menu (although this doesn't actually work
on Leopard, it would seem) and there may be other text fields around
that you haven't explicitly created.


In addition to what Michael wrote, it is possible for the user to open  
the character palette from the Input Menu. It is impossible to stop  
the user getting at the character palette.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]


Help Menu

2008-12-03 Thread David Blanton

I have been required to develop and build with Xcode 2.41 on 10.4.11.

In testing on 10.5.5 I get two help menus.

Is there something I need to do for Help on 10.5.x ?


David Blanton





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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]