Re: Calculating accurate bounds of stroked paths [SOLVED]

2008-07-09 Thread Chris Suter

Hi Graham,

On 09/07/2008, at 4:37 PM, Graham Cox wrote:


On 9 Jul 2008, at 4:02 pm, Chris Suter wrote:


so you can get a worst case bounds by ignoring the mitre limit.


No you can't. If the stroke width is 'w' then you can outset the  
bounds by w/2 to enclose the path for straight edges and angles >=  
90 degrees. When there is a more acute angle though the resulting  
spike quickly extends beyond this bounds up to the miter limit, at  
which point it becomes a bevel join and falls within the bounds  
again. Thus to calculate the bounds that will include all such  
spikes, you do need to factor in the miter limit.


You could ignore the mitre limit and assume it was always mitre joint  
and it would give you a worst case bounds. However, it wouldn't be  
sensible to do that since the bounds would stretch out excessively for  
very acute angles. It's for this reason that I was wrong to suggest it.



Thanks to this page I now understand what the miter limit is:

http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Attributes-Stroke.html


I suggest you have a look at the PDF specification since that's the  
definitive reference for this stuff.


It's the distance 'm' along the widest part of the corner. This is  
the hypotenuse of a right-triangle whose other sides are the edge of  
the path and the normal to the path, which has the known width 'w'.  
Thus the angle 'a' of the corner is equal to 2*sin(w/m), or m = 2w/ 
sin(a).


I think you mean a = 2 * arcsin(w / m) and m = w / sin(a / 2).

But it's not necessary to worry about the angle itself for a worst  
case calculation, since only the value of m matters - it can never  
exceed the programmed miter limit. Thus the path bounds is simply  
outset by (miter limit * w/2) to ensure it is just beyond the tip of  
any possible spike.


You will need to also take into account of the line width (as I'm sure  
you do) so I think the combined offset would be best expressed as:


max(w / 2, ml * w / 2)

where ml is the mitre limit.

-- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Calculating accurate bounds of stroked paths [SOLVED]

2008-07-09 Thread Graham Cox


On 9 Jul 2008, at 5:11 pm, Chris Suter wrote:

You could ignore the mitre limit and assume it was always mitre  
joint and it would give you a worst case bounds. However, it  
wouldn't be sensible to do that since the bounds would stretch out  
excessively for very acute angles.


Without knowing the miter limit's value, the "worst case bounds" would  
have to be infinitely large. I suppose that could be defined as 'worst  
case'! As a practical matter it's always going to be something though,  
and it turns out to be easy to factor it in. I can also avoid doing  
this if my path joins are round or bevel.


I suggest you have a look at the PDF specification since that's the  
definitive reference for this stuff.


Yep, I'm just downloading that now.


I think you mean a = 2 * arcsin(w / m) and m = w / sin(a / 2).


Indeed I do - been a long day ;-)



You will need to also take into account of the line width (as I'm  
sure you do) so I think the combined offset would be best expressed  
as:


max(w / 2, ml * w / 2)

where ml is the mitre limit.


That's right, and precisely what I'm doing. Works well enough though  
for most actual paths is on the generous side (because rarely do  
angles get that sharp). Still, it's probably a fair compromise between  
updating more than necessary and going over each path to find the  
sharpest angle.



cheers, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Ken Thomases

On Jul 8, 2008, at 7:11 PM, Hamish Allan wrote:


I'm seeing "connection went invalid while waiting for a reply" in a DO
callback. The client passes self in a call to the server; some time
later, the server calls a method on that client (proxy), the program
hangs for a second or so, the "connection went invalid" connection
appears, but the method call is successful anyway, so it would appear
that the DO machinery is re-connecting everything okay.

According to the debugger, the message appears as a result of an
uncaught NSException from -[NSConnection sendInvocation:internal:],
called from -[NSDistantObject forwardInvocation].

Server and client are both properly retained.


Perhaps the connection or relevant port objects are being released?  I  
would think that they should be automatically retained by the  
corresponding NSDistantObject(s), but maybe not.


If you turn on NSZombie, does that provide any insight?

Similarly, you can use the Object Allocations instrument.  When the  
exception happens, examine the history of NSConnection and NS(Mach| 
Message|Socket)Port objects to see if any have gone missing when they  
shouldn't have.


Also, you can try DTrace with the "objc" provider to get a trace,  
possibly with backtraces, of every message to NSConnection* or  
NS*Port* methods.  (That's not the same as tracing all messages to  
instances of those classes.  Some messages are implemented on  
superclasses (like NSObject), of course, and they won't be traced in  
that way.  Trying to trace every method of NSObject can be done, but  
will probably be overwhelming.)


sudo dtrace -n 'objc$target:NSConnection*::entry, objc 
$target:NS*Port*::entry {ustack();}' -c /path/to/YourApplication.app/ 
Contents/MacOS/YourApplication


or

sudo dtrace -n 'objc$target:NSConnection*::entry, objc 
$target:NS*Port*::entry {ustack();}' -p 


Good luck,
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: Calculating accurate bounds of stroked paths [SOLVED]

2008-07-09 Thread Peter Zegelin


On 09/07/2008, at 5:24 PM, Graham Cox wrote:










You will need to also take into account of the line width (as I'm  
sure you do) so I think the combined offset would be best expressed  
as:


max(w / 2, ml * w / 2)

where ml is the mitre limit.


That's right, and precisely what I'm doing. Works well enough though  
for most actual paths is on the generous side (because rarely do  
angles get that sharp). Still, it's probably a fair compromise  
between updating more than necessary and going over each path to  
find the sharpest angle.


Since I'm working in C++ for this part of my app I'm going to have to  
do all the calculations myself rather than using  
CGContextGetPathBoundingBox. I'll probably use the worst case while  
the shape is selected and then calculate the exact bounds when the  
shape becomes deselected. Interestingly, not only will the maximum  
outset have to be calculated according to the angle *at* each point  
but this will have to then be modified depending on the rotation of  
the point itself. Great fun for the math challenged like me.


Peter
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: problem with IKImageView and filters

2008-07-09 Thread hsanderson

On 8 Jul 2008, at 20:12, douglas a. welton wrote:

Am I reading correctly that you have two IKImageViews stacked on top  
on one another?


Yes. If I understand the Core Animation documentation correctly, a  
view can be composited with underlying views using a Compositing  
Filter. This seems to work okay with bog-standard NSImageViews; my  
problem is getting this to work with IKImageViews.



Is there a reason that you aren't using Core Image and using one of  
the compositing filters to produce a "difference" that you can then  
display?


Dynamic user interaction. If I have to use CI I'll need to write a  
bunch of extra code to provide the same level of functionality that  
IKImageView provides as standard.



do the items you are currently displaying in the two IKImageViews  
need to be moved (dynamically , by the user?) in relation to one  
another?


Correct. The two images may have different bounds, so the user needs  
to manually align the upper image with the lower one using Move and  
Zoom tools. We already have a PHP+ImageMagick-based tool that does  
static diffs of identically sized images, but it's not sufficiently  
flexible for users' needs so I've been asked to write a replacement.


Thanks,

Hamish
--

Hamish Sanderson
Production Workflow Developer
Sun Branding Solutions Ltd
Tel: +44(0)1274 200 700
www.s-brandingsolutions.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: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Mike Bellerby
I use DOs on 10.3, 10.4 and 10.5. They work correctly on all versions.  
From your description I'm not entirely sure what you are trying to  
do. Could you post a code example and I try to help.


Cheers
Mike

On 9 Jul 2008, at 01:11, Hamish Allan wrote:


I'm seeing "connection went invalid while waiting for a reply" in a DO
callback. The client passes self in a call to the server; some time
later, the server calls a method on that client (proxy), the program
hangs for a second or so, the "connection went invalid" connection
appears, but the method call is successful anyway, so it would appear
that the DO machinery is re-connecting everything okay.

According to the debugger, the message appears as a result of an
uncaught NSException from -[NSConnection sendInvocation:internal:],
called from -[NSDistantObject forwardInvocation].

Server and client are both properly retained.

There seem to be a lot of messages of late on Apple's forums about
problems with iSync (10.5.4) and even Interface Builder (10.5.3,
IB3.1beta6) in which this message is reported. Is it perhaps a bug in
recent versions of the OS rather than in my code?

Hamish

P.S. This question has been asked before, but the OP didn't get an
answer (http://www.cocoabuilder.com/archive/message/cocoa/2006/12/29/176458 
)

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mdb%40realvnc.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: Making a text cell in a table editable

2008-07-09 Thread Jens Miltner


Am 09.07.2008 um 08:09 schrieb Chris Idou:



How do I programmatically make a text cell in a NSTableView to have  
focus and be in edit mode?


I believe -[NSTableView editColumn:(NSInteger)columnIndex row: 
(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select:(BOOL)flag]  
is the method you want to call...


HTH,






___

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

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

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

This email sent to [EMAIL PROTECTED]


Debugging strategy - exceptions

2008-07-09 Thread Ruotger Skupin

Hi,

this is more of an open discussion topic than a concrete question but  
hopefully someone has a good idea about this:


I got a bug report of a non-crash bug I cannot reproduce and where I  
do not even know where to start looking. The only hint is a line in  
the console.log:


*** -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to  
insert nil value at objects[0] (key: NSFont)


So an exception got thrown for a pretty obvious reason, but where?  
Could be anywhere, even in WebKit (which we use). Is there any chance  
to get near the culprit without a stack trace (which I don't have)?


Even worse: There does not to be a way to switch off exceptions  
without switching off @synchronized() at the same time. That's not an  
option for the code in question.


Ruotger

___

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

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

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

This email sent to [EMAIL PROTECTED]


Receive notifications about frontmost application change

2008-07-09 Thread Александр Даровских

Hi,
Is there any way to subscribe to frontmost application change  
notification? For example, via NSDistributedNotificationCenter or some  
other facility? I have managed to get process startup and shutdown  
notifications, but I cannot get active application change  
notification. Maybe it is done in somehow another way?


--
Best regards,
Alexander A. Darovskikh



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: controlling system muting ?

2008-07-09 Thread Mike Abdullah


On 9 Jul 2008, at 04:21, Jason Bobier wrote:

I also need to determine the user's current mute and volume settings  
and restore them after my alert plays, which is the other reason  
that I was looking for something other than AppleScript.


Well it's still possible to do that with AppleScript, but I would go  
with the Core Audio wrapper code; much saner.


And I think your "emergency" scenario has probably now shut people up ;)

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: NSDateFormatter and NSCell oddness

2008-07-09 Thread Nathan Kinsinger


On Jul 8, 2008, at 6:43 PM, [EMAIL PROTECTED] wrote:


Hello,

I'm trying to replicate the Finder's behaviour for date fields when  
resizing. I found this on the archives which pretty much has the  
answer:


http://www.cocoabuilder.com/archive/message/cocoa/2005/8/9/143911

I'm trying to update it so that it returns the correct value for the  
current localisation. This is the full code of my NSCell subclass  
(debugging commented out):


@implementation DMSquishableDateCell

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
{
	NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]  
autorelease];
	[dateFormatter  
setFormatterBehavior:NSDateFormatterBehavior10_4]; // needed?


int width = cellFrame.size.width;

   if (width < 130)
   [dateFormatter setDateStyle:NSDateFormatterShortStyle];
   else if (width < 145)
   [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
   else // if (width < 170)
   [dateFormatter setDateStyle:NSDateFormatterLongStyle];

[dateFormatter setTimeStyle:NSDateFormatterNoStyle];

   [self setFormatter:dateFormatter];
   [super drawWithFrame:cellFrame inView:controlView];

	//NSDate *date = [NSDate dateWithTimeIntervalSinceReferenceDate: 
118800];

//NSLog(@"formatted date: %@", [dateFormatter stringFromDate:date]);

//  if ([self hasValidObjectValue])
//		 NSLog(@"formatted date: %@", [dateFormatter stringFromDate: 
[self objectValue]]);

}

@end

In my awakeFromNib: method where the table is created, I set the  
cell thusly:


DMSquishableDateCell *dateCell = [[[DMSquishableDateCell alloc]  
init] autorelease];
NSTableColumn *creationDateColumn = [table  
tableColumnWithIdentifier:@"creation_date"];

[creationDateColumn setDataCell:dateCell];

However, the column is completely blank. If I remove the three lines  
above, the dates are properly displayed. The lines that I've  
commented above verify that the formatter itself is working  
properly. The cell objects come straight from CoreData, and seem to  
be objects of class "__NSCFDate".


What am I doing wrong?!?

Thanks!

Demitri


The problem you are having is that NSCell doesn't know how to draw  
text (or anything else for that matter). In your subclass you are not  
drawing the date string yourself so it is blank. When you delete the  
lines adding your cell class as the data cell then the cell is using  
the default NSTextFieldCell which does draw text.


There is a sample project from apple that has a date cell that changes  
based on the width of the cell:

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

-- Nathan
___

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

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

2008-07-09 Thread Joan Lluch (casa)


El 09/07/2008, a las 12:13, Ruotger Skupin escribió:


So an exception got thrown for a pretty obvious reason, but where?  
Could be anywhere, even in WebKit (which we use). Is there any  
chance to get near the culprit without a stack trace (which I don't  
have)?



This question is more suitable for the Xcode-user list, but anyway,  
you should get a proper stack trace by breaking at  
"objc_exception_throw". Did you try it?


Joan Lluch___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Receive notifications about frontmost application change

2008-07-09 Thread Mike Bellerby

Hi

Which notifications do you want to receive?

Cheers
Mike

On 9 Jul 2008, at 11:22, Александр Даровских wrote:


Hi,
Is there any way to subscribe to frontmost application change  
notification? For example, via NSDistributedNotificationCenter or  
some other facility? I have managed to get process startup and  
shutdown notifications, but I cannot get active application change  
notification. Maybe it is done in somehow another way?


--
Best regards,
Alexander A. Darovskikh



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to indent in NSOutlineView?

2008-07-09 Thread Aman Alam

Is there a way to indent main headings in NSOutlineView as follows: -




Heading 1


   Item

   Item


Heading 2


   Item


Heading 2.1


   Item

   Item


Heading 3


   Item



I tried many ways to indent the headings but not succeeded. The 
disclosure triangle doesn't indent with headings. I required heading 
within heading and the heading should be independent of its parent 
heading. The parent heading may contain any number of items within.


Hmmh - you don't tell us how you provide the data to the outline view: 
are you using an NSTreeController + bindings or are you implementing  an 
NSOutlineView datasource?


Usually, all the indenting is automatically done by the outline view  once 
you return your items in the appropriate hierarchy.


If you can share a bit more information about your code / your setup, 
people might able to help you...







   I am using datasource that contain two types of object.
