Trying to calculate a running total using Core Data

2008-04-21 Thread Felix Rodriguez
I am trying to figure out how to calculate a running total using core  
data. I have created an entity called Transactions that have the  
following properties.


Transactions
amount
balance


I am trying to calculate the balance by adding up the amount of all  
the previous balances. I have subclased NSManagedObject and  
overridden awakeFromFetch. Here is the code I have so far.


- (void)awakeFromFetch
{
[super awakeFromFetch];

double amount = [[self valueForKey:@"amount"] doubleValue];
[self setValue:[NSNumber numberWithFloat:amount]  
forKey:@"balance"];

}

This routine only copies the amount to the balance property. I am  
thinking that I have to Query all of the previous transactions and  
calculate their totals. I know how to create a NSFetchRequest on a  
transaction object but I am unsure on how to create the NSPredicate  
object to extract all the transactions that were created prior to the  
current transaction. Thanks for any help you can provide.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: After Unarchive Object Exists, After First GUI Action, gone...

2008-04-21 Thread Andrew Farmer

On 20 Apr 08, at 18:55, John Joyce wrote:
Looks like I found a solution... anyone please let me know if my  
solution stinks. (or any of the rest of this thing!)

In the method
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
I added this:
[textView setString:[[stickitNotes objectAtIndex:0] noteBody]];


A few general notes:

1. You should never have to call setNeedsDisplay: on anything except  
self (in NSView subclasses). A properly written view will do that on  
its own when its contents change.


2. There's a lot of duplication in your code. You should probably  
factor out some common code into a new method (updateCurrentNotes?  
setNoteIndex?). Alternatively, you may want to take a look at Cocoa  
Bindings - in particular, NSArrayController - which should be able to  
do a lot of this work for you.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Implementing a Slightly Unusual NSTableView

2008-04-21 Thread Peter Zegelin

Thanks Graham - I have updated my code as well.

I also think I solved the focus problem. Tried most of the responder  
methods without luck so I took a different tack. I realized that I  
would only have 3 views that could grab the focus so I created a  
global variable 'currentResponder'  (will make it local to the window  
when I figure out how) and set it in becomeFirstResponder of the other  
views. Then in my 'special' tableview if I am clicking on a checkbox I  
just call:


[[self window] makeFirstResponder: currentResponder];

to set the focus back to the original view. Works like a treat even if  
it seems a bit of  a hack.


regards,

Peter
www.fracturedSoftware.com


On 21/04/2008, at 12:36 AM, Graham Cox wrote:


I just noticed a bug in the code I posted - it should be:

- mouseDown:
...

	if ([dataCell trackMouse:event inRect:cellFrame ofView:self  
untilMouseUp:YES])

{
// call the datasource to handle the checkbox state change as 
normal
		[[self dataSource] tableView:self setObjectValue:[dataCell  
objectValue] forTableColumn:theColumn row:row];

}
...


previously I passed dataCell directly, not [datacell objectValue],  
and I passed it to the delegate, not the dataSource.


In fact passing  works with many cell types such as  
buttons and checkboxes because they happen to implement methods such  
as stringValue and so on, but if you use a custom cell that returns  
something like a colour for example, that doesn't work. The delegate/ 
datasource mixup is another thing I got away with as usually they  
happen to be the same.


To be honest I'm having to sort of guess how the tableview is  
actually calling its dataSource, so this could still be wrong, but  
so far this handles all the cases I've thrown at it (admittedly not  
that many, but includes a variety of standard and custom cells).


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: Trying to calculate a running total using Core Data

2008-04-21 Thread I. Savant
I know how to create a NSFetchRequest on a transaction object but I  
am unsure on how to create the NSPredicate object to extract all the  
transactions that were created prior to the current transaction.



  How about consulting the documentation?

Fetching (trust me - re-read this)
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html

Predicates Programming Guide (useful for the future, but probably not  
needed in your case right now)

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html

I am trying to figure out how to calculate a running total using  
core data.


  Keep this in mind:

Set & Array Operators (directly relevant)
http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html

  Interestingly, the example used in the above is similar to what  
you're doing ...


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


Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Daniel Thorpe

Hello everyone,

I can't seem to get this to work, yet it seems like it should be so  
easy. I have an NSBitmapImageRep, and I want to crop it to a given  
NSRect. The code I've attempted so far is this:


// Create an NSImage for the current image rep
NSImage *source = [[NSImage alloc] init];

// Add the image rep to the source
[source addRepresentation:imageRep];

// Let's just write this to file
	[[source TIFFRepresentation] writeToFile:[NSString stringWithFormat:@"[EMAIL PROTECTED] 
", label] atomically:YES];


	self.extent = [imageRep nonZeroBounds];	// This is our NSRect,  
computed using a category method of NSBitmapImageRep


NSImage *target = [[NSImage alloc] initWithSize:extent.size];   

// Set the target as the current drawing context
[target lockFocus];
// Composite a rectange of the source to a point in the target
[[NSGraphicsContext currentContext] setShouldAntialias:NO];
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];

[target unlockFocus];

// Let's just write this to file
	[[target TIFFRepresentation] writeToFile:[NSString stringWithFormat:@"[EMAIL PROTECTED] 
", label] atomically:YES];


I've not really used Quartz before, but this seems to be how all these  
methods work. Although it's not working, the cropped image is the  
right size, but is just black and doesn't contain the right rect of  
the source image... what am I doing wrong?


As always, the help from people on the list is really appreciated,  
thanks!


Cheers
Dan

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Complex data for webservices

2008-04-21 Thread Niklas Saers

Just a short update with new questions:

On Apr 20, 2008, at 2:07 PM, Niklas Saers wrote:
So I know I have to create some kind of CFTypeRef, but how do I make  
a CFTypeRef object to match the Authentication class definition  
above? And how do I make a CFTypeRef to match an array of  
Authentication objects?


As far as I've understood, the CFTypeRef is an NSDictionary, and the  
NSDictionary will represent any complex type. For the Authentication  
object, I provide a dictionary with a datatype (I believe it's  
supposed to be "xsd:Authentication") and the two named parameters. I  
have not found a way to declare what datatype they are, so this is  
what I do:


NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
[dict setObject:self.username forKey:@"username"];
[dict setObject:self.password forKey:@"password"];
[dict setObject:@"xsd:Authentication" forKey:(NSString*) kWSRecordType];

From myService.asmx I have defined TestAuthentication that is a SOAP- 
based webservice living on an MS-IIS server, specified:

(bool) TestAuthentication(Authentication auth);

So I've #import'ed testStub.h and do the following to invoke the call:

TestAuthentication *WS = [[TestAuthentication alloc] init];
[WS setCallBack:(id)self  
selector:@selector(testAuthenticationCompleted:)];

[WS setParameters:param];
[WS scheduleOnRunLoop:(NSRunLoop*)CFRunLoopGetCurrent() mode:(NSString  
*)kCFRunLoopDefaultMode];


Finally I've created a function for the selector:
- (id) testAuthenticationCompleted:(WSGeneratedObj*)invocation;

The function runs to its end, but shortly after my program crashes  
with a "Bus error". I believe that perhaps I should define the  
selector function differently, but I don't know what it should look  
like. So instead of doing it asyncronous I try calling it  
syncronously, and just to be sure I add a bit of logging:


TestAuthentication *WS = [[TestAuthentication alloc] init];
[WS setParameters:param];
NSLog(@"isComplete == %d, isFault == %d, true == %d", [WS isComplete],  
[WS isFault], YES);


What's strange here is that isFault is true: isComplete == 1, isFault  
== 1, true == 1
So I guess my NSDictionary is invalid since all I've done is pass it  
the parameters.


Another thing that I find strange is that the webservice is called  
upon [[TestAuthentication alloc] init], even though in my mind it  
should not have been executed until I call something like

[[WS getRef] executeCommand]

I hope that my explanation is good enough that you understand what my  
problems are and can help me out. As you know, documentation isn't  
great on this topic, and I've been unable to find sample code that  
does this for complex data types.


Sincerely yours

Nik
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Graham Cox


On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];



Try using NSCompositeSourceCopy here instead.


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]


Getting current NSViewAnimation coordinates

2008-04-21 Thread Thomas Engelmeier

Hi,

I have some code that sometimes needs to cancel aka stop a running  
NSViewAnimation and start another. It seems on Tiger the real view  
coordinates are animated but on Leopard only an proxy is anmiated.. -  
on Leopard the view with the stopped animation is very visibly redrawn  
at the original coordinate and before the new animation starts.


Is there any way to gather the calculated animation coordinates short  
of interpolating the (end - start) * currentValue  coordintes myself?


TIA,
Tom_E
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Graham Cox

Oops, I meant NSCompositeCopy

g.

On 21 Apr 2008, at 9:55 pm, Graham Cox wrote:


On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];



Try using NSCompositeSourceCopy here instead.


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/graham.cox%40bigpond.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: Complex data for webservices

2008-04-21 Thread Niklas Saers

Just a short PS

On Apr 21, 2008, at 1:45 PM, Niklas Saers wrote:

TestAuthentication *WS = [[TestAuthentication alloc] init];
[WS setParameters:param];
NSLog(@"isComplete == %d, isFault == %d, true == %d", [WS  
isComplete], [WS isFault], YES);


I hadn't noticed that static functions were also present in the stubs,  
so I tried them but got the same results. I added a NSLog there as  
well, and got the same result:


+ (id) TestAuthentication:(CFTypeRef) in_parameters
{
id result = NULL;
TestAuthentication* _invocation = [[TestAuthentication alloc]  
init];

[_invocation setParameters: in_parameters];
result = [[_invocation resultValue] retain];
NSLog(@"debug: isComplete: %d, isFault: %d, true: %d",  
[_invocation isComplete], [_invocation isFault], YES);

[_invocation release];
return result;
}

output: debug: isComplete: 1, isFault: 1, true: 1

To decouple this from the complex types, I wrote a little webservice  
in C# for MS-IIS called testInt that I've verified with SOAP Client  
from Scandalous Software that behaves correctly:


[WebMethod]
int testInt() {
  return 5;
}

that returns

http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema 
 instance"xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>

-
-
--5




Again I added debug info to the code:
+ (id) testInt:(CFTypeRef) in_parameters
{
id result = NULL;
testInt* _invocation = [[testInt alloc] init];
[_invocation setParameters: in_parameters];
result = [[_invocation resultValue] retain];
	NSLog(@"debug: isComplete: %d, isFault: %d, true: %d", [_invocation  
isComplete], [_invocation isFault], YES);

[_invocation release];
return result;
}

and again it failed: debug: isComplete: 1, isFault: 1, true: 1

My call in this case was:
[Service1Service testInt:[[NSDictionary alloc] init]];

That is, an empty dictionary, so no parameters. I tried passing nil,  
but then it just crashed


For the authentication I called:
NSDictionary *serviceDict = (NSDictionary*) [myServiceService  
TestAuthentication:param];

NSLog(@"Entries: %d", [serviceDict count]);

and I got: "Entries: 0"

So either way isFault returns YES, and either way I get an empty  
NSDictionary back. Why is this, and how do I get it to return  
correctly? (you'd think it'd be easy enough calling an "int  
function()" ;-) )


Cheers

Nik
___

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

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

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

This email sent to [EMAIL PROTECTED]


Crash when dispaying document in iChat Theater

2008-04-21 Thread Antonio Nunes

Hi,

I'm trying to implement iChat Theater capability into my garbage  
collected app, and it looks to be almost working, except for a rather  
all important crash. When my app is notified that it should start  
sending video it executes the following code:


IMAVManager *manager = [IMAVManager sharedAVManager];
MyDocument *d;

switch ([manager state])
{
case IMAVRequested:
			d = [[NSDocumentController sharedDocumentController] documentForURL: 
[manager URLToShare]];

if (d == nil) {
d = [[NSDocumentController sharedDocumentController]  
openDocumentWithContentsOfURL:[manager URLToShare] display:YES];

}
[manager setVideoDataSource:d.someView];
[manager start];
break;
}

someView has subviews, including a PDFView subclass. I have tried  
setting the data source to the PDFView and to the PDFView's  
documentView, but the result is always the same.


When I start a session the theater mode activates and I can see my  
document in the iChat window. All is well until anything causes a  
redraw of the view being displayed, at which point there is either a  
crash, or an error that leads to a crash if I try to continue  
execution. Here are the backtraces of the two types of crash:


#0  0x956bb6e8 in objc_msgSend ()
#1  0x90a2f337 in _pixelBufferReleaseCallback ()
#2  0x93079d78 in CVPixelBufferBacking::finalize ()
#3  0x9307242e in CVPixelBuffer::finalize ()
#4  0x90a21de9 in -[IMAuxVideoProvider _fillBufferFromPool:atRate:] ()
#5  0x90a21bfe in -[IMAuxVideoProvider _callbackThreadMain] ()
#6  0x95d735ad in -[NSThread main] ()
#7  0x95d73154 in __NSThread__main__ ()
#8  0x95440c55 in _pthread_start ()
#9  0x95440b12 in thread_start ()


#0  0x956b00d7 in objc_exception_throw ()
#1  0x927e844a in -[NSObject doesNotRecognizeSelector:] ()
#2  0x927e6a4c in ___forwarding___ ()
#3  0x927e6b12 in __forwarding_prep_0___ ()
#4  0x90a2f337 in _pixelBufferReleaseCallback ()
#5  0x93079d78 in CVPixelBufferBacking::finalize ()
#6  0x9307242e in CVPixelBuffer::finalize ()
#7  0x90a21de9 in -[IMAuxVideoProvider _fillBufferFromPool:atRate:] ()
#8  0x90a21bfe in -[IMAuxVideoProvider _callbackThreadMain] ()
#9  0x95d735ad in -[NSThread main] ()
#10 0x95d73154 in __NSThread__main__ ()
#11 0x95440c55 in _pthread_start ()
#12 0x95440b12 in thread_start ()

The second problem (doesNotRecognizeSelector:) I've so far only seen  
once, usually there is a straight crash (bad access). This looks like  
a framework bug to me, but I thought I'd ask here if anybody has any  
other ideas, or similar experience to share, before filing a bug report.


-António

---
Some things have to be believed to be seen.

--Ralph Hodgson
---___

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

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

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

This email sent to [EMAIL PROTECTED]


Fullscreen mode detection from background

2008-04-21 Thread Peter Hoerster

Hi,
is there a method to detect from the background if a foreground program 
is running in fullscreen mode?
I have to hide a floating panel when a video or game software is running 
fullscreen.

Thanks in advance.
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: Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Daniel Thorpe
Thanks Graham, I've just tried NSCompositeCopy, still doesn't work, no  
change...


One thing that I've noticed though, is that the source is a grayscale  
image, but the image that I'm creating is RGB. Should I perhaps be  
creating a new bitmap image rep in the target (of the same colorSpace)  
before calling the compositeToPoint method?


Cheers
Dan

On 21 Apr 2008, at 12:57, Graham Cox wrote:


Oops, I meant NSCompositeCopy

g.

On 21 Apr 2008, at 9:55 pm, Graham Cox wrote:


On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];



