dataWithPDFInsideRect doesn't clip

2008-04-18 Thread Lorenzo
I rotate a NSView with setFrameCenterRotation. It looks perfect on the
screen. Then I call [superview dataWithPDFInsideRect:[superview bounds]];

On the pdf, the view is properly rotated but it looks larger than the real
one. It seems that dataWithPDFInsideRect didn't clip the view.
What should I do to print my superview as WYSYWYG?



Best Regards
-- 
Lorenzo
email: [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: Using STL strings and supporting 10.2.x

2008-04-18 Thread Sherm Pendley
On Fri, Apr 18, 2008 at 5:16 PM, Mark Thomas <[EMAIL PROTECTED]> wrote:

> >
> >> Hi All,
> >>  Does anybody know how to stop the STL string class including any
> unicode
> >> support, as we are compiling a .dylib with Xcode 2.2.1 on 10.4, but
> when
> >> the
> >> library loads on a 10.2 system we are getting linker errors because of
> the
> >> lack of wchar support on 10.2.x.
> >
> >
> > What are the errors? And, what compiler version are you using? Binaries
> > built with g++ 4 require 10.3.9 or newer; to support 10.2, you must use
> g++
> > 3.3 instead, as documented here:
> >
> > <
> >
> http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_devel
> > opment/HowItWorks/chapter_2_section_9.html
> >>
>   Yes I am using gcc 3.3, which is setting via GCC_VERSION_ppc flag within
> the Xcode project (universal settings), which builds fine. There are no
> problems building the .dylib because I'm using a 10.4.x system, I have set
> the deploy target to 10.2, but that seems only to matter for frameworks
> not
> system libs.
>
>  I'm getting undefined symbols for
>
> U _wcscoll
> U _wcsftime
> U _wcslen
> U _wcsrtombs
> U _wcsxfrm
> U _wctob
> U _wctype
>
>  which I understand aren't present on 10.2.x, when the .dylib tries to
> load.


Have you tried using STLport instead of g++'s own STL? I haven't went down
that path yet, so I can't say how much pain is entailed in using STLport. It
may, however, give you working wstrings on 10.2.



You could use the macros from Availability.h to conditionally create your
own string type that's typedef'd as whichever of string or wstring is
appropriate for the current SDK and deployment target.

Can your app use any features that are only found in 10.3 or newer, such as
Bonjour, aka The Service Formerly Known as Rendezvous? If not, you could set
SDKROOT_ppc to point to the 10.3 SDK. This would limit the options available
to your app, but it wouldn't require any code changes.

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: running out of NSPipes

2008-04-18 Thread justin webster

I'm pretty sure I've got all objects alloc'd and released correctly.
this example is the broken one:

- (NSString *)myShellFunction:(NSString *)PID
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSTask *ps=[[NSTask alloc] init];
   //NSPipe *pipe=[NSPipe pipe];
NSPipe *pipe=[[NSPipe alloc] init];
NSFileHandle *handle;
NSString *string;

[ps setLaunchPath:@"/bin/ps"];
		[ps setArguments:[NSArray arrayWithObjects:@"-p", PID, @"-o" ,  
@"pcpu", nil]];

[ps setStandardOutput:pipe];
handle=[pipe fileHandleForReading];
[ps launch];
		string = [[NSString alloc] initWithData:[handle  
readDataToEndOfFile] encoding:NSASCIIStringEncoding];


[ps waitUntilExit];
[ps release];
[pipe release];
[string release];   
[pool release];

return string;
}


On 19/04/2008, at 2:21 PM, justin webster wrote:


I guess it may be a bug.
I achieved more or less the same thing bypassing NSTask and NSPipe  
and now have no issues with resource management.
the trick, I think, was fflush() and pclose(). perhaps NSPipe is  
missing some tidy-up code.
there probably are more efficient ways of doing this but efficiency  
is not really a concern in my case.


for the record - here's an example which works:
int f;
for(f=0; f<5000; f++){
fflush(nil);
FILE *rtn = popen([@"ls" cString], [@"r" cString]);
//here we use the output of the pipe
pclose(rtn);
}

thanks for the help
justin

On 19/04/2008, at 12:15 PM, Ken Thomases wrote:


On Apr 18, 2008, at 6:05 PM, justin webster wrote:
I'm pretty sure I've got everything alloc'ing and releasing in  
the right way


I agree.  It all looks correct.  It may very well be a bug in the  
framework.


One last thing to check: does some part of your code register for  
the NSTaskDidTerminateNotification notification, presumably  
without specifying a task object, but listening for all of them?   
If so, might it be retaining the notification object which is the  
task object?


If there's no other explanation, I recommend that you file a bug  
at bugreport.apple.com.



That said, to accomplish what you need I recommend that you use  
sysctl(3) to get the information from the system directly without  
launching the ps process.  Here's some code from Apple that you  
can adapt: http://developer.apple.com/qa/qa2001/qa1123.html


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: Hand style movement inside a NSScrollView

2008-04-18 Thread Ben Lachman

On Apr 19, 2008, at 12:41 AM, Jens Alfke wrote:



On 18 Apr '08, at 8:59 PM, Ben Lachman wrote:

I tend to like scrollRect:by: for this sort of thing since it  
takes a offset to a rect.


But that method just blits pixels around on the screen; it doesn't  
actually change the coordinate system of the view. The scroll view  
will do the blitting for you automatically when you change its  
coordinates via -scrollPoint:.




Looks like I misread Steve's question.  Jens is right of course.  In  
light of rereading the OP correctly though, I think using


[view scrollRectToVisible:NSOffsetRect([view visibleRect], offsetX,  
offsetY)];


might work and would make more sense (at least to me) when going back  
to the code in a 6 months.


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Modal popup from command line tool or daemon?

2008-04-18 Thread Rod Cater
I think the CFUserNotification API is exactly what I'm looking for,  
although I'm not pleased with daemons requiring user interaction in  
the first place. An earlier reply suggested Growl which I'm thinking  
is better suited for what I'm doing. Combined with a simple  
preference pane for setting configuration and a CFUserNotification  
object for alerts, this should keep user interactions to a minimum.


Thanks for the responses!

Rod

On 18-Apr-08, at 9:04 PM, Jens Alfke wrote:



On 18 Apr '08, at 1:21 PM, David Wilson wrote:


A command line tool or a true background daemon can't really pull it
off- the process wouldn't have a connection to the window server to
actually do any of that.


A command-line tool, invoked from a logged-in user account, can use  
a GUI if it's linked against the appropriate libraries (like  
AppKit). As a trivial example, you can launch a regular Cocoa app  
from a shell by just running its binary directly.


But this usually isn't a good idea for something that's primarily  
meant as a daemon or tool. A better way to do simple alert-style  
interaction is to use the API in CFUserNotification.h. This doesn't  
require you to link against anything higher-level than  
CoreFoundation. The downside is that it's kind of messy to use for  
anything beyond a simple "message and OK button" alert; but I think  
there is sample code with examples.


—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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Hand style movement inside a NSScrollView

2008-04-18 Thread Jens Alfke


On 18 Apr '08, at 8:59 PM, Ben Lachman wrote:

I tend to like scrollRect:by: for this sort of thing since it takes  
a offset to a rect.


But that method just blits pixels around on the screen; it doesn't  
actually change the coordinate system of the view. The scroll view  
will do the blitting for you automatically when you change its  
coordinates via -scrollPoint:.


—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: running out of NSPipes

2008-04-18 Thread Jens Alfke


On 18 Apr '08, at 7:21 PM, justin webster wrote:

the trick, I think, was fflush() and pclose(). perhaps NSPipe is  
missing some tidy-up code.


I don't think so; more likely the NSPipe instances weren't being  
released at the end of each loop iteration.



FILE *rtn = popen([@"ls" cString], [@"r" cString]);


popen can be dangerous, since you're giving it a bash command line. If  
you're not very careful about quoting metacharacters like spaces and  
asterisks, the arguments can get misinterpreted, causing various  
problems. (One particular version of Apple's iTunes installer had a  
bug like this, which caused several people's entire hard disks to be  
erased because they had spaces in their names.)


execv is much safer since it takes an argument list, and runs the tool  
directly instead of invoking a shell, so there is no quoting going on.  
You have to call fork first, though, to actually spawn a new process.


Or you could keep using NSTask and just wrap your loop in an  
autorelease pool, as people suggested.


—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: Simulating menu bar blink in Cocoa

2008-04-18 Thread Benjamin Stiglitz
As previously explained here, I'm handling hotkeys in my app via  
custom code in order to work around some AppKit bugs.


How can I simulate the menu-title blink effect using Cocoa? In  
Carbon, it's FlashMenuBar(menuID) but I don't see a Cocoa equivalent.


What’s the actual bug? Maybe there is a simpler workaround.

-Ben___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Hand style movement inside a NSScrollView

2008-04-18 Thread Ben Lachman

On Apr 18, 2008, at 9:14 PM, Jens Alfke wrote:



On 18 Apr '08, at 12:49 PM, Steve Sheets wrote:

However, I also want to implement a "Hand" style tool. One that  
allows the user to simple click inside the Scroll View and draw  
the graphics around.


I think you just need to have your view's mouseDragged: handler  
method call -scrollPoint: on self. The only tricky bit is figuring  
out what point (in your view's coords) should become the origin of  
its visible bounds.




I tend to like scrollRect:by: for this sort of thing since it takes a  
offset to a rect.

--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: editing in a custom NSView

2008-04-18 Thread Torsten Curdt


On Apr 19, 2008, at 03:12, Jens Alfke wrote:


On 18 Apr '08, at 4:32 PM, Torsten Curdt wrote:

So I already got a custom view that is manually bound to  
NSArrayController and draws the objects. Now I need to make one of  
the object's string attributes editable. How to do that best?


I assume I could catch the click on the item, then (somehow) show  
in place a NSTextView and have the user do the changes to the text.  
On every change I would check the height of the NSTextView and  
apply that to the drawing of the item. Once done I'll hide the  
NSTextView again. Does that sound like reasonable approach? Or how  
would you tackle this?


I'd implement your view as a container of NSTextField views.


Now that I just found out that NSTableView *does* support different  
row heights the question comes up: is it easier to write such a custom  
view or subclass and tweak NSTableView.


Listen for control-text-changed notifications from the subviews, and  
when you get one, check the view's field-editor* to see how high its  
content is, and update the view's size accordingly (which means  
moving other views up or down.)


*Controls with editable text don't do their own text editing.  
Instead they swap in a single NSTextView, called the field editor,  
that's usually shared between all controls in a window. So while the  
user's editing in a text field, you have to look at the field's  
currentEditor to get information about the text editing state.


Ah, I see ...that was basically what I was thinking to implement for  
that view as well. But how would I swap in such a NSTextView in my  
custom NSView?


cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


controls in a NSTableCell (was Re: editing in a custom NSView)

2008-04-18 Thread Torsten Curdt
Bizarre ...remember I read it somewhere. Well, fair enough. Now got my  
NSTableView with different row heights working. But how do I get other  
edit controls in there? Is this the only way to stick a NSView in  
there? http://www.stepwise.com/Articles/Technical/2003-12-20.01.html


Essentially I would want to edit a string, a checkbox/boolean, a date  
and use a proper layout ...not just have them in columns


cheers
--
Torsten

On Apr 19, 2008, at 02:01, Mike Manzano wrote:

NSTableView:

tableView:heightOfRow:
Returns the height of row in tableView.

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow: 
(NSInteger)row


Discussion
You should implement this method if your table supports varying row  
heights. The height returned should not include intercell spacing  
and must be greater than zero.


Although table views may cache the returned values, you should  
ensure that this method is efficient. When you change a row's height  
you must invalidate the existing row height by calling  
noteHeightOfRowsWithIndexesChanged:. NSTableView automatically  
invalidates its entire row height cache when reloadData and  
noteNumberOfRowsChanged are called.


Availability
• Available in Mac OS X v10.4 and later.
Declared InNSTableView.h


On Apr 18, 2008, at 4:32 PM, Torsten Curdt wrote:

Hey guys,

I need some pointers into the right direction.

I would like to create a view that display a list of objects with  
their attributes. Of course NSTableView could do that. But I would  
like the rows to expand vertically when I add more information to  
the object ...and have the attributes not just layed out in column  
based manner. The most simple example: a list of multi line edit  
fields. Example: OmniOutliner - press alt-enter and the line height  
increases. AFAIK you cannot do that with either NSTableView or  
NSCollectionView as the row heights may be different per row.


So I already got a custom view that is manually bound to  
NSArrayController and draws the objects. Now I need to make one of  
the object's string attributes editable. How to do that best?


I assume I could catch the click on the item, then (somehow) show  
in place a NSTextView and have the user do the changes to the text.  
On every change I would check the height of the NSTextView and  
apply that to the drawing of the item. Once done I'll hide the  
NSTextView again. Does that sound like reasonable approach? Or how  
would you tackle this?


Any suggested example or open source project to look at?

cheers
--
Torsten
__


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [SOLVED] Simulating menu bar blink in Cocoa

2008-04-18 Thread Martin Wierschin
The "fake temporary item" solution actually works pretty well.  
It's the last thing I'd call elegant, but here's how you can blink  
a menu title in Cocoa.


Unfortunately that solution (and any of the other horrible  
strategies available) trigger VoiceOver for the menu item. Anyone  
know a way to activate that for the folks using Accessibility options?


Oops, I meant to say these solutions _do not_ trigger VoiceOver.

~Martin

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: running out of NSPipes

2008-04-18 Thread justin webster

I guess it may be a bug.
I achieved more or less the same thing bypassing NSTask and NSPipe  
and now have no issues with resource management.
the trick, I think, was fflush() and pclose(). perhaps NSPipe is  
missing some tidy-up code.
there probably are more efficient ways of doing this but efficiency  
is not really a concern in my case.


for the record - here's an example which works:
int f;
for(f=0; f<5000; f++){
fflush(nil);
FILE *rtn = popen([@"ls" cString], [@"r" cString]);
//here we use the output of the pipe
pclose(rtn);
}

thanks for the help
justin

On 19/04/2008, at 12:15 PM, Ken Thomases wrote:


On Apr 18, 2008, at 6:05 PM, justin webster wrote:
I'm pretty sure I've got everything alloc'ing and releasing in the  
right way