The first object (Heading) contains a flag. If it is YES then it act as 
child of other main heading.
The second object(item) contains value to show which is always child of main 
heading. 


___

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

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

2008-07-09 Thread Jens Miltner


Am 09.07.2008 um 13:09 schrieb Aman Alam:




  I am using datasource that contain two types of object.
The first object (Heading) contains a flag. If it is YES then it act  
as child of other main heading.
The second object(item) contains value to show which is always child  
of main heading.


You don't tell us anything about the organization of your hierarchy,  
so I assume that your datasource code looks something like this:


- (int)outlineView:(NSOutlineView *)anOutlineView  
numberOfChildrenOfItem:(id)item

{
if ( item == nil ) return [headings count];
else return [[item childItems] count];
}

- (id)outlineView:(NSOutlineView *)anOutlineView child:(int)index  
ofItem:(id)item

{
if ( item == nil ) return [headings objectAtIndex:index];
else return [[item childItems] objectAtIndex:index];
}


(assuming both your Heading and item objects have a method - 
(NSArray*)childItems that returns the child items for that item and  
your dataSource contains an array "headings" that holds the top-level  
headings)


?




___

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

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

2008-07-09 Thread Ken Thomases

On Jul 9, 2008, at 5:13 AM, Ruotger Skupin wrote:

this is more of an open discussion topic than a concrete question  
but hopefully someone has a good idea about this:


I got a bug report of a non-crash bug I cannot reproduce and where I  
do not even know where to start looking. The only hint is a line in  
the console.log:


*** -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to  
insert nil value at objects[0] (key: NSFont)


So an exception got thrown for a pretty obvious reason, but where?  
Could be anywhere, even in WebKit (which we use). Is there any  
chance to get near the culprit without a stack trace (which I don't  
have)?


You will need to get a stack trace for any reasonable debugging.

I take it this is happening for a user but not for you, the  
developer?  You could try to talk them through launching your program  
through gdb, although that would be a pain for you and them.  It might  
entail them installing Xcode.


If the user is on Leopard, you could send them a DTrace one-liner that  
they could execute.  You would use the "pid" provider to probe the  
objc_exception_throw function entry point and trace the stack.   
Something like:


sudo dtrace -n 'pid$target::objc_exception_throw:entry {ustack();}' -p  
`ps xww | grep /TextEdit | grep -v grep | sed -Ee 's/^ *([0-9]+).*/\1/'`


except using your application name instead of "TextEdit".


Even worse: There does not to be a way to switch off exceptions  
without switching off @synchronized() at the same time. That's not  
an option for the code in question.


You can't turn off exceptions, even if you do turn off @synchronized.   
Turning off @synchronized for your own code would prevent you from  
using @throw, but not from using -[NSException raise].  In any case,  
it doesn't change what the frameworks can do.


However, if you're willing to supply your user with a new version of  
your application (and it sounds like you are), you can use  
NSExceptionHandler.  See .


Lastly, you should be familiar with TechNote 2124, Mac OS X Debugging  
Magic  if you  
aren't already.


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


how to get the status of network when the network is set disable.

2008-07-09 Thread xiaobin
Hello,

I am writing a program to detect the status of network.

In my program, I need get the status of network when the connection is
set disable.  here it is not by connecting the network to get the
status.
which API or method can work for it?

for example, if my lan cable is unpluged or the network is set
disable, it is certainly to know the status of the network is off. so
it is not necessary to connect the network to get the status.
so I want to know When it is clearly to know the status of the network
is on or off, which API or method can get the status.

I have read the example of apple's document for  using CFDiagnostics
to check whether the network is connected or not, but I think it is
not for my need.  It is by connecting the network to get the status.

Would anyone can give me a help ?

Thanks a lot
___

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

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

2008-07-09 Thread Ruotger Skupin

I would rather not try to teach my users gdb...

Ruotger

Am 09.07.2008 um 12:31 schrieb Joan Lluch (casa):



El 09/07/2008, a las 12:13, Ruotger Skupin escribió:


So an exception got thrown for a pretty obvious reason, but where?  
Could be anywhere, even in WebKit (which we use). Is there any  
chance to get near the culprit without a stack trace (which I don't  
have)?



This question is more suitable for the Xcode-user list, but anyway,  
you should get a proper stack trace by breaking at  
"objc_exception_throw". Did you try it?


Joan Lluch


___

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

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

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

This email sent to [EMAIL PROTECTED]


A modal window dialog instead of a sheet

2008-07-09 Thread Ronnie B
I am trying to implement a login UI for a small app.  The idea is that after
the MainWindow nib is loaded, in case if no credentials were entered, a
modal window asking for name and password will show up.  The app will be
blocked unless the modal window is closed either with Submit or Cancel
button.  I've seen it done with the Sheets, but the desired would be the
modal window.


Thanks,

Ron
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A modal window dialog instead of a sheet

2008-07-09 Thread Mike Bellerby

Try [NSApp runModalForWindow:window];

Cheers
Mike

On 9 Jul 2008, at 13:59, Ronnie B wrote:

I am trying to implement a login UI for a small app.  The idea is  
that after
the MainWindow nib is loaded, in case if no credentials were  
entered, a
modal window asking for name and password will show up.  The app  
will be

blocked unless the modal window is closed either with Submit or Cancel
button.  I've seen it done with the Sheets, but the desired would be  
the

modal window.


Thanks,

Ron
___

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

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

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


Overriding v alueForKeyPath

2008-07-09 Thread Laurent Cerveau

Hi

I am trying to us KVC in a way that it allows me to add an accessor  
semantic to an object so that it can answer to simple valueForKeyPah  
call.


For example I want to be able to write [myObject  
valueForKeyPath:@"texts.title.en"] which would give me the english  
version of the title of my Object


Practically the class is having an ivar that is an other type of  
object , itself containing a set of "localized object" (hope this is  
not too confusing) . A "normal" way to access this would be to write  
somethign like ([myObject.texts objectForLanguageID:1]).title. and 1  
ithe ID of english language.


The problem is that because I am not sure that 1 will stay the ID for  
english, and because I would like to be sure that at the highest level  
the API stays the same , be based on KVC.


When I write the setters with setValueForKeyPath and do the  
interpretation of the path in the right way, all is fine. However in  
the accessor way this does not go fine and I end up with messages in  
the console telling me hings like
[  
addObserver: forKeyPath:@"title.de"  
options:0x0 context:0x15aa5cb0] was sent to an object that is not KVC- 
compliant for the "title" property.


Apparently what is happening is that the keyPath is decomposed, each  
object is verified to be KVC compliant for the appropriate subPath and  
here we go : nothing unexpected if I refer to the doc except that..the  
part I do not understand in this case is the following : why is own  
valueForKeyPath for this object not called at first place in this case?


Thanks

laurent




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 get the status of network when the network is set disable.

2008-07-09 Thread Michael Kaye

Try the SCNetworkReachability API...

I borrowed the following from one of Apple's examples:

- (BOOL)isDataSourceAvailable
{
static BOOL checkNetwork = YES;
if (checkNetwork) { // Since checking the reachability of a host  
can be expensive, cache the result and perform the reachability check  
once.

checkNetwork = NO;

Boolean success;
const char *host_name = "http://localhost:8080";;

SCNetworkReachabilityRef reachability =  
SCNetworkReachabilityCreateWithName(NULL, host_name);

SCNetworkReachabilityFlags flags;
success = SCNetworkReachabilityGetFlags(reachability, &flags);
_isDataSourceAvailable = success && (flags &  
kSCNetworkFlagsReachable) && !(flags &  
kSCNetworkFlagsConnectionRequired);

}
return _isDataSourceAvailable;
}

HTHs. Michael.

On 9 Jul 2008, at 13:22, xiaobin wrote:


Hello,

I am writing a program to detect the status of network.

In my program, I need get the status of network when the connection is
set disable.  here it is not by connecting the network to get the
status.
which API or method can work for it?

for example, if my lan cable is unpluged or the network is set
disable, it is certainly to know the status of the network is off. so
it is not necessary to connect the network to get the status.
so I want to know When it is clearly to know the status of the network
is on or off, which API or method can get the status.

I have read the example of apple's document for  using CFDiagnostics
to check whether the network is connected or not, but I think it is
not for my need.  It is by connecting the network to get the status.

Would anyone can give me a help ?

Thanks a lot
___

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

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

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

2008-07-09 Thread Phil
On Wed, Jul 9, 2008 at 10:13 PM, Ruotger Skupin <[EMAIL PROTECTED]> wrote:
> *** -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to insert nil
> value at objects[0] (key: NSFont)
>
> So an exception got thrown for a pretty obvious reason, but where? Could be
> anywhere, even in WebKit (which we use). Is there any chance to get near the
> culprit without a stack trace (which I don't have)?
>

You really need to get more information. If the user can reproduce
this problem, then could you give them a version of your application
with some additional code to print out a stack trace/state information
that they can send to you?

Depending on what's going on, there's a few different ways you can go
about this. Take a read of:


In particular, "Uncaught Excpetions" and "Controlling a Program's
Response to Exceptions".

Phil
___

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

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

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

This email sent to [EMAIL PROTECTED]


top most window question when it is launched by another app

2008-07-09 Thread xiaobin
Hello,
I have these question for several days.

1. How to make the modal window become the top most when the modal
window is launched from another application by using NSTask?

2. And I also want to know the types of window in  cocoa application.
Is there only modal window in cocoa app when I use method [NSWindow:
runModalForWindow:] etc.

3. method  [NSWindow:  orderFrontRegardless] is not useful for
NSAlert, when I use it as follow:

NSAlert* alert;
[alert runModal];
[[alert window] orderFrontRegardless];

The following is the detail of the questions:
I am using modal window for my application named BB.app.

In my BB.app, I use many modal window, for example a panel for showing
webview, a panel for showing progress bar and an alert for showing
information and waring by using NSAlert, etc.

I have another app for example named AA.app. I want to launch BB.app from AA.app

In AA.app, I use method setLaunchPath of NSTask to launch BB.app
because it is necessary to pass an argument to BB.app. And so the
method launchApplication of NSWorkspace is not useful because of the
argument.

so my question is when BB.app was launched by AA.app, the modal window
of BB.app is not the top most.
I tried to use the method of [NSWindow:  orderFrontRegardless] to
control the order of the modal windows of my BB.app. It is true that
the progress bar panel and the panel with webview are bacame the top
most, but the method [NSWindow:  orderFrontRegardless] is not useful
for NSAlert,

To investigate the question, I did a try. I tried to launch the
application TextEdit by an application with a window using NSTask

[NSTask setLaunchPath:@"/Application/TextEdit.app/Contents/MacOS/TextEdit"];

I found the launched window of TextEdit is behind the launching window
of launching application.

(And I also found if I use [[NSWorkspace sharedApplication]
launchApplication:@"TextEdit.app"]; to launch TextEdit application,
the TextEdit winodw become the top most.)

Would anyone can help me?

Thank you for any help.
-- 
xiaobin
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: top most window question when it is launched by another app

2008-07-09 Thread Mike Abdullah


On 9 Jul 2008, at 15:10, xiaobin wrote:


Hello,
I have these question for several days.

1. How to make the modal window become the top most when the modal
window is launched from another application by using NSTask?

2. And I also want to know the types of window in  cocoa application.
Is there only modal window in cocoa app when I use method [NSWindow:
runModalForWindow:] etc.

3. method  [NSWindow:  orderFrontRegardless] is not useful for
NSAlert, when I use it as follow:

NSAlert* alert;
[alert runModal];
[[alert window] orderFrontRegardless];

The following is the detail of the questions:
I am using modal window for my application named BB.app.

In my BB.app, I use many modal window, for example a panel for showing
webview, a panel for showing progress bar and an alert for showing
information and waring by using NSAlert, etc.

I have another app for example named AA.app. I want to launch BB.app  
from AA.app


In AA.app, I use method setLaunchPath of NSTask to launch BB.app
because it is necessary to pass an argument to BB.app. And so the
method launchApplication of NSWorkspace is not useful because of the
argument.

so my question is when BB.app was launched by AA.app, the modal window
of BB.app is not the top most.
I tried to use the method of [NSWindow:  orderFrontRegardless] to
control the order of the modal windows of my BB.app. It is true that
the progress bar panel and the panel with webview are bacame the top
most, but the method [NSWindow:  orderFrontRegardless] is not useful
for NSAlert,

To investigate the question, I did a try. I tried to launch the
application TextEdit by an application with a window using NSTask

[NSTask setLaunchPath:@"/Application/TextEdit.app/Contents/MacOS/ 
TextEdit"];


This is a really, really bad idea. If TextEdit is already running, it  
will cause a second copy to be launched. And, as you found, some GUI  
nuances may not work quite right.


Instead use NSWorkspace, or if it doesn't meet your needs fully, drop  
down to LaunchServices.



I found the launched window of TextEdit is behind the launching window
of launching application.

(And I also found if I use [[NSWorkspace sharedApplication]
launchApplication:@"TextEdit.app"]; to launch TextEdit application,
the TextEdit winodw become the top most.)

Would anyone can help me?

Thank you for any help.
--
xiaobin
___

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

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


afferentless mac mini

2008-07-09 Thread em
I have a "Network Receiver" application which is in my "login items" section of 
an Apple Intel mac mini
computer running the latest version of Leopard.  I do not need a keyboard, nor 
a mouse directly wired to this computer(or indirectly thru wifi:-)), as  these 
afferent branches are obviously to be supplied over a network.  This doesn't 
work 'out of the box', as some part of Leopard demands a keyboard before my 
'login items' are launched.  Any suggestions would be appreciated. 
thanks,
em 
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: top most window question when it is launched by another app

2008-07-09 Thread Mike Bellerby
In BB.app do [NSApp activateIgnoringOtherApps:YES]; before showing the  
window.


Cheers
Mike

On 9 Jul 2008, at 15:10, xiaobin wrote:


Hello,
I have these question for several days.

1. How to make the modal window become the top most when the modal
window is launched from another application by using NSTask?

2. And I also want to know the types of window in  cocoa application.
Is there only modal window in cocoa app when I use method [NSWindow:
runModalForWindow:] etc.

3. method  [NSWindow:  orderFrontRegardless] is not useful for
NSAlert, when I use it as follow:

NSAlert* alert;
[alert runModal];
[[alert window] orderFrontRegardless];

The following is the detail of the questions:
I am using modal window for my application named BB.app.

In my BB.app, I use many modal window, for example a panel for showing
webview, a panel for showing progress bar and an alert for showing
information and waring by using NSAlert, etc.

I have another app for example named AA.app. I want to launch BB.app  
from AA.app


In AA.app, I use method setLaunchPath of NSTask to launch BB.app
because it is necessary to pass an argument to BB.app. And so the
method launchApplication of NSWorkspace is not useful because of the
argument.

so my question is when BB.app was launched by AA.app, the modal window
of BB.app is not the top most.
I tried to use the method of [NSWindow:  orderFrontRegardless] to
control the order of the modal windows of my BB.app. It is true that
the progress bar panel and the panel with webview are bacame the top
most, but the method [NSWindow:  orderFrontRegardless] is not useful
for NSAlert,

To investigate the question, I did a try. I tried to launch the
application TextEdit by an application with a window using NSTask

[NSTask setLaunchPath:@"/Application/TextEdit.app/Contents/MacOS/ 
TextEdit"];


I found the launched window of TextEdit is behind the launching window
of launching application.

(And I also found if I use [[NSWorkspace sharedApplication]
launchApplication:@"TextEdit.app"]; to launch TextEdit application,
the TextEdit winodw become the top most.)

Would anyone can help me?

Thank you for any help.
--
xiaobin
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mdb%40realvnc.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: Finding AS related memory leak

2008-07-09 Thread Antonio Nunes

Taking this back to the list, as I think it came off by mistake...

On 9 Jul 2008, at 14:56, John C. Daub wrote:



It's difficult to say what the problem IS, but I can suggest a few  
things to

look at:

on 7/9/08 1:48 AM, Antonio Nunes at [EMAIL PROTECTED] wrote:


When the script runs, the code in my app that gets called is:

- (id)unstyledTextForScripting
{
return self.string;
}


It seems you are using the Objective-C 2.0 properties, so I would  
check what
your properties are set to... minding how things are retained or  
copied or

assigned. This may lend some clues.


The class where this method exists is a subclass of PDFPage. "string"  
is one of the superclass's ivars. I'm just passing it through, and  
assume PDFPage does the right thing. Further, the app is garbage  
collected, so retain and release should be non-issues.



to get the text of a PDF page, and:

- (NSArray *)pages
{
if (masterArray == nil || masterArray.document !=
self.masterPDFDocument) {
masterArray = [[ANPDFClerkPagesArray alloc] init];
masterArray.document = self.masterPDFDocument;
}


This is one that made me wonder... what is the state/properties of  
this
"masterArray". For instance, if it's set to retain, this is going to  
leak
because you've alloc/init'd, and then the assignment to masterArray  
would

retain (so now it's theoretically got a retain count of 2).


ANPDFClerkPagesArray exists the gain access to the pages in a PDF  
document that is an ivar in my NSDocument subclass. It simply  
overrides the two required methods for NSArray subclasses:



@interface ANPDFClerkPagesArray : NSArray  {
PDFDocument *document;
}

@property (assign) PDFDocument *document;


@implementation ANPDFClerkPagesArray

- (NSUInteger)count
{
return document.pageCount;
}

- (id)objectAtIndex:(NSUInteger)index
{
return [document pageAtIndex:index];
}

...snip...

@synthesize document;

@end


As you can see, it basically acts as a proxy array for the pages in a  
PDFDocument. It doesn't create or hold on to anything.



As well, what happens in the case of masterArray not being nil but the
masterArray.document not being self.masterPDFDocument? That will  
cause a new
ANPDFClerkPagesArray to be allocated and the old one left to the  
ether. Of

course again, much of this depends upon what the state/properties of
masterArray are... retain/assign/copy, do you have explicit get/set
accessors for that, etc..


masterArray is not implemented with properties or any kind of  
accessors. It's only ever accessed directly and only in the "pages"  
method listed above. The implementation would leak if the app were not  
garbage collected, but since it is, when a new array replaces the old  
one, the old one no longer has a strong reference to it and becomes  
collectable. Furthermore this situation doesn't occur in the course of  
the script at hand, so we are guaranteed that the "pages" method is  
always returning the same array. It only gets created once, so we're  
not leaking an array on each run through the loop. Personally I think  
we're leaking a CFString on each iteration, but since I'm not that  
comfortable yet around ObjectAlloc and Leaks and Shark etc. I csn't be  
sure.


António


I try to take one day at a time, but sometimes, several days attack me  
all at once!




___

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

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

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

This email sent to [EMAIL PROTECTED]


ANN: CocoaHeads NYC, Thu July 10

2008-07-09 Thread Andy Lee
Ed VanVliet of VVI will be presenting DAQ Plot and Vvidget.  Details  
here:


   

--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: counting managed objects of a certain type

2008-07-09 Thread Daniel Child
Somehow I thought a predicate was mandatory. Simply setting the entity  
works.


Thank you.

On Jul 9, 2008, at 2:34 AM, mmalc crawford wrote:



On Jul 8, 2008, at 11:16 PM, Daniel Child wrote:


NSManagedObjectContext *moc = [self managedObjectContext];
NSEntityDescription *entityDescription = [NSEntityDescription
  entityForName:@"Employee" inManagedObjectContext:moc];
NSFetchRequest *request = [[[NSFetchRequest alloc] init]  
autorelease];

[request setEntity:entityDescription];

but then goes on to talk about various predicates (like "where  
salary is over 1").

I simply want "all employees".

I've looked through the documentation and found  
"countForFetchRequest: error:"
but that still leads the question of what kind of request asks for  
"all objects of a certain type".



What do you think happens if you don't set a predicate?
Did you try it?

mmalc



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Does this caution need fixed? (newb)

2008-07-09 Thread Chris Paveglio
I'm trying to make sure that this part of my code is good and clean and not 
leaking. I believe that I have it right (but still think I have something 
wrong).
This code makes a list of file paths, and then copies the files or folders from 
their location to the destination the user selected. If the item already exists 
in the destination, I delete it first (to overwrite with new data, yes this is 
what I intend and the user is aware of how the app works).
I've read all your previous responses (Thanks) and it seems like since I am 
just using "normal" strings that they will be autoreleased on their own. There 
are now no compiler cautions and the app seems to work OK.
A side issue is that I want to add a 2 second delay before closing the sheet 
that is displayed, is NSTimer the correct item to use?
Chris



#import "MyExporter.h"

@implementation MyExporter

- (IBAction)exportPrefs:(id)sender
{
NSOpenPanel *theOpenPanel = [NSOpenPanel openPanel];
[theOpenPanel setTitle:@"Choose a folder to save your prefs into:"];
[theOpenPanel setCanChooseDirectories:YES];
[theOpenPanel setCanChooseFiles:NO];

if ([theOpenPanel runModal] == NSOKButton)
//if user chooses a folder
{
NSString *theDestination = [theOpenPanel filename]; //get name
NSFileManager *theManager = [NSFileManager defaultManager]; 
//make an NSFM

//if files dont exist on user machine it just seems to bypass 
copying them
NSString *string1  = @"Library/Preferences/Adobe Photoshop CS3 
Settings";
NSString *string1a = @"Adobe Photoshop CS3 Settings";
NSString *string2  = @"Library/Preferences/Adobe Illustrator 
CS3 Settings";
NSString *string2a = @"Adobe Illustrator CS3 Settings";
NSString *string3  = @"Library/Preferences/Adobe 
InDesign/Version 5.0";
NSString *string3a = @"Version 5.0";
NSString *string4  = @"Library/Preferences/CDFinder 
Preferences";
NSString *string4a = @"CDFinder Preferences";
NSString *string5  = @"Library/Application Support/Firefox";
NSString *string5a = @"Firefox";
NSString *string6  = @"Library/Safari";
NSString *string6a = @"Safari";
NSString *string7  = @"Library/Application Support/Adobe/Adobe 
PDF/Settings";
NSString *string7a = @"Settings";
NSString *string8  = @"Library/Preferences/Acrobat Distiller 
Prefs";
NSString *string8a = @"Acrobat Distiller Prefs";
NSString *string9  = @"Documents/Microsoft User Data";
NSString *string9a = @"Microsoft User Data";

//make 2 arrays with locations of orig prefs, and then short 
version to save in folder
NSArray *myPrefs;
myPrefs = [NSArray arrayWithObjects: string1, string2, string3, 
string4, string5, string6, string7, string8, string9, nil];

NSArray *myPrefsSaved;
myPrefsSaved = [NSArray arrayWithObjects: string1a, string2a, 
string3a, string4a, string5a, string6a, string7a, string8a, string9a, nil];

//start panel here
[NSApp beginSheet:exportSheet modalForWindow:mainWindow 
modalDelegate:self didEndSelector:NULL contextInfo:nil];

[exportProgressBar setDoubleValue:(double)3.0]; //fake 
ourselves some progress
[exportProgressBar displayIfNeeded];

int i;
for (i = 0; i < 8; i++) //skip string9 for testing, takes too 
long to copy
{   
NSString *theSettings = [NSHomeDirectory() 
stringByAppendingPathComponent:[myPrefs objectAtIndex:i]];
//change/set out variable to this data

//loop with each item saving into our destination folder
NSString *theDestinationFile = [theDestination 
stringByAppendingPathComponent:[myPrefsSaved objectAtIndex:i]];

[exportCurrentFileName 
setStringValue:(@"%@",[myPrefsSaved objectAtIndex:i])];
[exportCurrentFileName displayIfNeeded]; //give a kick 
to our text box dammit!

//delete the old pref file
[theManager removeFileAtPath:theDestinationFile 
handler:nil];

//copy the file
[theManager copyPath:theSettings 
toPath:theDestinationFile handler:nil];

[exportProgressBar incrementBy:(double)11.0]; //11 is 
arbitrary progress (100 divided by 9 items)
[exportProgressBar displayIfNeeded];

}
[exportProgressBar setDou

Re: Finding AS related memory leak

2008-07-09 Thread Antonio Nunes

On 9 Jul 2008, at 15:40, Antonio Nunes wrote:


Taking this back to the list, as I think it came off by mistake...


Hmmm, directed it back to the wrong list at that.

Apologies.

António

---
And could you keep your heart in wonder
at the daily miracles of your life,
your pain would not seem less wondrous
than your joy.

--Kahlil Gibran
---



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Does this caution need fixed? (newb)

2008-07-09 Thread Jens Alfke


On 9 Jul '08, at 7:44 AM, Chris Paveglio wrote:

I'm trying to make sure that this part of my code is good and clean  
and not leaking. I believe that I have it right (but still think I  
have something wrong).


It looks OK to me on quick reading. The main thing I'd change is to  
put the path strings into a plist, or at least put the string literals  
directly into the NSArray initializer lines instead of declaring  
separate variables for them, i.e.
	myPrefs = [NSArray arrayWithObjects: @"Library/Preferences/Adobe  
Photoshop CS3 Settings",

@"Adobe Photoshop 
CS3 Settings",
..., 
nil];
but that's just an issue of style.

—Jens

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: afferentless mac mini

2008-07-09 Thread Jens Alfke


On 9 Jul '08, at 7:22 AM, em wrote:

I have a "Network Receiver" application which is in my "login items"  
section of an Apple Intel mac mini
computer running the latest version of Leopard.  I do not need a  
keyboard, nor a mouse directly wired to this computer(or indirectly  
thru wifi:-)), as  these afferent branches are obviously to be  
supplied over a network.  This doesn't work 'out of the box', as  
some part of Leopard demands a keyboard before my 'login items' are  
launched.  Any suggestions would be appreciated.


You can't log into a user account on a machine without a mouse/ 
keyboard, unless you use something like Apple Remote Desktop.


It sounds like your network app should be a dæmon instead … that way  
it will always be running on the machine and doesn't require a user to  
log in. That's the traditional way that server-type processes are  
implemented. See the giant Apple tech-note on writing dæmons and agents.


—Jens

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: Debugging strategy - exceptions

2008-07-09 Thread Jens Alfke


On 9 Jul '08, at 5:32 AM, Ruotger Skupin wrote:


I would rather not try to teach my users gdb...


My MYUtilities library includes support for getting exception  
backtraces at runtime and reporting them to the user (see  
"ExceptionUtils.h").

http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/

I believe Uli also added this functionality to his excellent  
UKCrashReporter utility:

http://www.zathras.de/angelweb/sourcecode.htm#UKCrashReporter
This adds a crash-report alert to your app that lets the user easily  
post crash (and exception) logs to your server.


—Jens

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: Receive notifications about frontmost application change

2008-07-09 Thread Jens Alfke


On 9 Jul '08, at 3:22 AM, Александр Даровских wrote:


Hi,
Is there any way to subscribe to frontmost application change  
notification? For example, via NSDistributedNotificationCenter or  
some other facility? I have managed to get process startup and  
shutdown notifications, but I cannot get active application change  
notification. Maybe it is done in somehow another way?


I ran NotificationWatcher, which logs all distributed notifications  
and workspace notifications, but didn't see anything when I switched  
apps. So it must be done a different way. I suspect there may be a  
CoreGraphics API that does this; try looking there.


—Jens

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: Receive notifications about frontmost application change

2008-07-09 Thread Matt Gough
You can do this (and a lot of other stuff not covered by NSWorkspace )  
with a CarbonEvent handler on kEventClassApplication,  
kEventAppFrontSwitched.


Matt
On 9 Jul 2008, at 5:44pm, Jens Alfke wrote:



On 9 Jul '08, at 3:22 AM, Александр Даровских wrote:


Hi,
Is there any way to subscribe to frontmost application change  
notification? For example, via NSDistributedNotificationCenter or  
some other facility? I have managed to get process startup and  
shutdown notifications, but I cannot get active application change  
notification. Maybe it is done in somehow another way?


I ran NotificationWatcher, which logs all distributed notifications  
and workspace notifications, but didn't see anything when I switched  
apps. So it must be done a different way. I suspect there may be a  
CoreGraphics API that does this; try looking there.


—Jens___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.gough%40agfa.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: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Brad Gibbs
Is Distributed Objects still the preferred method for communicating  
among computers on a local network?  It's been hinted that DO may be  
deprecated in the not-so-distant future.  When I asked about DO  
recently, I was pushed in the direction of Jens Alfke's Blip.



Thanks.



On Jul 9, 2008, at 2:14 AM, Mike Bellerby wrote:

I use DOs on 10.3, 10.4 and 10.5. They work correctly on all  
versions. From your description I'm not entirely sure what you are  
trying to do. Could you post a code example and I try to help.


Cheers
Mike

On 9 Jul 2008, at 01:11, Hamish Allan wrote:

I'm seeing "connection went invalid while waiting for a reply" in a  
DO

callback. The client passes self in a call to the server; some time
later, the server calls a method on that client (proxy), the program
hangs for a second or so, the "connection went invalid" connection
appears, but the method call is successful anyway, so it would appear
that the DO machinery is re-connecting everything okay.

According to the debugger, the message appears as a result of an
uncaught NSException from -[NSConnection sendInvocation:internal:],
called from -[NSDistantObject forwardInvocation].

Server and client are both properly retained.

There seem to be a lot of messages of late on Apple's forums about
problems with iSync (10.5.4) and even Interface Builder (10.5.3,
IB3.1beta6) in which this message is reported. Is it perhaps a bug in
recent versions of the OS rather than in my code?

Hamish

P.S. This question has been asked before, but the OP didn't get an
answer (http://www.cocoabuilder.com/archive/message/cocoa/2006/12/29/176458 
)

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mdb%40realvnc.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/bradgibbs%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: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Ken Thomases

On Jul 9, 2008, at 10:53 AM, Brad Gibbs wrote:

Is Distributed Objects still the preferred method for communicating  
among computers on a local network?  It's been hinted that DO may be  
deprecated in the not-so-distant future.


I've seen and heard comments from Apple that Distributed Objects  
between threads in a single process is discouraged.  It's overkill and  
unnecessarily complicated for that use case.  Especially, the new  
NSThread features in Leopard make it much less necessary.


However, I haven't seen/heard anything about it being discouraged  
between processes or among computers, much less being deprecated.


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


Deploying application with Growl support

2008-07-09 Thread Matthew Gertner
Hi,

Perhaps this isn't the right place to ask this, but I have a Cocoa
application that uses Growl for notifications. I'm looking for
information about how to create a package so the application is
distributed with Growl for those users who don't already have the
latter installed. Can anyone give me a pointer? If there's a better
place to ask this, please let me know.

Regards,
Matt
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Hamish Allan
On Wed, Jul 9, 2008 at 10:14 AM, Mike Bellerby <[EMAIL PROTECTED]> wrote:

> I use DOs on 10.3, 10.4 and 10.5. They work correctly on all versions. From
> your description I'm not entirely sure what you are trying to do. Could you
> post a code example and I try to help.

Thanks, Mike. Will do -- I'll create a cut-down test project to see if
I can isolate the problem further.

Cheers,
Hamish
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Hamish Allan
Hi Ken,

Thanks for your reply. I already had NSZombieEnabled, so no help
there, but the Object Allocations Instrument highlighted that
-[NSConnection invalidate] was being called; a breakpoint on that
revealed the following trace for thread 2:

#0  0x91b1f916 in -[NSConnection invalidate]
#1  0x91b18598 in +[NSConnection _portInvalidated:]
#2  0x91aa154a in _nsnote_callback
#3  0x9463baba in __CFXNotificationPost
#4  0x9463bd93 in _CFXNotificationPostNotification
#5  0x91a9e7b0 in -[NSNotificationCenter 
postNotificationName:object:userInfo:]
#6  0x91ae9fea in _NSPortDeathNotify
#7  0x946363eb in CFMachPortInvalidate
#8  0x94636de6 in __CFNotifyDeadMachPort
#9  0x94636635 in __CFMachPortPerform
#10 0x9465a908 in CFRunLoopRunSpecific
#11 0x9465acf8 in CFRunLoopRunInMode
#12 0x91b05460 in +[NSURLConnection(NSURLConnectionReallyInternal)
_resourceLoadLoop:]
#13 0x91aa1f1d in -[NSThread main]
#14 0x91aa1ac4 in __NSThread__main__
#15 0x9062f6f5 in _pthread_start
#16 0x9062f5b2 in thread_start

So it looks like a mach port has died under me. I'm going to try to
create a small test project to investigate why.

Cheers,
Hamish
___

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

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

2008-07-09 Thread Hamish Allan
On Wed, Jul 9, 2008 at 2:39 PM, Laurent Cerveau <[EMAIL PROTECTED]> wrote:

> Apparently what is happening is that the keyPath is decomposed, each object
> is verified to be KVC compliant for the appropriate subPath and here we go :
> nothing unexpected if I refer to the doc except that..the part I do not
> understand in this case is the following : why is own valueForKeyPath for
> this object not called at first place in this case?

I'm not sure I'm answering your question directly, but the reason the
KVO machinery wants the object to be genuinely KVC-compliant for the
"title" property is that one of the ways that "title.de" can change is
if "title" changes, so it wants to set itself up to monitor that.

You might consider using a proxy object for the property "title" which
handles the inverted heirarchy?

Hamish
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Deploying application with Growl support

2008-07-09 Thread Mike Abdullah
Adium does exactly this and is open source. I imagine a perusal of  
their code would be quite handy.


Mike.

On 9 Jul 2008, at 17:27, Matthew Gertner wrote:


Hi,

Perhaps this isn't the right place to ask this, but I have a Cocoa
application that uses Growl for notifications. I'm looking for
information about how to create a package so the application is
distributed with Growl for those users who don't already have the
latter installed. Can anyone give me a pointer? If there's a better
place to ask this, please let me know.

Regards,
Matt
___

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

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

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


Re: Redrawing CALayer subclass when super layer is scaled

2008-07-09 Thread David Duncan

On Jul 8, 2008, at 10:53 PM, Rick Mann wrote:

I'm trying to use scaling of the superlayer to implement a zoom  
feature in my CAD app. The various elements in the canvas are drawn  
by a CALayer subclass I have, which overrides drawInContext:. After  
the zoom finishes animating, I want CA to call all the sublayer's  
drawInContext: methods as necessary to re-render the layer's  
contents. Is there any way to do this, short of keeping track of all  
the layers myself and calling setNeedsDisplay on them?



Your best solution for rendering multi-representational content in  
Core Animation is to use a CATiledLayer. It will automatically be  
called to update content as you zoom in and out (assuming you specify  
that the level of content exists). The drawing model is exactly the  
same as with a CALayer, although you can optimize the drawing a bit  
with a bit more knowledge.

--
David Duncan
Apple DTS Animation and Printing
[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: Overriding v alueForKeyPath

2008-07-09 Thread Laurent Cerveau

Hi Hamish

Thanks for the suggestion : I did in fact sit with a collegue and he  
also forced me to look at the other side (KVO ) and we kind of found a  
way


Basically the order of calling is valueForKey for the first part of  
the "KV path" which goes in valueForUndefinedKey and if this "one does  
the right thing" is ends up in valueForKeyPath
We went down further and the best way to force a call done to  
"valueForKeyPath" is in fact to return a constant value from the  
valueForKey / valueForUndefinedKey . and the simplest one is nil.


now I need to check the proper behavior for observer to make sure they  
can observe properly


thanks

laurent



On Jul 9, 2008, at 6:46 PM, Hamish Allan wrote:

On Wed, Jul 9, 2008 at 2:39 PM, Laurent Cerveau <[EMAIL PROTECTED]>  
wrote:


Apparently what is happening is that the keyPath is decomposed,  
each object
is verified to be KVC compliant for the appropriate subPath and  
here we go :
nothing unexpected if I refer to the doc except that..the part I do  
not
understand in this case is the following : why is own  
valueForKeyPath for

this object not called at first place in this case?


I'm not sure I'm answering your question directly, but the reason the
KVO machinery wants the object to be genuinely KVC-compliant for the
"title" property is that one of the ways that "title.de" can change is
if "title" changes, so it wants to set itself up to monitor that.

You might consider using a proxy object for the property "title" which
handles the inverted heirarchy?

Hamish


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Receive notifications about frontmost application change

2008-07-09 Thread Jean-Daniel Dupas


Yes, so the bad new is that you have to go Carbon to listen front  
switched events, the good new is that this part of Carbon is available  
for 64 bits apps (probably because this is the only public way to do  
this for now).



Le 9 juil. 08 à 17:49, Matt Gough a écrit :

You can do this (and a lot of other stuff not covered by  
NSWorkspace ) with a CarbonEvent handler on kEventClassApplication,  
kEventAppFrontSwitched.


Matt
On 9 Jul 2008, at 5:44pm, Jens Alfke wrote:



On 9 Jul '08, at 3:22 AM, Александр Даровских  
wrote:



Hi,
Is there any way to subscribe to frontmost application change  
notification? For example, via NSDistributedNotificationCenter or  
some other facility? I have managed to get process startup and  
shutdown notifications, but I cannot get active application change  
notification. Maybe it is done in somehow another way?


I ran NotificationWatcher, which logs all distributed notifications  
and workspace notifications, but didn't see anything when I  
switched apps. So it must be done a different way. I suspect there  
may be a CoreGraphics API that does this; try looking there.


—Jens___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.gough 
%40agfa.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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]





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: Deploying application with Growl support

2008-07-09 Thread Peter Maurer

Perhaps this isn't the right place to ask this, but I have a Cocoa
application that uses Growl for notifications.


Have a look at the bottom of this page:




You'll want to use Growl-WithInstaller.framework.


If there's a better place to ask this, please let me know.


There's a Growl mailing list at .


Cheers,

Peter.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Deploying application with Growl support

2008-07-09 Thread Marcelo Alves
Read the growl documentation. There's a chapter explaining how to  
bundle a growl installer inside your app.




Sent from my iPhone

On 9 Jul 2008, at 13:27, "Matthew Gertner" <[EMAIL PROTECTED]> wrote:


Hi,

Perhaps this isn't the right place to ask this, but I have a Cocoa
application that uses Growl for notifications. I'm looking for
information about how to create a package so the application is
distributed with Growl for those users who don't already have the
latter installed. Can anyone give me a pointer? If there's a better
place to ask this, please let me know.

Regards,
Matt
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/marcelo.alves%40redefined.cc

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: Receive notifications about frontmost application change

2008-07-09 Thread Bill Cheeseman
on 2008-07-09 11:44 AM, Jens Alfke at [EMAIL PROTECTED] wrote:

> On 9 Jul '08, at 3:22 AM, Александр Даровских wrote:
> 
>> Hi,
>> Is there any way to subscribe to frontmost application change
>> notification? For example, via NSDistributedNotificationCenter or
>> some other facility? I have managed to get process startup and
>> shutdown notifications, but I cannot get active application change
>> notification. Maybe it is done in somehow another way?

You can register to observe the accessibility notifications
AXApplicationActivated and AXApplicationDeactivated. These require you to
register to observe a specific target application. Therefore, in order to
catch every application switch, use the NSWorkspace -activeApplication
method to get the name of the current active application, register to
observe when it deactivates, then when it does deactivate get the new
-activeApplication and register to observe when it deactivates, and so on.

See Apple's iChatStatusFromApplication sample code for Leopard to see
exactly how to implement this.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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: Deploying application with Growl support

2008-07-09 Thread Matthew Gertner
Thanks for all the advice. I'll take a look and inquire on the Growl
list if I need more help.

On Wed, Jul 9, 2008 at 7:21 PM, Marcelo Alves
<[EMAIL PROTECTED]> wrote:
> Read the growl documentation. There's a chapter explaining how to bundle a
> growl installer inside your app.
>
>
>
> Sent from my iPhone
>
> On 9 Jul 2008, at 13:27, "Matthew Gertner" <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> Perhaps this isn't the right place to ask this, but I have a Cocoa
>> application that uses Growl for notifications. I'm looking for
>> information about how to create a package so the application is
>> distributed with Growl for those users who don't already have the
>> latter installed. Can anyone give me a pointer? If there's a better
>> place to ask this, please let me know.
>>
>> Regards,
>> Matt
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> http://lists.apple.com/mailman/options/cocoa-dev/marcelo.alves%40redefined.cc
>>
>> This email sent to [EMAIL PROTECTED]
>



-- 
*** Note that my email has changed to [EMAIL PROTECTED]
Please update your address book accordingly. ***
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Receive notifications about frontmost application change

2008-07-09 Thread Bill Cheeseman
on 2008-07-09 1:12 PM, Jean-Daniel Dupas at [EMAIL PROTECTED] wrote:

> Yes, so the bad new is that you have to go Carbon to listen front
> switched events, the good new is that this part of Carbon is available
> for 64 bits apps (probably because this is the only public way to do
> this for now).

No. See my message just now about the Accessibility API.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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: Receive notifications about frontmost application change

2008-07-09 Thread James Montgomerie

On 9 Jul 2008, at 18:46, Bill Cheeseman wrote:


on 2008-07-09 11:44 AM, Jens Alfke at [EMAIL PROTECTED] wrote:


On 9 Jul '08, at 3:22 AM, Александр Даровских wrote:


Hi,
Is there any way to subscribe to frontmost application change
notification? For example, via NSDistributedNotificationCenter or
some other facility? I have managed to get process startup and
shutdown notifications, but I cannot get active application change
notification. Maybe it is done in somehow another way?


You can register to observe the accessibility notifications
AXApplicationActivated and AXApplicationDeactivated. These require  
you to
register to observe a specific target application. Therefore, in  
order to

catch every application switch, use the NSWorkspace -activeApplication
method to get the name of the current active application, register to
observe when it deactivates, then when it does deactivate get the new
-activeApplication and register to observe when it deactivates, and  
so on.


See Apple's iChatStatusFromApplication sample code for Leopard to see
exactly how to implement this.


This does require, though, that the user has "Enable access for  
assistive devices" enabled in the Universal Access preferences pane  
(the Carbon method does not).


Jamie.___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Redrawing CALayer subclass when super layer is scaled

2008-07-09 Thread Rick Mann


On Jul 9, 2008, at 09:56:36, David Duncan wrote:

Your best solution for rendering multi-representational content in  
Core Animation is to use a CATiledLayer. It will automatically be  
called to update content as you zoom in and out (assuming you  
specify that the level of content exists). The drawing model is  
exactly the same as with a CALayer, although you can optimize the  
drawing a bit with a bit more knowledge.



My CAD program has a number of "parts" laid out on the canvas at the  
whim of the user. These parts are interconnected by the user with  
lines comprised of a series of orthogonal line segments (it's  
schematic capture CAD). There is one instance of my CALayer subclass  
for each of these parts, and I'm thinking I'll use one for each  
connected set of line segments (not sure yet).


Are you suggesting that each of these should subclass CATiledLayer  
instead (or provide a delegate)? I was setting the transform on the  
window's (root?) layer. Will that result in tile sublayers redrawing  
their content?


I'll read the docs on CATiledLayer, and give this a shot. Thanks!

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Does this caution need fixed? (newb)

2008-07-09 Thread Brian Stern


On Jul 9, 2008, at 10:44 AM, Chris Paveglio wrote:

I'm trying to make sure that this part of my code is good and clean  
and not leaking. I believe that I have it right (but still think I  
have something wrong).
This code makes a list of file paths, and then copies the files or  
folders from their location to the destination the user selected. If  
the item already exists in the destination, I delete it first (to  
overwrite with new data, yes this is what I intend and the user is  
aware of how the app works).
I've read all your previous responses (Thanks) and it seems like  
since I am just using "normal" strings that they will be  
autoreleased on their own. There are now no compiler cautions and  
the app seems to work OK.
A side issue is that I want to add a 2 second delay before closing  
the sheet that is displayed, is NSTimer the correct item to use?

Chris


I have some stylistic comments on this code.

Your method is too large.  To make it smaller you should break it up  
into a number of smaller tasks.

As Jens mentioned a string like this

NSString *string1  = @"Library/Preferences/Adobe Photoshop CS3  
Settings";


is pretty much the same as a string like this: @"Library/Preferences/ 
Adobe Photoshop CS3 Settings"


I would build a method that does nothing but return the array or  
arrays that contain your manifest of files to save


-(NSArray)myPrefsArray
{
// build array here
return myPrefs;
}

I notice that your  myPrefsSaved array is derived from the myPrefs  
array but it just has the file name not the full path.  I'd use  
[astring lastPathComponent] to either build the second array or just  
call this method inside your loop.


I would break out the entire copy files loop into its own method.

Since you loop over the contents of the myPrefs array I wouldn't hard  
code the loop index to 8 or 9 I'd depend on the [myrefsArray length]  
value to index the loop.  You should also look at NSEnumerator and  
also fast enumeration as ways to drive this loop in a better way.


I notice that you call [myPrefs objectAtIndex:i] several times in your  
loop.  If you use NSEnumerator or fast enumeration you can avoid this  
otherwise just call it once at the top of the loop and save the value  
in a temp string variable.


Also, declaring the loop counter outside the loop is now old  
fashioned.  You can try this:


for (int i = 0; i < limit; i++)

You might need to set your C dialect setting to C99 or gnu99 if you're  
using an old project. I recommend it.


You don't check any errors from the file manager operations. What if  
the user chooses a folder on a locked volume or the disk gets full or  
the user chooses a network volume and the network drops out?  Your  
users will hate you if these things happen but your app fails  
silently.  You should both check for errors and report them to the user.


I don't see any problems in this code with leaking of objects.

I don't like the way that all the steps of this process are done one  
after another in a sequential fashion.  I would probably set up the  
tasks to be done in a separate thread or have each file copy be done  
inside a timer callback until all are done and show a progress window  
probably in place of a progress sheet (although it might work ok  
either way).


Regarding your 2 second delay you can use a timer or  
performSelector:withObject:afterDelay but both will require you to  
provide a callback method that will dismiss your sheet.


Good luck,

Brian


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Redrawing CALayer subclass when super layer is scaled

2008-07-09 Thread David Duncan

On Jul 9, 2008, at 11:09 AM, Rick Mann wrote:

My CAD program has a number of "parts" laid out on the canvas at the  
whim of the user. These parts are interconnected by the user with  
lines comprised of a series of orthogonal line segments (it's  
schematic capture CAD). There is one instance of my CALayer subclass  
for each of these parts, and I'm thinking I'll use one for each  
connected set of line segments (not sure yet).


Given what it sounds like your content is, I might consider putting  
the whole canvas on a single or small set of tiled layers (they can be  
unbounded in size).


Are you suggesting that each of these should subclass CATiledLayer  
instead (or provide a delegate)? I was setting the transform on the  
window's (root?) layer. Will that result in tile sublayers redrawing  
their content?


A tiled layer will trigger redraws when it detects that higher (or  
lower) resolution content is available. It caches this drawing as  
well, so you won't get called to redraw just because of a resize of  
content at that level is already available.


--
David Duncan
Apple DTS Animation and Printing
[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: Making a text cell in a table editable

2008-07-09 Thread Vitaly Ovchinnikov
I have a similar question. My NSTableView is bound to
NSArrayController and I need to make cell editable immediately after
adding new row. Rows added with default values and I need to allow
user to edit them easy. I have an "Add" button that fires action like
this:

- (void) onAdd: (id) sender
{
 [arrayController insert:self]; // creates new object
 // here I need to select new cell and start editing
}

If I call -editColumn:row:withEvent:select immediately after -insert -
it does nothing. It seems that NSTableView will be updated a bit
later, so I find out this way:

I call [self performSelector:@selector(doBeginEditing) withObject:nil
afterDelay:0];

and in -doBeginEditing I call [grid editColumn:row:withEvent:select].
This works but I feel that the more clear way exists. Does it?

On Wed, Jul 9, 2008 at 1:54 PM, Jens Miltner <[EMAIL PROTECTED]> wrote:
>
> Am 09.07.2008 um 08:09 schrieb Chris Idou:
>
>>
>> How do I programmatically make a text cell in a NSTableView to have focus
>> and be in edit mode?
>
> I believe -[NSTableView editColumn:(NSInteger)columnIndex
> row:(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select:(BOOL)flag] is
> the method you want to call...
>
> HTH,
> 
>
>
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/vitaly.ovchinnikov%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]


Set string value

2008-07-09 Thread Kevin Walzer

Hello,

I'm trying to work through an exercise in the new Hillegass book and am 
encountering difficulties. The app fails to build. The relevant code 
snippet is below, with errors noted in the comments:


-(IBAction)getCount:(id)sender
{

NSString *string = [textField stringValue];
	int *stringLength = [string length];  //warning: initialization makes 
pointer from integer without a cast
	[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters long", string, 
stringLength]; //error: too many arguments to function 'setStringValue:'

NSLog(@"%@", string); 
}

The idea is to take input from a text field, calculate the number of 
characters in the text string, and display both the entered text string 
and the number of characters in a text label.


I'd appreciate it if someone could clarify two things for me:

1. How to structure the setStringValue method so that gcc doesn't barf 
because of "too many arguments"--I'm not clear what that means.
2. How to structure the initialization of the  stringLength variable so 
that gcc doesn't emit warnings--I'm not clear on what the problem is here.


TIA,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.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: Set string value

2008-07-09 Thread Alex Wait
It's this line

[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters long", string,
stringLength];

The setStringValue function does not take more than one argument. If you
want to format the string like that try

[textlabel setStringValue: [NSString stringWithFormat:@"\"[EMAIL PROTECTED]" is 
%d
characters long", string, stringLength] ]

On Wed, Jul 9, 2008 at 1:12 PM, Kevin Walzer <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I'm trying to work through an exercise in the new Hillegass book and am
> encountering difficulties. The app fails to build. The relevant code snippet
> is below, with errors noted in the comments:
>
> -(IBAction)getCount:(id)sender
> {
>
>NSString *string = [textField stringValue];
>int *stringLength = [string length];  //warning: initialization
> makes pointer from integer without a cast
>[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters 
> long", string,
> stringLength]; //error: too many arguments to function 'setStringValue:'
>NSLog(@"%@", string);
> }
>
> The idea is to take input from a text field, calculate the number of
> characters in the text string, and display both the entered text string and
> the number of characters in a text label.
>
> I'd appreciate it if someone could clarify two things for me:
>
> 1. How to structure the setStringValue method so that gcc doesn't barf
> because of "too many arguments"--I'm not clear what that means.
> 2. How to structure the initialization of the  stringLength variable so
> that gcc doesn't emit warnings--I'm not clear on what the problem is here.
>
> TIA,
> Kevin
>
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.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/bobber205%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

2008-07-09 Thread I. Savant
>int *stringLength = [string length];  //warning: initialization makes
> pointer from integer without a cast

  You're declaring an int pointer (int *) instead of an int (int),
then assigning it an int value (the result of asking 'string' for its
-length).

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Set string value

2008-07-09 Thread Vitaly Ovchinnikov
try this:

NSString *string = [textField stringValue];
int stringLength = [string length];
NSString *msg = [NSString stringWithFormat:@"\"[EMAIL PROTECTED]" is %d 
characters
long", string, stringLength]
[textLabel setStringValue:msg];
NSLog(@"%@", string);


On Thu, Jul 10, 2008 at 12:12 AM, Kevin Walzer <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm trying to work through an exercise in the new Hillegass book and am
> encountering difficulties. The app fails to build. The relevant code snippet
> is below, with errors noted in the comments:
>
> -(IBAction)getCount:(id)sender
> {
>
>NSString *string = [textField stringValue];
>int *stringLength = [string length];  //warning: initialization makes
> pointer from integer without a cast
>[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters 
> long", string,
> stringLength]; //error: too many arguments to function 'setStringValue:'
>NSLog(@"%@", string);
> }
>
> The idea is to take input from a text field, calculate the number of
> characters in the text string, and display both the entered text string and
> the number of characters in a text label.
>
> I'd appreciate it if someone could clarify two things for me:
>
> 1. How to structure the setStringValue method so that gcc doesn't barf
> because of "too many arguments"--I'm not clear what that means.
> 2. How to structure the initialization of the  stringLength variable so that
> gcc doesn't emit warnings--I'm not clear on what the problem is here.
>
> TIA,
> Kevin
>
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.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/vitaly.ovchinnikov%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: Set string value

2008-07-09 Thread Abernathy, Joshua
And your line "int *stringLength = [string length];" should not have the
* in front of the variable name. Putting the * in front means it is a
pointer to an int, but -[NSString length] returns just an int.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] On Behalf Of Alex Wait
Sent: Wednesday, July 09, 2008 4:15 PM
To: [EMAIL PROTECTED]
Cc: Cocoa-dev@lists.apple.com
Subject: Re: Set string value

It's this line

[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters long", string,
stringLength];

The setStringValue function does not take more than one argument. If you
want to format the string like that try

[textlabel setStringValue: [NSString stringWithFormat:@"\"[EMAIL PROTECTED]" is 
%d
characters long", string, stringLength] ]

On Wed, Jul 9, 2008 at 1:12 PM, Kevin Walzer <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I'm trying to work through an exercise in the new Hillegass book and
am
> encountering difficulties. The app fails to build. The relevant code
snippet
> is below, with errors noted in the comments:
>
> -(IBAction)getCount:(id)sender
> {
>
>NSString *string = [textField stringValue];
>int *stringLength = [string length];  //warning: initialization
> makes pointer from integer without a cast
>[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters 
> long",
string,
> stringLength]; //error: too many arguments to function
'setStringValue:'
>NSLog(@"%@", string);
> }
>
> The idea is to take input from a text field, calculate the number of
> characters in the text string, and display both the entered text
string and
> the number of characters in a text label.
>
> I'd appreciate it if someone could clarify two things for me:
>
> 1. How to structure the setStringValue method so that gcc doesn't barf
> because of "too many arguments"--I'm not clear what that means.
> 2. How to structure the initialization of the  stringLength variable
so
> that gcc doesn't emit warnings--I'm not clear on what the problem is
here.
>
> TIA,
> Kevin
>
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.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/bobber205%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jabernathy%40burrislogi
stics.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: Set string value

2008-07-09 Thread Sherm Pendley
On Wed, Jul 9, 2008 at 4:12 PM, Kevin Walzer <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm trying to work through an exercise in the new Hillegass book and am
> encountering difficulties. The app fails to build. The relevant code snippet
> is below, with errors noted in the comments:
>
> -(IBAction)getCount:(id)sender
> {
>
>NSString *string = [textField stringValue];
>int *stringLength = [string length];  //warning: initialization makes
> pointer from integer without a cast

You've declared stringLength as a pointer to an int, then assigned an
integer value to it. You don't want a pointer here, so leave out he *:

int stringLength = [string length];

>[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters 
> long", string,
> stringLength]; //error: too many arguments to function 'setStringValue:'

The -setStringValue: method takes one and only one argument. In
particular, it does *not* take a format string and a variable argument
list, as you appear to expect it to do. To do something like that, you
need to break it into two steps:

NSString *newString = [NSString localizedStringWithFormat:
@"\"[EMAIL PROTECTED]" is %d characters long", string, stringLength];
[textLabel setStringValue: newString];

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Set string value

2008-07-09 Thread Ken Thomases

In addition to what Alex said...

On Jul 9, 2008, at 3:12 PM, Kevin Walzer wrote:


-(IBAction)getCount:(id)sender
{

NSString *string = [textField stringValue];
	int *stringLength = [string length];  //warning: initialization  
makes pointer from integer without a cast


This declares stringLength as a pointer to an int.  You don't want it  
to be a pointer, it should just be an int.  So, remove the asterisk.


For somebody learning C and Objective-C at the same time, it can be  
confusing.  On the one hand, most Objective-C objects are stored into  
explicit pointer variables (except "id" where the pointerness is  
implicit).  On the other hand, many of the C standard types are not  
pointers to objects -- they are just "scalars".  I think you need to  
review the basics of C.




	[textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters long", string,  
stringLength]; //error: too many arguments to function  
'setStringValue:'

NSLog(@"%@", string); 
}


Cheers,
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: Making a text cell in a table editable

2008-07-09 Thread Jens Miltner


Am 9.7.08 um 22:05 schrieb Vitaly Ovchinnikov:


I have a similar question. My NSTableView is bound to
NSArrayController and I need to make cell editable immediately after
adding new row. Rows added with default values and I need to allow
user to edit them easy. I have an "Add" button that fires action like
this:

- (void) onAdd: (id) sender
{
[arrayController insert:self]; // creates new object
// here I need to select new cell and start editing
}


Haven't ever had this problem, but have you tried

- (void) onAdd: (id) sender
{
[arrayController insert:self]; // creates new object

[tableView reloadData]; // <-- make table view reload it's data

[tableView editColumn:...]; // maybe table view now knows about  
the new row?

}




If I call -editColumn:row:withEvent:select immediately after -insert -
it does nothing. It seems that NSTableView will be updated a bit
later, so I find out this way:

I call [self performSelector:@selector(doBeginEditing) withObject:nil
afterDelay:0];

and in -doBeginEditing I call [grid editColumn:row:withEvent:select].
This works but I feel that the more clear way exists. Does it?

On Wed, Jul 9, 2008 at 1:54 PM, Jens Miltner <[EMAIL PROTECTED]> wrote:


Am 09.07.2008 um 08:09 schrieb Chris Idou:



How do I programmatically make a text cell in a NSTableView to  
have focus

and be in edit mode?


I believe -[NSTableView editColumn:(NSInteger)columnIndex
row:(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select: 
(BOOL)flag] is

the method you want to call...

HTH,






___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/vitaly.ovchinnikov%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: Making a text cell in a table editable

2008-07-09 Thread I. Savant
> - (void) onAdd: (id) sender
> {
>[arrayController insert:self]; // creates new object
>
>[tableView reloadData]; // <-- make table view reload it's data
>
>[tableView editColumn:...]; // maybe table view now knows about the new
> row?
> }

  This probably won't work as expected because the array controller
(directly after your call to -insert:) won't be ready for you. From
the docs regarding -insert: ...

"Beginning with Mac OS X v10.4 the result of this method is deferred
until the next iteration of the runloop so that the error presentation
mechanism can provide feedback as a sheet."

  Same goes for -add: ... You'll need to force the array controller to
-rearrangeObjects before asking the tableView to reload. If you're
using Core Data, you'll probably also need to force a -fetch: before
calling -rearrangeObjects, though I don't know for sure.

  This forces the array controller to do its thing right then and
there. Of course short-circuiting the mechanism like that can cause
validation problems, so be careful ...

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Making a text cell in a table editable

2008-07-09 Thread I. Savant
>  Same goes for -add: ... You'll need to force the array controller to
> -rearrangeObjects before asking the tableView to reload. If you're
> using Core Data, you'll probably also need to force a -fetch: before
> calling -rearrangeObjects, though I don't know for sure.
>
>  This forces the array controller to do its thing right then and
> there. Of course short-circuiting the mechanism like that can cause
> validation problems, so be careful ...

  Sorry! I'm not thinking straight ... you will need to directly use
the -addObject: and -insertObject:atArrangedObjectIndex: methods
rather than -insert: or -add: for the above to work. This takes affect
immediately (but must still be rearranged via -rearrangeObjects).

   Also, you need to use the index of the newly-inserted object in the
array controller's -arrangedObjects array, not its contents (so you
get the correct row to edit in the table).

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Set string value

2008-07-09 Thread Kevin Walzer

Sherm Pendley wrote:

On Wed, Jul 9, 2008 at 4:12 PM, Kevin Walzer <[EMAIL PROTECTED]> wrote:

Hello,

I'm trying to work through an exercise in the new Hillegass book and am
encountering difficulties. The app fails to build. The relevant code snippet
is below, with errors noted in the comments:

-(IBAction)getCount:(id)sender
{

   NSString *string = [textField stringValue];
   int *stringLength = [string length];  //warning: initialization makes
pointer from integer without a cast


You've declared stringLength as a pointer to an int, then assigned an
integer value to it. You don't want a pointer here, so leave out he *:

int stringLength = [string length];


   [textLabel setStringValue:@"\"[EMAIL PROTECTED]" is %d characters long", 
string,
stringLength]; //error: too many arguments to function 'setStringValue:'


The -setStringValue: method takes one and only one argument. In
particular, it does *not* take a format string and a variable argument
list, as you appear to expect it to do. To do something like that, you
need to break it into two steps:

NSString *newString = [NSString localizedStringWithFormat:
@"\"[EMAIL PROTECTED]" is %d characters long", string, stringLength];
[textLabel setStringValue: newString];

sherm--



Sherm,

Thanks to you and everyone else for the clarifications. I have a lot 
experience with scripting languages (Tcl, Python, AppleScript) but am a 
relative newbie to C/ObjC.


Regards,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.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]


Calling autorelease on CFAllocated objects?

2008-07-09 Thread Scott Andrew
I have a memory management question. I was looking at the QCTV example  
on from the quicktime site. It has some code that does the following:


ICMCompressionSessionOptionsRef options;

..

Do some work
..

return (ICMCompressionSessionOptionsRef)[(id)options autorelease];

Can you do this with CoreFoundation allocated things that are not  
bridged?


Scott
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Redrawing CALayer subclass when super layer is scaled

2008-07-09 Thread Rick Mann


On Jul 9, 2008, at 12:59:33, David Duncan wrote:

Given what it sounds like your content is, I might consider putting  
the whole canvas on a single or small set of tiled layers (they can  
be unbounded in size).



Oh. I had thought making each individual part its own CALayer was most  
appropriate. I intend for each part to change its appearance to  
reflect selection, hover, etc, as well as be draggable, rotatable,  
etc. Animating these these changes seems to dictate making each its  
own layer.


Now, I'm not really sure how to animate something I'm drawing directly  
(for example, when you're hovering over a part, I would like it's  
"significant contour" to pulsate, or something like that).


--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Making a text cell in a table editable

2008-07-09 Thread Vitaly Ovchinnikov
In my case I just use [grid selectedRow], because NSTableView selects
new row for me. Thanks, will try your method too.

On Thu, Jul 10, 2008 at 12:49 AM, I. Savant <[EMAIL PROTECTED]> wrote:
>>  Same goes for -add: ... You'll need to force the array controller to
>> -rearrangeObjects before asking the tableView to reload. If you're
>> using Core Data, you'll probably also need to force a -fetch: before
>> calling -rearrangeObjects, though I don't know for sure.
>>
>>  This forces the array controller to do its thing right then and
>> there. Of course short-circuiting the mechanism like that can cause
>> validation problems, so be careful ...
>
>  Sorry! I'm not thinking straight ... you will need to directly use
> the -addObject: and -insertObject:atArrangedObjectIndex: methods
> rather than -insert: or -add: for the above to work. This takes affect
> immediately (but must still be rearranged via -rearrangeObjects).
>
>   Also, you need to use the index of the newly-inserted object in the
> array controller's -arrangedObjects array, not its contents (so you
> get the correct row to edit in the table).
>
> --
> I.S.
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Redrawing CALayer subclass when super layer is scaled

2008-07-09 Thread David Duncan

On Jul 9, 2008, at 2:08 PM, Rick Mann wrote:


On Jul 9, 2008, at 12:59:33, David Duncan wrote:

Given what it sounds like your content is, I might consider putting  
the whole canvas on a single or small set of tiled layers (they can  
be unbounded in size).



Oh. I had thought making each individual part its own CALayer was  
most appropriate. I intend for each part to change its appearance to  
reflect selection, hover, etc, as well as be draggable, rotatable,  
etc. Animating these these changes seems to dictate making each its  
own layer.


Now, I'm not really sure how to animate something I'm drawing  
directly (for example, when you're hovering over a part, I would  
like it's "significant contour" to pulsate, or something like that).



Either method should work, but you may want to consider resource usage  
in both as well. Its certainly plausible to logically pull something  
out of its parent layer (i.e. redraw it into another layer) when  
selected, then when deselected burn it into the model so its drawn on  
its parent layer again.


But its mostly an implementation detail. I would probably go with what  
works first, then if you find a performance issue to consider a change  
then. As always, premature optimization is to be avoided.

--
David Duncan
Apple DTS Animation and Printing
[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: Why aren't my bindings firing?

2008-07-09 Thread Scott Anguish


On Jul 9, 2008, at 12:39 AM, Hamish Allan wrote:

On Wed, Jul 9, 2008 at 2:43 AM, Scott Anguish <[EMAIL PROTECTED]>  
wrote:


On Jul 8, 2008, at 11:33 AM, Hamish Allan wrote:


Scott, for what it's worth, I really don't agree with you that Cocoa
Bindings and KVB are "the same thing" or that "there is no
distinction".


Ron just said the same thing.


If you honestly think that an informal protocol and its implementation
are the same thing, and that X and a proper subset of X are the same
thing, then I can see how you might arrive at that conclusion.
Otherwise, I am baffled.



This is a misrepresentation (yet again). To go back to the point where  
this all started.


There are not two different bindings technologies with confusingly  
similar names (Cocoa Bindings and Key-Value Binding).


There is one, it's all Cocoa Bindings.


and now I'm going to pull out the moderator hammer and close the thread.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 get the status of network when the network is set disable.

2008-07-09 Thread Mike
The SCF documentation specifically says SC routines cannot be used to 
test *remote* reachability and should only be used to test whether a 
packet can *leave* the host. If this is all you need, then Michael's 
example will work. If you need to test remote reachability, you will 
need to devise some other method.


Mike

Michael Kaye wrote:

Try the SCNetworkReachability API...

I borrowed the following from one of Apple's examples:

- (BOOL)isDataSourceAvailable
{
static BOOL checkNetwork = YES;
if (checkNetwork) { // Since checking the reachability of a host can 
be expensive, cache the result and perform the reachability check once.

checkNetwork = NO;

Boolean success;
const char *host_name = "http://localhost:8080";;
   
SCNetworkReachabilityRef reachability = 
SCNetworkReachabilityCreateWithName(NULL, host_name);

SCNetworkReachabilityFlags flags;
success = SCNetworkReachabilityGetFlags(reachability, &flags);
_isDataSourceAvailable = success && (flags & 
kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired);

}
return _isDataSourceAvailable;
}

HTHs. Michael.

On 9 Jul 2008, at 13:22, xiaobin wrote:


Hello,

I am writing a program to detect the status of network.

In my program, I need get the status of network when the connection is
set disable.  here it is not by connecting the network to get the
status.
which API or method can work for it?

for example, if my lan cable is unpluged or the network is set
disable, it is certainly to know the status of the network is off. so
it is not necessary to connect the network to get the status.
so I want to know When it is clearly to know the status of the network
is on or off, which API or method can get the status.

I have read the example of apple's document for  using CFDiagnostics
to check whether the network is connected or not, but I think it is
not for my need.  It is by connecting the network to get the status.

Would anyone can give me a help ?

Thanks a lot
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/michaelkaye%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/junklists%40michael-amorose.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: Quick look preview multipage rich text

2008-07-09 Thread Julien Jalon
If I understand correctly your point, it seems that in the first case, you
use the direct to data print operation and in the second case, you use the
direct to file print operation then read back the file in memory and send it
to Quick Look. Both methods use QLPreviewRequestSetDataRepresentation(). Am
I right?

What do you mean when you say "does not display the content as multipage".
What does it display?

You should try to dump on disk the data produced in the first case and take
a look at it.

-- 
Julien

On Wed, Jul 9, 2008 at 4:40 AM, Philip Dow <[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I am trying to generate multipage pdf data for display in a quick look
> preview from rich text attributed string data. Attributed strings don't know
> anything about pages, so it seems to me that I'll have to go through the OS
> printing architecture to generate the multipage pdf content.
>
> Frustrating thing is, this works if I write the data to a file but not if I
> send it to quicklook. I can generate the pdf data with a custom print info
> specifying the page attributes, but quicklook does not display the content
> as multipage. If I use the same settings but a different print operation,
> writing the data to a temporary file instead, I get a correctly paginated
> document.
>
> Code follows.
>
> I understand that PDF content can be created with CGPDFContextCreate and
> the associated begin and end page calls, but the attributed string doesn't
> know about pages, so that seems like a dead end to me. If there's a method
> for doing it that way, I'm all for switching.
>
> You might also suggest just sending RTF to Quick Look, but I'd like the
> text attachments to display. Converting it to html seems like even more
> work.
>
> ===
>
> GenerateMultiPagePDFPreviewForURL(...)
>
> NSAttributedString *attrString = ...;
> NSTextView *textView = ... (filled with attrString);
>
> NSMutableData *pdfData = [NSMutableData data];
> NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
>
> [printInfo setPaperSize:NSMakeSize(612,792)];
> [printInfo setHorizontalPagination: NSFitPagination];
> [printInfo setVerticalPagination: NSAutoPagination];
> [printInfo setVerticallyCentered:NO];
>
> NSPrintOperation *po = [NSPrintOperation PDFOperationWithView:textView
>insideRect:[textView bounds]
>toData:pdfData
>printInfo:printInfo];
>
> [po runOperation];
> QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)pdfData,
> kUTTypePDF, NULL);
>
> ===
>
> Quicklook does not present a multipage preview with that code. But the
> following code writes a multipage document...
>
> ===
>
> NSAttributedString *attrString = ...;
> NSTextView *textView = ... (filled with attrString);
>
> NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
> NSMutableDictionary *printInfoDict = [NSMutableDictionary
> dictionaryWithDictionary:[printInfo dictionary]];
>
> [printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition];
> [printInfoDict setObject:@"someLocation.pdf" forKey:NSPrintSavePath];
>
> printInfo = [[NSPrintInfo alloc] initWithDictionary: printInfoDict];
> [printInfo setHorizontalPagination: NSFitPagination];
> [printInfo setVerticalPagination: NSAutoPagination];
> [printInfo setVerticallyCentered:NO];
>
> po  = [NSPrintOperation printOperationWithView:textView
> printInfo:printInfo];
> [po setShowPanels:NO];
> [po runOperation];
>
> ===
>
> In the first case I'm using [NSPrintOperation
> PDFOperationWithView:insideRect:toData:printInfo:] and in the second
> [NSPrintOperation printOperationWithView: printInfo:]. Is the
> PDFOperationWithView method not capable of producing multipage pdf data
> despite the custom printInfo?
>
> ~Phil
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%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: Calling autorelease on CFAllocated objects?

2008-07-09 Thread Wade Tregaskis
I have a memory management question. I was looking at the QCTV  
example on from the quicktime site. It has some code that does the  
following:


ICMCompressionSessionOptionsRef options;

..

Do some work
..

return (ICMCompressionSessionOptionsRef)[(id)options autorelease];

Can you do this with CoreFoundation allocated things that are not  
bridged?


Autorelease pools ultimately just invoke -(void)release on the  
objects.  If the object is not a true ObjC object or a bridged CF  
object, this will not work.  I'm not sure what the result will be -  
whether it'll crash or do nothing or what.  Fair to say the result is  
undefined and invariably bad.


Wade
___

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

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

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

This email sent to [EMAIL PROTECTED]


Spaces API issues

2008-07-09 Thread Chilton Webb
Hi,

I realize there is no Spaces API, and that there likely won't be, per se. 

I have an app that my users want to behave differently based on the space it is 
currently accessed from. There is currently no way to find the current 'space', 
as I understand it, so that is out of the question (and I filed a feature 
request). Of course, if anyone knows how to do this, I wouldn't mind hearing 
about it ;-)



In the meantime, they would at least like my app to show up in every space. 
It's not as elegant, but at least it's something. So currently I use this:

[[self window] 
setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];

The problem is that in most cases, regardless of what app they click on in the 
Spaces' overview, my app shows up in front when the space (any space) zooms in. 
Also, despite that this will occur, my app doesn't show up in all of the 
spaces. 

What I would like to know is how I can get Spaces to keep my app on all spaces, 
yet not have it come to the foreground when the user switches spaces.

Thanks!
-Chilton
___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] How to add "Find" feature for an NSTextView?

2008-07-09 Thread JongAm Park

Hello.

I'm trying to write codes that searches a given text in an NSTextView.
Currently, a window has an NSSearchField and an NSTextView. Some text 
will be loaded into the NSTextView and I expect users type into the 
NSSearchField to search some words in the NSTextView.


I connected -(IBAction)searchSource:(id)sender to the NSSearchField.

-(IBAction)searchSource:(id)sender
{
   NSString *searchString = [searchField stringValue];
   NSRange stringRange = NSMakeRange(0, [searchString length] );

   // xmlSourceView is the NSTextView in which the given string will be 
searched

   [xmlSourceView showFindIndicatorForRange:stringRange];
   [xmlSourceView performFindPanelAction:self];
}

According to the document, the performFindPanelAction performs some 
actions based on its tag.

However, there is no explanation how to set the tag.

Also, I tried "Command-F" to display a Find dialog box, but all of its 
buttons are disabled.
I thought "Find" feature was automatically enabled without writing any 
code before, but it doesn't work for me now.


Can anyone help me?

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]


Re: Quick look preview multipage rich text

2008-07-09 Thread Jean-Daniel Dupas


Le 9 juil. 08 à 23:54, Julien Jalon a écrit :

If I understand correctly your point, it seems that in the first  
case, you
use the direct to data print operation and in the second case, you  
use the
direct to file print operation then read back the file in memory and  
send it
to Quick Look. Both methods use  
QLPreviewRequestSetDataRepresentation(). Am

I right?

What do you mean when you say "does not display the content as  
multipage".

What does it display?

You should try to dump on disk the data produced in the first case  
and take

a look at it.

--
Julien

On Wed, Jul 9, 2008 at 4:40 AM, Philip Dow <[EMAIL PROTECTED]> wrote:


Hi all,

I am trying to generate multipage pdf data for display in a quick  
look
preview from rich text attributed string data. Attributed strings  
don't know
anything about pages, so it seems to me that I'll have to go  
through the OS

printing architecture to generate the multipage pdf content.

Frustrating thing is, this works if I write the data to a file but  
not if I
send it to quicklook. I can generate the pdf data with a custom  
print info
specifying the page attributes, but quicklook does not display the  
content
as multipage. If I use the same settings but a different print  
operation,
writing the data to a temporary file instead, I get a correctly  
paginated

document.

Code follows.

I understand that PDF content can be created with  
CGPDFContextCreate and
the associated begin and end page calls, but the attributed string  
doesn't
know about pages, so that seems like a dead end to me. If there's a  
method

for doing it that way, I'm all for switching.

You might also suggest just sending RTF to Quick Look, but I'd like  
the
text attachments to display. Converting it to html seems like even  
more

work.

===

GenerateMultiPagePDFPreviewForURL(...)

NSAttributedString *attrString = ...;
NSTextView *textView = ... (filled with attrString);

NSMutableData *pdfData = [NSMutableData data];
NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];

[printInfo setPaperSize:NSMakeSize(612,792)];
[printInfo setHorizontalPagination: NSFitPagination];
[printInfo setVerticalPagination: NSAutoPagination];
[printInfo setVerticallyCentered:NO];

NSPrintOperation *po = [NSPrintOperation  
PDFOperationWithView:textView

  insideRect:[textView bounds]
  toData:pdfData
  printInfo:printInfo];

[po runOperation];
QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)pdfData,
kUTTypePDF, NULL);

===

Quicklook does not present a multipage preview with that code. But  
the

following code writes a multipage document...

===

NSAttributedString *attrString = ...;
NSTextView *textView = ... (filled with attrString);

NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSMutableDictionary *printInfoDict = [NSMutableDictionary
dictionaryWithDictionary:[printInfo dictionary]];

[printInfoDict setObject:NSPrintSaveJob  
forKey:NSPrintJobDisposition];

[printInfoDict setObject:@"someLocation.pdf" forKey:NSPrintSavePath];

printInfo = [[NSPrintInfo alloc] initWithDictionary: printInfoDict];
[printInfo setHorizontalPagination: NSFitPagination];
[printInfo setVerticalPagination: NSAutoPagination];
[printInfo setVerticallyCentered:NO];

po  = [NSPrintOperation printOperationWithView:textView
printInfo:printInfo];
[po setShowPanels:NO];
[po runOperation];

===

In the first case I'm using [NSPrintOperation
PDFOperationWithView:insideRect:toData:printInfo:] and in the second
[NSPrintOperation printOperationWithView: printInfo:]. Is the
PDFOperationWithView method not capable of producing multipage pdf  
data

despite the custom printInfo?

~Phil





QuickLook support WebView contents, and the WebView support RTF data.

convert your attributed string into RTF (using -[NSAttributedString  
RTFFromRange:documentAttributes:]), then send the data to QuickLook.  
You may also generate html from your RTF , but I think the convertion  
is sometime less accurate.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Calling autorelease on CFAllocated objects?

2008-07-09 Thread Adam R. Maxwell
 
On Wednesday, July 09, 2008, at 03:12PM, "Wade Tregaskis" <[EMAIL PROTECTED]> 
wrote:
>> I have a memory management question. I was looking at the QCTV  
>> example on from the quicktime site. It has some code that does the  
>> following:
>>
>> ICMCompressionSessionOptionsRef options;
>>
>> ..
>>
>> Do some work
>> ..
>>
>> return (ICMCompressionSessionOptionsRef)[(id)options autorelease];
>>
>> Can you do this with CoreFoundation allocated things that are not  
>> bridged?
>
>Autorelease pools ultimately just invoke -(void)release on the  
>objects.  If the object is not a true ObjC object or a bridged CF  
>object, this will not work.  I'm not sure what the result will be -  
>whether it'll crash or do nothing or what.  Fair to say the result is  
>undefined and invariably bad.

Since ICMCompressionSessionOptionsGetTypeID returns a CFTypeID, 
ICMCompressionSessionOptionsRef is apparently a CFType.  As such, autorelease 
should work with it:

http://www.cocoabuilder.com/archive/message/cocoa/2008/7/5/212046

I wish this were better documented; the Search Kit docs show autorelease being 
sent to an SKDocumentRef, also, and that's always made me nervous (I think I 
actually sent feedback on that one a long time ago).

-- 
Adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quick look preview multipage rich text

2008-07-09 Thread Jean-Daniel Dupas


Le 10 juil. 08 à 00:20, Jean-Daniel Dupas a écrit :



Le 9 juil. 08 à 23:54, Julien Jalon a écrit :

If I understand correctly your point, it seems that in the first  
case, you
use the direct to data print operation and in the second case, you  
use the
direct to file print operation then read back the file in memory  
and send it
to Quick Look. Both methods use  
QLPreviewRequestSetDataRepresentation(). Am

I right?

What do you mean when you say "does not display the content as  
multipage".

What does it display?

You should try to dump on disk the data produced in the first case  
and take

a look at it.

--
Julien

On Wed, Jul 9, 2008 at 4:40 AM, Philip Dow <[EMAIL PROTECTED]> wrote:


Hi all,

I am trying to generate multipage pdf data for display in a quick  
look
preview from rich text attributed string data. Attributed strings  
don't know
anything about pages, so it seems to me that I'll have to go  
through the OS

printing architecture to generate the multipage pdf content.

Frustrating thing is, this works if I write the data to a file but  
not if I
send it to quicklook. I can generate the pdf data with a custom  
print info
specifying the page attributes, but quicklook does not display the  
content
as multipage. If I use the same settings but a different print  
operation,
writing the data to a temporary file instead, I get a correctly  
paginated

document.

Code follows.

I understand that PDF content can be created with  
CGPDFContextCreate and
the associated begin and end page calls, but the attributed string  
doesn't
know about pages, so that seems like a dead end to me. If there's  
a method

for doing it that way, I'm all for switching.

You might also suggest just sending RTF to Quick Look, but I'd  
like the
text attachments to display. Converting it to html seems like even  
more

work.




QuickLook support WebView contents, and the WebView support RTF data.

convert your attributed string into RTF (using -[NSAttributedString  
RTFFromRange:documentAttributes:]), then send the data to QuickLook.  
You may also generate html from your RTF , but I think the  
convertion is sometime less accurate.


Sorry for the noise, I think I should read the whole message before  
replying. That said, there is also an - 
RTFDFromRange:documentAttributes: method. RTFD should include  
attachement, I wonder if there is a way to send the generated data to  
a Webview (and so to QuickLook).





___

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

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

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

This email sent to [EMAIL PROTECTED]


Nesting IKImageBrowser GroupStyles

2008-07-09 Thread Ian
The grouping feature of IKImageBrowserView seems to be one of the  
least documented but most powerful features I've seen in a while.
The only references I can find to using groups with IKImageBrowserView  
all point back to the scant info in the API docs.


Anyway, after getting it working with minimal effort, I wondered if it  
was possible to nest groups within each other?


The obvious example use would be to have IKGroupBezelStyle groups of  
"versions" of images (a la Aperture) inside IKGroupDisclosureStyle  
groups of "rolls" (a la iPhoto).


Judging by the silence on Google and the list archives I'm not  
expecting a flood of answers but if the people responsible for this  
cool IKImageBrowserView behavior are listening then at least this post  
will serve to let them know someone is using and appreciating their  
good work!


Cheers
Ian

___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] How to highlighted text remained as highlighted?

2008-07-09 Thread JongAm Park

Hello.

With the Safari, when users search some text in a HTML document, the 
found text is remained highlighted until they click "Done" button.
I tried using the showFindIndicatorForRage for NSTextView, but the 
yellow highlight just disappears after it blinks.

Is there any way to leave it highlighted?

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]


Re: Receive notifications about frontmost application change

2008-07-09 Thread Bill Cheeseman
on 2008-07-09 1:58 PM, James Montgomerie at [EMAIL PROTECTED] wrote:

>> You can register to observe the accessibility notifications
>> AXApplicationActivated and AXApplicationDeactivated. These require
>> you to
>> register to observe a specific target application. Therefore, in
>> order to
>> catch every application switch, use the NSWorkspace -activeApplication
>> method to get the name of the current active application, register to
>> observe when it deactivates, then when it does deactivate get the new
>> -activeApplication and register to observe when it deactivates, and
>> so on.
>> 
>> See Apple's iChatStatusFromApplication sample code for Leopard to see
>> exactly how to implement this.
> 
> This does require, though, that the user has "Enable access for
> assistive devices" enabled in the Universal Access preferences pane
> (the Carbon method does not).

In Leopard, you can make your application process trusted by the
accessibility API (requires user authentication), using the
AXMakeProcessTrusted function. Then you don't need to ask your users to
enable global access for assistive devices. However, making your process
trusted is not easy -- you have to embed a couple of helper applications in
your application package, one of them to run as root and make your process
trusted, and the other to relaunch your application so the newly-trusted
process is running. If you have an easier way to accomplish your goal, go
for it.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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: [Q] How to highlighted text remained as highlighted?

2008-07-09 Thread Douglas Davidson


On Jul 9, 2008, at 4:07 PM, JongAm Park wrote:

With the Safari, when users search some text in a HTML document, the  
found text is remained highlighted until they click "Done" button.
I tried using the showFindIndicatorForRage for NSTextView, but the  
yellow highlight just disappears after it blinks.

Is there any way to leave it highlighted?


There is no support for Safari-style highlighting.  Various forms of  
highlighting were considered, and the one implemented is the one  
considered to be appropriate for most NSTextView usage.


Douglas Davidson

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: [Q] How to highlighted text remained as highlighted?

2008-07-09 Thread Seth Willits

On Jul 9, 2008, at 4:07 PM, JongAm Park wrote:

With the Safari, when users search some text in a HTML document, the  
found text is remained highlighted until they click "Done" button.
I tried using the showFindIndicatorForRage for NSTextView, but the  
yellow highlight just disappears after it blinks.

Is there any way to leave it highlighted?


I wrote my own code to do this (for 10.4). I imagine you'll either  
have to dig into private methods to see if there's a way to tweak its  
behavior in 10.5, or you'll have to roll your own as well.



--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


Attributed menu titles

2008-07-09 Thread Kiel Gillard
Hi all,
I have a menu of items whose titles are attributed strings. I have specified
custom colours for parts of those strings. The documentation reads:

If you do not set a text color for the attributed string, it is black when
not selected, white when selected, and gray when disabled. Colored text
remains unchanged when selected.

Is there some way to provide a colour for the NSMenuItem's attributedTitle
when the item is selected or disabled? For example, is there some key I can
set in an attributes dictionary that allows me to specify a colour to use
when either of these cases occurs? Have I overlooked or missed something in
the documentation?

Thanks,

Kiel
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Calling autorelease on CFAllocated objects?

2008-07-09 Thread Wade Tregaskis

http://www.cocoabuilder.com/archive/message/cocoa/2008/7/5/212046

I wish this were better documented; the Search Kit docs show  
autorelease being sent to an SKDocumentRef, also, and that's always  
made me nervous (I think I actually sent feedback on that one a long  
time ago).


I do apologise, you are absolutely correct.  The confusion arises from  
the fact that the term "toll-free bridging" is used to describe CF  
objects that have real NS equivalents, functionally.  In fact, all CF  
objects are bridged, in a functional sense - just that by default  
they're bridged to essentially NSObject so all you get is the basic  
NSObject functionality.


So my previous answer was actually right, just not helpful. :D

The documentation could be clearer, yes.  I just filed a bug report  
myself, which I know isn't the first, but if you do encounter places  
in the documentation which talk about toll-free bridging and are  
ambiguous or seemingly contrary to this, please file bug reports for  
those specifically.


Wade
___

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

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

2008-07-09 Thread thomas goossens

Hi Ian,

On Jul 10, 2008, at 1:07 AM, Ian wrote:

The grouping feature of IKImageBrowserView seems to be one of the  
least documented but most powerful features I've seen in a while.
The only references I can find to using groups with  
IKImageBrowserView all point back to the scant info in the API docs.


Anyway, after getting it working with minimal effort, I wondered if  
it was possible to nest groups within each other?


It is possible to add one or more bezel groups inside a disclosure  
group. But you can't have groups inside a bezel group or disclosure  
groups inside a group.


The obvious example use would be to have IKGroupBezelStyle groups of  
"versions" of images (a la Aperture) inside IKGroupDisclosureStyle  
groups of "rolls" (a la iPhoto).


That should work.

Judging by the silence on Google and the list archives I'm not  
expecting a flood of answers but if the people responsible for this  
cool IKImageBrowserView behavior are listening then at least this  
post will serve to let them know someone is using and appreciating  
their good work!


thanks :)
--Thomas.


Cheers
Ian

___

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

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

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

2008-07-09 Thread Ian

On 10 Jul 2008, at 00:49, thomas goossens wrote:


Hi Ian,

On Jul 10, 2008, at 1:07 AM, Ian wrote:

The grouping feature of IKImageBrowserView seems to be one of the  
least documented but most powerful features I've seen in a while.





It is possible to add one or more bezel groups inside a disclosure  
group. But you can't have groups inside a bezel group or disclosure  
groups inside a group.




OK, my first thought was "rhhhtt, but how?".
Then it occurred to me - overlapping ranges!
Works perfectly.
I suppose it just took someone to say it was possible before I tried  
it myself. Shame on me.

Mind you - there wasn't exactly a lot to go on ;-)

Thanks a lot thomas, this is sweet stuff.

Cheers
Ian

___

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

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

2008-07-09 Thread Brett Powley

On 10/07/2008, at 9:42 AM, Kiel Gillard wrote:

Is there some way to provide a colour for the NSMenuItem's  
attributedTitle
when the item is selected or disabled? For example, is there some  
key I can



You could draw it yourself -- in 10.5 at least you can call setView on  
the NSMenuItem:



Discussion
A menu item with a view does not draw its title, state, font, or  
other standard drawing attributes, and assigns drawing  
responsibility entirely to the view. Keyboard equivalents and type- 
select continue to use the key equivalent and title as normal. For  
more details, see Application Menu and Pop-up List Programming  
Topics for Cocoa.





Cheers,
Brett
___

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

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

2008-07-09 Thread Peter Ammon


On Jul 9, 2008, at 4:42 PM, Kiel Gillard wrote:


Hi all,
I have a menu of items whose titles are attributed strings. I have  
specified

custom colours for parts of those strings. The documentation reads:

If you do not set a text color for the attributed string, it is  
black when
not selected, white when selected, and gray when disabled. Colored  
text

remains unchanged when selected.

Is there some way to provide a colour for the NSMenuItem's  
attributedTitle
when the item is selected or disabled? For example, is there some  
key I can
set in an attributes dictionary that allows me to specify a colour  
to use
when either of these cases occurs? Have I overlooked or missed  
something in

the documentation?


There's no built in way to do this.  One way would be to use the  
delegate method menu:willHighlightItem: to change the attributed title  
when the item is highlighted or unhighlighted.


However, there's no guarantee that the menu item highlight color will  
be stable across OS releases.  What looks good today may not look good  
on a future OS version.  For that reason, most developers let the  
frameworks take responsibility for inverting menu item titles, and  
just live with the fact that colored portions do not invert.


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


Crying Over CoreAnimation Center Rotation Math

2008-07-09 Thread Chilton Webb
Hi,

I have an NSView subclass. I rotated it with -setFrameCenterRotation, and that 
works just fine. 

But now I want to scale it down 50%. If I use NSInsetRect() to shrink it, it 
flies off in a random direction. 

Worse, if I set another view to that view, or use the frame of the rotated view 
for checking intersection with another rectangle, it's always somewhere weird.

I get it though, I realize that this is the same as rotating off the 0,0 
corner. So how do I correctly establish the boundaries of the rotated object?


Thank you,
-Chilton Webb



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTableView prematurely posts selection changed notification

2008-07-09 Thread Graham Cox
When my app starts up, it opens a floating window containing a table  
view. As the table is brought to life from the Nib, it posts a  
"selection changed" notification to its delegate. At that time it  
hasn't had its data initialised from the data model so the selected  
row is 0. This causes an undesirable change to the data model.


Here's the stack trace of the table initialisation.

#0	0x00014cbd in -[GCLayersPaletteController  
tableViewSelectionDidChange:] at GCLayersPaletteController.m:93

#1  0x94a5254a in _nsnote_callback
#2  0x90e14aba in __CFXNotificationPost
#3  0x90e14d93 in _CFXNotificationPostNotification
#4	0x94a4f7b0 in -[NSNotificationCenter  
postNotificationName:object:userInfo:]

#5  0x94a58ff8 in -[NSNotificationCenter postNotificationName:object:]
#6  0x9363e4f1 in -[NSTableView _enableSelectionPostingAndPost]
#7  0x9363dc17 in -[NSTableView _tileAndRedisplayAll]
#8  0x9363d8c8 in -[NSTableView setDataSource:]
#9  0x93550c0c in -[NSNibOutletConnector establishConnection]
#10	0x93530aa4 in -[NSIBObjectData  
nibInstantiateWithOwner:topLevelObjects:]

#11 0x93526e12 in loadNib
#12	0x93526774 in +[NSBundle(NSNibLoading)  
_loadNibFile:nameTable:withZone:ownerBundle:]
#13	0x935263b7 in +[NSBundle(NSNibLoading)  
loadNibFile:externalNameTable:withZone:]

#14 0x935666b5 in -[NSWindowController loadWindow]
#15 0x9356644e in -[NSWindowController window]
#16 0x93566376 in -[NSWindowController showWindow:]
#17	0x0023ece4 in -[DKDrawkitInspectorBase showWindow:] at  
DKDrawkitInspectorBase.m:164
#18	0x358b in -[GCDrawKitAppDelegate showLayersPalette:] at  
GCDrawKitAppDelegate.m:51
#19	0x3c48 in -[GCDrawKitAppDelegate  
applicationDidFinishLaunching:] at GCDrawKitAppDelegate.m:188