Try using NSCompositeSourceCopy here instead.


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/graham.cox%40bigpond.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: Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Graham Cox

Hard to tell from the code posted. Maybe extent is incorrect?

You can just draw the source imageRep directly - you don't have to  
wrap it in an image, and given that you just want a straight copy  
it'll be simpler too. Use [imageRep drawAtPoint:...] This may not have  
a bearing on your problem but the simpler the code, the easier to  
debug :)


Having different colourspaces shouldn't matter - the drawing operation  
will convert the image as necessary.




G.



On 21 Apr 2008, at 10:23 pm, Daniel Thorpe wrote:
Thanks Graham, I've just tried NSCompositeCopy, still doesn't work,  
no change...


One thing that I've noticed though, is that the source is a  
grayscale image, but the image that I'm creating is RGB. Should I  
perhaps be creating a new bitmap image rep in the target (of the  
same colorSpace) before calling the compositeToPoint method?


Cheers
Dan

On 21 Apr 2008, at 12:57, Graham Cox wrote:


Oops, I meant NSCompositeCopy

g.

On 21 Apr 2008, at 9:55 pm, Graham Cox wrote:


On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];



Try using NSCompositeSourceCopy here instead.


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/graham.cox%40bigpond.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: After Unarchive Object Exists, After First GUI Action, gone...

2008-04-21 Thread John Joyce


On Apr 21, 2008, at 6:45 AM, [EMAIL PROTECTED] wrote:


Date: Mon, 21 Apr 2008 01:16:56 -0700
From: Andrew Farmer <[EMAIL PROTECTED]>
Subject: Re: After Unarchive Object Exists, After First GUI Action,
gone...
To: John Joyce <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On 20 Apr 08, at 18:55, John Joyce wrote:

Looks like I found a solution... anyone please let me know if my
solution stinks. (or any of the rest of this thing!)
In the method
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
I added this:
[textView setString:[[stickitNotes objectAtIndex:0] noteBody]];


A few general notes:

1. You should never have to call setNeedsDisplay: on anything except
self (in NSView subclasses). A properly written view will do that on
its own when its contents change.

2. There's a lot of duplication in your code. You should probably
factor out some common code into a new method (updateCurrentNotes?
setNoteIndex?). Alternatively, you may want to take a look at Cocoa
Bindings - in particular, NSArrayController - which should be able to
do a lot of this work for you.
Thanks Andrew, yep, that's where I picked up setNeedsDisplay, so I  
was just trying it to see if I was missing something.
As for the duplication, yeah, I am aware of it, but refactoring can  
come in after functionality for this. I've worked with Ruby a lot so  
I'm willing to write rough drafts and fix it later.


I agree and was thinking that Bindings would possibly be the way to  
go for this. I actually just lifted large bits of the thing from the  
Hillegass book's RaiseMan application, which is a terrible app that  
introduces a lot of different elements of Cocoa at once.
the trickiest part of bindings seems to me to be the key paths.  
Getting those right (and some of the settings in the inspector  
palette in IB) is a bit mysterious. Do bindings rely mainly on  
NSDictionary or do they work well with NSArray too? In this case, I'm  
building a note app to replace stickies for a very specific workflow.  
I just need it to be fast and stable with a small footprint. Things  
could be refactored to use dictionaries for more meta data, and  
probably will be, but NSArray seems to be the fastest lookup and is  
already sequential.


But for now I'm just trying to wrap my head around enough of the  
Cocoa basics.
In particular, after Ruby (not even Rails necessarily) I feel quite  
comfortable with Objective C and Cocoa, but sometimes I feel like  
methods I should have are not there, or I can't guess the name of  
them. It's probably me thinking Ruby, but I often feel like I'm just  
missing methods for NSArray...


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Daniel Thorpe

The extent rect is correct, I've double checked that.

Looking at the docs for NSImageRep's drawAtPoint and drawInRect  
methods, it looks like they only allow you to draw the whole image  
rep, not a rect within the rep.


I think the problem might be that the cropping is working fine, it's  
just that I'm not viewing the result correctly, if I print out the  
description of the result's representations array, I get this:


NSCachedImageRep 0x1f6b30 Size={101, 120}  
ColorSpace=NSCalibratedRGBColorSpace BPS=8 Pixels=101x120 Alpha=YES


So, perhaps the TIFFRepresention method of the NSImage doesn't  
actually return the pixels? Perhaps?


Cheers
Dan

On 21 Apr 2008, at 13:41, Graham Cox wrote:


Hard to tell from the code posted. Maybe extent is incorrect?

You can just draw the source imageRep directly - you don't have to  
wrap it in an image, and given that you just want a straight copy  
it'll be simpler too. Use [imageRep drawAtPoint:...] This may not  
have a bearing on your problem but the simpler the code, the easier  
to debug :)


Having different colourspaces shouldn't matter - the drawing  
operation will convert the image as necessary.




G.



On 21 Apr 2008, at 10:23 pm, Daniel Thorpe wrote:
Thanks Graham, I've just tried NSCompositeCopy, still doesn't work,  
no change...


One thing that I've noticed though, is that the source is a  
grayscale image, but the image that I'm creating is RGB. Should I  
perhaps be creating a new bitmap image rep in the target (of the  
same colorSpace) before calling the compositeToPoint method?


Cheers
Dan

On 21 Apr 2008, at 12:57, Graham Cox wrote:


Oops, I meant NSCompositeCopy

g.

On 21 Apr 2008, at 9:55 pm, Graham Cox wrote:


On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];



Try using NSCompositeSourceCopy here instead.


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/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]








___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A cursor bug in DragItemAround example

2008-04-21 Thread Ling Wang
Cursor-tracking glitches, where the cursor doesn't revert when  
exiting a view, are really common in Cocoa apps. I see them in all  
kinds of apps, even major Apple ones like Mail and Xcode. I think  
it's due to bugs in AppKit, unfortunately. These bugs have been  
around since at least 10.0, but they've never been fully tracked  
down and fixed.


—Jens
Do you mean that it is unclear why this happens and there is no way  
for application developers to avoid this annoyance?___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: Complex data for webservices

2008-04-21 Thread Jeff LaMarche

Niklas:

I'm no expert on Web Services on Objective-C, but I've been playing  
around with them a bit.  One thing that I have discovered is that  
CFTypeRef is not _always_ a dictionary. In some cases, it wants a  
string. For example, if you run WSMakeStubs on the National Weather  
Service's WSDL :


http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl

Several of the CFRefType arguments in the class methods actually need  
to be specified as NSStrings not as NSDictionary instances, something  
I only discovered after a lot of failed attempts to use it.  
Unfortunately, the documentation for WSMakeStubs and the web services  
part of CoreServices, AFAIK, doesn't give detailed information on how  
to know when CFRefType refers to a dictionary and when it's something  
else like an NSString in your generated stubs.


Without knowing what your web service looks like I don't think I can  
be any more helpful than that. Have you used the debugger to step  
through the setParameters: method while it's running? You might be  
able to tell what it's looking for by doing that. That was how I  
figured out to pass in a space delimited list as an NSString rather  
than a dictionary.


Sorry I can't be more helpful,
Jeff

On Apr 21, 2008, at 8:15 AM, Niklas Saers wrote:


Just a short PS

On Apr 21, 2008, at 1:45 PM, Niklas Saers wrote:

TestAuthentication *WS = [[TestAuthentication alloc] init];
[WS setParameters:param];
NSLog(@"isComplete == %d, isFault == %d, true == %d", [WS  
isComplete], [WS isFault], YES);


I hadn't noticed that static functions were also present in the  
stubs, so I tried them but got the same results. I added a NSLog  
there as well, and got the same result:


+ (id) TestAuthentication:(CFTypeRef) in_parameters
{
   id result = NULL;
   TestAuthentication* _invocation = [[TestAuthentication alloc]  
init];

   [_invocation setParameters: in_parameters];
   result = [[_invocation resultValue] retain];
   NSLog(@"debug: isComplete: %d, isFault: %d, true: %d",  
[_invocation isComplete], [_invocation isFault], YES);

   [_invocation release];
   return result;
}

output: debug: isComplete: 1, isFault: 1, true: 1

To decouple this from the complex types, I wrote a little webservice  
in C# for MS-IIS called testInt that I've verified with SOAP Client  
from Scandalous Software that behaves correctly:


[WebMethod]
int testInt() {
 return 5;
}

that returns

http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema 
 instance"xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>

-
-
--5




Again I added debug info to the code:
+ (id) testInt:(CFTypeRef) in_parameters
{
   id result = NULL;
   testInt* _invocation = [[testInt alloc] init];
   [_invocation setParameters: in_parameters];
   result = [[_invocation resultValue] retain];
	NSLog(@"debug: isComplete: %d, isFault: %d, true: %d", [_invocation  
isComplete], [_invocation isFault], YES);

   [_invocation release];
   return result;
}

and again it failed: debug: isComplete: 1, isFault: 1, true: 1

My call in this case was:
[Service1Service testInt:[[NSDictionary alloc] init]];

That is, an empty dictionary, so no parameters. I tried passing nil,  
but then it just crashed


For the authentication I called:
NSDictionary *serviceDict = (NSDictionary*) [myServiceService  
TestAuthentication:param];

NSLog(@"Entries: %d", [serviceDict count]);

and I got: "Entries: 0"