I agree.  It all looks correct.  It may very well be a bug in the  
framework.


One last thing to check: does some part of your code register for  
the NSTaskDidTerminateNotification notification, presumably without  
specifying a task object, but listening for all of them?  If so,  
might it be retaining the notification object which is the task  
object?


If there's no other explanation, I recommend that you file a bug at  
bugreport.apple.com.



That said, to accomplish what you need I recommend that you use  
sysctl(3) to get the information from the system directly without  
launching the ps process.  Here's some code from Apple that you can  
adapt: http://developer.apple.com/qa/qa2001/qa1123.html


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: [SOLVED] Simulating menu bar blink in Cocoa

2008-04-18 Thread Martin Wierschin
The "fake temporary item" solution actually works pretty well. It's  
the last thing I'd call elegant, but here's how you can blink a  
menu title in Cocoa.


Unfortunately that solution (and any of the other horrible strategies  
available) trigger VoiceOver for the menu item. Anyone know a way to  
activate that for the folks using Accessibility options?


~Martin

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting an array/tree controller to select newly added managed objects

2008-04-18 Thread Ron Lue-Sang


On Apr 18, 2008, at 2:54 PM, Sean McBride wrote:


Hi all,

Consider an app that uses bindings and Core Data.  It has a tableview
bound to an array controller.  There is an 'Add' button that creates a
new entity to be shown in the table.  It could be implemented by:

1) sending add: to the array controller.
2) using a custom IBAction method that creates a new entity and adds  
it

to the managed object context.

#1 is nice because the array controller will automatically select the
newly added object (if selectsInsertedObjects is YES).  However, I  
find
myself often needing to use method #2 because I must supply some  
initial
data to create the new entity.  In that case, the array controller  
sees

the new entity but does not select it.

What is the "right" way to get it selected?  Should I just pass the  
new

NSManagedObject up to my view-controller and call
[theArrayController:setSelectedObjects:[NSArray
arrayWithObject:newManagedObject]]?  If so, how do I do it in the tree
controller case?  There is no setSelectedObjects:.



Subclass the controller and override newObject: - declared in  
NSObjectController.h







Thanks,

--

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

___

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

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

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

This email sent to [EMAIL PROTECTED]



-
RONZILLA




___

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

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

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

This email sent to [EMAIL PROTECTED]


"setTextColor:range:" text coloring problem

2008-04-18 Thread tyler durden
Hi Everybody,

i am writing an easy chat application. i have an object of NSTextview on my UI 
form. i want to change the text color in a specified range from default color 
black to red. i used the method "setTextColor:range:" but it did not work. 
following is my declaration of the object and the corresponding code. 

More specifically, the code below is supposed to change color of a certain 
range of characters (in the following case, between 1st and the 6th chars) but 
it doesn't really work. it either changes the color of the whole text to red 
when i start from zero or it doesn't make any changes if i start from 1.


Any suggestions ? 

IBOutlet NSTextView* _view; 

[((_view) setTextColor:[NSColor redColor] range: NSMakeRange(1,5)]; 




  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Hand style movement inside a NSScrollView

2008-04-18 Thread Jens Alfke


On 18 Apr '08, at 12:49 PM, Steve Sheets wrote:

However, I also want to implement a "Hand" style tool. One that  
allows the user to simple click inside the Scroll View and draw the  
graphics around.


I think you just need to have your view's mouseDragged: handler method  
call -scrollPoint: on self. The only tricky bit is figuring out what  
point (in your view's coords) should become the origin of its visible  
bounds.


—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: editing in a custom NSView

2008-04-18 Thread Jens Alfke


On 18 Apr '08, at 4:32 PM, Torsten Curdt wrote:

So I already got a custom view that is manually bound to  
NSArrayController and draws the objects. Now I need to make one of  
the object's string attributes editable. How to do that best?


I assume I could catch the click on the item, then (somehow) show in  
place a NSTextView and have the user do the changes to the text. On  
every change I would check the height of the NSTextView and apply  
that to the drawing of the item. Once done I'll hide the NSTextView  
again. Does that sound like reasonable approach? Or how would you  
tackle this?


I'd implement your view as a container of NSTextField views. Listen  
for control-text-changed notifications from the subviews, and when you  
get one, check the view's field-editor* to see how high its content  
is, and update the view's size accordingly (which means moving other  
views up or down.)


*Controls with editable text don't do their own text editing. Instead  
they swap in a single NSTextView, called the field editor, that's  
usually shared between all controls in a window. So while the user's  
editing in a text field, you have to look at the field's currentEditor  
to get information about the text editing state.


—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: Modal popup from command line tool or daemon?

2008-04-18 Thread Jens Alfke


On 18 Apr '08, at 1:21 PM, David Wilson wrote:


A command line tool or a true background daemon can't really pull it
off- the process wouldn't have a connection to the window server to
actually do any of that.


A command-line tool, invoked from a logged-in user account, can use a  
GUI if it's linked against the appropriate libraries (like AppKit). As  
a trivial example, you can launch a regular Cocoa app from a shell by  
just running its binary directly.


But this usually isn't a good idea for something that's primarily  
meant as a daemon or tool. A better way to do simple alert-style  
interaction is to use the API in CFUserNotification.h. This doesn't  
require you to link against anything higher-level than CoreFoundation.  
The downside is that it's kind of messy to use for anything beyond a  
simple "message and OK button" alert; but I think there is sample code  
with examples.


—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: Hand style movement inside a NSScrollView

2008-04-18 Thread Jamie Phelps
Not sure if it's suitable for your purposes, but IKImageView and its  
currentToolMode property (IKToolModeMove). This would get you the  
behavior you want for free.


JP

On Apr 18, 2008, at 2:49 PM, Steve Sheets wrote:


Does someone have any suggestions or hints about how to do this?

I am using NSScrollView to display some graphical data. The Scroll  
View displays a section of  my custom view which displays the  
graphics. The user can drag the horizontal and vertical scrollers to  
change the visible position inside the graphics. It function the way  
you would expect any graphic program to work.


Depending on the current selected too, when the user clicks in the  
scroll view on my custom view and drags, if the drag goes outside  
the view area, the scrolled automatically scrolls to show more area.  
I called setScrollsDynamically:TRUE for my scroll view, and the  
object handles this automatically (Thank you Apple).  Again, it is  
what you expect from a well behaved draw program.


However, I also want to implement a "Hand" style tool. One that  
allows the user to simple click inside the Scroll View and draw the  
graphics around. This function is different then the  
scrollsDynamically flag (which auto scrolls if you go outside the  
view display rectangle).


Does anyone have any suggestions on how to implement? Or better yet,  
some examples? I would have thought this call would be implemented  
by the NSScrollView object (it is more difficult then  
scrollsDynamically), but I can not find any suggestions on how to do  
it.


Thank you,

Steve Sheets
___

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

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

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


Hand style movement inside a NSScrollView

2008-04-18 Thread Steve Sheets

Does someone have any suggestions or hints about how to do this?

I am using NSScrollView to display some graphical data. The Scroll  
View displays a section of  my custom view which displays the  
graphics. The user can drag the horizontal and vertical scrollers to  
change the visible position inside the graphics. It function the way  
you would expect any graphic program to work.


Depending on the current selected too, when the user clicks in the  
scroll view on my custom view and drags, if the drag goes outside the  
view area, the scrolled automatically scrolls to show more area. I  
called setScrollsDynamically:TRUE for my scroll view, and the object  
handles this automatically (Thank you Apple).  Again, it is what you  
expect from a well behaved draw program.


However, I also want to implement a "Hand" style tool. One that allows  
the user to simple click inside the Scroll View and draw the graphics  
around. This function is different then the scrollsDynamically flag  
(which auto scrolls if you go outside the view display rectangle).


Does anyone have any suggestions on how to implement? Or better yet,  
some examples? I would have thought this call would be implemented by  
the NSScrollView object (it is more difficult then  
scrollsDynamically), but I can not find any suggestions on how to do it.


Thank you,

Steve Sheets
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: editing in a custom NSView

2008-04-18 Thread Mike Manzano

NSTableView:

tableView:heightOfRow:
Returns the height of row in tableView.

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row

Discussion
You should implement this method if your table supports varying row  
heights. The height returned should not include intercell spacing and  
must be greater than zero.


Although table views may cache the returned values, you should ensure  
that this method is efficient. When you change a row's height you must  
invalidate the existing row height by calling  
noteHeightOfRowsWithIndexesChanged:. NSTableView automatically  
invalidates its entire row height cache when reloadData and  
noteNumberOfRowsChanged are called.


Availability
Available in Mac OS X v10.4 and later.
Declared In
NSTableView.h


On Apr 18, 2008, at 4:32 PM, Torsten Curdt wrote:


Hey guys,

I need some pointers into the right direction.

I would like to create a view that display a list of objects with  
their attributes. Of course NSTableView could do that. But I would  
like the rows to expand vertically when I add more information to  
the object ...and have the attributes not just layed out in column  
based manner. The most simple example: a list of multi line edit  
fields. Example: OmniOutliner - press alt-enter and the line height  
increases. AFAIK you cannot do that with either NSTableView or  
NSCollectionView as the row heights may be different per row.


So I already got a custom view that is manually bound to  
NSArrayController and draws the objects. Now I need to make one of  
the object's string attributes editable. How to do that best?


I assume I could catch the click on the item, then (somehow) show in  
place a NSTextView and have the user do the changes to the text. On  
every change I would check the height of the NSTextView and apply  
that to the drawing of the item. Once done I'll hide the NSTextView  
again. Does that sound like reasonable approach? Or how would you  
tackle this?


Any suggested example or open source project to look at?

cheers
--
Torsten
__

___

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

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

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

This email sent to [EMAIL PROTECTED]


editing in a custom NSView

2008-04-18 Thread Torsten Curdt

Hey guys,

I need some pointers into the right direction.

I would like to create a view that display a list of objects with  
their attributes. Of course NSTableView could do that. But I would  
like the rows to expand vertically when I add more information to the  
object ...and have the attributes not just layed out in column based  
manner. The most simple example: a list of multi line edit fields.  
Example: OmniOutliner - press alt-enter and the line height increases.  
AFAIK you cannot do that with either NSTableView or NSCollectionView  
as the row heights may be different per row.


So I already got a custom view that is manually bound to  
NSArrayController and draws the objects. Now I need to make one of the  
object's string attributes editable. How to do that best?


I assume I could catch the click on the item, then (somehow) show in  
place a NSTextView and have the user do the changes to the text. On  
every change I would check the height of the NSTextView and apply that  
to the drawing of the item. Once done I'll hide the NSTextView again.  
Does that sound like reasonable approach? Or how would you tackle this?


Any suggested example or open source project to look at?

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Subclassing

2008-04-18 Thread Jack Repenning

On Apr 18, 2008, at 2:56 PM, K. Darcy Otto wrote:

I want to subclass Dependency and override a few things.  Can I do  
this without modifying DeductionLine?


Perhaps you want to create a category instead?  That allows you to add  
methods to Dependency without DeductionLine having to know about it.



-==-
Jack Repenning
[EMAIL PROTECTED]
Project Owner
SCPlugin
http://scplugin.tigris.org
"Subversion for the rest of OS X"


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Subclassing

2008-04-18 Thread Andy Lee


On Apr 18, 2008, at 5:56 PM, K. Darcy Otto wrote:

I am working on a program with a complex hierarchy of classes, and I  
want to subclass one of the objects a few steps down on that  
hierarchy.  Do I have to create a parallel hierarchy to do this?   
Here is the problem:


AppController instantiates a Deduction object.
The Deduction object instantiates a DeductionLine object.
The DeductionLine object instantiates a Dependency object.


When you say "instantiates," I assume you mean each object has the  
next-level object as an instance variable, and the instantiating  
happens in the -init method?  And the problem is that the  
DeductionLine and Dependency classes are hard-coded in the init  
methods that instantiate them?


Assuming I've guessed correctly...

Perhaps you could add an init method in each class that takes an  
instance of the sub-object as an argument.  For example, DeductionLine  
could have this as its new designated initializer:


- (id)initWithDependency:(Dependency *)dependency
{
   if ((self = [super init]))
   {
   _dependency = [dependency retain];
   }

   return self;
}

Then it could override -init to use a plain Dependency as the default:

- (id)init
{
   return [self initWithDependency:[[[Dependency alloc] init]  
autorelease]];

}

You could do a similar -initWithDeductionLine: method for the  
Deduction class.


To create a Deduction that uses an SDependency two levels down, you  
could do:


Dependency *sdep =
   [[[SDependency alloc] init] autorelease];
DeductionLine *dedLine =
   [[[DeductionLine alloc] initWithDependency:sdep] autorelease];
Deduction *ded =
   [[[Deduction alloc] initWithDeductionLine:dedLine] autorelease];


You could simplify things by wrapping some of the above in convenience  
methods that would enable you to do this...


Deduction *ded = [Deduction deductionWithDependency:[SDependency  
dependency]];


...or even this if it's not too implementation-revealing...

Deduction *ded = [Deduction deductionWithSDependency];


Another approach might involve using setter methods like - 
setDependency: etc.  But it sounds like the structure of your code  
requires a DeductionLine to have a valid Dependency instance as soon  
as it is instantiated.


--Andy





I want to subclass Dependency and override a few things.  Can I do  
this without modifying DeductionLine?  As it stands, I think I'm  
going to have to do this:


AppController instantiates a SDeduction object (where SDeduction is  
a subclass of Deduction).
The SDeduction object instantiates a SDeductionLine object (where  
SDeductionLine is a subclass of DeductionLine).
The SDeduction object instantiates a SDependency object (where  
SDependency is a subclass of Dependency).


The only reason to subclass Deduction (with SDeduction) and then  
DeductionLine (with SDeductionLine) is to get an SDependency  
object.  Is there an easier way?  I suppose I could just copy the  
Dependency class files and then modify it for this particular  
project; but I was hoping for a different way.  Thanks.

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aglee%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: Capsule-Style Toolbar Controls

2008-04-18 Thread Peter Ammon
Yes, in Leopard, unified and non-unified windows are the same except  
for some minor differences in the toolbar metrics, which you  
found.  :)  The metric differences were left in for compatibility.


I don't think the HIG has any guidance about when to use one or the  
other on Leopard, so I suppose you can use whichever you think looks  
best for your app.


-Peter

On Apr 18, 2008, at 3:22 PM, Stefan Hafeneger wrote:


Hi Peter,

Thanks for your reply. You are right. Since the WWDC Beta I haven't  
touched the unified checkbox because I thought that there is no  
difference because the design is always unified. I also didn't find  
something in the HIG about that. So when should we activate this  
checkbox? Is the difference just the 2px?


With best wishes, Stefan

Am 18.04.2008 um 23:05 schrieb Peter Ammon:


Thanks Stefan,

From the screenshot, it looks to me like the test app is not using  
the unified title/toolbar metrics, but Mail is.  Try checking the  
unified title/toolbar checkbox in IB.


Your understanding of the NSToolbarItemGroup is correct.  However,  
the view will not be automatically resized to fit the labels.  For  
now, you will have to size the segments manually.


-Peter

On Apr 17, 2008, at 9:25 AM, Stefan Hafeneger wrote:

Hi Peter,

I uploaded two screenshots from Mail (in the background) and a  
demo app (in the foreground) designed just in Interface Builder.  
The size of the segmented control is exactly the same but there is  
a difference in the baseline.


http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar1.png-zip.zip
http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar2.png-zip.zip

Concerning NSToolbarItemGroup: So I create a NSToolbarItemGroup  
and with three "dummy" items and label the three dummy items. Then  
I create a segmented control cell with 3 segments and set it to  
the view of NSToolbarItemGroup. Is this correct? Will the view  
then be automatically resized if the user enables or disables the  
labels?


With best wishes, Stefan

Am 16.04.2008 um 23:29 schrieb Peter Ammon:



On Apr 16, 2008, at 1:27 PM, Stefan Hafeneger wrote:


Hi,

Has anyone tried to use the Capsule-Style Toolbar Controls in an  
app so that it looks and behaves like Mail or Preview? When I  
add them to my toolbar it looks like Mail. But if I compare them  
side by side the ones in Mail and Preview there is a 2 pixel  
difference of the baseline. And I think it looks better in Mail/ 
Preview. When I add a multi-segment control I only have one  
Label (not two or more). In Mail and Preview it looks like there  
are as many labels as segments. You can "fake" this by adding  
blanks. But there is one more point: In Mail and Preview the  
size of the control is adjusted (I think depending on the size  
of the label(s)). Well, in the nib files from Mail and Preview  
there are no toolbars, so Apple builds them via code. So the  
question is: If I code them as well, is it possible to do the  
same that Apple does in Mail and Preview via NSSegmentedCell or  
is this all done by hand?


With best wishes, Stefan


Hi Stefan,

As of Leopard, this is all possible using standard AppKit  
controls, which Mail and Preview both use.


Regarding the two pixel difference in the baseline, this may be  
because the segmented control is too short and so is clipped.   
Try using sizeToFit.  You may also be referring to different  
window metrics; try giving the window a unified title/toolbar to  
see if that gives the appearance you expect.  It shouldn't affect  
the appearance much, but it does subtly change the toolbar  
positioning.  If these don't fix your issue, maybe you can  
provide a screenshot so I understand what you mean.


To have multiple labels in a single toolbar item, make an  
NSToolbarItemGroup, and give it subitems.  If you set a view (but  
not a label) on the Group, the labels of the subitems will be  
arranged under the view.  If the view is a segmented control, the  
labels will be aligned with corresponding segments, assuming  
there's the same number of both. This is what Mail and Preview do.


I hope that's clear,
-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: Subclassing

2008-04-18 Thread j o a r


On Apr 18, 2008, at 2:56 PM, K. Darcy Otto wrote:

The only reason to subclass Deduction (with SDeduction) and then  
DeductionLine (with SDeductionLine) is to get an SDependency  
object.  Is there an easier way?  I suppose I could just copy the  
Dependency class files and then modify it for this particular  
project; but I was hoping for a different way.  Thanks.




I think that what you would typically do is either to add:

"-[DeductionLine initWithDependency:]"

// Where Deduction line doesn't know, or care about, what particular
	// type of object is being passed, as long as it is either a subclass  
of

// Dependency, or it conforms to a specific protocol.

Or something like:

"-[DeductionLine initWithProperty:]"

// Where the caller doesn't know about different Dependency classes,
	// and instead specify some type of configuration / context property,  
to

// which the DeductionLine responds by instantiating an appropriate
// Dependency subclass.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles


Ben Lachman wrote:
> Well, you should be able to just override the drawing code, since 
> thats really your problem.  Going directly against the docs, while it 
> may work fine now, is playing with fire in my opinion.
Yeah… that's why I posted :) I was hoping to get a "oh yeah, that only 
applies if [...], file a radar on the docs" or something.
  
I decided that, no matter what, the docs are definitely not right, 
because they claim that an exception will be thrown even though that 
clearly does not happen. So I filed a radar; we'll see if anything comes 
back.


rdar://5875017   [Docs] -editColumn:row:withEvent:select: needs 
clarification

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles

Ben Lachman wrote:
Well, you should be able to just override the drawing code, since 
thats really your problem.  Going directly against the docs, while it 
may work fine now, is playing with fire in my opinion.
Yeah… that's why I posted :) I was hoping to get a "oh yeah, that only 
applies if [...], file a radar on the docs" or something.


To get the drawing you want, you can just implement 
tableView:willDisplayCell:forTableColumn:row: in the delegate and 
manually switch selection highlighting on or off depending on whether 
the table column passed to you is the selected table column.  
That's a thought. I'll look into that. I already use the delegate method 
for my "selected"-cell coloring.


You'll probably have to have a couple more cases if you're really 
trying to get close to the standard spreadsheet functionality that 
lets you select the full row/column by clicking on the header.  

Fortunately I don't need to worry about that in this case. Not a problem.


But this should get you started, hopefully.

->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Apr 18, 2008, at 1:55 PM, John Stiles wrote:

The docs for -editColumn:row:withEvent:select:  ominously claim:
   The row at rowIndex must be selected prior to calling 
editColumn:row:withEvent:select:, or an exception will be raised.


I'm implementing a subclass of NSTableView which behaves a little 
more like an Excel spreadsheet—it maintains a phony selection by 
overloading -mouseDown/Dragged/Up: and coloring cell backgrounds as 
appropriate. It works great. But it means that the table view, 
internally, never actually considers a row to be "selected." My 
subclass handles that entirely on its own and leaves the table view 
out of it.


Now I'm getting around to implementing the part where the user can 
edit table cells in place, and since I wanted to follow the rules in 
the docs, I started by implementing it like this:


   [myTableView selectRow:inRow byExtendingSelection:NO];
   [myTableView editColumn:inCol row:inRow withEvent:myEvent select:NO];

It worked fine but, of course, the entire row turned blue, ruining 
the spreadsheet illusion.
So just to see what would happen, I tried removing the call to 
-selectRow:: and, lo and behold! No exception. It worked great. Looks 
just like how I want it to look.


Am I getting lucky here? Are the docs just wrong? I don't want to do 
something overtly dangerous, but in practice it does exactly what I 
want... are there any gotchas?


I'm on Leopard FWIW, and don't need to target older OSes.
___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Subclassing

2008-04-18 Thread K. Darcy Otto
I am working on a program with a complex hierarchy of classes, and I  
want to subclass one of the objects a few steps down on that  
hierarchy.  Do I have to create a parallel hierarchy to do this?  Here  
is the problem:


AppController instantiates a Deduction object.
The Deduction object instantiates a DeductionLine object.
The DeductionLine object instantiates a Dependency object.

I want to subclass Dependency and override a few things.  Can I do  
this without modifying DeductionLine?  As it stands, I think I'm going  
to have to do this:


AppController instantiates a SDeduction object (where SDeduction is a  
subclass of Deduction).
The SDeduction object instantiates a SDeductionLine object (where  
SDeductionLine is a subclass of DeductionLine).
The SDeduction object instantiates a SDependency object (where  
SDependency is a subclass of Dependency).


The only reason to subclass Deduction (with SDeduction) and then  
DeductionLine (with SDeductionLine) is to get an SDependency object.   
Is there an easier way?  I suppose I could just copy the Dependency  
class files and then modify it for this particular project; but I was  
hoping for a different way.  Thanks.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Capsule-Style Toolbar Controls

2008-04-18 Thread Stefan Hafeneger

Hi Peter,

Thanks for your reply. You are right. Since the WWDC Beta I haven't  
touched the unified checkbox because I thought that there is no  
difference because the design is always unified. I also didn't find  
something in the HIG about that. So when should we activate this  
checkbox? Is the difference just the 2px?


With best wishes, Stefan

Am 18.04.2008 um 23:05 schrieb Peter Ammon:


Thanks Stefan,

From the screenshot, it looks to me like the test app is not using  
the unified title/toolbar metrics, but Mail is.  Try checking the  
unified title/toolbar checkbox in IB.


Your understanding of the NSToolbarItemGroup is correct.  However,  
the view will not be automatically resized to fit the labels.  For  
now, you will have to size the segments manually.


-Peter

On Apr 17, 2008, at 9:25 AM, Stefan Hafeneger wrote:

Hi Peter,

I uploaded two screenshots from Mail (in the background) and a demo  
app (in the foreground) designed just in Interface Builder. The  
size of the segmented control is exactly the same but there is a  
difference in the baseline.


http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar1.png-zip.zip
http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar2.png-zip.zip

Concerning NSToolbarItemGroup: So I create a NSToolbarItemGroup and  
with three "dummy" items and label the three dummy items. Then I  
create a segmented control cell with 3 segments and set it to the  
view of NSToolbarItemGroup. Is this correct? Will the view then be  
automatically resized if the user enables or disables the labels?


With best wishes, Stefan

Am 16.04.2008 um 23:29 schrieb Peter Ammon:



On Apr 16, 2008, at 1:27 PM, Stefan Hafeneger wrote:


Hi,

Has anyone tried to use the Capsule-Style Toolbar Controls in an  
app so that it looks and behaves like Mail or Preview? When I add  
them to my toolbar it looks like Mail. But if I compare them side  
by side the ones in Mail and Preview there is a 2 pixel  
difference of the baseline. And I think it looks better in Mail/ 
Preview. When I add a multi-segment control I only have one Label  
(not two or more). In Mail and Preview it looks like there are as  
many labels as segments. You can "fake" this by adding blanks.  
But there is one more point: In Mail and Preview the size of the  
control is adjusted (I think depending on the size of the  
label(s)). Well, in the nib files from Mail and Preview there are  
no toolbars, so Apple builds them via code. So the question is:  
If I code them as well, is it possible to do the same that Apple  
does in Mail and Preview via NSSegmentedCell or is this all done  
by hand?


With best wishes, Stefan


Hi Stefan,

As of Leopard, this is all possible using standard AppKit  
controls, which Mail and Preview both use.


Regarding the two pixel difference in the baseline, this may be  
because the segmented control is too short and so is clipped.  Try  
using sizeToFit.  You may also be referring to different window  
metrics; try giving the window a unified title/toolbar to see if  
that gives the appearance you expect.  It shouldn't affect the  
appearance much, but it does subtly change the toolbar  
positioning.  If these don't fix your issue, maybe you can provide  
a screenshot so I understand what you mean.


To have multiple labels in a single toolbar item, make an  
NSToolbarItemGroup, and give it subitems.  If you set a view (but  
not a label) on the Group, the labels of the subitems will be  
arranged under the view.  If the view is a segmented control, the  
labels will be aligned with corresponding segments, assuming  
there's the same number of both. This is what Mail and Preview do.


I hope that's clear,
-Peter









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: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread Ben Lachman
Well, you should be able to just override the drawing code, since  
thats really your problem.  Going directly against the docs, while it  
may work fine now, is playing with fire in my opinion.  To get the  
drawing you want, you can just implement  
tableView:willDisplayCell:forTableColumn:row: in the delegate and  
manually switch selection highlighting on or off depending on whether  
the table column passed to you is the selected table column.  You'll  
probably have to have a couple more cases if you're really trying to  
get close to the standard spreadsheet functionality that lets you  
select the full row/column by clicking on the header.  But this  
should get you started, hopefully.


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Apr 18, 2008, at 1:55 PM, John Stiles wrote:

The docs for -editColumn:row:withEvent:select:  ominously claim:
   The row at rowIndex must be selected prior to calling  
editColumn:row:withEvent:select:, or an exception will be raised.


I'm implementing a subclass of NSTableView which behaves a little  
more like an Excel spreadsheet—it maintains a phony selection by  
overloading -mouseDown/Dragged/Up: and coloring cell backgrounds as  
appropriate. It works great. But it means that the table view,  
internally, never actually considers a row to be "selected." My  
subclass handles that entirely on its own and leaves the table view  
out of it.


Now I'm getting around to implementing the part where the user can  
edit table cells in place, and since I wanted to follow the rules  
in the docs, I started by implementing it like this:


   [myTableView selectRow:inRow byExtendingSelection:NO];
   [myTableView editColumn:inCol row:inRow withEvent:myEvent  
select:NO];


It worked fine but, of course, the entire row turned blue, ruining  
the spreadsheet illusion.
So just to see what would happen, I tried removing the call to - 
selectRow:: and, lo and behold! No exception. It worked great.  
Looks just like how I want it to look.


Am I getting lucky here? Are the docs just wrong? I don't want to  
do something overtly dangerous, but in practice it does exactly  
what I want... are there any gotchas?


I'm on Leopard FWIW, and don't need to target older OSes.
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Getting an array/tree controller to select newly added managed objects

2008-04-18 Thread Sean McBride
Hi all,

Consider an app that uses bindings and Core Data.  It has a tableview
bound to an array controller.  There is an 'Add' button that creates a
new entity to be shown in the table.  It could be implemented by:

1) sending add: to the array controller.
2) using a custom IBAction method that creates a new entity and adds it
to the managed object context.

#1 is nice because the array controller will automatically select the
newly added object (if selectsInsertedObjects is YES).  However, I find
myself often needing to use method #2 because I must supply some initial
data to create the new entity.  In that case, the array controller sees
the new entity but does not select it.

What is the "right" way to get it selected?  Should I just pass the new
NSManagedObject up to my view-controller and call
[theArrayController:setSelectedObjects:[NSArray
arrayWithObject:newManagedObject]]?  If so, how do I do it in the tree
controller case?  There is no setSelectedObjects:.

Thanks,

--

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Unregistering KVO observers

2008-04-18 Thread Hal Mueller

Maybe try
[[NSNotificationCenter defaultCenter] removeObserver:nil name:nil  
object:self]
in your dealloc method?  I think that will patch the symptom, but I  
still don't understand why you're getting the original error.


This bit looks important though.  Makes me wonder if you've got things  
wired up in IB the way they should be, or some other similar hard-to- 
notice glitch.


On Apr 17, 2008, at 10:05 PM, Steve Nicholson wrote:
When my app was simply an NSDocument, it worked fine: when the  
window closed, the bindings were automatically broken. But now that  
I'm using NSDocument and NSWindowController, they aren't.


The section on Window Closing Behavior in the Document-Based  
Application Overview might help:


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

Hal

___

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

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

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

This email sent to [EMAIL PROTECTED]


[SOLVED] Simulating menu bar blink in Cocoa

2008-04-18 Thread John Stiles
The "fake temporary item" solution actually works pretty well. It's the 
last thing I'd call elegant, but here's how you can blink a menu title 
in Cocoa.
This assumes that you aren't actually assigning the command+F35 key 
equivalent to any of your menu items... hopefully a safe assumption for 
the time being :)



- (void) blink {
   const unichar  f35Key = NSF35FunctionKey;
   NSString*  f35String = [NSString stringWithCharacters:&f35Key 
length:1];

   intposition = [myMenu numberOfItems];
  
   NSMenuItem* item = [[[NSMenuItem alloc] initWithTitle:@"* blink *"

  action:NULL
   keyEquivalent:f35String] 
autorelease];


   [item setTarget:NULL];
   [myMenu insertItem:item atIndex:position];

   NSEvent * f35Event = [NSEvent keyEventWithType:NSKeyDown
 location:NSZeroPoint
modifierFlags:NSCommandKeyMask
timestamp:0
 windowNumber:0
  context:[NSGraphicsContext 
currentContext]

   characters:f35String
  charactersIgnoringModifiers:f35String
isARepeat:NO
  keyCode:0];
  
   [myMenu performKeyEquivalent:f35Event];
  
   [myMenu removeItemAtIndex:position];

}



John Stiles wrote:
Reading the list archives a little more, it looks like there may be 
two ways to do this:


- _NSHighlightCarbonMenu and _NSUnhighlightCarbonMenu are SPIs which 
take an NSMenu* and do exactly what you'd expect
- You can add a fake temporary menu item to your menu, with a suitably 
bizarre key equivalent and no target or action. Then use NSMenu 
-performKeyEquivalent: to simulate its selection.


Wow, great choices here :| I'm going to try #2 first since it's not 
SPI. I'll inform the list of the results.



John Stiles wrote:

John Stiles wrote:

Randall Meadows wrote:

On Apr 17, 2008, at 11:54 AM, John Stiles wrote:
As previously explained here, I'm handling hotkeys in my app via 
custom code in order to work around some AppKit bugs.


How can I simulate the menu-title blink effect using Cocoa? In 
Carbon, it's FlashMenuBar(menuID) but I don't see a Cocoa equivalent.


NSMenuView's -performActionWithHighlightingForItemAtIndex:?

(Never used it, just looked it up...)

This is at the top of the file:

   Note: NSMenuView is deprecated and is no longer used to draw 
menus. Calling its methods will not affect the appearance of your 
menus.


I don't think this will work.  Actually I don't think there is even 
a way to get a valid NSMenuView* at all.
For the curious, I tried the next best thing—NSMenu's 
-performActionForItemAtIndex: —and this API does not appear to 
simulate the menu blink, although it arguably should.



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jstiles%40blizzard.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: NSBundle loadNib creates extra NSMenuItem

2008-04-18 Thread Peter Ammon
These items in the upper right are called status items, to distinguish  
them from menu items that are in menus.


A likely reason for this is that you create the status item in  
awakeFromNib, and awakeFromNib is being executed twice - once when the  
main nib is loaded, and once again when your Registration nib is loaded.


You could fix this by moving the code to another method, such as  
applicationDidFinishLaunching:, or checking if your status item exists  
before creating it in awakeFromNib.


-Peter

On Apr 18, 2008, at 11:26 AM, Justin Williams wrote:


Hi,

I have an NSMenuItem in my application that toggles the visibility of
my application's main window.  If the user hasn't entered a license
code for the application, I call a method in my main controller that
shows a custom sheet that asks them to register.

- (void) showTrialWindow {
if (!oRegistrationPanel)
[NSBundle loadNibNamed:@"Registration" owner:self];

// Other stuff
}

When I call this showTrialWindow, it will temporarily create a
secondary NSMenuItem in the user's menu bar.   Is there a better way I
could load the nib so that it wouldn't create the secondary menu item?

Thanks for the assistance.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setTextContainerInset with different values for left and right

2008-04-18 Thread Ferhat Ayaz

thank you! Works great.

On Apr 18, 2008, at 8:17 PM, Ben Lachman wrote:

You can subclass the text view and returned an origin point from -  
(NSPoint)textContainerOrigin.  This will give you origin.x 
+inset.width on the left and just inset.width on the right when used  
in conjunction with setTextContainerInset.


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Apr 18, 2008, at 11:44 AM, Ferhat Ayaz wrote:

Hi,

how would I go about setting NSTextView up so its insets are dx1  
from the left and dx2  from the right side?
I guess setTextContainerInset: will set for both left and right the  
same value (dx1 = dx2).




Ferhat

http://www.thinkcocoa.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: Capsule-Style Toolbar Controls

2008-04-18 Thread Peter Ammon

Thanks Stefan,

From the screenshot, it looks to me like the test app is not using  
the unified title/toolbar metrics, but Mail is.  Try checking the  
unified title/toolbar checkbox in IB.


Your understanding of the NSToolbarItemGroup is correct.  However, the  
view will not be automatically resized to fit the labels.  For now,  
you will have to size the segments manually.


-Peter

On Apr 17, 2008, at 9:25 AM, Stefan Hafeneger wrote:

Hi Peter,

I uploaded two screenshots from Mail (in the background) and a demo  
app (in the foreground) designed just in Interface Builder. The size  
of the segmented control is exactly the same but there is a  
difference in the baseline.


http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar1.png-zip.zip
http://homepage.mac.com/stefan.hafeneger/.cv/stefan.hafeneger/Sites/.Public/CapsuleToolbar2.png-zip.zip

Concerning NSToolbarItemGroup: So I create a NSToolbarItemGroup and  
with three "dummy" items and label the three dummy items. Then I  
create a segmented control cell with 3 segments and set it to the  
view of NSToolbarItemGroup. Is this correct? Will the view then be  
automatically resized if the user enables or disables the labels?


With best wishes, Stefan

Am 16.04.2008 um 23:29 schrieb Peter Ammon:



On Apr 16, 2008, at 1:27 PM, Stefan Hafeneger wrote:


Hi,

Has anyone tried to use the Capsule-Style Toolbar Controls in an  
app so that it looks and behaves like Mail or Preview? When I add  
them to my toolbar it looks like Mail. But if I compare them side  
by side the ones in Mail and Preview there is a 2 pixel difference  
of the baseline. And I think it looks better in Mail/Preview. When  
I add a multi-segment control I only have one Label (not two or  
more). In Mail and Preview it looks like there are as many labels  
as segments. You can "fake" this by adding blanks. But there is  
one more point: In Mail and Preview the size of the control is  
adjusted (I think depending on the size of the label(s)). Well, in  
the nib files from Mail and Preview there are no toolbars, so  
Apple builds them via code. So the question is: If I code them as  
well, is it possible to do the same that Apple does in Mail and  
Preview via NSSegmentedCell or is this all done by hand?


With best wishes, Stefan


Hi Stefan,

As of Leopard, this is all possible using standard AppKit controls,  
which Mail and Preview both use.


Regarding the two pixel difference in the baseline, this may be  
because the segmented control is too short and so is clipped.  Try  
using sizeToFit.  You may also be referring to different window  
metrics; try giving the window a unified title/toolbar to see if  
that gives the appearance you expect.  It shouldn't affect the  
appearance much, but it does subtly change the toolbar  
positioning.  If these don't fix your issue, maybe you can provide  
a screenshot so I understand what you mean.


To have multiple labels in a single toolbar item, make an  
NSToolbarItemGroup, and give it subitems.  If you set a view (but  
not a label) on the Group, the labels of the subitems will be  
arranged under the view.  If the view is a segmented control, the  
labels will be aligned with corresponding segments, assuming  
there's the same number of both. This is what Mail and Preview do.


I hope that's clear,
-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: Modal popup from command line tool or daemon?

2008-04-18 Thread Daniel Staal
--As of April 18, 2008 4:21:39 PM -0400, David Wilson is alleged to have 
said:



A command line tool or a true background daemon can't really pull it
off- the process wouldn't have a connection to the window server to
actually do any of that. The best bet, I think, would be to have a
small helper application that could be launched to display the
appropriate alert; the helper application could be a very simple cocoa
app.


--As for the rest, it is mine.

Instead of bundling (and writing) your own helper app, it might be worth 
while to think about calling Growl:



Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mounting AFP Volume using Cocoa

2008-04-18 Thread Bill Monk


On Apr 18, 2008, at 2:59 PM, Randall Meadows wrote:


On Apr 18, 2008, at 1:48 PM, Bill Monk wrote:

On Apr 18, 2008, at 2:03 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:


I haven't used any of those functions. How about reading the
documentation? Just type "FSVolumeMount" into Xcode's documentation
viewer.


Well, um, that won't help him much, because there is no such  
function.


You mean this one com.apple.ADC_Reference_Library.CoreReference.docset/Contents/ 
Resources/Documents/documentation/Carbon/Reference/File_Manager/ 
Reference/reference.html#//apple_ref/doc/uid/TP3107-CH1g-SW13>?


:)


:)

For posterity, let's amend that exchange to read:

"How about reading the Leopard documentation? Just type  
"FSVolumeMount" into Xcode 3.0 (or better)'s documentation viewer."


"Well, um, that won't help him much, because there is no such  
function - unless he's on Leopard, and even then it's not immediately  
clear how or even if he could use it to do what he asked - mount a  
volume silently by passing the user name and password.  
FSMountServerVolumeSync will do what he wants and works back to 10.2"





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bitmap data from CGImageRef

2008-04-18 Thread Carter R. Harrison
Surprisingly, if you go to Xcode Documentation you can find the method  
that Adam first mentioned, but it is not on the ADC website.


Thanks Scott.


On Apr 18, 2008, at 3:05 PM, Scott Thompson wrote:



On Apr 18, 2008, at 1:54 PM, Carter R. Harrison wrote:

Thanks Adam..  For some reason I cannot seem to find  
CGDataProviderCopyData in the Apple docs.  I can search for it at  
the ADC, and it returns the page for CGDataProvider as the first  
hit, but once you go to that page, there is absolutely no reference  
to CGDataProviderCopyData.  Strange.


There was another thread on quartz-dev that noted that.  Someone at  
Apple said they would look into it. FWIW.


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: Modal popup from command line tool or daemon?

2008-04-18 Thread David Wilson
A command line tool or a true background daemon can't really pull it
off- the process wouldn't have a connection to the window server to
actually do any of that. The best bet, I think, would be to have a
small helper application that could be launched to display the
appropriate alert; the helper application could be a very simple cocoa
app.

On Fri, Apr 18, 2008 at 3:49 PM, Rod Cater <[EMAIL PROTECTED]> wrote:
> Hi
>
>  I'm new to Cocoa and I'm trying to figure out how to create a simple popup
> which can be displayed from a command line tool or a background process.
> Ideally it would be something like NSAlert plus a text input field. I've
> been reading Apple's docs on windows, documents and the various controllers,
> and playing around with Interface Builder, but I think I'm missing something
> basic. Any pointers on where to begin would be appreciated.
>
>  Rod
>  ___
>
>  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>  Please do not post admin requests or moderator comments to the list.
>  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>  Help/Unsubscribe/Update your Subscription:
>  http://lists.apple.com/mailman/options/cocoa-dev/david.t.wilson%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>



-- 
- David T. Wilson
[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: NSBundle loadNib creates extra NSMenuItem

2008-04-18 Thread Justin Williams
On Fri, Apr 18, 2008 at 2:23 PM, Rob Napier <[EMAIL PROTECTED]> wrote:
> On Apr 18, 2008, at 2:26 PM, Justin Williams wrote:
>
>  When you say "a secondary NSMenuItem in the user's menu bar," what do you
> mean?
>
>  -Rob
>

Hi Rob,

I've made a short screencast that shows what's happening.   As you'll
see, it temporarily creates a secondary "sun" icon in the menu bar
when it loads the NSBundle called in my showTrialWindow method.

http://secondgearllc.com/attachments/ccd_doublemenu.mov

Thanks!

-- 
-
Justin Williams
[EMAIL PROTECTED]
work: http://www.secondgearllc.com/
play: http://www.carpeaqua.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]


Modal popup from command line tool or daemon?

2008-04-18 Thread Rod Cater

Hi

I'm new to Cocoa and I'm trying to figure out how to create a simple  
popup which can be displayed from a command line tool or a background  
process. Ideally it would be something like NSAlert plus a text input  
field. I've been reading Apple's docs on windows, documents and the  
various controllers, and playing around with Interface Builder, but I  
think I'm missing something basic. Any pointers on where to begin  
would be appreciated.


Rod
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mounting AFP Volume using Cocoa

2008-04-18 Thread Bill Monk

On Apr 18, 2008, at 2:03 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:


I haven't used any of those functions. How about reading the
documentation? Just type "FSVolumeMount" into Xcode's documentation
viewer.


Well, um, that won't help him much, because there is no such function.


Something like this will do the job:


-(OSStatus)mountServer:(NSString *)serverAddress
volumeName:(NSString *)volumeName
usingTransport:(NSString *)transportName
optionalMountDirectory:(NSString *)mountDirectoryPath
  username:(NSString *)userName
passsword:(NSString *)password
  returnRefNum:(FSVolumeRefNum *)returnRefNum
{


// encode afp:// URL for server, without userName/password
NSString *urlStringOfVolumeToMount = [NSString  
stringWithFormat:@"%@://%@/%@", transportName, serverAddress,  
volumeName];


   // make sure any space characters in the url string are percent- 
escaped
urlStringOfVolumeToMount = [urlStringOfVolumeToMount  
stringByAddingPercentEscapesUsingEncoding:NSMacOSRomanStringEncoding];


   NSURL *urlOfVolumeToMount = [NSURL  
URLWithString:urlStringOfVolumeToMount];


   // create NSURL for optional mount directory on server - left as  
an exercise for the reader


	// To mount a volume quietly, without an authentication dialog, it's  
necessary that FSMountServerVolumeSync's

// userName and password params not be NULL.
// If they are encoded into the URL, and the server doesn't  
exist, passing NULL for these params
	// causes the system to put up a "server is not available or may not  
be operational" dialog.

//
// The solution is to always pass userName and password  
directly to FSMountServerVolumeSync, and leave them

// out of the URL.
	// This will mount the volume if it's possible, and if not, quietly  
return an error, and no authentication
	// dialog will appear (assuming the name/password are valid, of  
course).

OSStatus error;
error = FSMountServerVolumeSync( (CFURLRef)urlOfVolumeToMount,
NULL, //(CFURLRef)mountDirectoryPath, // if NULL, default  
location is mounted.

(CFStringRef)userName,
(CFStringRef)password,
returnRefNum,
 0L /* OptionBits, currently unused */ );

if ( error ) {
NSBeep();
		NSLog( @"Server %@/%@ reported error %d", serverAddress,  
volumeName, error );

}


return error;
}


and used something like:

FSVolumeRefNum refNum;
OSStatus status;

err = [self  mountServer:@"MyServer.local"
  volumeName:@"volumeName"
  usingTransport:@"afp"
 optionalMountDirectory:@""
username:@"username"
   passsword:@"password"
returnRefNum:&refNum];

err = [self  mountServer:@"idisk.mac.com"
  volumeName:@"youriDisk-Public"
  usingTransport:@"http"
  optionalMountDirectory:@""
 username:@"username"
passsword:@"" // assuming the iDisk has no password  
set on /Public

 returnRefNum:&refNum];

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: running out of NSPipes

2008-04-18 Thread Ken Thomases

On Apr 18, 2008, at 4:23 AM, justin webster wrote:

so I see at least one other thread on this topic but no real solution.

the situation is:
using NSTask to run a shell command and using the return.
all the NSTask stuff is in a separate function which gets called  
repeatedly from a loop.
works great until I run out out NSPipes - about 248 iterations  
before [NSPipe pipe] returns nil.
I have the function wrapped in an autorelease pool and have tried  
explicitly allocating and releasing the NSPipe.


the [myTask waitUntilExit] solution mentioned in another thread made  
no difference.


does anyone understand what causes this limitaion?

is there another way to get a return from the shell?
system() does what I need, as often as you like, except I can't get  
the return value.


What Scott Ribe said is almost certainly the proper way to address  
this issue.


However, for completeness I will mention that setrlimit() can be used  
to bump the limit on open file descriptors up to OPEN_MAX (10240).   
Also, the popen() call can be used as an alternative to NSTask to run  
a command and write data to its input and read data from its output.


Neither will help you if you aren't properly managing resources,  
though -- you'll still eventually hit the resource limits.  So, better  
to fix the resource management bugs than resort to these workarounds.


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: Bitmap data from CGImageRef

2008-04-18 Thread Scott Thompson


On Apr 18, 2008, at 1:54 PM, Carter R. Harrison wrote:

Thanks Adam..  For some reason I cannot seem to find  
CGDataProviderCopyData in the Apple docs.  I can search for it at  
the ADC, and it returns the page for CGDataProvider as the first  
hit, but once you go to that page, there is absolutely no reference  
to CGDataProviderCopyData.  Strange.


There was another thread on quartz-dev that noted that.  Someone at  
Apple said they would look into it. FWIW.


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: Bitmap data from CGImageRef

2008-04-18 Thread Carter R. Harrison
Thanks Adam..  For some reason I cannot seem to find  
CGDataProviderCopyData in the Apple docs.  I can search for it at the  
ADC, and it returns the page for CGDataProvider as the first hit, but  
once you go to that page, there is absolutely no reference to  
CGDataProviderCopyData.  Strange.



On Apr 18, 2008, at 2:49 PM, Adam R. Maxwell wrote:



On Friday, April 18, 2008, at 11:40AM, "Adam R. Maxwell" <[EMAIL PROTECTED] 
> wrote:


On Friday, April 18, 2008, at 11:32AM, "Carter R. Harrison" <[EMAIL PROTECTED] 
> wrote:

Hey everybody,

Is it possible to obtain the raw bitmap data from a CGImageRef?   
Thanks.


CGImageGetDataProvider and CGImageProviderCopyData should do what  
you want.


That second call should of course be CGDataProviderCopyData...  sorry.

--
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: Bitmap data from CGImageRef

2008-04-18 Thread Adam R. Maxwell
 
On Friday, April 18, 2008, at 11:40AM, "Adam R. Maxwell" <[EMAIL PROTECTED]> 
wrote:
> 
>On Friday, April 18, 2008, at 11:32AM, "Carter R. Harrison" <[EMAIL 
>PROTECTED]> wrote:
>>Hey everybody,
>>
>>Is it possible to obtain the raw bitmap data from a CGImageRef?  Thanks.
>
>CGImageGetDataProvider and CGImageProviderCopyData should do what you want.

That second call should of course be CGDataProviderCopyData...  sorry.

-- 
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: Simulating menu bar blink in Cocoa

2008-04-18 Thread John Stiles
Reading the list archives a little more, it looks like there may be two 
ways to do this:


- _NSHighlightCarbonMenu and _NSUnhighlightCarbonMenu are SPIs which 
take an NSMenu* and do exactly what you'd expect
- You can add a fake temporary menu item to your menu, with a suitably 
bizarre key equivalent and no target or action. Then use NSMenu 
-performKeyEquivalent: to simulate its selection.


Wow, great choices here :| I'm going to try #2 first since it's not SPI. 
I'll inform the list of the results.



John Stiles wrote:

John Stiles wrote:

Randall Meadows wrote:

On Apr 17, 2008, at 11:54 AM, John Stiles wrote:
As previously explained here, I'm handling hotkeys in my app via 
custom code in order to work around some AppKit bugs.


How can I simulate the menu-title blink effect using Cocoa? In 
Carbon, it's FlashMenuBar(menuID) but I don't see a Cocoa equivalent.


NSMenuView's -performActionWithHighlightingForItemAtIndex:?

(Never used it, just looked it up...)

This is at the top of the file:

   Note: NSMenuView is deprecated and is no longer used to draw 
menus. Calling its methods will not affect the appearance of your menus.


I don't think this will work.  Actually I don't think there is even a 
way to get a valid NSMenuView* at all.
For the curious, I tried the next best thing—NSMenu's 
-performActionForItemAtIndex: —and this API does not appear to 
simulate the menu blink, although it arguably should.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bitmap data from CGImageRef

2008-04-18 Thread Adam R. Maxwell
 
On Friday, April 18, 2008, at 11:32AM, "Carter R. Harrison" <[EMAIL PROTECTED]> 
wrote:
>Hey everybody,
>
>Is it possible to obtain the raw bitmap data from a CGImageRef?  Thanks.

CGImageGetDataProvider and CGImageProviderCopyData should do what you want.

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


Bitmap data from CGImageRef

2008-04-18 Thread Carter R. Harrison

Hey everybody,

Is it possible to obtain the raw bitmap data from a CGImageRef?  Thanks.

Regards,
Carter
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSBundle loadNib creates extra NSMenuItem

2008-04-18 Thread Justin Williams
Hi,

I have an NSMenuItem in my application that toggles the visibility of
my application's main window.  If the user hasn't entered a license
code for the application, I call a method in my main controller that
shows a custom sheet that asks them to register.

- (void) showTrialWindow {
if (!oRegistrationPanel)
[NSBundle loadNibNamed:@"Registration" owner:self];

// Other stuff
}

When I call this showTrialWindow, it will temporarily create a
secondary NSMenuItem in the user's menu bar.   Is there a better way I
could load the nib so that it wouldn't create the secondary menu item?

Thanks for the assistance.

-- 
-
Justin Williams
[EMAIL PROTECTED]
work: http://www.secondgearllc.com/
play: http://www.carpeaqua.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: setTextContainerInset with different values for left and right

2008-04-18 Thread Ben Lachman
You can subclass the text view and returned an origin point from -  
(NSPoint)textContainerOrigin.  This will give you origin.x 
+inset.width on the left and just inset.width on the right when used  
in conjunction with setTextContainerInset.


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Apr 18, 2008, at 11:44 AM, Ferhat Ayaz wrote:

Hi,

how would I go about setting NSTextView up so its insets are dx1  
from the left and dx2  from the right side?
I guess setTextContainerInset: will set for both left and right the  
same value (dx1 = dx2).



___

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

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

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

This email sent to [EMAIL PROTECTED]


Pasteboard inconsistencies

2008-04-18 Thread Randall Meadows
I'm doing some manipulation of selected text and having some  
inconsistencies, apparently based on what the *contents* of the text  
is.  I'm very confused about this, hopefully someone can set me  
straight.


I'm using writeSelectionToPasteboard:types: to get the current text  
selection, using a custom pasteboard ([NSPasteboard  
pasteboardWithUniqueName]) and pass an array containing only  
NSStringPboardType for "types".


That all works, I get the text using [pb  
stringForType:NSStringPboardType], and I perform my manipulation on  
it; I can see the results of it, and it's exactly what I expect.  The  
problem surfaces when I try to replace the selection with my new text.


I put the new text onto my custom clipboard using [pb  
setString:newText forType:NSStringPboardType], and then replace the  
selected text with [view readSelectionFromPasteboard:pb].  Now, for a  
simple string like "asdf", this works just fine.  The problem occurs  
when the new text contains control characters, like a carriage return  
or a tab character.  In that case, the text is not replaced with the  
new text I've just placed on my custom clipboard, but rather with the  
contents of the general pasteboard (like what I see when I select Show  
Clipboard from Finder's Edit menu).


Immediately after the setString call, I can 'po [pb  
stringForType:NSStringPboardType]', and I see that my new text is  
indeed there.  Why come then is it taking the text from a totally  
different pasteboard than what I specified, and even then only  
*sometimes*, depending on whether there are control characters in the  
text?



TIA!
randy
___

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

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

2008-04-18 Thread John Stiles

The docs for -editColumn:row:withEvent:select:  ominously claim:
   The row at rowIndex must be selected prior to calling 
editColumn:row:withEvent:select:, or an exception will be raised.


I'm implementing a subclass of NSTableView which behaves a little more 
like an Excel spreadsheet—it maintains a phony selection by overloading 
-mouseDown/Dragged/Up: and coloring cell backgrounds as appropriate. It 
works great. But it means that the table view, internally, never 
actually considers a row to be "selected." My subclass handles that 
entirely on its own and leaves the table view out of it.


Now I'm getting around to implementing the part where the user can edit 
table cells in place, and since I wanted to follow the rules in the 
docs, I started by implementing it like this:


   [myTableView selectRow:inRow byExtendingSelection:NO];
   [myTableView editColumn:inCol row:inRow withEvent:myEvent select:NO];

It worked fine but, of course, the entire row turned blue, ruining the 
spreadsheet illusion.
So just to see what would happen, I tried removing the call to 
-selectRow:: and, lo and behold! No exception. It worked great. Looks 
just like how I want it to look.


Am I getting lucky here? Are the docs just wrong? I don't want to do 
something overtly dangerous, but in practice it does exactly what I 
want... are there any gotchas?


I'm on Leopard FWIW, and don't need to target older OSes.
___

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

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

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 is [nil aMessage] a no-op?

2008-04-18 Thread Rob Napier

On Apr 18, 2008, at 9:56 AM, Adam P Jenkins wrote:


On Apr 18, 2008, at 1:16 AM, Graham Cox wrote:


Here's a simple example:

- (void) dealloc
{
  [someIvar release];
  [super dealloc];
}

is  really initialised? Maybe it's nil? Do I care at this  
point? no - either way, the code is correct - if the object was  
made, it's released, if it wasn't, it's a no-op. Exactly what you  
want.


That makes a lot of sense.  I can now picture many lines of code  
I've written over the years which wouldn't have been necessary with  
this feature.


Thanks a lot to everyone who responded to my question.  I now  
understand the pros and cons of the nil-eats-messages feature much  
better, and it doesn't seem like a mis-feature to me now.



In Martin Fowler's "Refactoring: Improving the Design of Existing  
Code", even as a Java-centric writer he discusses the utility of the  
Null Object (the strict-typing version of the nil-eats-message  
pattern). Some background he quotes from Ron Jeffries (of Extreme  
Programming fame):


---
	We first started using the null object pattern when Rich Garzaniti  
found that lots of code in the system would check objects for presence  
before sending a message to the object. We might ask an object for its  
person, then ask the result whether it was null. If the object was  
present, we would ask it for its rate. We were doing this in several  
places, and the resulting duplicate code was getting annoying.
	So we implemented a missing-person object that answered a zero rate  
(we call our null objects missing objects). Soon missing person knew a  
lot of methods, such as rate. Now we have more than 80 null-object  
classes.

...
	An interesting characteristic of using null objects is that things  
almost never blow up. Because the null object responds to all the same  
messages as a real one, the system generally behaves normally. This  
can sometimes make it difficult to detect or find a problem, because  
nothing ever breaks. Of course, as soon as you begin inspecting the  
objects, you'll find the null object somewhere where it shouldn't be.

---

Like ObjC memory management, nil-eats-message is something that new  
ObjC programmers rail against (I know I did), but that experienced  
ObjC programmers grow comfortable with and eventually quite fond of.  
It doesn't make it the one-and-only "right way," but it demonstrates  
that it's generally more useful than it is dangerous.


-Rob
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mounting AFP Volume using Cocoa

2008-04-18 Thread Jens Alfke


On 18 Apr '08, at 4:52 AM, JanakiRam wrote:

Can you provide some pointers on using FSVolumeMount API or some  
CoreServices API.


I haven't used any of those functions. How about reading the  
documentation? Just type "FSVolumeMount" into Xcode's documentation  
viewer.


If no API is available , then how Finder is able to connect to afp  
volume using Connect to Server (Cmd+K). Any pointers on these is  
greatly appreciated.


I told you API is available. Finder — which isn't a Cocoa app, anyway  
— is probably calling FSVolumeMount.


—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: @dynamic and Programmatic Access to Setters

2008-04-18 Thread Mike Rossetti
Hah!  I believe Paul and Jens have identified the problem!  Yes, I am  
using [[Tip alloc] init].  I'll rework that portion of the code and  
ping back later confirmating the good news.


Thanks guys!

Mike

On Apr 17, 2008, at 11:13 PM, Paul Goracke wrote:

[snip]
I think the problem is in your creation of the Tip NSManagedObject-- 
you can't simply call [[Tip alloc] init] and have it work. Create  
your object via "[[NSManagedObject alloc] initWithEntity:@"Tip"  
insertIntoManagedObjectContext:[self managedObjectContext]]" or  
"[NSEntityDescription entityForName:@"Tip" inManagedObjectContext: 
[self managedObjectContext]]" and it should work as expected.



On Apr 18, 2008, at 12:21 AM, Jens Alfke wrote:

[snip]
My guess would be that you're not instantiating the object properly.  
NSManagedObject does some very, very weird stuff behind the scenes,  
including swizzling in fake superclasses. Accordingly, you have to  
let the CoreData factory methods instantiate managed objects: just  
calling alloc+init won't work.


___

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

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

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

This email sent to [EMAIL PROTECTED]


setTextContainerInset with different values for left and right

2008-04-18 Thread Ferhat Ayaz

Hi,

how would I go about setting NSTextView up so its insets are dx1 from  
the left and dx2  from the right side?
I guess setTextContainerInset: will set for both left and right the  
same value (dx1 = dx2).


Thanks,

Ferhat






___

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

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

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 is [nil aMessage] a no-op?

2008-04-18 Thread Andy Lee

This has been a great thread.

I wonder whether nil-eats-message makes me *more* sensitive to cases  
where nil really matters, because it frees me from having to clutter  
my code with trivial cases where nil doesn't matter.  But I might be  
trying to rationalize a subjective preference.


I also wonder if programmers who have done a lot of SQL are less  
freaked out by nil-eats-message, given the way NULL behaves in  
databases.


--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: Authenticatiion tool

2008-04-18 Thread I. Savant
>  In my case I want to save my chat session in an html file which when
>  double clicked will open the file in the browser and will show all the chat
>  messages with their respective images of the people who are sending the
>  messages. How can I do this? One more thing my application is not document
>  based architecture. Hereby I am attaching the screenshot of my chat window.

  Again, this is a very general question, so you'll get general
answers. Please give this article a read - you're going to have to
post more carefully to get useful feedback from the list. It is a
great resource for getting effective help from technical mailing lists
and is cited in the cocoa-dev list's guidelines:

http://catb.org/~esr/faqs/smart-questions.html

  With that said, I'm assuming you know how to connect your Save As
... menu item to an action. If not, you'll need to review the
introductory Cocoa documentation as you won't get very far without
these basics.

  Assuming you know how to do the above but simply want to know how to
approach the "export" problem, you'll need to create a method that
does the following:

1 - Render as HTML:

  You'll want to render your chat session as HTML somehow. The *easy*
way to do this is to (assuming you know HTML) construct a string that
contains your chat transcript in HTML form. There are many ways to
approach this - if you get stuck, search the documentation and if you
can't find answers, ask specific questions of the list. Note that
you'll probably want to put any stylesheet code *inline* in the
document so it's self-contained *and* pretty. Relying on a separate
.css file is lame. :-)

2 - Save the HTML string to a File:

  You'll need to get that string into a file. This involves prompting
the user with a Save dialog. Read the documentation; this is easy.
Once you have the target path from the user, you'll simply write the
string to a file. See NSString's documentation - this is also easy.

3 - There is no step 3; you're done.

  That's all there is to it. Assuming the file is saved with a .htm or
.html extension, it'll open in the user's default browser if
double-clicked in Finder (or if opened with NSWorkspace's method - see
its documentation, also easy).

  Assuming also your HTML string is well-formed, the web browser will
display your beautifully (or not) rendered chat transcripts.

--
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: Different ways of application installation

2008-04-18 Thread parag vibhute
Fine.

Palav

On Fri, Apr 18, 2008 at 8:30 PM, I. Savant <[EMAIL PROTECTED]>
wrote:

> On Fri, Apr 18, 2008 at 10:56 AM, parag vibhute <[EMAIL PROTECTED]>
> wrote:
> > I don't know much about Mac OS X Server, but does it have this type of
> > remote installation without requiring ARD?
>
>   This is definitely off-topic for this list. You'll want to take
> these types of questions to a more suitable location.
>
> http://www.lists.apple.com
>
> Suggestions:
>
> Remote-desktop
> Macos-x-server
>
>  If you're looking to write your own, this is the best place but you
> need to pose more specific questions.
>
> --
> I.S.
>



-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Different ways of application installation

2008-04-18 Thread I. Savant
On Fri, Apr 18, 2008 at 10:56 AM, parag vibhute <[EMAIL PROTECTED]> wrote:
> I don't know much about Mac OS X Server, but does it have this type of
> remote installation without requiring ARD?

  This is definitely off-topic for this list. You'll want to take
these types of questions to a more suitable location.

http://www.lists.apple.com

Suggestions:

Remote-desktop
Macos-x-server

  If you're looking to write your own, this is the best place but you
need to pose more specific questions.

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


Authenticatiion tool

2008-04-18 Thread parag vibhute
I am currently working on a project which is similar to an iChat application
tool. I want to save the chat session as iChat does. Incase of iChat we have
noted how when we click on save copy menu item it saves the copy of the chat
session as a file with time. And when we want to see the chat session we
double click on that particular file it will open the chat session in chat
window. In my case I want to save my chat session in an html file which when
double clicked will open the file in the browser and will show all the chat
messages with their respective images of the people who are sending the
messages. How can I do this? One more thing my application is not document
based architecture. Hereby I am attaching the screenshot of my chat window.

Thanks,
Palav

-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Different ways of application installation

2008-04-18 Thread parag vibhute
I don't know much about Mac OS X Server, but does it have this type of
remote installation without requiring ARD?

Thanks,
Palav


On Fri, Apr 18, 2008 at 8:04 PM, I. Savant <[EMAIL PROTECTED]>
wrote:

> > Remotely means pushing software packages to clients on a network. Not
> > understood meaning of "An installer that pulls its payload from a remote
> > server".
>
>   That's considerably more complicated than a simple client-side
> install by dragging an application to a folder. :-)
>
>  I wonder if you realize that there are mechanisms already in place
> on every Mac to handle 'push' installs for any installer package.
> Apple Remote Desktop makes this easy for any application. You can
> select multiple computers on your network, tell it to install a
> package, run a script, copy a file, etc. In the case of a standard
> installer package, you can just select the package and it'll run
> silently on all clients.
>
>  This, IMO, is a far better solution than reinventing the wheel for
> an individual application. From the very first page of the document I
> sent you:
>
>  "Network administrators can use a type of managed install, a remote
> install, to install a product on several networked computers using
> Remote Desktop. No user interaction occurs in this type of install."
>
>  The how-to's on that, however, are best suited for another list, but
> that is *the* standard way on OS X - it unfortunately requires ARD
> (Apple Remote Desktop), I believe.
>
>  A somewhat clunkier method might be to run a script via SSH ...
>
> --
> I.S.
>



-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Printing and tabular data (again)

2008-04-18 Thread Erik Verbruggen
The third approach is to use the NSTextTable, as described in http:// 
developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/ 
Articles/TextTables.html


Cheers,
Erik.


On 16 Apr 2008, at 22:44, Luca Torella wrote:

Hi all,
I know this has been discussed many times before, but I still can't  
find a definitely easy and all-purpose answer. Is it really that  
hard to print the content of an NSTableView? It seems there are two  
main ways to do that.


- The first way is to create another NSTableView in an invisible  
window as covered in this topic:

http://forums.macrumors.com/showthread.php?t=273153

- The second approach is to create an NSString containing HTML code  
that should be rendered by the fabulous WebKit.


Well I dislike both approaches: they are both not so smooth as I'm  
used to with Cocoa. And I can't believe there isn't an open-source  
class or a framework that can be used and can be improved by Cocoa  
developers. Printing tabular data in Cocoa is just to hard and this  
should be fixed as soon as possible in my opinion, in the while the  
Cocoa community should work out to find a solution.
I'll be happy to give my contribute, but first I'd like to know  
some opinions about other Cocoa developers and their approaches to  
this problem.


Thanks in advance,
Luca



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/erikjv%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: Why is [nil aMessage] a no-op?

2008-04-18 Thread Scott Ribe
> Here's a simple example:
> 
> - (void) dealloc
> {
>[someIvar release];
>[super dealloc];
> }

It's worth noting that even in C++ there's a special case for delete, so
that one can write "delete myptr" rather than "if(myptr) delete myptr)" 10
bazillion[1] times. I was around when this behavior was standardized, and
there were people arguing strenuously that this would support "sloppy
programming", whereas my opinion is that writing redundant code
unnecessarily is what is sloppy.

> That makes a lot of sense.  I can now picture many lines of code I've
> written over the years which wouldn't have been necessary with this
> feature.

Here's an example from my own use. Imagine a "workflow" type application.
You'd have some kind of big chunk of structured data (probably backed by
database, but that's irrelevant here). At various stages in the process, you
would show different subsets of the details to different users, using
different forms from different nibs.

Approach 1: different window controller for each form. Lots of common code
for handling controls is duplicated between forms.

Approach 2: extract code for common controls into a base class. Each form
has its window controller that inherits from the base class and implements
the non-common controls. There is the possibility that either some forms
still have duplicated code, or that to eliminate duplicated code requires
more than one level of inheritance (yuck!). But the biggest problem is that
as requirements change, some controls may change from being common or not,
and the code may have to be moved around in the hierarchy.

Approach 3: put code for all controls in the base class, and count on the
fact that controls that don't exist in a nib will have their outlets set to
nil, and messages to them will be noops. There *may* still be some cases
where you will need to know if a control actually exists, but in most cases
you simply don't need to know. (Bindings change the balance, because they
eliminate a lot of code that interacts with controls.)

[1] Yeah, yeah, yeah. Templates, Boost, Loki: modern C++ code should have
far fewer explicit invocations of delete than what we were writing back in
the '80s.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Another graphical challenge...

2008-04-18 Thread Erik Buck
Micro Tile Arrays are a general solution for minimal rectangular decomposition 
of arbitrary shapes.  The overlapping rectangles problem is the simplest case 
and easily solved by utas.

Here is an open source implementation:
http://www.levien.com/libart/uta.html
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Different ways of application installation

2008-04-18 Thread I. Savant
> Remotely means pushing software packages to clients on a network. Not
> understood meaning of "An installer that pulls its payload from a remote
> server".

  That's considerably more complicated than a simple client-side
install by dragging an application to a folder. :-)

  I wonder if you realize that there are mechanisms already in place
on every Mac to handle 'push' installs for any installer package.
Apple Remote Desktop makes this easy for any application. You can
select multiple computers on your network, tell it to install a
package, run a script, copy a file, etc. In the case of a standard
installer package, you can just select the package and it'll run
silently on all clients.

  This, IMO, is a far better solution than reinventing the wheel for
an individual application. From the very first page of the document I
sent you:

  "Network administrators can use a type of managed install, a remote
install, to install a product on several networked computers using
Remote Desktop. No user interaction occurs in this type of install."

  The how-to's on that, however, are best suited for another list, but
that is *the* standard way on OS X - it unfortunately requires ARD
(Apple Remote Desktop), I believe.

  A somewhat clunkier method might be to run a script via SSH ...

--
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: Another graphical challenge...

2008-04-18 Thread Graham Cox
Richard, thanks very much for applying yourself to this problem. You  
make it seem easy, and it works a treat. I obviously haven't drunk  
enough coffee today as it looked a lot harder than it turned out to be!


Here's my ready-to-use Cocoa-conversion, if anyone else wants to make  
use of it.



NSSet*  DifferenceOfTwoRects( const NSRect a, const NSRect b )
{
NSMutableSet* result = [NSMutableSet set];

// if a == b, there is no difference, so return the empty set

if( ! NSEqualRects( a, b ))
{
NSRect ir = NSIntersectionRect( a, b );

if( NSEqualRects( ir, NSZeroRect ))
{
// no intersection, so result is the two input rects

[result addObject:[NSValue valueWithRect:a]];
[result addObject:[NSValue valueWithRect:b]];
}
else
{
			// a and b do intersect, so collect all the pieces by subtracting  
 from each


[result unionSet:SubtractTwoRects( a, ir )];
[result unionSet:SubtractTwoRects( b, ir )];
}
}

return result;
}


NSSet*  SubtractTwoRects( const NSRect a, const NSRect b )
{
	// subtracts  from , returning the pieces left over. If a and b  
don't intersect the result is correct
	// but maybe broken into pieces when it doesn't need to be, so the  
caller should test for intersection first.


NSMutableSet* result = [NSMutableSet set];

float rml, lmr, upb, lwt, mny, mxy;

rml = MAX( NSMaxX( b ), NSMinX( a ));
lmr = MIN( NSMinX( b ), NSMaxX( a ));
upb = MAX( NSMaxY( b ), NSMinY( a ));
lwt = MIN( NSMinY( b ), NSMaxY( a ));
mny = MIN( NSMaxY( a ), NSMaxY( b ));
mxy = MAX( NSMinY( a ), NSMinY( b ));

NSRect  rr, rl, rt, rb;

rr = NSMakeRect( rml, mxy, NSMaxX( a ) - rml, mny - mxy );
rl = NSMakeRect( NSMinX( a ), mxy, lmr - NSMinX( a ), mny - mxy );
rt = NSMakeRect( NSMinX( a ), upb, NSWidth( a ), NSMaxY( a ) - upb );
	rb = NSMakeRect( NSMinX( a ), NSMinY( a ), NSWidth( a ), lwt -  
NSMinY( a ));


// add any non empty rects to the result

if ( rr.size.width > 0 && rr.size.height > 0 )
[result addObject:[NSValue valueWithRect:rr]];

if ( rl.size.width > 0 && rl.size.height > 0 )
[result addObject:[NSValue valueWithRect:rl]];

if ( rt.size.width > 0 && rt.size.height > 0 )
[result addObject:[NSValue valueWithRect:rt]];

if ( rb.size.width > 0 && rb.size.height > 0 )
[result addObject:[NSValue valueWithRect:rb]];

return result;
}




On 18 Apr 2008, at 10:42 pm, Richard Kennaway wrote:

Quoting Graham Cox <[EMAIL PROTECTED]>:


This is not really a Cocoa-specific problem, but before I embark on a
long-winded quest, I just wonder if there's a solution out there
already.

Given two rectangles that overlap in some way, I need to create a  
list
of all the rectangles that make up the non-overlapping areas. In  
other

words it's the exclusive-OR of the two inputs, but broken down into a
list of rects (preferably the smallest number needed to make up the
result).


It made an interesting lunchtime exercise!  Here's one method,  
written in Matlab because that's what was to hand, but it should be  
clear enough how to write the same in any other language.  The code  
finds the part of a rectangle r1 outside a rectangle r2.  Repeat  
with r1 and r2 swapped to get the symmetric difference.  The only  
division into cases it needs is disjoint vs. non-disjoint.


%   r1 and r2 are rectangles represented as 4-element vectors
%[ xlo, xhi, ylo, yhi ].
%   The part of r1 outside r2 in general has 4 parts:
%+--+
%   r1 = |  rt  |
%|  |
%|...++.|
%|rl | r2 | rr  |
%|...++.|
%|  |
%|  rb  |
%|  |
%+--+
%   If r2 is not wholly inside r1 then one or more of the parts may be
%   empty.

   XLO = 1;
   XHI = 2;
   YLO = 3;
   YHI = 4;

   % Deal with the disjoint case first.  This isn't entirely  
necessary, as the
   % code for the general case will give a correct answer in the  
disjoint case,

   % but it may unnecessarily split r1 into subrectangles.
   if (r1(XLO) >= r2(XHI)) ...
   || (r1(XHI) <= r2(XLO)) ...
   || (r1(YLO) >= r2(YHI)) ...
   || (r1(YHI) <= r2(YLO))
   % The rectangles are disjoint.
   % Return r1 as the result.
   return;
   end

   rightmostleft = 

Re: Different ways of application installation

2008-04-18 Thread parag vibhute
ya, option "An installer that pulls its payload from a remote server" will
also be ok.

Palav

On Fri, Apr 18, 2008 at 7:53 PM, parag vibhute <[EMAIL PROTECTED]>
wrote:

> Remotely means pushing software packages to clients on a network. Not
> understood meaning of "An installer that pulls its payload from a remote
> server".
>
> Palav
>
>
> On Fri, Apr 18, 2008 at 7:31 PM, Michael Watson <[EMAIL PROTECTED]>
> wrote:
>
> > It's worth noting that you also need to define more clearly what you
> > mean by "remotely". Do you mean pushing software packages to clients on a
> > network or over the Internet? An installer that pulls its payload from a
> > remote server? Something else?
> >
> >
> > --
> > m-s
> >
> >
> > On 18 Apr, 2008, at 09:36, I. Savant wrote:
> >
> > > I have build cocoa application. I am finding out as many ways as
> > > > possible of
> > > > application installation which can be done either locally or
> > > > remotely.
> > > >
> > > > Can you please list all those ways?
> > > >
> > >
> > >  Have a look at this document:
> > >
> > >
> > > http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Introduction/chapter_1_section_1.html
> > >
> > > --
> > > 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/mikey-san%
> > > 40bungie.org
> > >
> > > This email sent to [EMAIL PROTECTED]
> > >
> >
> >
>
>
> --
>
> There are many things in your life that will catch your eye but only a few
> will catch your heartpursue those'.
>



-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Different ways of application installation

2008-04-18 Thread parag vibhute
Remotely means pushing software packages to clients on a network. Not
understood meaning of "An installer that pulls its payload from a remote
server".

Palav

On Fri, Apr 18, 2008 at 7:31 PM, Michael Watson <[EMAIL PROTECTED]>
wrote:

> It's worth noting that you also need to define more clearly what you mean
> by "remotely". Do you mean pushing software packages to clients on a network
> or over the Internet? An installer that pulls its payload from a remote
> server? Something else?
>
>
> --
> m-s
>
>
> On 18 Apr, 2008, at 09:36, I. Savant wrote:
>
> > I have build cocoa application. I am finding out as many ways as
> > > possible of
> > > application installation which can be done either locally or remotely.
> > >
> > > Can you please list all those ways?
> > >
> >
> >  Have a look at this document:
> >
> >
> > http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Introduction/chapter_1_section_1.html
> >
> > --
> > 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/mikey-san%40bungie.org
> >
> > This email sent to [EMAIL PROTECTED]
> >
>
>


-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Different ways of application installation

2008-04-18 Thread Michael Watson
It's worth noting that you also need to define more clearly what you  
mean by "remotely". Do you mean pushing software packages to clients  
on a network or over the Internet? An installer that pulls its payload  
from a remote server? Something else?



--
m-s

On 18 Apr, 2008, at 09:36, I. Savant wrote:
I have build cocoa application. I am finding out as many ways as  
possible of
application installation which can be done either locally or  
remotely.


Can you please list all those ways?


 Have a look at this document:

http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Introduction/chapter_1_section_1.html

--
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/mikey-san 
%40bungie.org


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why is [nil aMessage] a no-op?

2008-04-18 Thread Adam P Jenkins


On Apr 18, 2008, at 1:16 AM, Graham Cox wrote:


Here's a simple example:

- (void) dealloc
{
   [someIvar release];
   [super dealloc];
}



is  really initialised? Maybe it's nil? Do I care at this  
point? no - either way, the code is correct - if the object was  
made, it's released, if it wasn't, it's a no-op. Exactly what you  
want.


That makes a lot of sense.  I can now picture many lines of code I've  
written over the years which wouldn't have been necessary with this  
feature.


Thanks a lot to everyone who responded to my question.  I now  
understand the pros and cons of the nil-eats-messages feature much  
better, and it doesn't seem like a mis-feature to me now.


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: Different ways of application installation

2008-04-18 Thread I. Savant
>  I have build cocoa application. I am finding out as many ways as possible of
>  application installation which can be done either locally or remotely.
>
>  Can you please list all those ways?

  Have a look at this document:

http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Introduction/chapter_1_section_1.html

--
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: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Scott Thompson
What function is drawing? I'm not sure this works with  
NSFrameRectWithWidth(), but it definitely does with NSBezierPath/ 
stroke.


The NSFrameRect family of routines are odd ducks to begin with.  In  
some ways, they tend to to be more pixel oriented than your typical  
drawing routines.  For example, if you use NSFrameRectWithWidth, and  
supply a width of 1 (or 0) then you will see that your framed  
rectangle does not have to have the 0.5 pixel offset in order to align  
to the pixel grid. You will also note that when using wider widths,  
the stroke does not straddle the rectangle's path the way it would  
when using NSBezierPath.  The entire width of the stroke (in pixels)  
will be contained within the rectangle. Finally,  the pixel-oriented  
nature of these routines is clear when you consider that there is  
NSFrameRectWithWidthUsingOperation which draws the frame while  
applying a pixel operation.


In a lot of ways, using NSFrameRect and friends is more like copying a  
bitmap onto the screen rather than drawing with the underlying Quartz  
mechanisms.


As a result, the NSFrameRect routines are very handy for drawing on- 
screen or to bitmap contexts, but may, or may not, give you suitable  
results when drawing to other devices.


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]


Different ways of application installation

2008-04-18 Thread parag vibhute
Hi guys,

I have build cocoa application. I am finding out as many ways as possible of
application installation which can be done either locally or remotely.

Can you please list all those ways?

Thanks,
Palav

-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Graham Cox


On 18 Apr 2008, at 11:21 pm, Scott Thompson wrote:
Setting a line width of 0 draws a 1-pixel wide line at the  
resolution of the device it draws to, so on screen, that's 1/72 of  
an inch (approx) on a printer 1/600 inch, say. It's a useful way to  
isolate drawing from any CTM scaling. This is handy for drawing a  
selection rect outline on top of a zoomed image where you don't  
want the selection itself to be scaled up (among many other uses).  
So yes, I'd say it works - and Quartz most definitely does draw  
strokes with a line width of 0.


No, Quartz 2D does not draw zero width strokes.

If you use NSBezierPath and supply a stroke width of 0 then Cocoa  
will fudge the stroke width on your behalf and come up with  
something that approximates a single pixel line, but Quartz 2D  
itself will not draw a 0 pixel wide line.  You can try it



Ah, I stand corrected - I was taking "Quartz" to mean NSBezierPath,  
which of course is not strictly correct. My assumption was that the  
functionality exhibited by NSBezierPath came up from Quartz, but I see  
now that's not the case.


G.
___

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

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

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 is [nil aMessage] a no-op?

2008-04-18 Thread Citizen


On 18 Apr 2008, at 05:56, Adam P Jenkins wrote:



On Apr 18, 2008, at 12:47 AM, Bill Bumgarner wrote:


On Apr 17, 2008, at 11:20 PM, Adam P Jenkins wrote:
Exactly.  And now that the convention of methods returning self no  
longer exists, it seems like there's no longer any advantage to  
this behavior.


There are 10s of thousands invocations of methods on nil objects  
during the normal, non-error-path, execution of your average Cocoa  
application that indicate that this behavior is still, very much,  
used to the advantage (where 'advantage == convenience') of Cocoa  
programmers.



Can you give an example of where invoking methods on nil objects  
would make sense in a non-error-path situation?   I'm not trying to  
be argumentative here, I'm really curious to know what Objective-C  
idioms take advantage of the nil-swallows-messages behavior.  Thank  
you.


Do these count?

1.
// add user defined savepath to savepath menu
NSString * userpath = [[NSUserDefaults standardUserDefaults]  
objectForKey:ZNCDRevPrefUserDefinedSavepathKey];

if (userpath) {
	[savepathPopUpButton insertItemWithTitle:[[NSFileManager  
defaultManager] displayNameAtPath:userpath] atIndex:2];

NSMenuItem * userDefinedMenuItem = [savepathPopUpButton itemAtIndex:2];
[userDefinedMenuItem setTag:CDRevPrefUserDefinedSaveMethod];
}

2.
- (BOOL) isPreEmphasisEnabledForSession:(int)aSession track:(int)aTrack;
{
	return [[[self TOCPlist] objectForKey:ZNDiscTOCSessionsKey]  
objectAtIndex:(aSession-1)]  
objectForKey:ZNDiscTOCSessionTrackArrayKey] objectAtIndex:(aTrack-1)]  
objectForKey:ZNDiscTOCTrackPreEmphasisEnabledFlagKey] boolValue];

}

If not nil messaging certainly makes life easier in these situations.

- Dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Scott Thompson
Setting a line width of 0 draws a 1-pixel wide line at the  
resolution of the device it draws to, so on screen, that's 1/72 of  
an inch (approx) on a printer 1/600 inch, say. It's a useful way to  
isolate drawing from any CTM scaling. This is handy for drawing a  
selection rect outline on top of a zoomed image where you don't want  
the selection itself to be scaled up (among many other uses). So  
yes, I'd say it works - and Quartz most definitely does draw strokes  
with a line width of 0.


No, Quartz 2D does not draw zero width strokes.

If you use NSBezierPath and supply a stroke width of 0 then Cocoa will  
fudge the stroke width on your behalf and come up with something that  
approximates a single pixel line, but Quartz 2D itself will not draw a  
0 pixel wide line.  You can try it yourself:


- (void) drawRect: (NSRect) rectToDraw
{
// This, of course, will draw
	NSBezierPath *bezierPath = [NSBezierPath bezierPathWithRect:  
NSMakeRect(20, 20, 150, 150)];

[bezierPath setLineWidth: 1];
[[NSColor blueColor] set];
[bezierPath stroke];

	// This also will draw because Cocoa is nice and fudges the  
underlying Quartz drawing for you
	bezierPath = [NSBezierPath bezierPathWithRect: NSMakeRect(10, 10,  
200, 200)];

[bezierPath setLineWidth: 0];
[[NSColor redColor] set];
[bezierPath stroke];

	// This will not draw anything because Quartz does not draw zero  
width lines.
	CGContextRef cgContext = (CGContextRef) [[NSGraphicsContext  
currentContext] graphicsPort];

CGContextSetLineWidth(cgContext, 0);
CGContextSetRGBStrokeColor(cgContext, 0.0, 1.0, 0.0, 1.0);
CGContextAddRect(cgContext, CGRectMake(5, 5, 150, 150));
CGContextStrokePath(cgContext);
}
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Peter Zegelin


On 18/04/2008, at 11:06 PM, Graham Cox wrote:



On 18 Apr 2008, at 11:01 pm, Peter Zegelin wrote:
Weird - I just set the stroke width of my selection rectangle to 0  
and didn't get anything.


Peter



What function is drawing? I'm not sure this works with  
NSFrameRectWithWidth(), but it definitely does with NSBezierPath/ 
stroke.




I'm using  CGContextSetLineWidth and then stoking with  
CGContextDrawPath.



G.


P.S. Thanks for your earlier suggestion - it got me thinking and  
having implemented it that way now (easy) it works really well.




Glad I could help.

regards,

Peter


NOTE: Have sent to Cocoa List as I accidently sent to you my earlier  
reply rather than to the list.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Peter Zegelin


On 18/04/2008, at 10:28 PM, Graham Cox wrote:



On 18 Apr 2008, at 10:19 pm, Scott Thompson wrote:


On Apr 17, 2008, at 4:28 AM, Heinrich Giesen wrote:



Sorry, pressed the wrong button.

And: if the bezier path shall always be drawn 1 pixel wide,  
independent

of resolution and scaling the lineWidth should be set to 0 (zero)


While this works for PostScript, it does not work for Quartz.   
Quartz 2D will not draw strokes with a zero width.


Scott



Setting a line width of 0 draws a 1-pixel wide line at the  
resolution of the device it draws to, so on screen, that's 1/72 of  
an inch (approx) on a printer 1/600 inch, say. It's a useful way to  
isolate drawing from any CTM scaling. This is handy for drawing a  
selection rect outline on top of a zoomed image where you don't want  
the selection itself to be scaled up (among many other uses). So  
yes, I'd say it works - and Quartz most definitely does draw strokes  
with a line width of 0.


Weird - I just set the stroke width of my selection rectangle to 0 and  
didn't get anything.


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: Another graphical challenge...

2008-04-18 Thread Richard Kennaway

Sorry, that should have gone just to the original poster.

-- Richard Kennaway
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Another graphical challenge...

2008-04-18 Thread Richard Kennaway

Quoting Graham Cox <[EMAIL PROTECTED]>:


This is not really a Cocoa-specific problem, but before I embark on a
long-winded quest, I just wonder if there's a solution out there
already.

Given two rectangles that overlap in some way, I need to create a list
of all the rectangles that make up the non-overlapping areas. In other
words it's the exclusive-OR of the two inputs, but broken down into a
list of rects (preferably the smallest number needed to make up the
result).


It made an interesting lunchtime exercise!  Here's one method, written  
in Matlab because that's what was to hand, but it should be clear  
enough how to write the same in any other language.  The code finds  
the part of a rectangle r1 outside a rectangle r2.  Repeat with r1 and  
r2 swapped to get the symmetric difference.  The only division into  
cases it needs is disjoint vs. non-disjoint.


%   r1 and r2 are rectangles represented as 4-element vectors
%[ xlo, xhi, ylo, yhi ].
%   The part of r1 outside r2 in general has 4 parts:
%+--+
%   r1 = |  rt  |
%|  |
%|...++.|
%|rl | r2 | rr  |
%|...++.|
%|  |
%|  rb  |
%|  |
%+--+
%   If r2 is not wholly inside r1 then one or more of the parts may be
%   empty.

XLO = 1;
XHI = 2;
YLO = 3;
YHI = 4;

% Deal with the disjoint case first.  This isn't entirely  
necessary, as the
% code for the general case will give a correct answer in the  
disjoint case,

% but it may unnecessarily split r1 into subrectangles.
if (r1(XLO) >= r2(XHI)) ...
|| (r1(XHI) <= r2(XLO)) ...
|| (r1(YLO) >= r2(YHI)) ...
|| (r1(YHI) <= r2(YLO))
% The rectangles are disjoint.
% Return r1 as the result.
return;
end

rightmostleft = max(r2(XHI),r1(XLO));
leftmostright = min(r2(XLO),r1(XHI));
upperlo = max(r2(YHI),r1(YLO));
lowerhi = min(r2(YLO),r1(YHI));
minYHI = min(r1(YHI),r2(YHI));
maxYLO = max(r1(YLO),r2(YLO));

% These are the four components of r1-r2. Return all the non-empty ones
% as the result.
rr = [ rightmostleft, r1(XHI), maxYLO, minYHI ];
rl = [ r1(XLO), leftmostright, maxYLO, minYHI ];
rt = [ r1(XLO), r1(XHI), upperlo, r1(YHI) ];
rb = [ r1(XLO), r1(XHI), r1(YLO), lowerhi ];

-- Richard Kennaway
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Graham Cox


On 18 Apr 2008, at 10:19 pm, Scott Thompson wrote:


On Apr 17, 2008, at 4:28 AM, Heinrich Giesen wrote:



Sorry, pressed the wrong button.

And: if the bezier path shall always be drawn 1 pixel wide,  
independent

of resolution and scaling the lineWidth should be set to 0 (zero)


While this works for PostScript, it does not work for Quartz.   
Quartz 2D will not draw strokes with a zero width.


Scott



Setting a line width of 0 draws a 1-pixel wide line at the resolution  
of the device it draws to, so on screen, that's 1/72 of an inch  
(approx) on a printer 1/600 inch, say. It's a useful way to isolate  
drawing from any CTM scaling. This is handy for drawing a selection  
rect outline on top of a zoomed image where you don't want the  
selection itself to be scaled up (among many other uses). So yes, I'd  
say it works - and Quartz most definitely does draw strokes with a  
line width of 0.



G.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: running out of NSPipes

2008-04-18 Thread Scott Ribe
> I have the function wrapped in an autorelease pool and have tried
> explicitly allocating and releasing the NSPipe.

Sre you sure the NSPipes are being dealloc'd? Are you sure you have sent
release/autorelease enough times? NSTask probably retains the NSPipes. Are
you reusing the same NSTask? If not, is the NSTask being dealloc'd, in other
words is it being released enough and is it alloc'd within the scope your
autorelease pool?
 
-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Scott Thompson


On Apr 17, 2008, at 4:28 AM, Heinrich Giesen wrote:



Sorry, pressed the wrong button.

And: if the bezier path shall always be drawn 1 pixel wide,  
independent

of resolution and scaling the lineWidth should be set to 0 (zero)


While this works for PostScript, it does not work for Quartz.  Quartz  
2D will not draw strokes with a zero width.


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: Mounting AFP Volume using Cocoa

2008-04-18 Thread Mike Abdullah


On 18 Apr 2008, at 12:52, JanakiRam wrote:


Hi Jens,
Thanks for the reply.

Can you provide some pointers on using FSVolumeMount API or some
CoreServices API.

If no API is available , then how Finder is able to connect to afp  
volume

using Connect to Server (Cmd+K). Any pointers on these is greatly
appreciated.

-JanakiRam.


Well the Finder almost certainly uses the aformentioned FSMountVolume  
APIs. This is probably a good starting point:


http://developer.apple.com/documentation/Carbon/Reference/File_Manager/Reference/reference.html#/ 
/apple_ref/c/func/FSMountServerVolumeSync




On Fri, Apr 18, 2008 at 11:53 AM, Jens Alfke <[EMAIL PROTECTED]>  
wrote:




On 17 Apr '08, at 1:19 PM, JanakiRam wrote:

 Is there any cocoa way to mount a volume silently by passing the  
user

name and password.



There is no Objective-C API; you'll have to use either CoreServices  
or

POSIX APIs.
I would look at the FSVolumeMount function.

—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/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: Mounting AFP Volume using Cocoa

2008-04-18 Thread JanakiRam
Hi Jens,
Thanks for the reply.

Can you provide some pointers on using FSVolumeMount API or some
CoreServices API.

If no API is available , then how Finder is able to connect to afp volume
using Connect to Server (Cmd+K). Any pointers on these is greatly
appreciated.

-JanakiRam.


On Fri, Apr 18, 2008 at 11:53 AM, Jens Alfke <[EMAIL PROTECTED]> wrote:

>
> On 17 Apr '08, at 1:19 PM, JanakiRam wrote:
>
>   Is there any cocoa way to mount a volume silently by passing the user
> > name and password.
> >
>
> There is no Objective-C API; you'll have to use either CoreServices or
> POSIX APIs.
> I would look at the FSVolumeMount function.
>
> —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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


how to get what tells fileURL has been changed by others

2008-04-18 Thread norio

Hi,

I'd like to know who tells NSDocument that its location has been  
changed by other apps and how to get the notification.


I'd like to hack before you notice something like "the document's  
location was changed, so do you want to save any other location?" when  
you open the file by an app and move the file to the other directory  
in Finder while editing the file.


Thank you,
Norio
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Mounting AFP Volume using Cocoa

2008-04-18 Thread Bill Cheeseman
on 2008-04-18 2:23 AM, Jens Alfke at [EMAIL PROTECTED] wrote:

> On 17 Apr '08, at 1:19 PM, JanakiRam wrote:
> 
>>   Is there any cocoa way to mount a volume silently by passing the
>> user name and password.
> 
> There is no Objective-C API; you'll have to use either CoreServices or
> POSIX APIs.
> I would look at the FSVolumeMount function.

Well, maybe this is stretching the "any cocoa way" requirement, but I
believe you could use NSAppleScript to run a simple AppleScript command
('mount volume', which takes optional user name and password parameters, or
'do shell script' with appropriate shell commands).

Instead of NSAppleScript you could use OSAKit, but it isn't technically
"Cocoa" by some definitions, although it is an Objective-C 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]


running out of NSPipes

2008-04-18 Thread justin webster

so I see at least one other thread on this topic but no real solution.

the situation is:
using NSTask to run a shell command and using the return.
all the NSTask stuff is in a separate function which gets called  
repeatedly from a loop.
works great until I run out out NSPipes - about 248 iterations before  
[NSPipe pipe] returns nil.
I have the function wrapped in an autorelease pool and have tried  
explicitly allocating and releasing the NSPipe.


the [myTask waitUntilExit] solution mentioned in another thread made  
no difference.


does anyone understand what causes this limitaion?

is there another way to get a return from the shell?
system() does what I need, as often as you like, except I can't get  
the return value.


cheers,
justin webster

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: OpenGL in a Visual iTunes Plugin

2008-04-18 Thread Paul Bailey
Since Cocoa is not an option, this is probably the wrong list to be
asking...  Maybe mac-opengl on this list server is more appropriate?

Cheers,

Paul

On Thu, Apr 17, 2008 at 8:43 PM, J. Todd Slack <
[EMAIL PROTECTED]> wrote:

> Hi All,
>
> I wish to create a UI using OpenGL for use in an ITunes Visualizer Plugin.
>
> Can anyone tell me how to get started?
>
> I have the Visualizer SDK already.
>
> Is there anything OpenGL wise that I have to download?
>
> Is there a tool, like Interface Builder, that I can drag and drop the
> interface and then use it?
>
> I basically need to generate Labels, Fields, buttons, standard controls.
> Since this is cross platform, Cocoa is not an option.
>
> Can anyone help?
>
> Thanks!
>
> -Jason
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bailey%40dreamshake.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: Why is [nil aMessage] a no-op?

2008-04-18 Thread ab_lists


On 18 Apr 2008, at 06:20, Adam P Jenkins wrote:

Of course (and as you have discovered), there are an awful lot of  
situations where a 'nil' return value is actually indicative of a  
serious problem -- something has failed that shouldn't have.  And  
tracking it down can be a pain.


Exactly.  And now that the convention of methods returning self no  
longer exists, it seems like there's no longer any advantage to this  
behavior.


Just invert the assumption: when you do care about things not being  
nil, encapsulate it in an "if" statement, otherwise don't bother. And  
document when a nil return value indicates a problem! IMHO this  
creates more readable code then the other way around. The examples of  
a possible dealloc implementation are trivial but to the point.


Like Mr. Bumgarner said it is all a matter of opinion. I always  
assumed the designers of the Objective-C language and Cocoa frameworks  
trust me to know what I'm doing while I find very elegant ways to  
shoot myself in the foot. I prefer this to a language and environment  
that treats me like a grunt and doesn't trust me every step of the way  
and I just end up with no hair left on my head.


Annard
___

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

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

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

This email sent to [EMAIL PROTECTED]


Another graphical challenge...

2008-04-18 Thread Graham Cox
This is not really a Cocoa-specific problem, but before I embark on a  
long-winded quest, I just wonder if there's a solution out there  
already.


Given two rectangles that overlap in some way, I need to create a list  
of all the rectangles that make up the non-overlapping areas. In other  
words it's the exclusive-OR of the two inputs, but broken down into a  
list of rects (preferably the smallest number needed to make up the  
result).


At first this seems quite trivial, but a quick exercise on paper  
suggests that there are 15 separate cases yielding between 0 and 4  
separate pieces per input rectangle. A brute force solution is  
probably not that hard but is there a more elegant way? A google  
search turns up some promising papers, but so far they all need some  
stupid subscription to read them (whatever happened to sharing  
knowledge for the good of mankind?)


What it's for: given a "before" update rect and an "after" update  
rect, the idea is only mark for refresh the difference. The case of  
before and after being equal or non-intersecting is trivial, but all  
the other possible intersecting cases are less obvious. The benefit of  
doing this should be much less drawing needed (at present I invalidate  
both before and after rects, i.e. the union).


I guess a prototype for the function might look something like:

NSSet*  NSExorRects( const NSRect a, const NSRect b );




--
S.O.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: Why is [nil aMessage] a no-op?

2008-04-18 Thread Gerriet M. Denkmann


On 18 Apr 2008, at 07:18, [EMAIL PROTECTED] wrote:


Date: Fri, 18 Apr 2008 00:56:13 -0400

On Apr 18, 2008, at 12:47 AM, Bill Bumgarner wrote:


On Apr 17, 2008, at 11:20 PM, Adam P Jenkins wrote:

Exactly.  And now that the convention of methods returning self no
longer exists, it seems like there's no longer any advantage to
this behavior.


There are 10s of thousands invocations of methods on nil objects
during the normal, non-error-path, execution of your average Cocoa
application that indicate that this behavior is still, very much,
used to the advantage (where 'advantage == convenience') of Cocoa
programmers.


Can you give an example of where invoking methods on nil objects would
make sense in a non-error-path situation?   I'm not trying to be
argumentative here, I'm really curious to know what Objective-C idioms
take advantage of the nil-swallows-messages behavior.  Thank you.


if ( [myContainer count] == 0)
{
	//	myContainer does not exist, or is empty. In both cases there is  
nothing for us  to do.

return;
}
//  do something with the things in myContainer...

if ([myObject isValid])
{
//  do something with myObject
}
else
{
//  no myObject or an invalid one. Do nothing.
}


Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting My NSTableView Delegate to Respond to Cut:Copy:Paste and Other Messages

2008-04-18 Thread Peter Zegelin


On 18/04/2008, at 4:53 PM, Jens Alfke wrote:



On 17 Apr '08, at 10:46 PM, Peter Zegelin wrote:

Is there some way of getting the delegate to respond to these  
messages?


Nope. Unfortunately, everyone has to do what you did (subclass  
NSTableView) just to make the table follow the HI Guidelines. Sigh.


—Jens


Ok - thanks!

I actually also tried to make my NSTableView subclass the delegate and  
data provider itself (again so I could have 1 class instead of two)  
but while my project ran I couldn't really get it to work correctly.


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]