This seems to be a race condition - before the table is ready I can't  
populate it and set the correct row to match my data model, but  
because of this notification the data model gets prematurely changed  
to an incorrect row.


I can't see why it sends this notification at this point - anyone care  
to explain? Anyway, how can I stop it?


cheers, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] How to highlighted text remained as highlighted?

2008-07-09 Thread JongAm Park

Oh.. I see. Thank you for the information.

On Jul 9, 2008, at 4:14 PM, Douglas Davidson wrote:



On Jul 9, 2008, at 4:07 PM, JongAm Park wrote:

With the Safari, when users search some text in a HTML document,  
the found text is remained highlighted until they click "Done"  
button.
I tried using the showFindIndicatorForRage for NSTextView, but the  
yellow highlight just disappears after it blinks.

Is there any way to leave it highlighted?


There is no support for Safari-style highlighting.  Various forms of  
highlighting were considered, and the one implemented is the one  
considered to be appropriate for most NSTextView usage.


Douglas Davidson



___

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

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

2008-07-09 Thread Chris Idou

I came up with the code below to set the color label. Questions:

1) Is it really necessary to do a FSGetCatalogInfo first? I presume it is 
because otherwise the FSSetCatalogInfo wouldn't know what fields of 
catalogInfo.finderInfo it is supposed to be updating, or even what bits of 
catalogInfo.fileInfo->finderFlags.

2) I'm casting finderInfo to a (FileInfo *). But from the header files it also 
mentions the FolderInfo structure in conjunction with the finderInfo member. 
From my looking at FileInfo and FolderInfo it appears as if the finderFlags are 
at different offsets in the structures. Am I supposed to check if it is a 
directory and cast it to one or the other depending on the result?

I'm confused!


int c = 7; // Orange
FSRef ref;
if (FSPathMakeRef((UInt8 *)[[path UTF8String], &ref, nil) < 0) {
return NO;
}
FSCatalogInfo catalogInfo;
FileInfo *fileInfo = (FileInfo *)catalogInfo.finderInfo;

FSGetCatalogInfo(&ref, kFSCatInfoFinderInfo, &catalogInfo, nil, nil nil);

fileInfo->finderFlags &= ~kColor;
fileInfo->finderFlags |= (c << 1)

if (FSSetCatalogInfo(ref, kFSCatInfoFinderInfo, &catalogInfo) < 0) {
   return NO;
}




  
___

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

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

2008-07-09 Thread John Terranova
Did you try the levelForItem:, or frameOfCellAtColumn:row:, or both?   
Did they both have the same results?  More information on what you  
have tried and what the results were would make it easier to help you.


You haven't turned off [NSOutlineView indentationMarkerFollowsCell],  
have you?  Is "Indentation Follows Cell" checked in Interface  
Builder?  Add a couple well-placed  
NSLog(@"indentationMarkerFollowsCell: %d", [outlineView  
indentationMarkerFollowsCell]) statements and make sure it always  
reports 1.


john

On Jul 8, 2008, at 10:47 PM, Aman Alam wrote:

I tried the same code earlier. This will indent the text displaying  
in cell but the disclosure button still at its old place.
In normal case, when there is child item in NSOutlineView then the  
button gets indented. But in my case the button doesn't get indent.


The most likely solution, off the top of my head, would involve  
subclassing the NSOutlineView and overriding some method to tell  
Cocoa  to indent some rows more than others.


Here is one possibility.  I don't know that it works, but it  
might.   Try it and see.


// you would need to subclass NSOutlineView, if you haven't  
already  and override this method

- (NSInteger)levelForItem:(id)item
{
NSInteger level = [super levelForItem:item];
if ([item needsExtraIndenting] == YES) // whatever your test is here
level++;

return level;
}

Another possibility would involve overriding something else, maybe   
like this:


- (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row
{
NSRect rc = [super frameOfCellAtColumn:column row:row];

if ([[self itemAtRow:row] needsExtraIndenting] == YES) // whatever   
your test is here

{
CGFloat indent = [self indentationPerLevel];
rc.origin.x += indent;
rc.size.width -= indent;
}
return rc;
}

Again, I don't know that this works, but this is the type of  
solution  I would look for first.  Look through NSOutlineView.h  
and  NSTableView.h for interesting methods that you can override  
and  customize.  That's what I did to find these two.


john

On Jul 8, 2008, at 3:48 AM, Aman Alam wrote:

Is there a way to indent main headings in NSOutlineView as  
follows: -





Heading 1


  Item

  Item


Heading 2


  Item


Heading 2.1


  Item

  Item


Heading 3


  Item



I tried many ways to indent the headings but not succeeded. The  
disclosure triangle doesn't indent with headings. I required  
heading within heading and the heading should be independent of  
its parent heading. The parent heading may contain any number of  
items within.

___

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

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

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

This email sent to [EMAIL PROTECTED]


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus  
Database: 270.4.7/1541 - Release Date: 7/8/2008 7:50 PM







___

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

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

2008-07-09 Thread Aman Alam

The indentationMarkerFollowsCell is always reports one.
I also try to indent disclosure button by setting  setIndentationPerLevel in 
drawRow: rowIndex clipRect:clipRect  method. It shows the button indented 
but the problem arises while clicking on it. It doesn't receive click 
properly.
When we click the button on its current place it doesn't response but if we 
click on its older place then it responds.


Is there any mistake in code or the button needs separate handling?

Did you try the levelForItem:, or frameOfCellAtColumn:row:, or both?   Did 
they both have the same results?  More information on what you  have tried 
and what the results were would make it easier to help you.


You haven't turned off [NSOutlineView indentationMarkerFollowsCell],  have 
you?  Is "Indentation Follows Cell" checked in Interface  Builder?  Add a 
couple well-placed  NSLog(@"indentationMarkerFollowsCell: %d", 
[outlineView  indentationMarkerFollowsCell]) statements and make sure it 
always  reports 1.


john

On Jul 8, 2008, at 10:47 PM, Aman Alam wrote:

I tried the same code earlier. This will indent the text displaying  in 
cell but the disclosure button still at its old place.
In normal case, when there is child item in NSOutlineView then the 
button gets indented. But in my case the button doesn't get indent.


The most likely solution, off the top of my head, would involve 
subclassing the NSOutlineView and overriding some method to tell  Cocoa 
to indent some rows more than others.


Here is one possibility.  I don't know that it works, but it  might. 
Try it and see.


// you would need to subclass NSOutlineView, if you haven't  already 
and override this method

- (NSInteger)levelForItem:(id)item
{
NSInteger level = [super levelForItem:item];
if ([item needsExtraIndenting] == YES) // whatever your test is here
level++;

return level;
}

Another possibility would involve overriding something else, maybe 
like this:


- (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row
{
NSRect rc = [super frameOfCellAtColumn:column row:row];

if ([[self itemAtRow:row] needsExtraIndenting] == YES) // whatever 
your test is here

{
CGFloat indent = [self indentationPerLevel];
rc.origin.x += indent;
rc.size.width -= indent;
}
return rc;
}

Again, I don't know that this works, but this is the type of  solution 
I would look for first.  Look through NSOutlineView.h  and 
NSTableView.h for interesting methods that you can override  and 
customize.  That's what I did to find these two.


john

On Jul 8, 2008, at 3:48 AM, Aman Alam wrote:


Is there a way to indent main headings in NSOutlineView as  follows: -




Heading 1


  Item

  Item


Heading 2


  Item


Heading 2.1


  Item

  Item


Heading 3


  Item



I tried many ways to indent the headings but not succeeded. The 
disclosure triangle doesn't indent with headings. I required  heading 
within heading and the heading should be independent of  its parent 
heading. The parent heading may contain any number of  items within.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Making a text cell in a table editable

2008-07-09 Thread Vitaly Ovchinnikov
I replaced my code with this one:

MyObject *p = [[MyObject alloc] init];
[arrayController addObject:p];
[p release];
[grid editColumn:0 row:[grid selectedRow] withEvent:nil selected:YES];

it works fine, NSTableView selects new row, -editColumn receives
correct row number and starts editing. So, the question is: why do I
need to call -rearrangeObjects? In what cases missing of this call
will lead to problems?

On Thu, Jul 10, 2008 at 12:49 AM, I. Savant <[EMAIL PROTECTED]> wrote:
>>  Same goes for -add: ... You'll need to force the array controller to
>> -rearrangeObjects before asking the tableView to reload. If you're
>> using Core Data, you'll probably also need to force a -fetch: before
>> calling -rearrangeObjects, though I don't know for sure.
>>
>>  This forces the array controller to do its thing right then and
>> there. Of course short-circuiting the mechanism like that can cause
>> validation problems, so be careful ...
>
>  Sorry! I'm not thinking straight ... you will need to directly use
> the -addObject: and -insertObject:atArrangedObjectIndex: methods
> rather than -insert: or -add: for the above to work. This takes affect
> immediately (but must still be rearranged via -rearrangeObjects).
>
>   Also, you need to use the index of the newly-inserted object in the
> array controller's -arrangedObjects array, not its contents (so you
> get the correct row to edit in the table).
>
> --
> I.S.
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Setting the color label

2008-07-09 Thread Adam R. Maxwell


On Jul 9, 2008, at 10:07 PM, Chris Idou wrote:



I came up with the code below to set the color label. Questions:

1) Is it really necessary to do a FSGetCatalogInfo first? I presume  
it is because otherwise the FSSetCatalogInfo wouldn't know what  
fields of catalogInfo.finderInfo it is supposed to be updating, or  
even what bits of catalogInfo.fileInfo->finderFlags.


I believe that's correct.

2) I'm casting finderInfo to a (FileInfo *). But from the header  
files it also mentions the FolderInfo structure in conjunction with  
the finderInfo member. From my looking at FileInfo and FolderInfo it  
appears as if the finderFlags are at different offsets in the  
structures. Am I supposed to check if it is a directory and cast it  
to one or the other depending on the result?


I think they're actually at the same offset; the Rect in FolderInfo  
has 4 short members (8 bytes), which should be the same size as the  
two OSType members in FinderInfo (4 bytes each).  In spite of that, I  
cast appropriately so I can see what's going on.  It's too late for me  
to think clearly, so I'll just point you to my own code for getting/ 
setting labels:  http://code.google.com/p/fileview/source/browse/trunk/fileview/FVFinderLabel.m 
 (BSD license).


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

  1   2   >