So either way isFault returns YES, and either way I get an empty  
NSDictionary back. Why is this, and how do I get it to return  
correctly? (you'd think it'd be easy enough calling an "int  
function()" ;-) )


Cheers

Nik
___

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

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

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


Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Ewan Delanoy
 Hello all,


in the user interface of my Cocoa app  I have a button with two
alternative titles,
one that I write in Interface Builder and the other appears on a line in
my code as
follows,


  [theButton setTitle:[NSString stringWithFormat:@"Put a n with a
tilde,like this : %c",0X00F1]];

Unfortunately, at runtime the exotic character is displayed incorrectly:
it appears as
a "breve" (Unicode character number 02D8 instead of 00F1).

 It seems clear that this is a conflicting encoding issue, but between
which encodings?
coming from where? (The default file encoding is "Unicode UTF-8" in the
Xcode preferences, and it seems there is no item to deal with encodings in
the Interface Builder's preferences)

 I thought at first that the problem came from my not localizing the Cocoa
project (I localize only at the very end), but even when I made the adhoc
localization the problem persisted.

Ewan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Binding NSButton enabled state

2008-04-21 Thread Lorenzo Thurman
> Message: 1
> Date: Sun, 20 Apr 2008 14:02:52 -0600
> From: Keary Suska <[EMAIL PROTECTED]>
> Subject: Re: Binding NSButton enabled state
> To: "Cocoa-Dev (Apple)" 
> Message-ID: <[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> >
> Content-Type: text/plain;   charset="US-ASCII"
>
> on 4/20/08 11:47 AM, [EMAIL PROTECTED] purportedly said:
>
> > On Sat, Apr 19, 2008 at 11:55 PM, Chris Hanson <[EMAIL PROTECTED]> wrote:
> >
> >> On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
> >>
> >>  I have two NSTableViews, tableA and tableB, each managed by separate
> >>> NSArrayControllers. When a selection is made in either table, an
> >>> instance
> >>> variable is set. I want to have an NSButton's enabled state to 'YES'
> >>> whenever the instance variable is set.
> >>>
> >>
> >> Don't think of it as an instance variable, think of it as a property.
> >>  Restating your problem, you want your "Do Something" button's enabled
> >> property to be bound to your window controller's "can do something"
> >> property.
> >>
> >> What this means is that you need to manipulate your window controller's
> >> "can do something" property in a way that things bound to it can notice
> --
> >> in other words, in a way that will post key-value observing
> notifications.
> >>  Thus instead of manipulating it as an instance variable, you should
> just
> >> always invoke its setter.
> >>
> >> You haven't said how you're actually noticing that the selection in one
> of
> >> your tables has changed; I assume you're either using an NSTableView
> >> delegate method or a notification to do so.
> >>
> >>  -- Chris
> >>
> >>
> > Here's my code:I register to receive these notifications when the
> selection
> > changes.
> >
> > -(void)applicationDidFinishLaunching:(NSNotification*)not{
> >
> >
> >  [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > usTableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:usCityTable];
> >
> > [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > intlableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:intlTable];
> >
> > }
> >
> >
> > These are the messages sent when  a selection is changed (Is there a way
> to
> > use just one?):
>
> Yes, if instead you make your controlling object the delegate to both
> tableviews and implement -tableViewSelectionDidChange:.
>
> > -(void) usTableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [usTableContent selectedObjects];
> >
> >  if([selObjs count] > 0) {
> >
> > [intlTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> > }
> >
> > -(void) intlableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [intlTableContent selectedObjects];
> >
> >  if([selObjs count] > 0){
> >
> > [cityTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> >
> > }
>
> Note that when you call -deselectAll:, that triggers an
> NSTableViewSelectionDidChangeNotification, so you may want to watch out.
> Your checks probably avoid loops, but the notifications will get sent more
> often than is necessary.
>
> Anyway, what kind of object is "location"? Are you applying any
> transformers? If not, how are you considering how your object will get
> coerced into a boolean?
>
> HTH,
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
>
>
> I'll look at the tableview deleegates again. I looked at those before, but
reasoned that they might not work as I would like, but I can't remember why.
Thanks for pointing out the potential for looping and the extra
notifications that get sent, but the problem I ran into without the
deselectAll, was that if I made a selection in tableA, my interface updated
correctly, then made a selection in tableB, my interface updated correctly,
but then made the same selection again in tableA as before, my interface did
not update correctly (since technically, there was no change in the
selection of tableA, so the notification is not sent). The selections in the
tables are mutually exclusive. That's an important point I neglected to add
to my original post. By the way, the "location" variable is an NSString. The
window cannot be dismissed using "Save" unless "location" actually has a
value, other than @"", of course. (there is a "Cancel" button). This is a
preferences window that cannot be dismissed using "Save" until "location" is
set or the cancel button is selected. Once it's set, the next time the user
opens the prefs, the "Save" button is enabled, since "location" takes its

Re: Cropping an NSBitmapImageRep to a given NSRect?

2008-04-21 Thread Graham Cox


On 21 Apr 2008, at 11:21 pm, Daniel Thorpe wrote:

The extent rect is correct, I've double checked that.

Looking at the docs for NSImageRep's drawAtPoint and drawInRect  
methods, it looks like they only allow you to draw the whole image  
rep, not a rect within the rep.


True, but if you don't need to scale the image, it's fine - just  
offset the point to the negative of the origin of the desired source  
rectangle. Only the pixels that the destination needs are copied.


I think the problem might be that the cropping is working fine, it's  
just that I'm not viewing the result correctly, if I print out the  
description of the result's representations array, I get this:


NSCachedImageRep 0x1f6b30 Size={101, 120}  
ColorSpace=NSCalibratedRGBColorSpace BPS=8 Pixels=101x120 Alpha=YES


So, perhaps the TIFFRepresention method of the NSImage doesn't  
actually return the pixels? Perhaps?


-TIFFRepresentation just creates the data on the fly (after all, it  
returns NSData, not an NSImageRep).


I'm wondering if the black image is to do with the alpha of your  
source image? - often problems with alpha produce a black result. But  
I'm afraid I can't really suggest anything to try here. I think what  
you're doing is basically correct though - I've frequently done much  
the same and had good results.


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: Cropping an NSBitmapImageRep to a given NSRect? [Solved]

2008-04-21 Thread Daniel Thorpe
Right, well, I've solved my problem, but using a completely different  
method. I still don't know/understand how to crop an NSImage to a  
smaller NSRect within the image's bounds.


However, this is what I've done to solve this...

// imageRep is my NSBitmapImageRep which contains the original image,
	// extent is now a NSRect that defines a rectangle within imageRep  
that we wish to crop to

self.extent = [imageRep nonZeroBounds]; 

// Target is an NSImage which we're going to create
NSImage *target = [[NSImage alloc] initWithSize:extent.size];
[target addRepresentation:[imageRep cropToRect:extent]];


And this uses a category method on NSBitmapImageRep, called  
cropToRect: which is as follows:


- (NSBitmapImageRep *)cropToRect:(NSRect)rect {
/* This method retuns a NSBitmapImage containing the
rectangle defined by the input bounds */

	CGImageRef cgImg = CGImageCreateWithImageInRect([self CGImage],  
NSRectToCGRect(rect));
	NSBitmapImageRep *result = [[NSBitmapImageRep alloc]  
initWithCGImage:cgImg];

CGImageRelease(cgImg);  
return [result autorelease];
}   

Anyway, this works a treat, and for my needs is actually pretty good,  
as I'm just manipulating NSBitmapImageReps, not NSImages.


Thanks for your help Graham!

Cheers
Dan

p.s. I've just seen your most recent email, so I'll try using the  
drawAtPoint using a negative origin.



On 21 Apr 2008, at 13:41, Graham Cox wrote:


Hard to tell from the code posted. Maybe extent is incorrect?

You can just draw the source imageRep directly - you don't have to  
wrap it in an image, and given that you just want a straight copy  
it'll be simpler too. Use [imageRep drawAtPoint:...] This may not  
have a bearing on your problem but the simpler the code, the easier  
to debug :)


Having different colourspaces shouldn't matter - the drawing  
operation will convert the image as necessary.




G.



On 21 Apr 2008, at 10:23 pm, Daniel Thorpe wrote:
Thanks Graham, I've just tried NSCompositeCopy, still doesn't work,  
no change...


One thing that I've noticed though, is that the source is a  
grayscale image, but the image that I'm creating is RGB. Should I  
perhaps be creating a new bitmap image rep in the target (of the  
same colorSpace) before calling the compositeToPoint method?


Cheers
Dan

On 21 Apr 2008, at 12:57, Graham Cox wrote:


Oops, I meant NSCompositeCopy

g.

On 21 Apr 2008, at 9:55 pm, Graham Cox wrote:


On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
	[source compositeToPoint:NSZeroPoint fromRect:extent  
operation:NSCompositeSourceIn fraction:1.0];



Try using NSCompositeSourceCopy here instead.


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/graham.cox%40bigpond.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: Binding NSButton enabled state

2008-04-21 Thread Lorenzo Thurman
> Message: 1
> Date: Sun, 20 Apr 2008 14:02:52 -0600
> From: Keary Suska <[EMAIL PROTECTED]>
> Subject: Re: Binding NSButton enabled state
> To: "Cocoa-Dev (Apple)" 
> Message-ID: <[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> >
> Content-Type: text/plain;   charset="US-ASCII"
>
> on 4/20/08 11:47 AM, [EMAIL PROTECTED] purportedly said:
>
> > On Sat, Apr 19, 2008 at 11:55 PM, Chris Hanson <[EMAIL PROTECTED]> wrote:
> >
> >> On Apr 19, 2008, at 11:08 AM, Lorenzo Thurman wrote:
> >>
> >>  I have two NSTableViews, tableA and tableB, each managed by separate
> >>> NSArrayControllers. When a selection is made in either table, an
> >>> instance
> >>> variable is set. I want to have an NSButton's enabled state to 'YES'
> >>> whenever the instance variable is set.
> >>>
> >>
> >> Don't think of it as an instance variable, think of it as a property.
> >>  Restating your problem, you want your "Do Something" button's enabled
> >> property to be bound to your window controller's "can do something"
> >> property.
> >>
> >> What this means is that you need to manipulate your window controller's
> >> "can do something" property in a way that things bound to it can notice
> --
> >> in other words, in a way that will post key-value observing
> notifications.
> >>  Thus instead of manipulating it as an instance variable, you should
> just
> >> always invoke its setter.
> >>
> >> You haven't said how you're actually noticing that the selection in one
> of
> >> your tables has changed; I assume you're either using an NSTableView
> >> delegate method or a notification to do so.
> >>
> >>  -- Chris
> >>
> >>
> > Here's my code:I register to receive these notifications when the
> selection
> > changes.
> >
> > -(void)applicationDidFinishLaunching:(NSNotification*)not{
> >
> >
> >  [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > usTableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:usCityTable];
> >
> > [[NSNotificationCenter defaultCenter]  addObserver:self
> selector:@selector(
> > intlableViewSelectionDidChange:) name:
> > NSTableViewSelectionDidChangeNotification object:intlTable];
> >
> > }
> >
> >
> > These are the messages sent when  a selection is changed (Is there a way
> to
> > use just one?):
>
> Yes, if instead you make your controlling object the delegate to both
> tableviews and implement -tableViewSelectionDidChange:.
>
> > -(void) usTableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [usTableContent selectedObjects];
> >
> >  if([selObjs count] > 0) {
> >
> > [intlTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> > }
> >
> > -(void) intlableViewSelectionDidChange:(NSNotification*)not{
> >
> > NSArray* selObjs = [intlTableContent selectedObjects];
> >
> >  if([selObjs count] > 0){
> >
> > [cityTable deselectAll:self];
> >
> > NSDictionary* selectedDictionary = [selObjs objectAtIndex:0];
> >
> > [self setValue:[selectedDictionary objectForKey:@"location"] forKey:
> > @"location"];
> >
> > [self setSelectedItem:selectedDictionary];
> >
> > }
> >
> >
> > }
>
> Note that when you call -deselectAll:, that triggers an
> NSTableViewSelectionDidChangeNotification, so you may want to watch out.
> Your checks probably avoid loops, but the notifications will get sent more
> often than is necessary.
>
> Anyway, what kind of object is "location"? Are you applying any
> transformers? If not, how are you considering how your object will get
> coerced into a boolean?
>
> HTH,
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
>
>
> I'll look at the tableview deleegates again. I looked at those before, but
reasoned that they might not work as I would like, but I can't remember why.
Thanks for pointing out the potential for looping and the extra
notifications that get sent, but the problem I ran into without the
deselectAll, was that if I made a selection in tableA, my interface updated
correctly, then made a selection in tableB, my interface updated correctly,
but then made the same selection again in tableA, my interface did not
update correctly, since there was not change in selection
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread glenn andreas


On Apr 21, 2008, at 8:35 AM, Ewan Delanoy wrote:



 [theButton setTitle:[NSString stringWithFormat:@"Put a n with a
tilde,like this : %c",0X00F1]];

Unfortunately, at runtime the exotic character is displayed  
incorrectly:

it appears as
a "breve" (Unicode character number 02D8 instead of 00F1).



You want %C, not %c (%c is "character", while %C is unicode character).

Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium | flame : flame fractals & strange attractors : build,  
mutate, evolve, animate




___

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

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

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

This email sent to [EMAIL PROTECTED]


Selection in NSCollectionView

2008-04-21 Thread Sudarshan S
I am trying to understand NSCollectionView with Apple provided sample 
IconCollection. I would like to write an action code to handle selection of 
items in this collection view. How do I do it ? 


thanks,
Leo




  

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]


Proper way to revert with NSUserDefaultsController

2008-04-21 Thread Lorenzo Thurman
I've run into some trouble using revert with NSUserDefaultsController:
It doesn't work. My settings do not revert to their previous settings. I'm
working on a prefs window and what I want to have happen is if a user clicks
the cancel button, any changes made are reverted to their previous setting.
I have programmatically set [[NSUserdefaultsController
sharedUserDefaultsController] setAppliesImmediately:NO]. My understanding
was that this was required for revert to work. I found a post at
cocoabuilder that said using this pair of messages would work to revert
settings:

dictionaryWithValuesForKeys (to get the current state of the user prefs)
setValuesForKeysWithDictionary (to restore the user prefs)

This actually works for me and I'm OK with this as a solution, but I'd still
like to know how revert should work. There are a number of posts about
revert at cocoabuilder. Many people seem to have issues with it, so it's use
does not appear to be as straightforward as implied by the docs.
Thanks


-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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

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

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

This email sent to [EMAIL PROTECTED]


Premature notification from NSApplication - workaround?

2008-04-21 Thread Graham Cox
I'm responding to: - (void) applicationDidBecomeActive: 
(NSNotification*) aNotification


But when I get the notification, it seems that [NSApp mainWindow]  
still returns nil as if it were inactive. The message is obviously  
sent before -mainWindow is set up, which means that in fact the  
application isn't really yet active in a useful sense - the message is  
sent prematurely.


Any way to get the current main window at this time?


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]


Integrating application with Time Machine

2008-04-21 Thread Rama Krishna
Is it possible to show an application's UI in Time Machine? When time
machine is launched from Mail, the snapshots at different times are shown in
the mail window as opposed to a Finder windows. 

 

Is it possible for any other application to do the same thing? So when user
enter time machine and my application is active, I want my application
windows to show snapshots at different times.

 

Thanks

Rama Krishna  

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: A cursor bug in DragItemAround example

2008-04-21 Thread Jens Alfke


On 21 Apr '08, at 6:22 AM, Ling Wang wrote:

Do you mean that it is unclear why this happens and there is no way  
for application developers to avoid this annoyance?


As far as I know, yes. :-(

—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: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Ewan Delanoy
>
> You want %C, not %c (%c is "character", while %C is unicode character).
>

   You're right, it works now with %C instead of %c. Thanks! I guess the use
of %c should be avoided, like the use of old-fashioned C Strings?

 Ewan

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Integrating application with Time Machine

2008-04-21 Thread Karl Moskowski


On 21-Apr-08, at 10:51 AM, Rama Krishna wrote:

Is it possible to show an application's UI in Time Machine? When time
machine is launched from Mail, the snapshots at different times are  
shown in

the mail window as opposed to a Finder windows.

Is it possible for any other application to do the same thing? So  
when user

enter time machine and my application is active, I want my application
windows to show snapshots at different times.



"Alan Qatermain" demonstrated this at tacow's November '07 meeting.  
He's posted a Xcode project at his web site. Apparently the API is  
private, so use it with caution.




Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Jens Alfke


On 21 Apr '08, at 6:35 AM, Ewan Delanoy wrote:


It seems clear that this is a conflicting encoding issue, but between
which encodings?
coming from where? (The default file encoding is "Unicode UTF-8" in  
the
Xcode preferences, and it seems there is no item to deal with  
encodings in

the Interface Builder's preferences)


"%c" is interpreted at runtime according to the default string  
encoding for that process. This depends on what the user's preferred  
language is set to, but for English and most European languages it's  
MacRoman. That choice makes sense for backward-compatibility reasons,  
but nowadays it tends to be mostly an annoyance.


So it's definitely best to stick to Unicode-based mechanisms, like "%C".

(By the way, in 10.5, GCC now allows you to use non-ascii characters  
in string literals right in your source code. So there's no need to  
construct a string with an ñ in it programmatically, as long as you're  
building with Xcode 3.0.)


—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: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Ewan Delanoy

>
> "%c" is interpreted at runtime according to the default string
> encoding for that process. This depends on what the user's preferred
> language is set to, but for English and most European languages it's
> MacRoman. That choice makes sense for backward-compatibility reasons,
> but nowadays it tends to be mostly an annoyance.
>
> So it's definitely best to stick to Unicode-based mechanisms, like "%C".
>
> (By the way, in 10.5, GCC now allows you to use non-ascii characters
> in string literals right in your source code. So there's no need to
> construct a string with an ñ in it programmatically, as long as you're
> building with Xcode 3.0.)
>
   Thanks for your very complete explanation (btw, I did not know
about being allowed to use Unicode directly in Xcode 3.0; that's a nice
improvement!). I read it just after sending
another post in that thread, unnecessarily in fact
since your explanation already answers eveything in the post.

 Ewan


___

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

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

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

This email sent to [EMAIL PROTECTED]


Using scrolling lists of controls and handling window resize.

2008-04-21 Thread Duncan Champney
My app has a 3D view window that displays a large OpenGL view over  
most of it's surface, along with a group of controls that run down the  
left side of the window. The user can resize the window quite small,  
which makes some of the controls disappear off the bottom of the  
window. My solution is to put the controls into a scrolling view, so  
that when the window gets small enough, a vertical scroller appears,  
and the user can scroll down to the controls that are missing.


This works pretty well, except for one thing.

When the user makes the window bigger than the default size, the view  
that contains the group of controls pins to the bottom of the window  
instead of the top. That means that the controls slide down the  
window, which looks really bad.


What I want to happen is for my controls to pin to the top of the  
window. When the window gets smaller than it's default size, the  
vertical scroller should appear and allow the user to scroll down to  
the controls that are hidden. When the user resizes the window bigger  
than the default size, the controls should stay anchored to the top of  
the window.


I can't figure out how to do this in IB. Is there something I'm  
missing in IB? It seems like the behavior I'm after should be fairly  
common.


Somebody suggested making my scrolling view contain a custom view, and  
overriding the -isFlipped method to make the view use flipped  
coordinates. However, wouldn't that mean that the controls in my view  
would then draw in reversed order?





Regards,

Duncan C
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trying to calculate a running total using Core Data

2008-04-21 Thread Keary Suska
on 4/21/08 2:06 AM, [EMAIL PROTECTED] purportedly said:

> I am trying to figure out how to calculate a running total using core
> data. I have created an entity called Transactions that have the
> following properties.
> 
> Transactions
> amount
> balance
> 
> 
> 
> This routine only copies the amount to the balance property. I am
> thinking that I have to Query all of the previous transactions and
> calculate their totals. I know how to create a NSFetchRequest on a
> transaction object but I am unsure on how to create the NSPredicate
> object to extract all the transactions that were created prior to the
> current transaction. Thanks for any help you can provide.

First issue I see is how you can know what transaction objects "occur" prior
to any given object. I don't think you can rely on objects being retrieved
in any specific order that your data model doesn't enforce.

Next, AFAIK, there is no way to do what you want purely from an entity's
perspective--i.e. through a predicate or any instance method of the entity
class--unless you can rely that -awakeFromFetch is called in a predictable
order (which I can't answer), and you are willing to recalculate the entire
data set every time any change is made.

Otherwise, an outside "controller" object, perhaps who can watch for certain
changes or gets called at certain strategic times, will perform
re/calculations when needed.

HTH,

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Jean-Daniel Dupas


Le 21 avr. 08 à 16:48, Jens Alfke a écrit :



On 21 Apr '08, at 6:35 AM, Ewan Delanoy wrote:


It seems clear that this is a conflicting encoding issue, but between
which encodings?
coming from where? (The default file encoding is "Unicode UTF-8" in  
the
Xcode preferences, and it seems there is no item to deal with  
encodings in

the Interface Builder's preferences)


"%c" is interpreted at runtime according to the default string  
encoding for that process. This depends on what the user's preferred  
language is set to, but for English and most European languages it's  
MacRoman. That choice makes sense for backward-compatibility  
reasons, but nowadays it tends to be mostly an annoyance.


So it's definitely best to stick to Unicode-based mechanisms, like  
"%C".


(By the way, in 10.5, GCC now allows you to use non-ascii characters  
in string literals right in your source code. So there's no need to  
construct a string with an ñ in it programmatically, as long as  
you're building with Xcode 3.0.)




What will be the output encoding in this case ? GCC generate utf-8 or  
it uses the source file encoding ?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Premature notification from NSApplication - workaround?

2008-04-21 Thread Keary Suska
on 4/21/08 8:14 AM, [EMAIL PROTECTED] purportedly said:

> I'm responding to: - (void) applicationDidBecomeActive:
> (NSNotification*) aNotification
> 
> But when I get the notification, it seems that [NSApp mainWindow]
> still returns nil as if it were inactive. The message is obviously
> sent before -mainWindow is set up, which means that in fact the
> application isn't really yet active in a useful sense - the message is
> sent prematurely.
> 
> Any way to get the current main window at this time?

I assume that it is this way to allow for click-thrus, so if your app has
more than one window open, a user could click on a window that wasn't
previously main, and make it so.

If you know that you will only every have one main window, you could
remember it when -applicationDidResignActive: is called.

Otherwise you may be able to call a handler method with
performSelectr:afterDelay:.

HTH,

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-21 Thread Jack Repenning

On Apr 20, 2008, at 11:37 AM, Manfred Schwind wrote:

Getting the height of a text for a given width is easy and I've done  
that countless times.
Also getting the width of a string (layed out in one line if it has  
no newlines) is no problem.


But I have a different problem. I try to give an easier explanation  
of my problem:


I have a text view that has a height that can hold three lines of  
text. Now I have one long string (without newlines). When putting  
this string into the text view, the text is automatically wrapped  
around. But maybe - for the initial width of the view - it will need  
four (or more) lines instead of just three. Now I want to calculate  
the optimal (minimum) width of the text view, to that the string is  
wrapped around in just three (or less) lines.



Either I'm misunderstanding your question, or you're misunderstanding  
the Geometries code.  I think you want -widthForHeight:attributes:,  
with the height specified for three lines (could just take it from  
what IB sets for you, or first get a heightForWidth:reallyBig, then  
triple that).  The demo program has a -heightForWidth:attributes:  
case, just flip it around.  This code _does_ work for a multi-line  
height, and does allow for correct wrapping, font changes in mid fly,  
multibyte characters, and all the rest.


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


Cannot find an icon

2008-04-21 Thread Lorenzo
When I compile then launch my app, I get this message on the Console
Could not find image named 'icnabcd'.

Now, there is no such an icon named that way on my nib file.
Anyway I started a search on the project and found the following lines in
the Nib file



icnabcd


So I tried to replace the string icnabcd with icn_onOff which really exists
on my interface, but my app still keeps on saying

Could not find image named 'icnabcd'.

I cleaned, quit Xcode 3.0, deleted my app's pref file, delete the build
folder, relaunched Xcode, compiled... unsuccessfully.
Also, there is no trace now on my project about icnabcd, nor spotlight finds
anything. Any idea???



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: A cursor bug in DragItemAround example

2008-04-21 Thread Mike Wright

On 21 Apr 2008 07:41:25 -0700 , Jens Alfke <[EMAIL PROTECTED]> wrote:


On 21 Apr '08, at 6:22 AM, Ling Wang wrote:


Do you mean that it is unclear why this happens and there is no way
for application developers to avoid this annoyance?


As far as I know, yes. :-(

—Jens


Perhaps it's not related, but something that's been bugging me is with  
my window that contains an NSTextView in an NSScrollView as its  
bottommost element. It's set to show the scroll bar only when needed.


When the (vertical) scroll bar is showing, moving the pointer from the  
text area to the resize box causes it to change from the I-beam to the  
arrow. But when the scroll bar is not showing, the pointer doesn't  
change when it gets to the resize box.


It seems that I unconsciously rely on that change to know when to  
click in the resize box, and if it doesn't change until it's  
completely outside the window, I often end up clicking on whatever is  
in the background, instead of in the resize box.


It would be a small annoyance if it didn't happen so often. Is it  
worth filing a bug about this simple case? Or, is there an easy fix  
for it?


Obviously, I could change my scroll view to always display the scroll  
bar, but four years on, I'd rather not change the behavior of the app  
for something this minor--and it may be that none of my customers are  
bothered by it at all.


Mike Wright
http://www.idata3.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: Crash when dispaying document in iChat Theater

2008-04-21 Thread Kevin Grant

Is the view drawing on a thread other than the main thread?
That might not be allowed (I'm not sure about Cocoa...in
Carbon this was never possible).

For the doesNotRecognizeSelector case, do you see any compiler
warnings about this?  That would at least show if it's your
code that's referring to a potentially nonexistent routine,
as opposed to the system.

Kevin G.



Hi,

I'm trying to implement iChat Theater capability into my garbage  
collected app, and it looks to be almost working, except for a  
rather all important crash. When my app is notified that it should  
start sending video it executes the following code:


IMAVManager *manager = [IMAVManager sharedAVManager];
MyDocument *d;

switch ([manager state])
{
case IMAVRequested:
			d = [[NSDocumentController sharedDocumentController]  
documentForURL:[manager URLToShare]];

if (d == nil) {
d = [[NSDocumentController sharedDocumentController]  
openDocumentWithContentsOfURL:[manager URLToShare] display:YES];

}
[manager setVideoDataSource:d.someView];
[manager start];
break;
}

someView has subviews, including a PDFView subclass. I have tried  
setting the data source to the PDFView and to the PDFView's  
documentView, but the result is always the same.


When I start a session the theater mode activates and I can see my  
document in the iChat window. All is well until anything causes a  
redraw of the view being displayed, at which point there is either a  
crash, or an error that leads to a crash if I try to continue  
execution. Here are the backtraces of the two types of crash:


#0  0x956bb6e8 in objc_msgSend ()
#1  0x90a2f337 in _pixelBufferReleaseCallback ()
#2  0x93079d78 in CVPixelBufferBacking::finalize ()
#3  0x9307242e in CVPixelBuffer::finalize ()
#4  0x90a21de9 in -[IMAuxVideoProvider _fillBufferFromPool:atRate:] ()
#5  0x90a21bfe in -[IMAuxVideoProvider _callbackThreadMain] ()
#6  0x95d735ad in -[NSThread main] ()
#7  0x95d73154 in __NSThread__main__ ()
#8  0x95440c55 in _pthread_start ()
#9  0x95440b12 in thread_start ()


#0  0x956b00d7 in objc_exception_throw ()
#1  0x927e844a in -[NSObject doesNotRecognizeSelector:] ()
#2  0x927e6a4c in ___forwarding___ ()
#3  0x927e6b12 in __forwarding_prep_0___ ()
#4  0x90a2f337 in _pixelBufferReleaseCallback ()
#5  0x93079d78 in CVPixelBufferBacking::finalize ()
#6  0x9307242e in CVPixelBuffer::finalize ()
#7  0x90a21de9 in -[IMAuxVideoProvider _fillBufferFromPool:atRate:] ()
#8  0x90a21bfe in -[IMAuxVideoProvider _callbackThreadMain] ()
#9  0x95d735ad in -[NSThread main] ()
#10 0x95d73154 in __NSThread__main__ ()
#11 0x95440c55 in _pthread_start ()
#12 0x95440b12 in thread_start ()

The second problem (doesNotRecognizeSelector:) I've so far only seen  
once, usually there is a straight crash (bad access). This looks  
like a framework bug to me, but I thought I'd ask here if anybody  
has any other ideas, or similar experience to share, before filing a  
bug report.


-António

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trying to calculate a running total using Core Data

2008-04-21 Thread I. Savant
>  First issue I see is how you can know what transaction objects "occur" prior
>  to any given object. I don't think you can rely on objects being retrieved
>  in any specific order that your data model doesn't enforce.

  You're correct - you can't rely on the order in which instances are
fetched. OP, see the many previous threads in this list's archives
regarding sort order, etc. I usually create a "sortOrder" attribute.
Since you're dealing with transactions, perhaps you'll want to use a
"date" attribute. Use your fetch request's friendly 'sort descriptors'
to do the heavy lifting.


  ... of course, even if you use a predicate to specify a date range,
the transaction order still doesn't matter. I digress.

  I gather from the OPs description that he's trying to compute the
balance after each transaction. The proposed approach is problematic:

1 - As Keary suggested, if the user edits a previous transaction's
amount, no balances will be updated (at least most likely not at the
expected time).

2 - Even using dependent keys (with the transaction instance's
-balance being dependent upon its -amount) won't help because changes
to other transaction instances will not trigger this dependency.

3 - Putting this logic in the model requires each instance to fetch
(and fire faults for) all transactions from the beginning of time up
to itself. Repeat this for every single transaction you want to show.
Ouch.

  The best approach (also as Keary suggested) is to put this logic in
your controller. It's wasteful to put the responsibility of the
current balance on each individual transaction. A transaction is only
a debit or a credit, after all. A toaster, incidentally, is also just
a toaster. ;-)

  To do this, I'd probably revert to the "old" table data source and
table delegate methods. Your "balance" column would not be bound to
anything. Instead, your table data source method would return the
total-balance-up-to-first-displayed-transaction plus the sum of all
transaction amounts (from first-displayed-transaction to the
transaction whose balance you're returning). This works particularly
well because:

1 - All the balance calculations (only for the displayed transaction
set) are done by your controller and not your model.
2 - This works since the order in which things are added and
subtracted are irrelevant for determining the final total and, though
you need a 'reference balance' up to the point you're displaying,
using set & array operators should get you there quickly.*
3 - With relatively little work, you can easily bind some ivar of your
controller to the total-balance-up-to-first-displayed-transaction.
That way, each time the table is reloaded, the balances should be
calculated as few times as necessary.*

* One thing I'm speaking on that I'm not entirely sure of (mmalc?
Scott?) is whether a fault is fired if you're using the @sum set/array
operator when asking for @sum.amount ...  I've never done this in
particular, hence the liberal smattering of 'should' in my
passive-aggressive assertions. :-)

--
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: Trying to calculate a running total using Core Data

2008-04-21 Thread I. Savant
>   ... of course, even if you use a predicate to specify a date range,
>  the transaction order still doesn't matter. I digress.

  Sorry - this is confusing. I meant to delete this paragraph after I
realized that the OP is talking about a running balance after each
transaction, rather than the total over all time, in which case, the
above would've been perfectly valid. ;-)

--
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: Crash when dispaying document in iChat Theater

2008-04-21 Thread Antonio Nunes

On Apr 21, 2008, at 4:55 PM, Kevin Grant wrote:


Is the view drawing on a thread other than the main thread?
That might not be allowed (I'm not sure about Cocoa...in
Carbon this was never possible).


No, it all happens on the main thread.


For the doesNotRecognizeSelector case, do you see any compiler
warnings about this?  That would at least show if it's your
code that's referring to a potentially nonexistent routine,
as opposed to the system.


This doesn't even happen in any part of my code. It happens within the  
Instant Messaging framework. After a bit more digging, I'm pretty  
convinced this is a garbage collection related issue, and I've filed a  
bug report.


...

In fact, I just had the bright idea to compile Mark Alldritt's iCheat  
Theater Demo with garbage collection turned on. And, although it isn't  
quite as eager to do it as my app, it eventually crashes with the same  
type of error. Just need to wiggle the mouse for a while while holding  
the window's resize knob. WIth GC off I can wiggle all I want for over  
a minute and every thing's just fine.


Thanks for the suggestions though.

António

---
What you have inside you expresses itself through both your
choice of words and the level of energy you assign to them.
The more healed, whole and connected you feel inside,
the more healing your words will be.

--Rita Goswami
---


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTextfields and keyboard equivalents - am I missing something?

2008-04-21 Thread Mattias Arrelid
I have a simple test application with a few custom menu items. Let's
assume that _none_ of these items has a key equivalent of COMMAND +
(right arrow) for now.

When the first responder of the application is an NSTextField, and the
user produces COMMAND + (right arrow), the insertion point is being
placed right after the last character in the text field. This is true
as long as the text field stays the first responder. As mentioned
earler, I _don't_ have a menu item with such a key equivalent at this
point.

If I add a menu item that _has_ a key equivalent of COMMAND + (righ
arrow), what happens is that this item's action is performed when I
press the above key combo - even if the text field is the first
responder. Is this supposed to happen? When reading the Cocoa
Event-Handling documentation, I stumbled upon this:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_3.html#//apple_ref/doc/uid/1060i-CH3-SW10

Inspired by that, I enabled some breakpoints in my project. From
these, I can see that the text field doesn't seem to care about saying
"yes, I do respond to COMMAND + (right arrow)" when its
"performKeyEquivalent:" is called, which explains why the menu item
gets the action eventually. Is this correct?

To sum things up: I want the text field to respond to all "standard"
key equivalents (move cursor to front, end, move word forward/backward
etc.), even if I have a menu item with such a key equivalent. There
are applications that behave like this, e.g. iTunes, and I do think
that this is the correct behavior. Could anyone point me in the right
direction here?

Regards
Mattias
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Aki Inoue
(By the way, in 10.5, GCC now allows you to use non-ascii  
characters in string literals right in your source code. So there's  
no need to construct a string with an $(D+P(B in it  
programmatically, as long as you're building with Xcode 3.0.)




What will be the output encoding in this case ? GCC generate utf-8  
or it uses the source file encoding ?


Regardless of GCC binary C string encoding settings, the content of  
constant CF/NSStrings are stored in UTF-16 in this case.


So, as long as your file encoding matches the GCC's file encoding  
setting (see -finput-charset) which is default to UTF-8, it just works.


Aki
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Crash when dispaying document in iChat Theater

2008-04-21 Thread Quincey Morris


On Apr 21, 2008, at 05:18, Antonio Nunes wrote:

I'm trying to implement iChat Theater capability into my garbage  
collected app, and it looks to be almost working, except for a  
rather all important crash. When my app is notified that it should  
start sending video it executes the following code:


IMAVManager *manager = [IMAVManager sharedAVManager];
MyDocument *d;

switch ([manager state])
{
case IMAVRequested:
			d = [[NSDocumentController sharedDocumentController]  
documentForURL:[manager URLToShare]];

if (d == nil) {
d = [[NSDocumentController sharedDocumentController]  
openDocumentWithContentsOfURL:[manager URLToShare] display:YES];

}
[manager setVideoDataSource:d.someView];
[manager start];
break;
}

someView has subviews, including a PDFView subclass. I have tried  
setting the data source to the PDFView and to the PDFView's  
documentView, but the result is always the same.


If d is a local variable, as this code fragment seems to say, what's  
keeping it (and therefore d.someView) from getting garbage collected  
as soon as it goes out of scope? 'setVideoDataSource' is documented to  
*not* retain the view (in non-GC), and I would take such a statement  
to mean that it does not hold a keep-alive reference to the object (in  
GC) either.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Copying contents of an NSString to the Clipboard

2008-04-21 Thread Johnny Lundy

Greetings,

I've studied the pasteboard docs, and wonder if there is a simple way  
to copy the contents of an NSString to the general clipboard. In AS or  
AS Studio it's just "set the clipboard to ." Is there such a  
convenience method in Cocoa?


Thanks,

Johnny
___

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

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

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

This email sent to [EMAIL PROTECTED]


Consistent Contextual Menu in NSTableview

2008-04-21 Thread Steve Cronin

Folks;

I'm having some difficulty getting consistent contextual menu behavior  
in NSTableView.


In the Finder and iTunes (what I feel most users are familiar with) if  
a row is selected but the user causes a contextual menu on a different  
row then row selection changes.
(I don't want to start a UI flame about 'correctness') I'm only  
interested in consistency!!


NOTE: the contextual menu can appear by a right mouse click, a two- 
fingered tap, and a control-click which appear to be detected as  
different events (see below)


The base NSTableView class does NOT change the selection when a  
contextual click occurs on a row

If I sub-class and add:
- (void)rightMouseDown:(NSEvent *)theEvent {
	[self selectRow:[self rowAtPoint:[self convertPoint:[theEvent  
locationInWindow] fromView:nil]] byExtendingSelection:NO];

[super rightMouseDown:theEvent];
}

I get half-way home.  Now the right mouse click and the two-fingered  
tap will alter the selection.


BUT

the control-click does not.

The Cocoa adage, "if you are working too hard, you probably are" keeps  
rummaging around my brain


What is the preferred means to efficiently make consistent contextual  
menu behavior like Finder and iTunes?


Thanks,
Steve
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextfields and keyboard equivalents - am I missing something?

2008-04-21 Thread John Stiles
In "The Path Of Key Events" in the URL you posted, the #1 item in the 
list is "key equivalents."
AppKit checks keyDown events to see if command is held; if it is, it 
tries to match it against the menus before passing it through the 
responder chain.
I think your best bet is to dim your menu item or remove its key 
equivalent when a text field gains first responder, and then restore it 
when the text field loses first responder.


Mattias Arrelid wrote:

I have a simple test application with a few custom menu items. Let's
assume that _none_ of these items has a key equivalent of COMMAND +
(right arrow) for now.

When the first responder of the application is an NSTextField, and the
user produces COMMAND + (right arrow), the insertion point is being
placed right after the last character in the text field. This is true
as long as the text field stays the first responder. As mentioned
earler, I _don't_ have a menu item with such a key equivalent at this
point.

If I add a menu item that _has_ a key equivalent of COMMAND + (righ
arrow), what happens is that this item's action is performed when I
press the above key combo - even if the text field is the first
responder. Is this supposed to happen? When reading the Cocoa
Event-Handling documentation, I stumbled upon this:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_3.html#//apple_ref/doc/uid/1060i-CH3-SW10

Inspired by that, I enabled some breakpoints in my project. From
these, I can see that the text field doesn't seem to care about saying
"yes, I do respond to COMMAND + (right arrow)" when its
"performKeyEquivalent:" is called, which explains why the menu item
gets the action eventually. Is this correct?

To sum things up: I want the text field to respond to all "standard"
key equivalents (move cursor to front, end, move word forward/backward
etc.), even if I have a menu item with such a key equivalent. There
are applications that behave like this, e.g. iTunes, and I do think
that this is the correct behavior. Could anyone point me in the right
direction here?

Regards
Mattias
___

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

Please do not post admin requests or moderator comments to the list.
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: Implementing a Slightly Unusual NSTableView

2008-04-21 Thread Corbin Dunn



I seem to recall that in 10.5 there is new API, either in  
NSTableView or NSActionCell, that makes this easy to do; but I just  
looked through both headers and can't find it. Does anyone else  
remember?


Yeah, I remember. The DragNDropOutlineView demo shows how.

Basically, you implement:

- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell  
*)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row;


And return YES, even if you don't allow the row to be selected, or if  
the table refuses first responder. You could refuse first responder  
via -acceptsFirstResponder by looking at [NSApp currentEvent] and  
determining if it is hit in the given cell (The demo app does  
something like this for refusing to change the row).


corbin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Jean-Daniel Dupas


Le 21 avr. 08 à 18:54, Aki Inoue a écrit :

(By the way, in 10.5, GCC now allows you to use non-ascii  
characters in string literals right in your source code. So  
there's no need to construct a string with an ñ in it  
programmatically, as long as you're building with Xcode 3.0.)




What will be the output encoding in this case ? GCC generate utf-8  
or it uses the source file encoding ?


Regardless of GCC binary C string encoding settings, the content of  
constant CF/NSStrings are stored in UTF-16 in this case.


So, as long as your file encoding matches the GCC's file encoding  
setting (see -finput-charset) which is default to UTF-8, it just  
works.


Aki



Thank you.
I didn't realize that "string literals" means CF/NSStrings and not  
standard C strings.





___

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

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

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-21 Thread Corbin Dunn


On Apr 18, 2008, at 3:37 PM, John Stiles wrote:


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


The docs are wrong. The row doesn't have to be selected before you  
call editColumn:. The row has to be selected before NSTableView will  
call editColumn:. If you are calling it yourself at the appropriate  
time, then that is a-okay.


In effect, another way to get what you want is to override selection  
drawing and to not draw selection. So, tableview still has a selected  
row, but it just doesn't show up selected.


corbin

___

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

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

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

This email sent to [EMAIL PROTECTED]


Remove the GUI > Revert applications to command-line binaries.

2008-04-21 Thread Pippo

Hello,

I have built and runt the OpenGLScreenSnapshot app successfully using  
the sample code available here:

http://devworld.apple.com/samplecode/OpenGLScreenSnapshot/index.html

The app permits to take a picture of the screen.

While running the OpenGLScreenSnapshot app, one must select the  
menubar and then select the 'Screen Snapshot' submenu in order to  
take a picture.


Instead my intention is to modify the code in order to let the app  
launch, take a snapshot saving to a custom location, and then close  
automatically.


I am aware of many ways to do the same thing using different methods  
(i.e. via command-line, applescript, keyboard shorcuts, etc), but I  
am posting here cause I would love to learn about how to modify the  
exact code used in the OpenGLScreenSnapshot.xcodeproj.


Reading the MyController.m I find:
--
- (IBAction)screenSnapshot:(id)sender

[...]
--

I am sure there are at least two solutions to the "quest" I am  
offering you:


[1] Adding the correct code would be possible to supersede the  
IBAction, letting a custom executable handling the events?


[2] Adding a command-line tool as new target, inserting the correct  
code after  "int main( int argc, char *argv[] ) ... " and completely  
removing the nib?


Maybe the NSApplicationLoad(); class could be of help when using the  
g_autoReleasePool.


However, I do not know which are the correct command-line args to add.

Regards, Pippo
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Crash when dispaying document in iChat Theater

2008-04-21 Thread Antonio Nunes

On Apr 21, 2008, at 5:52 PM, Quincey Morris wrote:

If d is a local variable, as this code fragment seems to say, what's  
keeping it (and therefore d.someView) from getting garbage collected  
as soon as it goes out of scope? 'setVideoDataSource' is documented  
to *not* retain the view (in non-GC), and I would take such a  
statement to mean that it does not hold a keep-alive reference to  
the object (in GC) either.


d is a local variable indeed, but it is just an intermediate  
instrument, one that points to a document that is held' by the  
document controller. The object d points to remains connected to a  
root object by being held by the controller.


Just in case: turning of the collector for variable d doesn't make a  
difference. Stil crashes.


António

---
And you would accept the seasons of your
heart, even as you have always accepted
the seasons that pass over your field.

--Kahlil Gibran
---



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Copying contents of an NSString to the Clipboard

2008-04-21 Thread I. Savant
>  I've studied the pasteboard docs, and wonder if there is a simple way to
> copy the contents of an NSString to the general clipboard. In AS or AS
> Studio it's just "set the clipboard to ." Is there such a
> convenience method in Cocoa?

  Study the docs again, the answers are there if you've carefully read
the entire document:

http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbImplementing.html

  Cobbled-together example from example code found in the "Lazy
Writing" section, only slightly modified:

NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil];
[pb declareTypes:types owner:self];
[pb setString:@"Read the docs carefully!" forType:NSStringPboardType];

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

2008-04-21 Thread John Stiles

Corbin Dunn wrote:


On Apr 18, 2008, at 3:37 PM, John Stiles wrote:


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


The docs are wrong. The row doesn't have to be selected before you 
call editColumn:. The row has to be selected before NSTableView will 
call editColumn:. If you are calling it yourself at the appropriate 
time, then that is a-okay.


In effect, another way to get what you want is to override selection 
drawing and to not draw selection. So, tableview still has a selected 
row, but it just doesn't show up selected.


Excellent. Thanks for the clarification, it's much appreciated!!

(How do you override selection drawing? Reimplement 
-highlightSelectionInClipRect:? Not that I think I need to, I'm just 
curious.)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: horizontal sizeToFit of NSTextView or NSTextField

2008-04-21 Thread Manfred Schwind
Either I'm misunderstanding your question, or you're  
misunderstanding the Geometries code.  I think you want - 
widthForHeight:attributes:, with the height specified for three  
lines (could just take it from what IB sets for you, or first get a  
heightForWidth:reallyBig, then triple that).  The demo program has a  
-heightForWidth:attributes: case, just flip it around.  This code  
_does_ work for a multi-line height, and does allow for correct  
wrapping, font changes in mid fly, multibyte characters, and all the  
rest.


No, the code does not work for multi-line height. If the text that has  
to be layouted does _not_ have newlines (so if I have one long line of  
text), then widthForHeight just returns the width of the text as if it  
is layouted in one long line. But I want the minimal width that is  
necessary so that the text is wrapped around into three lines.


I think this is the missing point: my text has no line breaks. It is  
one long line. But I am searching for a rectangle where the text is  
wrapped around into 3 lines and I am searching the optimal width for  
that.


OK. So I took NS(Attributed)String+Geometics and put the following  
test code in:


{
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:

[NSFont systemFontOfSize:12.0], NSFontAttributeName,

nil];
NSString *test = @"This is a very long line. It should be wrapped into  
three lines. And I want to get the optimal (minimal) width for that.";
float width = [test widthForHeight:45.0 attributes:attributes];	// a  
height of 45.0 is capable of holding 3 lines of 12pt system font

NSLog(@"width = %f", width);
// this is what widthForHeight internally does:
NSSize size = [test sizeForWidth:FLT_MAX height:45.0  
attributes:attributes];

NSLog(@"size = %@", NSStringFromSize(size));
}

Output is:

2008-04-21 19:40:20.317 StringGeometricsDemo[17913:10b] width =  
686.863281
2008-04-21 19:40:20.319 StringGeometricsDemo[17913:10b] size =  
{686.863, 15}


So, this is really NOT what I want. This is the width for the text if  
it is layouted in one line.


In the meantime I have a solution that searches for the optimal width  
with a binary search algorithm (just takes a few layouts to get a good  
result).
The result that I get for the text above is {246, 45}, and that's  
exactly the result that I wanted.
246 is the smallest width so that the text fits completely into the  
rectangle and is wrapped into 3 lines.
If I choose a smaller width, the text will be clipped (it will not fit  
completely in the rectangle).
If I choose a wider width, the text will be wrapped in less than 3  
lines at some point.


Regards,
Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.

___

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

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

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

2008-04-21 Thread Steve Nicholson

On Apr 18, 2008, at 2:35 PM, Hal Mueller wrote:


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.


I tried that, but no luck. Also, I'm doing this in windowWillClose:  
in my NSWindowController subclass, not dealloc.


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


I tried sending setShouldCloseDocument:YES to my  
mainWindowController, but no change.


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.


I put together two simple test cases for my bindings/KVO problem. One  
that was NSDocument-based and one NSDocument/NSWindowController- 
based. In doing so, I finally figured out my problem. The NSDocument  
has an object called "problem" that has the data I'm looking at. When  
I set bindings in the NSWindowController, I had them still bound to  
the property "problem" and added "problem" and "setProblem" methods  
to my NSWindowController subclass. When I changed the bindings to  
"document.problem..." and removed the NSWindowController's "problem"  
and "setProblem" methods, the message "An instance 0x3434f0 of class  
ExperimentalData is being deallocated while key value observers are  
still registered with it." stopped appearing in the log when I closed  
the window.


-Steve
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fullscreen mode detection from background

2008-04-21 Thread Ken Thomases

On Apr 21, 2008, at 7:24 AM, Peter Hoerster wrote:
is there a method to detect from the background if a foreground  
program is running in fullscreen mode?
I have to hide a floating panel when a video or game software is  
running fullscreen.


It depends on what you mean by fullscreen mode.  Most programs which  
have a fullscreen mode capture the display(s) with CGDisplayCapture* 
() or CGCaptureAllDisplays*().  If they do that, then I don't think  
you have to worry about it -- by design, the GUI of other  
applications won't display and they won't be informed of the change  
in display configuration.  (That's the point of capturing the  
display.  You don't want the Finder to rearrange all of your desktop  
icons when you change resolutions, for example.)


If by fullscreen mode you mean that the frontmost application has  
hidden the menubar and Dock via SetSystemUIMode, then you may need to  
monitor the mode by installing a Carbon event handler for the  
kEventAppSystemUIModeChanged event.  I assume, but can't be sure,  
that [NSMenu setMenuBarVisible:NO] uses SetSystemUIMode under the  
hood, and thus generates the same Carbon event.


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: Crash when dispaying document in iChat Theater

2008-04-21 Thread Quincey Morris


On Apr 21, 2008, at 10:32, Antonio Nunes wrote:

d is a local variable indeed, but it is just an intermediate  
instrument, one that points to a document that is held' by the  
document controller. The object d points to remains connected to a  
root object by being held by the controller.


Just in case: turning of the collector for variable d doesn't make a  
difference. Stil crashes.


The interesting part of the stack trace is:



#1  0x90a2f337 in _pixelBufferReleaseCallback ()
#2  0x93079d78 in CVPixelBufferBacking::finalize ()
#3  0x9307242e in CVPixelBuffer::finalize ()



That has the *appearance* of CVPixelBufferBacking violating the  
finalize rules -- it looks like it's sending a message to the object  
that allocated it, but that object has already been garbage collected  
out of existence (or, in the case of the second stack trace, been  
reallocated already as a different kind of object). If that's so, I  
agree it looks like a frameworks bug.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: thread count problem

2008-04-21 Thread David Duncan

On Apr 21, 2008, at 1:03 PM, Nick Rogers wrote:

when I run my cocoa app, Activity monitor shows it having 2 threads,  
and thats ok, cause I'm running one POSIX thread with the start of  
the app and which remains till the app is exited.
The problem is when I detach a new NSThread, from which I'm calling  
"performSelectorOnMainThread:" frequently, the thread count goes to  
4. and when this new NSThread finishes, the thread count comes to 3  
and not 2. And it stays 3.


Is there something wrong?


Does this cause problems for your application? Mac OS X will spawn  
threads on behalf of your application to perform certain activities  
and this is generally beyond your control. This should typically be  
completely transparent to you.

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


New to drag and drop

2008-04-21 Thread Mark Thomas
Hi,
  I'm looking to add in drag and drop support to my app, but one thing which
isn't clear at the minute, is whether you are suppose to subclass the
NSViews or use delegates to do this. I would have assumed delegates as makes
the most future proof solution, so I added a

[webWindow registerForDraggedTypes:[NSArray
arrayWithObjects:NSFilenamesPboardType,nil] ];
   
  as I'm interested in file's being dropped on me, and I had an existing
delegate on my window, as was tracking movement ..etc, so added in

@implementation Controller(NSDraggingDestination)
- (BOOL)performDragOperation:(id )sender;
{
return TRUE;
}

  I then put a breakpoint here, awaiting to get called via the debugger but
it didn't happen when I drop a file on my window, so I'm wondering

1) I have a webkit control which covers the whole window, would the drop
message be sent to the parent ?

2) Or should I be putting operating this on the Webkit control ?

3) Should I be adding more drag delegates, but the doc's say that you didn't
need any other as were optional.

  I have seen the drag/drop example but its assumes you have subclassed
control, which why I'm wondering about this.

Thanks
Mark.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: thread count problem

2008-04-21 Thread Scott Ribe
1) What are you doing in the method you call from your detached thread?

Or

2) Don't worry, be happy.


There are a number of Cocoa features which will create a worker thread of
their own[1]. In other words, if you *never* explicitly create a thread,
you'll likely wind up with multiple threads anyway. And it's nothing to
worry about. I frankly don't know what all causes Cocoa to start another
thread for itself. (Perhaps performSelectorOnMainThread, if you don't wait
for completion, starts a thread that coordinates putting the call into the
main run loop?)

If you're really interested, I imagine that if you press for answers others
can provide info. But it really is nothing to worry about.

[1] Some probably more than one thread. For example, there are routines in
lower-level accelerated image processing libraries that will spawn multiple
threads on multi-core machines in order to process image slices in parallel.
I expect that some Cocoa image methods wind up calling down to those
routines.


-- 
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: thread count problem

2008-04-21 Thread Navneet Kumar

Thanks for the reply.
No, it doesn't affect my app. I was just asking whether it is a problem.

On 22-Apr-08, at 1:52 AM, David Duncan wrote:


On Apr 21, 2008, at 1:03 PM, Nick Rogers wrote:

when I run my cocoa app, Activity monitor shows it having 2  
threads, and thats ok, cause I'm running one POSIX thread with the  
start of the app and which remains till the app is exited.
The problem is when I detach a new NSThread, from which I'm  
calling "performSelectorOnMainThread:" frequently, the thread  
count goes to 4. and when this new NSThread finishes, the thread  
count comes to 3 and not 2. And it stays 3.


Is there something wrong?


Does this cause problems for your application? Mac OS X will spawn  
threads on behalf of your application to perform certain activities  
and this is generally beyond your control. This should typically be  
completely transparent to you.

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]


thread count problem

2008-04-21 Thread Nick Rogers

hi,
when I run my cocoa app, Activity monitor shows it having 2 threads,  
and thats ok, cause I'm running one POSIX thread with the start of  
the app and which remains till the app is exited.
The problem is when I detach a new NSThread, from which I'm calling  
"performSelectorOnMainThread:" frequently, the thread count goes to  
4. and when this new NSThread finishes, the thread count comes to 3  
and not 2. And it stays 3.


Is there something wrong?
Shall I provide more details?

WIshes,
Nick
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Consistent Contextual Menu in NSTableview

2008-04-21 Thread Nate Weaver

I would probably override -menuForEvent: instead of -rightMouseDown: .

Leopard also has a bit nicer contextual menu handing for table/outline  
views: If you right-click a row that's not currently selected it  
highlights just an outline and doesn't change the selection (you can  
use -clickedRow to get that row from within your action method(s)).


On Apr 21, 2008, at 11:59 AM, Steve Cronin wrote:

Folks;

I'm having some difficulty getting consistent contextual menu  
behavior in NSTableView.


In the Finder and iTunes (what I feel most users are familiar with)  
if a row is selected but the user causes a contextual menu on a  
different row then row selection changes.
(I don't want to start a UI flame about 'correctness') I'm only  
interested in consistency!!


NOTE: the contextual menu can appear by a right mouse click, a two- 
fingered tap, and a control-click which appear to be detected as  
different events (see below)


The base NSTableView class does NOT change the selection when a  
contextual click occurs on a row

If I sub-class and add:
- (void)rightMouseDown:(NSEvent *)theEvent {
	[self selectRow:[self rowAtPoint:[self convertPoint:[theEvent  
locationInWindow] fromView:nil]] byExtendingSelection:NO];

[super rightMouseDown:theEvent];
}

I get half-way home.  Now the right mouse click and the two-fingered  
tap will alter the selection.


BUT

the control-click does not.

The Cocoa adage, "if you are working too hard, you probably are"  
keeps rummaging around my brain


What is the preferred means to efficiently make consistent  
contextual menu behavior like Finder and iTunes?


Thanks,
Steve

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: thread count problem

2008-04-21 Thread Sean McBride
On 4/22/08 1:33 AM, Nick Rogers said:

>when I run my cocoa app, Activity monitor shows it having 2 threads,
>and thats ok, cause I'm running one POSIX thread with the start of
>the app and which remains till the app is exited.
>The problem is when I detach a new NSThread, from which I'm calling
>"performSelectorOnMainThread:" frequently, the thread count goes to
>4. and when this new NSThread finishes, the thread count comes to 3
>and not 2. And it stays 3.

Are you putting Cocoa in multithreaded mode before creating your
pthread?  See:


--

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]


Cocoa support for serial port access?

2008-04-21 Thread Rick Mann
Does Cocoa provide any high-level serial port access API? Or do I just  
use IOKit?



--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


adding an opaque NSView as subview of a semi-transparent NSView

2008-04-21 Thread Bryan Bonczek
I have a custom NSView subclass that draws a semi-transparent  
background with the following:


[[NSColor colorWithDeviceRed:0.0f green:0.0f blue:0.0f  
alpha:QuickViewControlAlphaValue] set];

NSRectFill(rect);

Why is it that any subview I add to my custom view gets drawn with the  
same alpha value?  Is there any way I can have an alpha value <1.0  
with subviews that are opaque?



Bryan Bonczek
[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-21 Thread Bill Monk

On Apr 19, 2008, on Mon, 21 Apr 2008 10:06:47 +0530, JanakiRam wrote:

   This code works fine , but when i try to mount another volume/ 
account on the same server , this code doesn't seem to work.I'm  
always getting -43 error.If i unmount the earlier volume/account on  
the same server then i'm able to mount another volume on the server.


What sort of server? Perhaps you should post some code. In general it  
should works for any number of volumes on a server.


Now, I have occasionally seen error -43 in a situation where  
[[NSWorkspace sharedWorkspace] mountedLocalVolumePaths] (which,  
somewhat contrary to its name, returns all mounted volumes including  
servers) lists a particular server as being mounted, but that server  
is not visible on the Desktop or in Finder window sidebars. Yet the  
server is in fact mounted, as can be confirmed with various File  
Manager API such as FSPathMakeRef(), reading/writing the volume by  
any means, etc. Such volumes can be unmounted in Terminal with  
umount, which succeeds without error. After that they can be mounted  
again with no problem.


Have only really noticed this under Tiger, with programmatically  
mounted idisks. My guess is that it may sometimes fail to display new  
volumes if several are mounted in very rapid succession. For my  
purposes it didn't matter: if a volume is mounted and accessible,  
that was good enough.


Without seeing your code, couldn't say if this applies to your  
situation. Possibly, sending 		


[[NSWorkspace sharedWorkspace]  
noteFileSystemChanged:pathOfVolumeToMount];


after a successful mount might help ensure the volume is visible in  
Finder. Probably best to first check if a volume is already mounted  
via mountedLocalVolumePaths anyway


As Jens notes, logging into AFP servers as multiple users at the same  
time may not always do what you'd expect.
With Leopard client, for instance, you -can- programatically mount  
the same volume for multiple logged-in accounts (assuming the volumes  
are marked as sharable for each account in System prefs, or the  
volume is the account's public folder). Doing this will succeed; no  
error occurs. The vRefNum returned, however, will be the same for all  
of them, and only the first appears in the Finder. This makes sense  
from a concurrency standpoint.


Not sure if any of the above addresses your -43 errors; http:// 
lists.apple.com/mailman/listinfo/filesystem-dev would definitely be a  
good place to ask about that.


In any case your question prompted me to rework that old code;  
passing a single dictionary for the many params is more  
pleasant...perhaps it will be useful to someone.



NSString *kServerNameKey = @"kServerNameKey";
NSString *kVolumeNameKey = @"kVolumeNameKey";
NSString *kTransportNameKey = @"kTransportNameKey";
NSString *kMountDirectoryKey = @"kMountDirectoryKey";
NSString *kUserNameKey = @"kUserNameKey";
NSString *kPasswordKey = @"kPasswordKey";
NSString *kAsyncKey = @"kAsyncKey";

-(void)mountServer:(NSDictionary *)mountDictionary
{
NSString *pathOfVolumeToMount;

#define kNoPasswordInURL 1
#if kNoPasswordInURL
// encode transportName://serverName/volumeName URL for server,  
without userName/password

pathOfVolumeToMount = [NSString stringWithFormat:@"%@://%@/%@",
[mountDictionary objectForKey:kTransportNameKey],
[mountDictionary objectForKey:kServerNameKey],
[mountDictionary objectForKey:kVolumeNameKey]];
#else
	// It's possible to encode the userName/password into the URL, but  
this is undesirable when trying to
	// mount a volume quietly, without an authentication dialog  
appearing. Instead, pass userName/password

// directly to FSMountServerVolumeSync (see comments below).
	// encode transportName://userName:[EMAIL PROTECTED]/volumeName  
URL for server, with userName/password

*pathOfVolumeToMount = [NSString stringWithFormat:@"%@://%@:%@@%@/%@",
[mountDictionary objectForKey:kTransportNameKey],
[mountDictionary objectForKey:kUserNameKey],
[mountDictionary objectForKey:kPasswordKey],
[mountDictionary objectForKey:kServerNameKey],
[mountDictionary objectForKey:kVolumeNameKey]];
#endif // kNoPasswordInURL

// percent-ascape any space characters in the URL string and create URL
	pathOfVolumeToMount = [pathOfVolumeToMount  
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *urlOfVolumeToMount = [NSURL URLWithString:pathOfVolumeToMount];

// create NSURL for optional directory on server to mount; can also
	// just include the subdirectory in server URL (if that path is  
share-able).

NSURL *mountDirectoryURL = NULL;
	NSString *mountDirectoryPath = [mountDictionary  
objectForKey:kMountDirectoryKey];

if ( ![mountDirectoryPath isEqualToString:@""] ) {
mountDirectoryPath = [NSString 
st

-windowDidLoad not getting called

2008-04-21 Thread Rick Mann
I started a very simple non-document Cocoa app project. I added a  
controller class derived from NSWindowController, and added an  
NSObject to my .xib to represent it. I've connected an outlet in my  
controller to a field in the window, and a button in the window to an  
action in the controller. I've also set the NSWindowController's  
window outlet to the window.


When the app launches, I see the window, and I can click the button  
and my action is called (and it updates the field). But, - 
windowDidLoad is never called.


What did I forget?

TIA,
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa support for serial port access?

2008-04-21 Thread Apple Cocoa List

Check out AMSerialPort from http://www.harmless.de/cocoa.php

I have used it for several projects and highly recommend it.

Todd


On Apr 21, 2008, at 5:00 PM, Rick Mann wrote:

Does Cocoa provide any high-level serial port access API? Or do I  
just use IOKit?



--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


SynchroScrollView

2008-04-21 Thread John Stiles

Has anyone gotten this example to work in Leopard?
   
http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html


I just tried it and I'm having terrible luck. The view is just blanking 
itself out immediately. I can get it to sort-of work if I replace 
-scrollToPoint: with calling -scrollRectToVisible: on the document, but 
it seems to screw up sometimes and go to the wrong location. It's really 
weird.


My use case is fairly simple—I just want line numbers to the left of a 
text view—and the code is basically unchanged (although I've tried 
tweaking it a few times, with mixed results, never 100% working).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa support for serial port access?

2008-04-21 Thread Hal Mueller
AMSerialPort is nice.  I use it with USB-serial converters and with  
Bluetooth serial devices.


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

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]


-windowDidLoad not getting called

2008-04-21 Thread Rick Mann
I started a very simple non-document Cocoa app project. I added a  
controller class derived from NSWindowController, and added an  
NSObject to my .xib to represent it. I've connected an outlet in my  
controller to a field in the window, and a button in the window to an  
action in the controller. I've also set the NSWindowController's  
window outlet to the window.


When the app launches, I see the window, and I can click the button  
and my action is called (and it updates the field). But, - 
windowDidLoad is never called.


What did I forget?

TIA
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: SynchroScrollView

2008-04-21 Thread John Stiles

I found thee things which, in conjunction, solve the problem:

1 - Rewrite synchronizedViewContentBoundsDidChange as follows. 
-scrollToPoint seems broken. (I am clamping the scroll view to the left 
side on purpose)


- (void)synchronizedViewContentBoundsDidChange:(NSNotification 
*)notification

{
   // get the changed content view from the notification
   NSView *changedContentView=[notification object];

   // get the origin of the NSClipView of the scroll view that
   // we're watching
   NSRect changedBounds = [changedContentView bounds];

   [[self contentView] scrollRectToVisible:NSMakeRect(0, 
changedBounds.origin.y, 1, changedBounds.size.height)];


   // we have to tell the NSScrollView to update its scrollers
   [self reflectScrolledClipView:[self contentView]];
}

2 - Disable non-contiguous layout. This seemed to cause the view to 
scroll to the wrong place.


3 - An NSSplitView was causing my layout to shift around if it was 
collapsed all the way, making things look more broken than they were... 
grr. I don't know how to work around this problem without a big kludge; 
we've filed a radar on AppKit back in 2006 with no word yet. 
(rdar://4399290 - A cocoa view that is shrunk to a degenerate rectangle 
loses its position & size)




John Stiles wrote:

Has anyone gotten this example to work in Leopard?
   
http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html 



I just tried it and I'm having terrible luck. The view is just 
blanking itself out immediately. I can get it to sort-of work if I 
replace -scrollToPoint: with calling -scrollRectToVisible: on the 
document, but it seems to screw up sometimes and go to the wrong 
location. It's really weird.


My use case is fairly simple—I just want line numbers to the left of a 
text view—and the code is basically unchanged (although I've tried 
tweaking it a few times, with mixed results, never 100% working).


___

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

Please do not post admin requests or moderator comments to the list.
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: New to drag and drop

2008-04-21 Thread Nick Zitzmann


On Apr 21, 2008, at 2:23 PM, Mark Thomas wrote:

1) I have a webkit control which covers the whole window, would the  
drop

message be sent to the parent ?

2) Or should I be putting operating this on the Webkit control ?



DnD implementations vary a bit. Views that display what its data  
source (or delegate, in the case of NSBrowser) tells it to display  
have methods allowing the data source to customize DnD. WebView, as it  
turns out, does have a method that is supposed to be called when  
performing a drag, -webView:willPerformDragDestinationAction:..., but  
due to a bug introduced in Leopard, it isn't.


Nick Zitzmann


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 import drawing paths into a Cocoa application?

2008-04-21 Thread Steve Weller


I my app I want to be able to use drawing paths for two purposes:

1. Clip images to the path

2. Generate points that lie on the path as a function of the distance  
along the path


I want to be able to create paths with Omnigraffle or some other  
vector-image app, and export them to PDF or EPS or equivalent format.  
The objects I am dealing with could have multiple path segments and/or  
paths that intersect themselves and each other. I will probably use  
Quartz rather than Cocoa drawing.


I expected to see a class method for NSBezierPath that would grab a  
path from a file, but it is not there. So:


1. What file format should I use to store my paths?

2. How do I get the path into an object that I can use?

I can clip images to a path by using the addClip method on the  
NSBezierPath. Are there any easy ways of calculating the points on the  
path as a function of the distance from the start of the path?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -windowDidLoad not getting called

2008-04-21 Thread Ken Thomases

On Apr 21, 2008, at 6:15 PM, Rick Mann wrote:
I started a very simple non-document Cocoa app project. I added a  
controller class derived from NSWindowController, and added an  
NSObject to my .xib to represent it. I've connected an outlet in my  
controller to a field in the window, and a button in the window to  
an action in the controller. I've also set the NSWindowController's  
window outlet to the window.


When the app launches, I see the window, and I can click the button  
and my action is called (and it updates the field). But, - 
windowDidLoad is never called.


What did I forget?


Sometimes an NSWindowController is instantiated in a NIB as a  
controller for a window in that same NIB.  Other times, an  
NSWindowController is outside the NIB that contains its window, and  
is used to load that NIB.


I suspect that -windowDidLoad is only called in the latter case.   
Read the description of the -window and -loadWindow methods, which  
describes how -windowDidLoad is called.


In the former case, the NSWindowController isn't initialized with a  
NIB.  It's just initialized with -init, which is presumably a cover  
for -initWithWindow:nil. Then, the NIB loading machinery calls its - 
setWindow: method to connect the outlet.  At some later point, you  
call -window but the window is already "loaded" in the sense that  
it's set, so -window doesn't call -loadWindow and friends.


I hope that helps,
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]


Flicker when resizing NSStatusItem with Custom View

2008-04-21 Thread vance

Hi

I am seeing annoying flickering when resizing a status bar item using  
a custom view.


I tried using
* [statusItem setLength:XX.X] and
* [customView setFrame:newFrame]
Both methods produce flickering. I investigated further to see where  
exactly is the flicker happening.


The problem is probably best illustrated with the debugger using the  
sample code below:


There are 3 breakpoint
2 before and after "setFrame" in the action "add" and
1 more at the start of drawRect in the custom view

1. When the "add" action is invoked (look at the sample code below),  
just before setFrame is called this is a screen capture of the status  
item (it is good): http://grkov.com/tmp/pic1.png


2. Step Over, and while within setFrame, the breakpoint in SBView  
drawRect is reached. This is a screen capture of that (not good, we  
see the problem): http://grkov.com/tmp/pic2.png


Here we see why the flicker occurs. The custom view is shifted 10  
pixels to the left and the new 10 pixels show up as white.


3. Step over the drawRect (white area is still there): 
http://grkov.com/tmp/pic3.png

And then hit continue

4. The breakpoint after "setFrame" (called in step 1) is reached. And  
at this point the status item looks good: http://grkov.com/tmp/pic4.png


But that is not the case with step 2 and 3.

(By the way, there is a second call to drawRect after the action "add"  
returns.)


Does anyone understands what is going on and how to go about further  
debugging this?


Thank you for your input and help,
Vance

#import 
#import "SBView.h"

@interface MyView : NSView {
NSStatusItem *statusItem;
SBView *siView;
}

- (IBAction)onClick:(id)o;
- (IBAction)add:(id)o;
- (IBAction)remove:(id)o;

@end

#import "MyView.h"

@implementation MyView

- (IBAction)create:(id)o
{
NSStatusBar *statusBar = [NSStatusBar systemStatusBar];
	statusItem = [[statusBar  
statusItemWithLength:NSVariableStatusItemLength] retain];


siView = [[SBView alloc] initWithFrame:NSMakeRect(0,0,30,20)];
[statusItem setView: siView];
}

- (IBAction)add:(id)o
{
NSRect f = [[statusItem view] bounds];
f.size.width += 10;
[[statusItem view] setFrame: f ];

//[statusItem setLength:[si length] + 10];
}

- (IBAction)remove:(id)o
{
NSRect f = [[statusItem view] frame];
f.size.width -= 10;
[[statusItem view] setFrame: f ];

//[statusItem setLength:[si length] - 10];
}

@end

/ Cusotm View  
Class /


@interface SBView : NSView {
}

@implementation SBView

- (void)drawRect:(NSRect)r
{   
NSString *t = @"display string";
[t drawAtPoint:NSMakePoint(0,0) withAttributes:nil];
}

@end
___

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

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

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

This email sent to [EMAIL PROTECTED]


Where is mach_port_deallocate()?

2008-04-21 Thread Rick Mann
Argh. So hard to find stuff in the docs. Where is  
mach_port_deallocate()?


TIA,
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -windowDidLoad not getting called

2008-04-21 Thread Rick Mann


On Apr 21, 2008, at 5:21 PM, Ken Thomases wrote:

Sometimes an NSWindowController is instantiated in a NIB as a  
controller for a window in that same NIB.  Other times, an  
NSWindowController is outside the NIB that contains its window, and  
is used to load that NIB.


I suspect that -windowDidLoad is only called in the latter case.   
Read the description of the -window and -loadWindow methods, which  
describes how -windowDidLoad is called.


In the former case, the NSWindowController isn't initialized with a  
NIB.  It's just initialized with -init, which is presumably a cover  
for -initWithWindow:nil. Then, the NIB loading machinery calls its - 
setWindow: method to connect the outlet.  At some later point, you  
call -window but the window is already "loaded" in the sense that  
it's set, so -window doesn't call -loadWindow and friends.



Thanks for the answer.

That's all a rather unfortunate inconsistency (and part of why I sit  
here learning Cocoa and thinking, "I thought Cocoa was supposed to be  
this great thing").


I basically want my controller to go do some stuff after it and the  
window are loaded. -setWindow seems like an ugly place to do this, and  
-init is probably too early. Is there a better place?



--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to import drawing paths into a Cocoa application?

2008-04-21 Thread Graham Cox


On 22 Apr 2008, at 10:23 am, Steve Weller wrote:
Are there any easy ways of calculating the points on the path as a  
function of the distance from the start of the path?



I'm not sure about the rest of your question but I can answer this  
part. The short answer is no - it's really tricky.


However if you have a look at my DrawKit project, it solves this  
problem exactly ;-)


One category method on NSBezierPath I have is:

- (NSPoint) pointOnPathAtLength:(float) length slope:(float*) slope;

where  is the linear distance from the start of the path - it  
optionally also returns the slope (dy/dx) at the given point. The  
project is still in beta though this method is used a lot in my code  
and is well debugged.


http://apptree.net/drawkitmain.html


hth,

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: -windowDidLoad not getting called

2008-04-21 Thread Jeff Nouwen

On Apr-21-2008, at 6:34 PM, Rick Mann wrote:
I basically want my controller to go do some stuff after it and the  
window are loaded. -setWindow seems like an ugly place to do this,  
and -init is probably too early. Is there a better place?


- (void)awakeFromNib

- Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Where is mach_port_deallocate()?

2008-04-21 Thread stephen joseph butler
On Mon, Apr 21, 2008 at 7:22 PM, Rick Mann <[EMAIL PROTECTED]> wrote:

> Argh. So hard to find stuff in the docs. Where is mach_port_deallocate()?


egrep -R mach_port_deallocate /usr/include

It would appear to be in mach/mach_port.h (at least on 10.5).
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Where is mach_port_deallocate()?

2008-04-21 Thread Rick Mann


On Apr 21, 2008, at 5:50 PM, stephen joseph butler wrote:


egrep -R mach_port_deallocate /usr/include


Oh I forgot to try that.


It would appear to be in mach/mach_port.h (at least on 10.5).


I used to try to include the actual file I needed, but that seemed to  
break the Frameworks thing. So what I really should have asked was,  
what should I include in my Cocoa app to get mach_port_deallocate()?


However, I found some sample code that used:

#include 


Thanks!

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Callbacks from IOKit

2008-04-21 Thread Rick Mann
Being somewhat new to Cocoa, I often wonder if there's a better way to  
do things.


I'm doing some stuff with USB, and the example code I'm using uses  
IOServiceAddMatchingNotification() to add a pointer to a C callback to  
get notified when things happen on the USB bus.


In C++, one typically uses the refcon parameter in these APIs to pass  
a pointer to the C++ object responsible for handling the callback, and  
a pointer to a static C++ member function that massages the call into  
a method dispatch.


Is the same approach typically done in Obj-C? Are there higher-level  
APIs in Cocoa that I should use instead of  
IOServiceAddMatchingNotification()?


TIA,
--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: SynchroScrollView

2008-04-21 Thread John Stiles

Oh, there was a fourth problem actually. This doesn't work in all cases:
  NSRect changedBounds = [changedContentView bounds];

It should have been
  NSRect changedBounds = [changedContentView documentVisibleRect];

Also, I switched to RBSplitView to work around issue 3.
Is there an IB3 plugin for RBSplitView? I've seen web posts indicating 
that it exists but I can't find it.



John Stiles wrote:

I found thee things which, in conjunction, solve the problem:

1 - Rewrite synchronizedViewContentBoundsDidChange as follows. 
-scrollToPoint seems broken. (I am clamping the scroll view to the 
left side on purpose)


- (void)synchronizedViewContentBoundsDidChange:(NSNotification 
*)notification

{
   // get the changed content view from the notification
   NSView *changedContentView=[notification object];

   // get the origin of the NSClipView of the scroll view that
   // we're watching
   NSRect changedBounds = [changedContentView bounds];

   [[self contentView] scrollRectToVisible:NSMakeRect(0, 
changedBounds.origin.y, 1, changedBounds.size.height)];


   // we have to tell the NSScrollView to update its scrollers
   [self reflectScrolledClipView:[self contentView]];
}

2 - Disable non-contiguous layout. This seemed to cause the view to 
scroll to the wrong place.


3 - An NSSplitView was causing my layout to shift around if it was 
collapsed all the way, making things look more broken than they 
were... grr. I don't know how to work around this problem without a 
big kludge; we've filed a radar on AppKit back in 2006 with no word 
yet. (rdar://4399290 - A cocoa view that is shrunk to a degenerate 
rectangle loses its position & size)




John Stiles wrote:

Has anyone gotten this example to work in Leopard?
   
http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html 



I just tried it and I'm having terrible luck. The view is just 
blanking itself out immediately. I can get it to sort-of work if I 
replace -scrollToPoint: with calling -scrollRectToVisible: on the 
document, but it seems to screw up sometimes and go to the wrong 
location. It's really weird.


My use case is fairly simple—I just want line numbers to the left of 
a text view—and the code is basically unchanged (although I've tried 
tweaking it a few times, with mixed results, never 100% working).


___

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

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

2008-04-21 Thread John Stiles

NM that last part, I found the plugin. For the archives, it's at
   http://brockerhoff.net/src/RBSplitView.ibplugin.zip

Sorry, all, for the multiple replies-to-self here :)


John Stiles wrote:

Oh, there was a fourth problem actually. This doesn't work in all cases:
  NSRect changedBounds = [changedContentView bounds];

It should have been
  NSRect changedBounds = [changedContentView documentVisibleRect];

Also, I switched to RBSplitView to work around issue 3.
Is there an IB3 plugin for RBSplitView? I've seen web posts indicating 
that it exists but I can't find it.



John Stiles wrote:

I found thee things which, in conjunction, solve the problem:

1 - Rewrite synchronizedViewContentBoundsDidChange as follows. 
-scrollToPoint seems broken. (I am clamping the scroll view to the 
left side on purpose)


- (void)synchronizedViewContentBoundsDidChange:(NSNotification 
*)notification

{
   // get the changed content view from the notification
   NSView *changedContentView=[notification object];

   // get the origin of the NSClipView of the scroll view that
   // we're watching
   NSRect changedBounds = [changedContentView bounds];

   [[self contentView] scrollRectToVisible:NSMakeRect(0, 
changedBounds.origin.y, 1, changedBounds.size.height)];


   // we have to tell the NSScrollView to update its scrollers
   [self reflectScrolledClipView:[self contentView]];
}

2 - Disable non-contiguous layout. This seemed to cause the view to 
scroll to the wrong place.


3 - An NSSplitView was causing my layout to shift around if it was 
collapsed all the way, making things look more broken than they 
were... grr. I don't know how to work around this problem without a 
big kludge; we've filed a radar on AppKit back in 2006 with no word 
yet. (rdar://4399290 - A cocoa view that is shrunk to a degenerate 
rectangle loses its position & size)




John Stiles wrote:

Has anyone gotten this example to work in Leopard?
   
http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html 



I just tried it and I'm having terrible luck. The view is just 
blanking itself out immediately. I can get it to sort-of work if I 
replace -scrollToPoint: with calling -scrollRectToVisible: on the 
document, but it seems to screw up sometimes and go to the wrong 
location. It's really weird.


My use case is fairly simple—I just want line numbers to the left of 
a text view—and the code is basically unchanged (although I've tried 
tweaking it a few times, with mixed results, never 100% working).


___

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

Please do not post admin requests or moderator comments to the list.
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/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/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: How to import drawing paths into a Cocoa application?

2008-04-21 Thread Graham Cox

Whoops, the URL should be: http://apptree.net/drawkitmain.htm



On 22 Apr 2008, at 10:35 am, Graham Cox wrote:


On 22 Apr 2008, at 10:23 am, Steve Weller wrote:
Are there any easy ways of calculating the points on the path as a  
function of the distance from the start of the path?



I'm not sure about the rest of your question but I can answer this  
part. The short answer is no - it's really tricky.


However if you have a look at my DrawKit project, it solves this  
problem exactly ;-)


One category method on NSBezierPath I have is:

- (NSPoint) pointOnPathAtLength:(float) length slope:(float*) slope;

where  is the linear distance from the start of the path -  
it optionally also returns the slope (dy/dx) at the given point. The  
project is still in beta though this method is used a lot in my code  
and is well debugged.


http://apptree.net/drawkitmain.html


hth,

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/graham.cox%40bigpond.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: Where is mach_port_deallocate()?

2008-04-21 Thread Tommy Nordgren


On 22 apr 2008, at 02.50, stephen joseph butler wrote:


egrep -R mach_port_deallocate /usr/include

	Even better - use the search dialog in the free Text Editor  
TextWrangler from BareBones Software
(www.barebones.com) Then you will get a dialog where you can browse  
any results.

---
See the amazing new SF reel: Invasion of the man eating cucumbers from  
outer space.
On congratulations for a fantastic parody, the producer replies :  
"What parody?"


Tommy Nordgren
[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]


vertically resize NSTextField frame

2008-04-21 Thread Stuart Malin
I have an NSTextField into which I pour some text. I'd like to resize  
the text field's frame to accommodate the typeset text. I'd like to  
adjust only the frame's vertical size, leaving the width fixed. I'd  
appreciate any pointers about what methods I can use to accomplish this.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Truncated Table Headers

2008-04-21 Thread Jason Barker
Hi everyone,
I have resized a few columns in a table to be just a few pixels wider than
the actual names of those columns. I have used bindings to connect an
NSArrayController to these columns. When I test the interface in Interface
Builder as well as building and running the project in Xcode, I notice that
the column names get cut off towards the end by about 15 pixels for
single-word column names or just the last word is removed for two-word
column names. However, when I unbind the column from the NSArrayController,
the column names are not truncated and the world is right.

Does anyone know what I might need to do to get around this?


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

This email sent to [EMAIL PROTECTED]


Re: Flicker when resizing NSStatusItem with Custom View

2008-04-21 Thread Peter Ammon


On Apr 21, 2008, at 5:23 PM, vance wrote:


Hi

I am seeing annoying flickering when resizing a status bar item  
using a custom view.


I tried using
* [statusItem setLength:XX.X] and
* [customView setFrame:newFrame]


Hi Vance,

Thank you for your analysis.  This is a known bug.  You can work  
around it by surrounding your call to setLength: with  
NSDisableScreenUpdates() and NSEnableScreenUpdates();


Hope that helps,
-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: Flicker when resizing NSStatusItem with Custom View

2008-04-21 Thread vance

Thanks Peter, the workaround worked nicely
Vance

On Apr 21, 2008, at 9:25 PM, Peter Ammon wrote:



On Apr 21, 2008, at 5:23 PM, vance wrote:


Hi

I am seeing annoying flickering when resizing a status bar item  
using a custom view.


I tried using
* [statusItem setLength:XX.X] and
* [customView setFrame:newFrame]


Hi Vance,

Thank you for your analysis.  This is a known bug.  You can work  
around it by surrounding your call to setLength: with  
NSDisableScreenUpdates() and NSEnableScreenUpdates();


Hope that helps,
-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]


[SOLVED] vertically resize NSTextField frame

2008-04-21 Thread Stuart Malin
After poking around some more, I came up with this approach, which  
seems to work

(except that I now have to deal with adjusting the text field's origin):

	NSRect r = NSMakeRect(0, 0, [theTextField frame].size.width,  
MAXFLOAT);	

NSSize s = [[theTextField cell] cellSizeForBounds:r];
[theTextField setFrameSize:s];

If there is a better way to be doing this, please advise.


On Apr 21, 2008, at 6:06 PM, [EMAIL PROTECTED] wrote:


Message: 16
Date: Mon, 21 Apr 2008 18:03:30 -1000
From: Stuart Malin <[EMAIL PROTECTED]>
Subject: vertically resize NSTextField frame
To: Cocoa Developer List 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I have an NSTextField into which I pour some text. I'd like to resize
the text field's frame to accommodate the typeset text. I'd like to
adjust only the frame's vertical size, leaving the width fixed. I'd
appreciate any pointers about what methods I can use to accomplish  
this.


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSCollectionView and CoreData question

2008-04-21 Thread Matthew Delves

Greetings,
What I currently have is a core data store that holds information I  
want to display in an NSCollectionView. What I'm wondering is whether  
there is a way to get this accomplished and if so how?


Any help is greatly appreciated.

Thanks,
Matthew Delves
___

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

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

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

This email sent to [EMAIL PROTECTED]


Programmatically placing an item in the dock

2008-04-21 Thread Oliver Wagner

Hi everyone,

I would like to add and remove an item in the dock (preferably with a  
nice poof when removed) programmatically without restarting the dock.  
I can't find a way to do this in 10.5. Do any of you know if this is  
possible?


Thanks,
Ollie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -windowDidLoad not getting called

2008-04-21 Thread Chris Hanson

On Apr 21, 2008, at 5:34 PM, Rick Mann wrote:

That's all a rather unfortunate inconsistency (and part of why I sit  
here learning Cocoa and thinking, "I thought Cocoa was supposed to  
be this great thing").


I basically want my controller to go do some stuff after it and the  
window are loaded. -setWindow seems like an ugly place to do this,  
and -init is probably too early. Is there a better place?


It's not so inconsistent, really.  A window controller is intended to  
be File's Owner for the nib containing a window, not be a separate top- 
level object in some other nib.  If you do that, then the window  
controller will load the nib itself, and thus load the window within  
it too and send itself -windowDidLoad at the end.  Since your window  
controller isn't what loaded the nib containing the window, its - 
windowDidLoad won't be invoked.


You could refactor your nib so that your window and its owning window  
controller are in their own nib, with the window controller as File's  
Owner; check out "Decompose Interface" in Interface Builder 3 for an  
easy tool that will get you partway there.  (You'll have to switch  
from using a separate object to using File's Owner as an instance of  
your NSWindowController subclass yourself.)


NSWindowController isn't the only class in Cocoa that works this way;  
NSViewController also does, for similar reasons.  It's a great  
substrate on which to build reusable "component" views.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >