Blob Detection with Core Image

2008-05-06 Thread Bridger Maxwell
Hello,I am trying to write a program that will detect bright "blobs" of
light in an image and then track those blobs of light. I would be a Cocoa
version of OpenTouch at http://code.google.com/p/opentouch/. I am wondering
the best way to do this sort of image processing with Cocoa frameworks.

I have a started this app and use QTKit Capture to grab video from the
webcam. I get my images through QTCaptureDecompressedVideoOutput as a
CIImage. I can apply some filters to the images and display them in a
OpenGLView, but I don't know how I should implement the blob tracking. From
experience, making an NSBitmapImageRep from the CIImage so I can work with
the image data is far too slow, so I can't work with the blob detection
library used in OpenTouch. Is it possible, or recommended, to implement the
blob tracking as a CIFilter?

I read through CIColorTracking sample code, which is very close to what I
want to do. However, CIColorTracking simplifies the areas of interest down
to one location (where to place the duck). I am having trouble seeing how it
could be adapted to track more than one blob of light. Is it possible to
make a CIFilter that would have an output NSArray containing the points
where the blobs were found? I could see how it would be possible to simplify
the image down to an alpha mask of the blobs, but don't know how I would
extract the number of blobs and location of each from that image. Also,
getting the size of the blob would be desirable.

I have done a lot of reading and don't seem to be getting anywhere. Some
advice on how to proceed would be greatly appreciated.

Thank You,
Bridger Maxwell
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Michael Vannorsdel
Do you have any crash logs or console errors?  Setting the  
progressOutlet to animate should be done on the main thread as well,  
being a UI object, but I don't think that's your crasher.



On May 6, 2008, at 12:07 AM, Karl von Moller wrote:

Thanks for that - I removed the Locks in my code. However I am still  
getting crashes after I changed my code to 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]


Re: SQL

2008-05-06 Thread I. Savant
Fields.Is there any help or documentation available for using  
cocoaMysql?



  Have you expended at least a little researching effort and looked  
at the CocoaMySQL web site or googled "CocoaMySQL documentation"?


  There's even example code in the same place ...

--
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: Threading - How its done?

2008-05-06 Thread Karl von Moller

Hi Michael

Yes I get this when I change the selection in the table view too  
quickly:


"encountered unexpected object type: 7. missing or invalid object  
number. invalid `Kids' array: missing or invalid dictionary at index 0."


gdb gives all sorts of different reports on what caused it but the one  
that comes up the most is: mach_msg_trap


I did try to introduce a delay to see whether this could help but  
still got a crash. selected file in the code below is my method that  
does all the selection handling in the table view.


- (void)tableViewSelectionDidChange: (NSNotification *)notification
{
	[self performSelector:@selector(selectedFile:) withObject:nil  
afterDelay:0.1];

}

I will do the UI animation in the main thread as you suggest.

Many thanks again
Cheers

Karl

On 06/05/2008, at 8:19 PM, Michael Vannorsdel wrote:

Do you have any crash logs or console errors?  Setting the  
progressOutlet to animate should be done on the main thread as well,  
being a UI object, but I don't think that's your crasher.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Michael Vannorsdel
Try changing your thread detaching to just calling the method directly  
so it's in the same thread, lets make sure it's a threading issue and  
not something else.



On May 6, 2008, at 5:04 AM, Karl von Moller wrote:


Hi Michael

Yes I get this when I change the selection in the table view too  
quickly:


"encountered unexpected object type: 7. missing or invalid object  
number. invalid `Kids' array: missing or invalid dictionary at index  
0."


gdb gives all sorts of different reports on what caused it but the  
one that comes up the most is: mach_msg_trap


I did try to introduce a delay to see whether this could help but  
still got a crash. selected file in the code below is my method that  
does all the selection handling in the table view.


- (void)tableViewSelectionDidChange: (NSNotification *)notification
{
	[self performSelector:@selector(selectedFile:) withObject:nil  
afterDelay:0.1];

}

I will do the UI animation in the main thread as you suggest.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Karl von Moller
Yes I tried that only moments ago. I actually went to the trouble of  
completely rebuilding the Application again by not using Threads.  
Instead I'm calling everything from the main thread as it were -  
directly. The application is pretty solid and function without  
crashes. I also got rid of the progress indicator as I'm now dubious  
on those also. In the Non thread version, the Progress Indicators  
slowed the app down considerably.


Cheers

Karl


On 06/05/2008, at 9:10 PM, Michael Vannorsdel wrote:

Try changing your thread detaching to just calling the method  
directly so it's in the same thread, lets make sure it's a threading  
issue and not something else.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Michael Vannorsdel
I'm guessing clicking table items causes a different PDF to be  
displayed.  If so I suspect when you click through them quickly what's  
happening is a previous call to your thread is completing when a new  
PDF is supposed to be displayed and you'll need a way to cancel the  
loading of the previous request when a new one is needed.  This could  
be done by giving each request a unique ID and having the PDF view  
discard (or cache off screen for later) replies for abandoned requests.



On May 6, 2008, at 5:19 AM, Karl von Moller wrote:

Yes I tried that only moments ago. I actually went to the trouble of  
completely rebuilding the Application again by not using Threads.  
Instead I'm calling everything from the main thread as it were -  
directly. The application is pretty solid and function without  
crashes. I also got rid of the progress indicator as I'm now dubious  
on those also. In the Non thread version, the Progress Indicators  
slowed the app down considerably.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: SQL

2008-05-06 Thread lbland


On May 6, 2008, at 2:44 AM, vinitha ks wrote:

I'm trying to do some database applications using cocoaMySql  
framework.This is my first database application. could connect with  
the database,and accesses the table of particular databases.But i  
couldn't access Fields.Is there any help or documentation available  
for using cocoaMysql?I didn't get the idea from the code itself.How  
can i access the fields?I think in that example tableSource class  
have loadTable function.How we can processes the queries?


hi-

You can always go direct ODBC to MySQL. We built a 64-bit connector  
for Leopard as part of our download:


http://www.peervisual.com/VvidgetUser10.5.4.dmg.zip

which interfaces with a Cocoa application.

thanks!-

-lance
VVI

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: SQL

2008-05-06 Thread Johannes Huning

On May 6, 2008, at 12:45 PM, I. Savant wrote:

Fields.Is there any help or documentation available for using  
cocoaMysql?



 Have you expended at least a little researching effort and looked  
at the CocoaMySQL web site or googled "CocoaMySQL documentation"?


 There's even example code in the same place ...

--
I.S.


Mr. Eric Steven Raymond's "How To Ask Questions The Smart Way" (http://www.catb.org/~esr/faqs/smart-questions.html 
) is also a very good read.


-
JH.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: User Default Groups

2008-05-06 Thread Jerry Krinock

On 2008 May, 05, at 23:27, Kevin Ferguson wrote:


In poking around other plist flies


Well, that's a good way to start Kevin, but now you've got to start  
poking around some documentation...


I have seen several 'groups' of data stored under a heading. Is it  
at all possible to take each individual piece of data and store them  
under a unique group?  Furthermore, is it at all possible to load  
each aspect of data back after saving it in this manner?


All is possible.  I believe that what you call "groups" are what we  
call "dictionaries".


Try poking around the documentation "Collections Programming Topics  
for Cocoa", "Property List Programming Guide for Cocoa", NSDictionary  
and NSUserDefaults.  Also, when you poke around in .plist files, use a  
plist editor such as "/Developer/Applications/Utilities/Property List  
Editor.app" or, better, Brian Webster's "PlistEdit Pro".


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Karl von Moller
I think you are right. It is the PDF loading that appears to be  
causing the crashing. I think your guess on the previous call to the  
Thread completing when a new PDF should load is absolutely the  
problem. Trouble is I really don't know how to implement the Unique ID  
system you speak of. I might have to do some serious reading before  
advancing much from here. Any suggested reading or example code I  
could look at?


Many thanks.

Karl

On 06/05/2008, at 10:00 PM, Michael Vannorsdel wrote:

I'm guessing clicking table items causes a different PDF to be  
displayed.  If so I suspect when you click through them quickly  
what's happening is a previous call to your thread is completing  
when a new PDF is supposed to be displayed and you'll need a way to  
cancel the loading of the previous request when a new one is  
needed.  This could be done by giving each request a unique ID and  
having the PDF view discard (or cache off screen for later) replies  
for abandoned requests.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cannot remove an observer ... because it is not registered as an observer.

2008-05-06 Thread Steve Steinitz

Summary:

KVO compliance discussion
Detailed problem description
Request (to Jens) for clarification
What I've tried
A failed workaround
A crappy, unsound workaround


Hi Jens, Jack and List Participants,

Thanks, Jens, for your reply.

On 4/5/08, Jens Alfke wrote:

Cannot remove an observer  for the key 
path "name" from  because it is not 
registered as an observer.


"It" refers to the observer. -removeObserver:forKeyPath: raises this
exception if told to remove an object that isn't currently registered
as an observer. So what's happening is that a table view is trying to
unregister as an observer from one of your objects that it
unfortunately didn't previouly register as an observer for.



The usual cause of this is that you have a property that isn't KVO-compliant.


All my properties have a setters and getters and have the 
appropriate calls to


will|did Access|Change ValueForKey

before/after any change.  Is there more that I need to do?

For what its worth, let me explain exactly what is causing the problem.

Firstly, the 'Contribution' Entity is more-or-less a many to 
many join table (but with a 'degree' attribute) between 
'Alternatives' and 'Values'.


I have a simple but unusual arrangement of what is displayed in 
the 'degree' column of my 'Alternatives' tableView.  Depending 
on the selection in a 'Values' tableView, I show the 'degree' 
attribute of a certain set of 'Contribution' objects (basically, 
the related 'Contributions' of the selected 'Value' -- there 
will be one for each 'Alternative').  i.e. Every time the user 
changes the 'Values' table selection, the degree column of the 
Alternatives' tableView changes to show the 'degree' attributes 
of a new set of 'Contributions'.  That change causes the "cannot 
remove an observer" exceptions.


Simple idea, hard to explain.  It could more easily have been a 
very wide tableView with a column for each 'Contribution', the 
column label being the name of the relevant 'Value'.  The 
current technique avoids at least three undesirable aspects:


variable number of table columns,
truncated column labels,
horizontal scrolling.

Those undesirables will be even more so when the app is also a 
web app.



Something accesses your 'foo' property and registers as an observer of
that property, and also as an observer of the object that's the
property's current value;


Jens, can you please elaborate on that distinction?  I was not 
aware that something could be an observer of an object.



you change the value of 'foo' without letting anyone know; the
observer then later decides to stop observing, gets your 'foo'
property, and removes itself as an observer of that object. But it's
no longer the same object that it registered as an observer for...


OK.  I made a guess that the culprit was ether the 'Alternative' 
tableView or the 'Alternative' ArrayController.  So, in my 
WindowController's awakeFromNib, I tried adding them as 
observers for the 'degree' property (the one the exception 
complains about) for all 'Contribution' objects, like so:


NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity: [NSEntityDescription 
entityForName: @"Contribution"

inManagedObjectContext: [self managedObjectContext]]];


NSArray *contributions = [[self managedObjectContext] 
executeFetchRequest: fetchRequest error: &error];

[fetchRequest release];

for (Contribution *aContribution in contributions)
{
[aContribution  addObserver: alternativeTableView
 forKeyPath: @"degree"
options: 
(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)

context: NULL];
[aContribution  addObserver: alternatives
 forKeyPath: @"degree"
options: 
(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)

context: NULL];
}

It didn't help.  Either the addObserver is insufficient or I 
still don't know what the "it" is in the error message.  (Or, 
I've created over-observance as mentioned by Jack.)


In desperation, I added try-catch around each step of the code 
that throws exceptions and discovered that these two lines throw :


[selectedAlternative
setContributionForSelectedDecisionValue: nil];  // KVO dummy setter

[alternativeArrayController rearrangeObjects];

but this line doesn't throw

[alternativeTableView   reloadData];

In the short-term, I've caught the two exceptions -- that has 
allowed the application to more-or-less work.  But it doesn't 
bode well for the future.  For one thing, any subsequent 
[alternativeArrayController rearrangeObjects] will fail.


I know of at least two other people struggling with this problem 
and have seen others encounter it in the past.  It would be 
great to have an answer here in th

Resetting IKImageEditPanel's Effects Selection

2008-05-06 Thread Jamie Phelps
I have an IKImageBrowserView and IKImageView. When the selection  
changes in the IKImageBrowserView, the IKImageView is updated with the  
newly selected image. If I invoke the IKImageEditPanel by double  
clicking the IKImageView and choose an effect such as Sepia, the image  
changes appropriately. Then, I dismiss the edit panel and change the  
selection in my IKImageBrowserView. This updates the image  
representation in the browser view. Without invoking the edit panel on  
the newly selected image, I select a new image in the browser view.  
The previously selected image is updated in the browser view and it  
has the same filter that I applied to the first image. Each subsequent  
selection does the same unless I change the selection by invoking the  
edit panel and choosing Original.


Is this a bug or is there some way that I could specify that the edit  
panel should reset its filter?


Another question, tangentially related to this, is how can I "undo" a  
filter? If I take the edited image from the IKImageView and then  
return to it, subsequent edits are applied on top of the previous  
edits, which become the original when setting the IKImageView image  
content afresh.


Thanks,
Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cannot remove an observer ... because it is not registered as an observer.

2008-05-06 Thread Hamish Allan
On Tue, May 6, 2008 at 2:27 PM, Steve Steinitz
<[EMAIL PROTECTED]> wrote:

>  All my properties have a setters and getters and have the appropriate calls
> to
>
> will|did Access|Change ValueForKey
>
>  before/after any change.  Is there more that I need to do?

You don't say whether or not you have set up manual notification
(using +[NSObject automaticallyNotifiesObserversForKey:]) which you
must do if you are calling willChangeValueForKey: et al...

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-06 Thread Thomas Engelmeier


On 05.05.2008, at 18:20, Jens Alfke wrote:

I find it safest to go with the Windows encoding, because it's a  
superset of both ASCII and ISO-Latin-1 that maps all 256 characters,  
so it never returns nil. It's also the default encoding on Windows,  
so there's a lot of text out there in the wild encoded with it.)


As the OP wants to create NSStrings with data created by his  
application I'm pretty sure he will not want the the Windows encoding  
- unless he parses text documents originating from Windows.


If the bytes come from MacOS text files he may want to use the  
MacRoman encoding, otherwise creating UTF8 and passing around  
NSStrings will be the way to go - especially in Europe where all that  
äöüñá goodies exist.


Regards,
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: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Michael Gardner
With help from Stéphane Sudre, I found that calling - 
registerForDraggedTypes: somewhere outside the destination's -init:  
method solves the issue. Can anyone shed light on why this would be?  
My views are created programatically rather than loaded from a .nib,  
so there shouldn't be any interference from that side of things. As  
far as I can tell, this looks to be a bug in Cocoa's DnD code, or at  
least a caveat that should be mentioned in the documentation...


-Michael

On May 5, 2008, at 4:02 PM, Michael Gardner wrote:

I'm trying to implement drag & drop in an NSView subclass. I made  
sure that the source returns NSDragOperationMove in - 
draggingSourceOperationMaskForLocal:, and that the destination calls  
-registerForDraggedTypes: with the same (custom) type that the  
source uses for the drag operation.


The drag operation starts properly, but the destination's - 
draggingEntered: method never gets called, no matter what I do. What  
could cause this? Does it matter if the source and destination are  
the same object?


-Michael


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread I. Savant
> With help from Stéphane Sudre, I found that calling
> -registerForDraggedTypes: somewhere outside the destination's -init: method
> solves the issue. Can anyone shed light on why this would be?

  I've never personally experienced the problem you're describing, but
if you're literally calling this from an init method with this
signature:  - (id)init  ... then "You're Doing It Wrong". Views and
their subclasses use -initWithFrame: as their designated initializer.
If your call to -registerForDraggedTypes: is in an -init method, it
won't get called unless you're creating your view with that method ...
which you shouldn't do because it's a view and "strange things will
happen".

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


Disable HUD in WebKit pdf display

2008-05-06 Thread jda


Hi,

I'm using WebKit to display pdfs in my app. The HUD that comes up 
when you mouse over the lower portion of the pdf display is 
inappropriate for my use (and actually can obscure some controls when 
a window is resized to a small size). My question is, how do I 
disable this feature so that WebKit doesn't put up the HUD?


Thanks,

Jon
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Andy Lee
I haven't been following this thread and I'm not sure this would make  
a difference, but do you really mean -init:, or -initWithFrame:?


--Andy

On May 6, 2008, at 10:27 AM, Michael Gardner wrote:

With help from Stéphane Sudre, I found that calling - 
registerForDraggedTypes: somewhere outside the destination's -init:  
method solves the issue. Can anyone shed light on why this would be?  
My views are created programatically rather than loaded from a .nib,  
so there shouldn't be any interference from that side of things. As  
far as I can tell, this looks to be a bug in Cocoa's DnD code, or at  
least a caveat that should be mentioned in the documentation...


-Michael

On May 5, 2008, at 4:02 PM, Michael Gardner wrote:

I'm trying to implement drag & drop in an NSView subclass. I made  
sure that the source returns NSDragOperationMove in - 
draggingSourceOperationMaskForLocal:, and that the destination  
calls -registerForDraggedTypes: with the same (custom) type that  
the source uses for the drag operation.


The drag operation starts properly, but the destination's - 
draggingEntered: method never gets called, no matter what I do.  
What could cause this? Does it matter if the source and destination  
are the same object?


-Michael


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Blob Detection with Core Image

2008-05-06 Thread Bridger Maxwell
I think I was unclear on where I was lost. I didn't think that I would be
able to use the OpenTouch blob detection framework, because I couldn't pass
it a CIImage, and converting the CIImage to an NSBitMapImageRep was too
slow. The only way to pass the image data to the blob detection library was
through the function:

void computeBlobs(int *pixels);


Therefor I thought that I would have to work with the CIImage only, perhaps
by making a CIFilter. How would the ObjC wrapper work? Oh, and I think the
Cocoa app which you are seeing with the OpenTouch source is actually the one
I am working on right now, I have access the the svn. :)
Thank You,
Bridger Maxwell

On Tue, May 6, 2008 at 3:50 AM, Mike Abdullah <[EMAIL PROTECTED]>
wrote:

> This seems an awful lot of work to me for little gain. If you check out
> the OpenTouch source, they have an example Cocoa app which really requires
> very little extra work. I think you'd be far better off writing an ObjC
> wrapper than creating your own entirely separate framework. Paweł would
> quite likely be happy to even incorporate it into the framework.
>
> Mike.
>
>
> On 6 May 2008, at 08:33, Bridger Maxwell wrote:
>
>  Hello,I am trying to write a program that will detect bright "blobs" of
> > light in an image and then track those blobs of light. I would be a
> > Cocoa
> > version of OpenTouch at http://code.google.com/p/opentouch/. I am
> > wondering
> > the best way to do this sort of image processing with Cocoa frameworks.
> >
> > I have a started this app and use QTKit Capture to grab video from the
> > webcam. I get my images through QTCaptureDecompressedVideoOutput as a
> > CIImage. I can apply some filters to the images and display them in a
> > OpenGLView, but I don't know how I should implement the blob tracking.
> > From
> > experience, making an NSBitmapImageRep from the CIImage so I can work
> > with
> > the image data is far too slow, so I can't work with the blob detection
> > library used in OpenTouch. Is it possible, or recommended, to implement
> > the
> > blob tracking as a CIFilter?
> >
> > I read through CIColorTracking sample code, which is very close to what
> > I
> > want to do. However, CIColorTracking simplifies the areas of interest
> > down
> > to one location (where to place the duck). I am having trouble seeing
> > how it
> > could be adapted to track more than one blob of light. Is it possible to
> > make a CIFilter that would have an output NSArray containing the points
> > where the blobs were found? I could see how it would be possible to
> > simplify
> > the image down to an alpha mask of the blobs, but don't know how I would
> > extract the number of blobs and location of each from that image. Also,
> > getting the size of the blob would be desirable.
> >
> > I have done a lot of reading and don't seem to be getting anywhere. Some
> > advice on how to proceed would be greatly appreciated.
> >
> > Thank You,
> > Bridger Maxwell
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> > http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> >
> > This email sent to [EMAIL PROTECTED]
> >
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Michael Gardner
My actual init method has a different signature, and calls - 
initWithFrame: on its superclass. I was trying to abstract away extra  
details, but I shouldn't have made it look like an actual method  
signature. Sorry about that.


-Michael

On May 6, 2008, at 9:34 AM, I. Savant wrote:


With help from Stéphane Sudre, I found that calling
-registerForDraggedTypes: somewhere outside the destination's - 
init: method

solves the issue. Can anyone shed light on why this would be?


 I've never personally experienced the problem you're describing, but
if you're literally calling this from an init method with this
signature:  - (id)init  ... then "You're Doing It Wrong". Views and
their subclasses use -initWithFrame: as their designated initializer.
If your call to -registerForDraggedTypes: is in an -init method, it
won't get called unless you're creating your view with that method ...
which you shouldn't do because it's a view and "strange things will
happen".

--
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: Threading - How its done?

2008-05-06 Thread Michael Vannorsdel
There's several ways, whatever you can think of to implement canceling  
or ignoring a previous request.  For instance maybe just use an  
incrementing counter.  Before you detach the thread tell the PDF view  
what number it should expect, then pass that number to the thread,  
which will then be passed back to the PDF view from the thread.  The  
PDF view can then check if the number of the response is equal to the  
number it's currently waiting for.


Or you can identify each item in the table view with ascending numbers  
or names (a string name, file path, row number) and use that as the  
unique ID for the corresponding PDF.  The advantage to this is if the  
PDF view gets an old response back, it can cache it in a dictionary  
for when the table item it belonged to is selected again.  Before  
loading the data it can first check if the data had already been  
loaded and just grab it from the dictionary, using the unique ID as  
the key.  Caching responses depends how often you might load the same  
PDF multiple times and how large the data is.


performSelectorOnMainThread:withObject:waitUntilDone: only allows one  
argument, but you can put multiple args in an array and pass that in.   
There's better ways to pass multiple arguments such as Distributed  
Objects, but that's a whole other concept you'll have to learn.  DO is  
a mechanism where threads can communicate and pass objects back and  
forth between each other, even threads in different processes.


Also, it might make more sense to put up the progress indicator from  
the main thread before detaching to load and then dismiss the  
indicator when the PDF view gets the PDF it wants.  Since it's  
possible for multiple load threads to be running at the same time, you  
don't want them both fighting over control of the progress indicator.


As you become more familiar with threading and making it work you'll  
find more elegant ways to implement all of this.  My suggestions are  
less elegant but easier to start with.  Just remember there's no  
guarantee with the order threads will complete; it's possible a later  
request can finish before a previous one.


These are just a few ideas, but there's many ways you could handle this.


On May 6, 2008, at 7:25 AM, Karl von Moller wrote:

I think you are right. It is the PDF loading that appears to be  
causing the crashing. I think your guess on the previous call to the  
Thread completing when a new PDF should load is absolutely the  
problem. Trouble is I really don't know how to implement the Unique  
ID system you speak of. I might have to do some serious reading  
before advancing much from here. Any suggested reading or example  
code I could look at?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Setting intercell spacing in NSBrowser

2008-05-06 Thread Jens Alfke


On 5 May '08, at 11:31 PM, Martin Redington wrote:


I tried subclassing NSMatrix, and over-riding

-[NSMatrix initWithFrame:  
mode:prototype:numberOfRows:numberOfColumns:]


to set the intercellSpacing. I can see it getting called, but I don't
get any gaps between rows, and when I browse the NSMatrix with
F-Script, the intercellSpacing shows up as (0, 0).


The browser is probably setting it to a default value later on when it  
initializes iself. Why not just set it in your controller's - 
windowDidLoad or -awakeFromNib method?


—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: Blob Detection with Core Image

2008-05-06 Thread Raphael Sebbe
I understand, processing is made on CPU anyway. The overhead you get is
because you duplicate (or redraw) the image before processing it.

I believe you actually get a CVImageBufferRef from QTKit, not a CIImage,
which resides in memory (not VRAM, as it comes from a camera anyway). You
could get access to pixel data that way:
CVPixelBufferLockBaseAddress
CVPixelBufferGetBaseAddress
CV...Unlock...

Avoiding unnecessary copy. This is not tested.

Raphael

2008/5/6 Bridger Maxwell <[EMAIL PROTECTED]>:

> I think I was unclear on where I was lost. I didn't think that I would be
> able to use the OpenTouch blob detection framework, because I couldn't
> pass
> it a CIImage, and converting the CIImage to an NSBitMapImageRep was too
> slow. The only way to pass the image data to the blob detection library
> was
> through the function:
>
> void computeBlobs(int *pixels);
>
>
> Therefor I thought that I would have to work with the CIImage only,
> perhaps
> by making a CIFilter. How would the ObjC wrapper work? Oh, and I think the
> Cocoa app which you are seeing with the OpenTouch source is actually the
> one
> I am working on right now, I have access the the svn. :)
> Thank You,
> Bridger Maxwell
>
> On Tue, May 6, 2008 at 3:50 AM, Mike Abdullah <[EMAIL PROTECTED]>
> wrote:
>
> > This seems an awful lot of work to me for little gain. If you check out
> > the OpenTouch source, they have an example Cocoa app which really
> requires
> > very little extra work. I think you'd be far better off writing an ObjC
> > wrapper than creating your own entirely separate framework. Paweł would
> > quite likely be happy to even incorporate it into the framework.
> >
> > Mike.
> >
> >
> > On 6 May 2008, at 08:33, Bridger Maxwell wrote:
> >
> >  Hello,I am trying to write a program that will detect bright "blobs" of
> > > light in an image and then track those blobs of light. I would be a
> > > Cocoa
> > > version of OpenTouch at http://code.google.com/p/opentouch/. I am
> > > wondering
> > > the best way to do this sort of image processing with Cocoa
> frameworks.
> > >
> > > I have a started this app and use QTKit Capture to grab video from the
> > > webcam. I get my images through QTCaptureDecompressedVideoOutput as a
> > > CIImage. I can apply some filters to the images and display them in a
> > > OpenGLView, but I don't know how I should implement the blob tracking.
> > > From
> > > experience, making an NSBitmapImageRep from the CIImage so I can work
> > > with
> > > the image data is far too slow, so I can't work with the blob
> detection
> > > library used in OpenTouch. Is it possible, or recommended, to
> implement
> > > the
> > > blob tracking as a CIFilter?
> > >
> > > I read through CIColorTracking sample code, which is very close to
> what
> > > I
> > > want to do. However, CIColorTracking simplifies the areas of interest
> > > down
> > > to one location (where to place the duck). I am having trouble seeing
> > > how it
> > > could be adapted to track more than one blob of light. Is it possible
> to
> > > make a CIFilter that would have an output NSArray containing the
> points
> > > where the blobs were found? I could see how it would be possible to
> > > simplify
> > > the image down to an alpha mask of the blobs, but don't know how I
> would
> > > extract the number of blobs and location of each from that image.
> Also,
> > > getting the size of the blob would be desirable.
> > >
> > > I have done a lot of reading and don't seem to be getting anywhere.
> Some
> > > advice on how to proceed would be greatly appreciated.
> > >
> > > Thank You,
> > > Bridger Maxwell
> > > ___
> > >
> > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> > >
> > > Please do not post admin requests or moderator comments to the list.
> > > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> > >
> > > Help/Unsubscribe/Update your Subscription:
> > >
> > >
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> > >
> > > This email sent to [EMAIL PROTECTED]
> > >
> >
> >
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/raphael.sebbe%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread I. Savant
On Tue, May 6, 2008 at 10:44 AM, Michael Gardner <[EMAIL PROTECTED]> wrote:
> My actual init method has a different signature, and calls -initWithFrame:
> on its superclass. I was trying to abstract away extra details, but I
> shouldn't have made it look like an actual method signature. Sorry about
> that.

  At this point, I think it's time to post your relevant code.

  Again, I have never run across the problem you've described -- it
should work as far as I know. I'll assume you've verified that your
own init method (and the associated call to is
-registerForDraggedTypes:) is actually called as expected (ie, you've
stepped through it with the debugger and it is in fact called).

--
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: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Michael Gardner
Upon further investigation, I've found that if I call - 
registerForDraggedTypes: before adding the view to its parent window  
with -setContentView:, I never get the -draggingEntered: messages. If  
I do so afterwards, everything works properly. Is this expected  
behavior?


As for posting the code, I'm trying to put together a minimal test  
case, but so far I haven't been able to duplicate the problem. There  
must be some relevant difference between the test case and my actual  
code, but I haven't been able to figure out what that is yet.


-Michael

On May 6, 2008, at 10:14 AM, I. Savant wrote:

On Tue, May 6, 2008 at 10:44 AM, Michael Gardner  
<[EMAIL PROTECTED]> wrote:
My actual init method has a different signature, and calls - 
initWithFrame:

on its superclass. I was trying to abstract away extra details, but I
shouldn't have made it look like an actual method signature. Sorry  
about

that.


 At this point, I think it's time to post your relevant code.

 Again, I have never run across the problem you've described -- it
should work as far as I know. I'll assume you've verified that your
own init method (and the associated call to is
-registerForDraggedTypes:) is actually called as expected (ie, you've
stepped through it with the debugger and it is in fact called).

--
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: -draggingEntered: never gets called [solved?]

2008-05-06 Thread I. Savant
On Tue, May 6, 2008 at 11:34 AM, Michael Gardner <[EMAIL PROTECTED]> wrote:
> Upon further investigation, I've found that if I call
> -registerForDraggedTypes: before adding the view to its parent window with
> -setContentView:, I never get the -draggingEntered: messages. If I do so
> afterwards, everything works properly. Is this expected behavior?

  Interesting ... have you placed the call in the view's
-viewDidMoveToSuperview to get this to work?

>  As for posting the code, I'm trying to put together a minimal test case,
> but so far I haven't been able to duplicate the problem. There must be some
> relevant difference between the test case and my actual code, but I haven't
> been able to figure out what that is yet.

  One thing that occurs to me is to check where you're defining your
custom type. Does it exist before you're registering it or vice-versa?
:-)

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


'Raises For Not Applicable Keys' not enough to step exception raises?

2008-05-06 Thread Sean McBride
Hi all,

I have an app that uses an NSOutlineView bound to an NSTreeController in
entity mode.  The tree controller matches all 'Shape' entities, but
there are also sub-entities named 'Square' and 'Circle'.  I have a
master-detail UI.  All 'Shapes' have a 'name' attribute and there is no
problem there.  Only 'Circle' has a 'radius' attribute however, and I
want to show this in a textfield.  I've bound the textfield and
unchecked the 'Raises For Not Applicable Keys'.

The problem is that I'm still getting an NSException raised.  It's
raised from [Circle valueForUndefinedKey:].  'Circle' is an
NSManagedObject subclass.

Does one also have to implement valueForUndefinedKey: in this
situation?  I thought removing 'Raises For Not Applicable Keys' was
supposed to be sufficient.

Thanks,

--

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-06 Thread Jens Alfke


On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:

As the OP wants to create NSStrings with data created by his  
application I'm pretty sure he will not want the the Windows  
encoding - unless he parses text documents originating from Windows.


He didn't say where the data originates from, or what those APIs are  
that return the strings. If they're networking APIs, the data could  
very likely have originated on Windows.


Also, you missed my point about using CP1252 (WinLatin1). It's useful  
as a fallback for any unknown C strings because (a) it's a superset of  
ISO-Latin-1, which (b) has no gaps in it (as ISO does, from  
0x80-0x9F), so decoding text into an NSString will never fail and  
return nil. (I've debugged several crashes that stemmed from nil  
NSStrings decoded from garbage strings.)


If the bytes come from MacOS text files he may want to use the  
MacRoman encoding, otherwise creating UTF8 and passing around  
NSStrings will be the way to go - especially in Europe where all  
that äöüñá goodies exist.


For the most part only old (pre-OS X) files would still be using  
MacRoman. Current Mac apps generally default to UTF-8.


—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: Blob Detection with Core Image

2008-05-06 Thread Jean-Daniel Dupas

You have to properly configure your QTVideoContext to get this.

By default, most of the CoreVideo sample code uses  
QTOpenGLTextureContextCreate(), and so, you get CVOpenGLTextureRef.
If you want to retreive CVPixelBuffers, you have to create your  
QTVisualContext using the QTPixelBufferContextCreate() function instead.
And when you create this kind of context, you have to configure the  
expected pixel format too.


The following sample show you how to configure this kind of context  
and how to access pixel data:


http://developer.apple.com/samplecode/QTPixelBufferVCToCGImage/listing1.html



Le 6 mai 08 à 17:08, Raphael Sebbe a écrit :

I understand, processing is made on CPU anyway. The overhead you get  
is

because you duplicate (or redraw) the image before processing it.

I believe you actually get a CVImageBufferRef from QTKit, not a  
CIImage,
which resides in memory (not VRAM, as it comes from a camera  
anyway). You

could get access to pixel data that way:
CVPixelBufferLockBaseAddress
CVPixelBufferGetBaseAddress
CV...Unlock...

Avoiding unnecessary copy. This is not tested.

Raphael

2008/5/6 Bridger Maxwell <[EMAIL PROTECTED]>:

I think I was unclear on where I was lost. I didn't think that I  
would be
able to use the OpenTouch blob detection framework, because I  
couldn't

pass
it a CIImage, and converting the CIImage to an NSBitMapImageRep was  
too
slow. The only way to pass the image data to the blob detection  
library

was
through the function:

void computeBlobs(int *pixels);


Therefor I thought that I would have to work with the CIImage only,
perhaps
by making a CIFilter. How would the ObjC wrapper work? Oh, and I  
think the
Cocoa app which you are seeing with the OpenTouch source is  
actually the

one
I am working on right now, I have access the the svn. :)
Thank You,
Bridger Maxwell

On Tue, May 6, 2008 at 3:50 AM, Mike Abdullah <[EMAIL PROTECTED] 
>

wrote:

This seems an awful lot of work to me for little gain. If you  
check out

the OpenTouch source, they have an example Cocoa app which really

requires
very little extra work. I think you'd be far better off writing an  
ObjC
wrapper than creating your own entirely separate framework. Paweł  
would

quite likely be happy to even incorporate it into the framework.

Mike.


On 6 May 2008, at 08:33, Bridger Maxwell wrote:

Hello,I am trying to write a program that will detect bright  
"blobs" of

light in an image and then track those blobs of light. I would be a
Cocoa
version of OpenTouch at http://code.google.com/p/opentouch/. I am
wondering
the best way to do this sort of image processing with Cocoa

frameworks.


I have a started this app and use QTKit Capture to grab video  
from the
webcam. I get my images through QTCaptureDecompressedVideoOutput  
as a
CIImage. I can apply some filters to the images and display them  
in a
OpenGLView, but I don't know how I should implement the blob  
tracking.

From
experience, making an NSBitmapImageRep from the CIImage so I can  
work

with
the image data is far too slow, so I can't work with the blob

detection

library used in OpenTouch. Is it possible, or recommended, to

implement

the
blob tracking as a CIFilter?

I read through CIColorTracking sample code, which is very close to

what

I
want to do. However, CIColorTracking simplifies the areas of  
interest

down
to one location (where to place the duck). I am having trouble  
seeing

how it
could be adapted to track more than one blob of light. Is it  
possible

to

make a CIFilter that would have an output NSArray containing the

points

where the blobs were found? I could see how it would be possible to
simplify
the image down to an alpha mask of the blobs, but don't know how I

would

extract the number of blobs and location of each from that image.

Also,

getting the size of the blob would be desirable.

I have done a lot of reading and don't seem to be getting anywhere.

Some

advice on how to proceed would be greatly appreciated.

Thank You,
Bridger Maxwell
___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:



http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net


This email sent to [EMAIL PROTECTED]






___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

Please do not post admin requests or moderator comments to the list.
Contact the

Cocoa UI Question

2008-05-06 Thread Kristopher Matthews
(I apologize in advance if this question is not appropriate for this  
list.)


I'm writing a small app to graph the speed of an attached hard disk  
under various circumstances. My thoughts for the interface are at http://homepage.mac.com/kmmx/UI.png 
 - where the left custom view will be my graph, and the right control  
(not sure if a table appropriate) will contain a list of volumes.


My question is: what is the proper method for the user to specify  
"measure this disk and append to the current graph"? I've thought of  
double clicking, or drag and drop. Both cases feel a little strange to  
me so I'm wondering what others think.


Thanks,
Kris



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: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Michael Gardner

On May 6, 2008, at 10:47 AM, I. Savant wrote:

On Tue, May 6, 2008 at 11:34 AM, Michael Gardner  
<[EMAIL PROTECTED]> wrote:

Upon further investigation, I've found that if I call
-registerForDraggedTypes: before adding the view to its parent  
window with
-setContentView:, I never get the -draggingEntered: messages. If I  
do so

afterwards, everything works properly. Is this expected behavior?


 Interesting ... have you placed the call in the view's
-viewDidMoveToSuperview to get this to work?



The first thing I tried was putting the call in the source's - 
mouseDown: method, right before the drag operation. Then on a hunch, I  
put the call outside the class, with the code that creates the view  
and adds it to the window:


NSWindow * window = [[[NSWindow alloc] initWithContentRect:  
NSMakeRect(100, 100, 500, 500) styleMask: NSTitledWindowMask |  
NSMiniaturizableWindowMask | NSResizableWindowMask backing:  
NSBackingStoreBuffered defer: NO] autorelease];

[windows addObject: window];
[window setTitle: @"MyWindow"];
MyView * view = [[[MyView alloc] initWithFoo: foo bar: bar frame:  
NSMakeRect(0, 0, 500, 500)] autorelease];

[view registerMyDraggedTypes];
[window setContentView: view];
[window makeKeyAndOrderFront: self];

[view registerMyDraggedTypes] just does the actual - 
registerForDraggedTypes: call with the right argument. Moving that  
statement one line down, after [window setContentView], fixes the issue.


As for posting the code, I'm trying to put together a minimal test  
case,
but so far I haven't been able to duplicate the problem. There must  
be some
relevant difference between the test case and my actual code, but I  
haven't

been able to figure out what that is yet.


 One thing that occurs to me is to check where you're defining your
custom type. Does it exist before you're registering it or vice-versa?
:-)



It's just a #define statement (#define MyPasteboardType @"application/ 
x-foo"), so it should get taken care of during preprocessing... as  
long as the compiler can see the definition from wherever I'm using  
it, that should be enough, right?



--
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: Threading - How its done?

2008-05-06 Thread Michael Ash
On Tue, May 6, 2008 at 12:46 AM, Karl von Moller
<[EMAIL PROTECTED]> wrote:
> Many thanks for your reply on this - much appreciated. I did think it had
> something to do with the images being swapped out as often the crashes
> occurred as I quickly changed selection in the table view. Because I know
> nothing about threading, I resorted to anything to lock the threads. That's
> why you see my silly attempt at Locking!

I mean no offense by any of this, but threading is a really complex
and difficult subject that you can't really just jump into and try to
get something working by trial and error. Partly this is because it's
difficult to the extent that you can't reasonably learn it by trial
and error. Partly this is because threading bugs are often extremely
subtle and it's entirely reasonable to write code which works fine for
you now but which breaks in extremely difficult to debug ways later
on.

There are lots of articles out there on general problems in
multithreading, locks, synchronization, message passing, and such. For
Apple-specific documentation, I'd recommend:

Threaded Programming Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/Introduction/chapter_1_section_1.html

Cocoa Fundamentals Guide: Multithreaded Cocoa Programs:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/AddingBehaviortoaCocoaProgram/chapter_4_section_6.html

This is part of the first article but it's really important so I'm
including it separately, Cocoa thread safety guidelines:
http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/chapter_950_section_2.html#

I highly encourage reading through all of those and any other
resources you can lay hands on. Your current path will at best result
in a program which works *most* of the time.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Multiple controls in a table cell

2008-05-06 Thread Randall Meadows

On May 5, 2008, at 6:17 PM, j o a r wrote:

On May 5, 2008, at 4:46 PM, Hamish Allan wrote:

I don't remember where we got it, but if you Google
"SubviewTableViewController" or "SubviewTableViewCell" it should  
get you in

the right direction.


It's by Joar Wingfors:

http://joar.com/code/


On Leopard you can often use NSCollectionView or NSRuleEditor  
instead of that old hack...   :-)


You can also create a custom cell subclass to solve this type of  
problem. This is a good piece of sample code to show how that works:





I've started on writing a subclass of NSSliderCell, after getting the  
idea after looking at your other code (so thank you for that, Joar!).   
I'll look into this sample as well.

___

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

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

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 UI Question

2008-05-06 Thread Stéphane


On May 6, 2008, at 6:16 PM, Kristopher Matthews wrote:

(I apologize in advance if this question is not appropriate for  
this list.)


I'm writing a small app to graph the speed of an attached hard disk  
under various circumstances. My thoughts for the interface are at  
http://homepage.mac.com/kmmx/UI.png - where the left custom view  
will be my graph, and the right control (not sure if a table  
appropriate) will contain a list of volumes.


On most Mac OS X applications, the volume list would be on the left  
(a NSTableView is a good choice).


My question is: what is the proper method for the user to specify  
"measure this disk and append to the current graph"? I've thought  
of double clicking, or drag and drop. Both cases feel a little  
strange to me so I'm wondering what others think.


Does it require a lot of CPU usage? Because just selecting the volume  
could start the operation.



___

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

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

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 UI Question

2008-05-06 Thread I. Savant
>  My question is: what is the proper method for the user to specify "measure
> this disk and append to the current graph"? I've thought of double clicking,
> or drag and drop. Both cases feel a little strange to me so I'm wondering
> what others think.

  First, I think other forums/lists have been suggested in the past
for Macintosh-related UI discussions, so that's probably the better
place to put this discussion, but ...

  Usually a 'source list' (which is what this essentially is) is on
the left side of the window. I would suggest a standard source list in
that the currently-selected drive in the source list gets its
information displayed above or below the graph somewhere (like its
details) in addition to a single "measure" action button. Perhaps
selecting multiple drives and clicking the "measure" button would
automatically test each drive and append its information to the graph.

  Critical are the following: a) list of available drives to measure,
b) necessary information about the selection, and c) the graph.

  Perhaps the workflow could be:

1 - Select drives to measure (multiple)
2 - Click 'measure' button
3 - Wait for measurements
4 - Display/examine measurements in graph
5 - Go to 1 as needed

  That would be most Mac-like. Hope that helps. Followups should
probably be taken to another list/forum (I don't know any off-hand).

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


NSComboBox adjustments

2008-05-06 Thread Howard Shere


I need to do one of two things to my NSComboBox sublcass:

1) Change the text hilite color

OR

2) Change it so when an item is selected from the NSComboBox popup  
menu and the text is inserted into the text area, it is not hilited.


I have tried overriding selectText: but that just makes the text not  
appear at all. Obviously it does something with regards to focus (I  
think).


Any suggestions?

Howard Shere
http://www.livejournal.com/users/realgreendragon/
Altair 8800a to Mac OS X so far...


___

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

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

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 UI Question

2008-05-06 Thread Buddy Kurz


I agree with the table on the left.
If the goal is to include multiple drives in the graph for comparison,  
perhaps a column of check boxes could indicate inclusion in the graph.


Buddy Kurz

On May 6, 2008, at 9:36 AM, Stéphane wrote:



On May 6, 2008, at 6:16 PM, Kristopher Matthews wrote:

(I apologize in advance if this question is not appropriate for  
this list.)


I'm writing a small app to graph the speed of an attached hard disk  
under various circumstances. My thoughts for the interface are at http://homepage.mac.com/kmmx/UI.png 
 - where the left custom view will be my graph, and the right  
control (not sure if a table appropriate) will contain a list of  
volumes.


On most Mac OS X applications, the volume list would be on the left  
(a NSTableView is a good choice).


My question is: what is the proper method for the user to specify  
"measure this disk and append to the current graph"? I've thought  
of double clicking, or drag and drop. Both cases feel a little  
strange to me so I'm wondering what others think.


Does it require a lot of CPU usage? Because just selecting the  
volume could start the operation.



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa UI Question

2008-05-06 Thread Andy Lee

On May 6, 2008, at 12:16 PM, Kristopher Matthews wrote:
(I apologize in advance if this question is not appropriate for this  
list.)


Here's a list it's definitely appropriate for:



--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSCollectionView animation complaint

2008-05-06 Thread David Carlisle
If I have two items in my NSCollectionView and I remove the first  
item, the animation causes the second item to slide underneath the  
first item which then pops out of existence revealing the second item  
underneath.  It would look better if the animation caused the second  
item to slide over the first item, concealing it, which would make it  
visually symmetric with adding a new first item, which causes the old  
first item to slide into the second position unconcealing the new item  
in the first position.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Open Recent->foo suddenly broke

2008-05-06 Thread David Springer
All,

My File->Open Recent-> menu suddenly broke and I am having trouble
debugging this problem.  What messages are sent from the items in this
menu, and where are they sent?  I want to see if somehow I broke a
link somewhere...

Thanks!
- Dave.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: NSCollectionView animation complaint

2008-05-06 Thread I. Savant
> If I have two items in my NSCollectionView and I remove the first item, the
> animation causes the second item to slide underneath the first item which
> then pops out of existence revealing the second item underneath.  It would
> look better if the animation caused the second item to slide over the first
> item, concealing it, which would make it visually symmetric with adding a
> new first item, which causes the old first item to slide into the second
> position unconcealing the new item in the first position.

  Right, we'll all get right on that. ;-)

  When you have a complaint such as this, **file a bug report**. The
cocoa-dev list is not the right place to submit one-off UI/API
complaints (ie, "preaching to the choir").

  http://bugreporter.apple.com

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


KVO Difficulties With Array Controller Selection didChange/willChange

2008-05-06 Thread Colin Cornaby
I have an array controller for a bunch of objects that are called  
"client". Clients have a one to many relationship with "records" (the  
relationship is accessible with the key "records).


I am observing the array controller based on the key  
"selection.records". I'm running into a problem though. The client can  
send the didChange/willChangeValueForKey: notifcations, and advertise  
when it is about to mutate the records relationship. However, I never  
get notified of the change based on the observation of  
"selection.records" on the array controller. It seems that the  
selection proxy object does not advertise the willChange/didChange  
notifications. The only way it seems to be registered of when the  
selection's records change is to actually get the real object (by  
using selected objects and getting the first object), and then  
directly adding an observer.


Is there a way to get this same behavior to work just by observing  
based on the selection of the array controller?


Thanks,
Colin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Resource fork & metadata - max size?

2008-05-06 Thread Karl Moskowski
I've been working on an Objective-C Zip utilities class that wraps  
around minizip. It works and it's mostly compatible with archives  
produced by Leopard's Archive Utility.


I was able to create AppleDouble ._ files using Uli Kusterer's  
UKXattrMetadataStore class a slightly hacked version of the  
GMAppleDouble class from MacFUSE. (The current GMAppleDouble in the  
project has a method for creating an NSData object from all the  
entries, but no inverse method; I added a method to do so, plus an  
accessor for the entries and I moved the entry interface to the public  
header. I filed a bug at MacFUSE, but it's been deemed a low priority  
enhancement request.)


To save a file's resource fork and extended attributes:
NSString *path = @"/path/to/a/file.ext";
NSString *appleDoublePath = @"/path/to/a/._file.ext";
GMAppleDouble *appleDouble = [GMAppleDouble appleDouble];
	NSData *finderInfo = [UKXattrMetadataStore dataForKey:[NSString  
stringWithCString:XATTR_FINDERINFO_NAME] atPath:path traverseLink:NO];
	NSData *resourceFork = [UKXattrMetadataStore dataForKey:[NSString  
stringWithCString:XATTR_RESOURCEFORK_NAME] atPath:path traverseLink:NO];
	if (finderInfo.length > 0) [appleDouble  
addEntryWithID:DoubleEntryFinderInfo data:finderInfo];
	if (resourceFork.length > 0) [appleDouble  
addEntryWithID:DoubleEntryResourceFork data:resourceFork];

NSData *appleDoubleData = [appleDouble data];
[appleDoubleData writeToFile:appleDoublePath atomically:YES];

To restore a resource fork and extended attributes to a file:
	NSData * appleDoubleData  = [NSData dataWithContentsOfFile:  
appleDoublePath];
	GMAppleDouble *appleDouble = [[GMAppleDouble alloc]  
initWithData:appleDoubleData];

if ([appleDouble entries] && [appleDouble entries].count > 0) {
for (GMAppleDoubleEntry *entry in [appleDouble entries]) {
switch ([entry entryID]) {
case DoubleEntryFinderInfo:
	[UKXattrMetadataStore setData:[entry data] forKey:[NSString  
stringWithCString:XATTR_FINDERINFO_NAME] atPath:path traverseLink:NO];

break;
case DoubleEntryResourceFork:
	[UKXattrMetadataStore setData:[entry data] forKey:[NSString  
stringWithCString:XATTR_RESOURCEFORK_NAME] atPath:path traverseLink:NO];

break;
default:
break;
}
}
}

My question is, how big can the resource fork and Finder info get? Is  
reading them into an in-memory NSData object feasible?


BTW, if anyone's interested in my still-rough source code (Leopard- 
only, garbage collection required), let me know and I'd be happy to  
pass it along.



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



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: How to convert UInt8 array to NSString

2008-05-06 Thread Aki Inoue


On 2008/05/06, at 8:56, Jens Alfke wrote:



On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:

As the OP wants to create NSStrings with data created by his  
application I'm pretty sure he will not want the the Windows  
encoding - unless he parses text documents originating from Windows.


He didn't say where the data originates from, or what those APIs are  
that return the strings. If they're networking APIs, the data could  
very likely have originated on Windows.


Also, you missed my point about using CP1252 (WinLatin1). It's  
useful as a fallback for any unknown C strings because (a) it's a  
superset of ISO-Latin-1, which (b) has no gaps in it (as ISO does,  
from 0x80-0x9F), so decoding text into an NSString will never fail  
and return nil. (I've debugged several crashes that stemmed from nil  
NSStrings decoded from garbage strings.)

Jens,

Actually, I don't recommend using CP1252 as the generic fallback  
encoding like this.


The encoding does have gaps, and the handling of those invalid gaps  
varies between conversion engines.  CF/NSString treat the invalid  
bytes strictly and return nil encountering those.


Also, being compatible with ISO Latin1 (aka ISO 8859-1) is becoming  
less compelling reasons in the Net since the overall percentage of the  
encoding (both ISO 8859-1 and cp1252 combined) is declining.


If the bytes come from MacOS text files he may want to use the  
MacRoman encoding, otherwise creating UTF8 and passing around  
NSStrings will be the way to go - especially in Europe where all  
that äöüñá goodies exist.


For the most part only old (pre-OS X) files would still be using  
MacRoman. Current Mac apps generally default to UTF-8.
So, our recommendation now is to try UTF-8 first; then, try some other  
encoding deduced from the context (user's localization, intended  
source/destination of the data, etc).  If all failed, should try  
MacRoman as the ultimate fallback (the encoding has no gap so never  
fails).


Aki




—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-06 Thread Clark Cox
On Tue, May 6, 2008 at 10:45 AM, Aki Inoue <[EMAIL PROTECTED]> wrote:
>
>  On 2008/05/06, at 8:56, Jens Alfke wrote:
>
>
> >
> > On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:
> >
> >
> > > As the OP wants to create NSStrings with data created by his application
> I'm pretty sure he will not want the the Windows encoding - unless he parses
> text documents originating from Windows.
> > >
> >
> > He didn't say where the data originates from, or what those APIs are that
> return the strings. If they're networking APIs, the data could very likely
> have originated on Windows.
> >
> > Also, you missed my point about using CP1252 (WinLatin1). It's useful as a
> fallback for any unknown C strings because (a) it's a superset of
> ISO-Latin-1, which (b) has no gaps in it (as ISO does, from 0x80-0x9F), so
> decoding text into an NSString will never fail and return nil. (I've
> debugged several crashes that stemmed from nil NSStrings decoded from
> garbage strings.)
> >
>  Jens,
>
>  Actually, I don't recommend using CP1252 as the generic fallback encoding
> like this.
>
>  The encoding does have gaps, and the handling of those invalid gaps varies
> between conversion engines.  CF/NSString treat the invalid bytes strictly
> and return nil encountering those.
>
>  Also, being compatible with ISO Latin1 (aka ISO 8859-1) is becoming less
> compelling reasons in the Net since the overall percentage of the encoding
> (both ISO 8859-1 and cp1252 combined) is declining.

Not just declining, completely overtaken by UTF-8:



>
>
>
> >
> > > If the bytes come from MacOS text files he may want to use the MacRoman
> encoding, otherwise creating UTF8 and passing around NSStrings will be the
> way to go - especially in Europe where all that äöüñá goodies exist.
> > >
> >
> > For the most part only old (pre-OS X) files would still be using MacRoman.
> Current Mac apps generally default to UTF-8.
> >
>  So, our recommendation now is to try UTF-8 first; then, try some other
> encoding deduced from the context (user's localization, intended
> source/destination of the data, etc).  If all failed, should try MacRoman as
> the ultimate fallback (the encoding has no gap so never fails).


-- 
Clark S. Cox III
[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: Setting intercell spacing in NSBrowser

2008-05-06 Thread Corbin Dunn


On May 6, 2008, at 8:07 AM, Jens Alfke wrote:


On 5 May '08, at 11:31 PM, Martin Redington wrote:


I tried subclassing NSMatrix, and over-riding

-[NSMatrix initWithFrame:  
mode:prototype:numberOfRows:numberOfColumns:]


to set the intercellSpacing. I can see it getting called, but I don't
get any gaps between rows, and when I browse the NSMatrix with
F-Script, the intercellSpacing shows up as (0, 0).


The browser is probably setting it to a default value later on when  
it initializes iself. Why not just set it in your controller's - 
windowDidLoad or -awakeFromNib method?


That's too late or too early, depending on how you look at it.

You could (probably) override -addColumn in NSBrowser, call super,  
then get the last matrix, and *then* set the spacing. I haven't tried  
this, but it might work.


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]


Deep sleep and file wrappers?

2008-05-06 Thread Keith Blount
Hi,

I have an application that saves its information as a file package. My 
NSDocument subclass overrides -saveDocument: to save individual files within 
the project folder (because there can be hundreds of files and I wouldn't want 
to save the whole file wrapper every time a single file is changed). It 
overrides -readFromURL:... to load in data from the project package that is 
initially required, and then other files are only loaded as and when needed. 
All of which works very well.

A couple of months ago, I posted about a data loss issue two users had had:

http://www.cocoabuilder.com/archive/message/cocoa/2008/2/19/199368

I never got to the bottom of the issue, and now another user has reported the 
same thing. To recap: whilst my app was open, the user's computer went into 
deep sleep (this was the case with the first two users; the third user cannot 
remember the exact circumstances but says his computer has had deep sleep 
problems recently). When it came out of deep sleep, everything in the project's 
file wrapper - that is, everything in the folder-with-extension on disk - had 
been wiped. All that was in there were the few files that were auto-saved 
_after_ deep sleep.

There is nothing in my app that would go through and delete everything in this 
manner - or at least, nothing obvious that I've done. Instead, it seems that 
during deep sleep something happens whereby the whole file package gets 
replaced/overwritten with a blank one. But again, I don't know how this could 
be as I never, ever write out the whole wrapper - only individual documents get 
written inside the wrapper in the -saveDocument: method.

So, my question is: is there anything that can happen during deep sleep that 
could make an NSDocument overwrite itself? Is there anything in the document 
architecture that could cause this when working with packages?

I'm really at a loss on this. Fortunately, as I know of, this has only happened 
to three of thousands of users. But three is still too many when it comes to 
data loss, obviously. Many thanks in advance for any advice or suggestions on 
where to start digging.

All the best,
Keith


  

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

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Army Research Lab
To the original poster:

How much experience do you have with threads?  I'm a little confused reading
through your posts, I can't tell if you are familiar with pthreads, and just
need to figure out NSThreads, or if you have no threading experience at all.

To everyone that has both Cocoa and threading experience:

Can NSView rendering be done on a worker thread, but without displaying the
results?  It occurred to me that if this is possible, another option to the
original problem would be to have a pool of worker threads that render the
thumbnails/PDFviews in the background.  It would simply be a matter of
having a thread-safe priority queue (so if the user clicks on a thumbnail,
it gets jumped to the head of the queue), and let the threads grab whatever
happens to be the highest priority to work on, returning the results to the
main thread to display later.  Alternatively, each time you click on a
thumbnail, it could spawn a thread, with the thread returning the results to
the main thread when it is done.

Thanks,
Cem Karan

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread glenn andreas


On May 6, 2008, at 1:30 PM, Army Research Lab wrote:


To the original poster:

How much experience do you have with threads?  I'm a little confused  
reading
through your posts, I can't tell if you are familiar with pthreads,  
and just
need to figure out NSThreads, or if you have no threading experience  
at all.


To everyone that has both Cocoa and threading experience:

Can NSView rendering be done on a worker thread, but without  
displaying the
results?  It occurred to me that if this is possible, another option  
to the
original problem would be to have a pool of worker threads that  
render the

thumbnails/PDFviews in the background.  It would simply be a matter of
having a thread-safe priority queue (so if the user clicks on a  
thumbnail,
it gets jumped to the head of the queue), and let the threads grab  
whatever
happens to be the highest priority to work on, returning the results  
to the

main thread to display later.  Alternatively, each time you click on a
thumbnail, it could spawn a thread, with the thread returning the  
results to

the main thread when it is done.



Nothing prevents you from rendering to an offscreen bitmap context in  
a thread and then feeding that image back to a main view (it's  
actually fairly simple since all you need to coordinate is the "take  
the next job from the queue"/"put the result on another queue" which  
are fairly straight forward threading exercises).  I use this exact  
technique to prove a "media browser" like view and it works quite well  
(and I wouldn't be surprised if IKImageBrowser didn't do the same).



Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
m.o.t.e.s. | minute object twisted environment simulation



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Update NSMenuItem while displaying

2008-05-06 Thread Jere Gmail
Thanks, it worked with this line:

[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];


On Sat, May 3, 2008 at 2:50 PM, Ricky Sharp <[EMAIL PROTECTED]> wrote:
>
> On May 3, 2008, at 7:31 AM, Jere Gmail wrote:
>
>> I have a NSMenuItem int a NSStatusBarItem that displays the remaining
>> time of a timer. It is only updated when I'm not viewing the menu.
>> When I click in the menu, I can see in the debug console that no there
>> are no calls to the timer loop function.
>> How can I solve it?
>
>
> When you're adding your timer to the run loop, I think you've only specified
> the NSDefaultRunLoopMode.  In addition to that, add the timer with a second
> mode of NSEventTrackingRunLoopMode.
>
> See addTimer:forMode:
>
>
> If using 10.5 and later, there appears to be a new mode
> (NSRunLoopCommonModes).  I have not used that myself, but check the docs to
> see if it may apply to you.
>
> ___
> Ricky A. Sharp mailto:[EMAIL PROTECTED]
> Instant Interactive(tm)   http://www.instantinteractive.com
>
>



-- 
http://zon7blog.wordpress.com/
And again we fall.
___

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

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

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

This email sent to [EMAIL PROTECTED]


User Preferences Causing Application to Crash

2008-05-06 Thread Patrick Altman
I am very new to cocoa development but a rather seasoned software  
engineer in general. I am attempting to get a handle on how user  
preferences work in the context of the NSUserDefaultsController and  
Bindings.


I follow the steps outlined here:
http://developer.apple.com/cocoa/cocoabindings.html

Despite this document clearly being for 10.4 and I am in 10.5, it  
seems to generally still apply.


I get everything wired up with little problem and run the application.  
When I select Preferences from my menu, it launches my preference  
panel and I type in a value and close the panel. The setting got  
written fine to the settings file as verified with a


defaults read

command in the Terminal.

However, when i go to click the "NewApplication" application menu  
again to be able to click the Preferences... menu item to pull back up  
the preferences pane, the menu doesn't drop down and instead my  
application crashes with this in the Console:


	The Debugger has exited due to signal 11 (SIGSEGV).The Debugger has  
exited due to signal 11 (SIGSEGV).


Any ideas of what I am doing wrong?

I have started a fresh project and repeated the steps just in case I  
screwed some setting up somewhere and I get the same results.


Any help is much appreciated.

-Patrick Altman
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: User Preferences Causing Application to Crash

2008-05-06 Thread John Stiles

I'm going to guess that your preferences window is set to release-on-close.
This can be set in Interface Builder; check the Inspector for this 
window and make sure that checkbox is not set.



Patrick Altman wrote:
I am very new to cocoa development but a rather seasoned software 
engineer in general. I am attempting to get a handle on how user 
preferences work in the context of the NSUserDefaultsController and 
Bindings.


I follow the steps outlined here:
http://developer.apple.com/cocoa/cocoabindings.html

Despite this document clearly being for 10.4 and I am in 10.5, it 
seems to generally still apply.


I get everything wired up with little problem and run the application. 
When I select Preferences from my menu, it launches my preference 
panel and I type in a value and close the panel. The setting got 
written fine to the settings file as verified with a


defaults read

command in the Terminal.

However, when i go to click the "NewApplication" application menu 
again to be able to click the Preferences... menu item to pull back up 
the preferences pane, the menu doesn't drop down and instead my 
application crashes with this in the Console:


The Debugger has exited due to signal 11 (SIGSEGV).The Debugger 
has exited due to signal 11 (SIGSEGV).


Any ideas of what I am doing wrong?

I have started a fresh project and repeated the steps just in case I 
screwed some setting up somewhere and I get the same results.


Any help is much appreciated.

-Patrick Altman
___

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

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


Bindings & Checkbox in NSTableView

2008-05-06 Thread Steven Huey

Hi,

I want to bind the value of a checkbox in a column of a NSTableView to  
a custom object managed by an NSArrayController. I have the  
NSArrayController setup to manage a class I've created using Obj-C 2.0  
properties, and added keys in the IB inspector for the  
NSArrayController to match the properties of my class. I've bound the  
value of the columns in my NSTableView to my array controller using  
arrangedObjects.keyName. The column containing checkboxes is bound to  
a property that is backed by a NSNumber instance.


Everything is working fine except clicking on the checkboxes doesn't  
change the value in my custom class, and my checkboxes are always "on"  
since by default the property they are bound to is initialized with  
[NSNumber numberWithBool:YES]. Other columns that use the default text  
cell and that are bound to NSString properties work fine.



My custom class is defined as:

@interface Foo : NSObject {
NSNumber *active;
NSString *description;
}
@property(copy) NSNumber *active;
@property(copy) NSString *description;
@end

@implementation Foo
@synthesize active, description;

- (id)init
{
if (self = [super init]) {
self.active = [NSNumber numberWithBool:YES];
self.description = @"Untitled";
}

return self;
}
@end

I set the table column to use a checkbox using:

NSButtonCell *cell = [[NSButtonCell alloc] init];
[cell setButtonType:NSSwitchButton];
[cell setImagePosition:NSImageOnly];
[cell setControlSize:NSSmallControlSize];
[[myTable tableColumnWithIdentifier:@"active"] setDataCell:cell];


Any ideas on what I'm missing or how better to debug this?

Thanks,
Steve


--
Steven Huey Software - http://www.stevenhuey.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: User Preferences Causing Application to Crash

2008-05-06 Thread Patrick Altman

That did the trick!

Thanks.


On May 6, 2008, at 2:10 PM, John Stiles wrote:

I'm going to guess that your preferences window is set to release-on- 
close.
This can be set in Interface Builder; check the Inspector for this  
window and make sure that checkbox is not set.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 'Raises For Not Applicable Keys' not enough to step exception raises?

2008-05-06 Thread Keary Suska
on 5/6/08 9:51 AM, [EMAIL PROTECTED] purportedly said:

> I have an app that uses an NSOutlineView bound to an NSTreeController in
> entity mode.  The tree controller matches all 'Shape' entities, but
> there are also sub-entities named 'Square' and 'Circle'.  I have a
> master-detail UI.  All 'Shapes' have a 'name' attribute and there is no
> problem there.  Only 'Circle' has a 'radius' attribute however, and I
> want to show this in a textfield.  I've bound the textfield and
> unchecked the 'Raises For Not Applicable Keys'.
> 
> The problem is that I'm still getting an NSException raised.  It's
> raised from [Circle valueForUndefinedKey:].  'Circle' is an
> NSManagedObject subclass.
> 
> Does one also have to implement valueForUndefinedKey: in this
> situation?  I thought removing 'Raises For Not Applicable Keys' was
> supposed to be sufficient.

I think you also have to specify a "Not Applicable" placeholder as
well--have you done that?

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]


bindings and mutliple NIBs

2008-05-06 Thread Torsten Curdt
I have an array of objects. The main application loads the objects via  
Core Data. The controller is in the main NIB. Now I have a separate  
NIB for the preferences. In this this NIB I have a NSTableColumn I  
want to bind to the controller for the objects. But the controller for  
the objects is in the main NIB and I cannot bind to it from inside the  
preferences NIB.


I assume it's not OK to create a second controller in the preferences  
NIB bound to the same managedObjectContext. Just having the controller  
in the preferences NIB doesn't work either as the main application  
also needs access.


How would you solve this?

Could I maybe establish the binding manually when I load the NIB?

cheers
--
Torsten

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: Bindings & Checkbox in NSTableView

2008-05-06 Thread Hamish Allan
On Tue, May 6, 2008 at 8:31 PM, Steven Huey <[EMAIL PROTECTED]> wrote:

>  I set the table column to use a checkbox using:
>
> NSButtonCell *cell = [[NSButtonCell alloc] init];
> [cell setButtonType:NSSwitchButton];
> [cell setImagePosition:NSImageOnly];
> [cell setControlSize:NSSmallControlSize];
> [[myTable tableColumnWithIdentifier:@"active"] setDataCell:cell];

Before further examining why your existing approach is failing, you
might first of all try setting up the table column to use a checkbox
in Interface Builder rather than in code (drag a check box cell from
the palette over the existing text cell of the table column).

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: bindings and mutliple NIBs

2008-05-06 Thread Hamish Allan
On Tue, May 6, 2008 at 9:06 PM, Torsten Curdt <[EMAIL PROTECTED]> wrote:

>  I assume it's not OK to create a second controller in the preferences NIB
> bound to the same managedObjectContext.

I wouldn't assume that -- as long as all your GUI code is kept to the
main thread, there shouldn't be any concurrent accesses...

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


@property (readonly, retain) ???

2008-05-06 Thread Optical Ali
Hi,

What does it mean to to have both readonly and retain in property
declaration?
My understanding is that retain is for assignment.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: @property (readonly, retain) ???

2008-05-06 Thread Jake Carter
As far as I understand it, you can omit the 'retain' if your property  
is readonly. You are correct that the retain is only for assignments.


"Specifies that retain should be invoked on the object upon assignment."

From:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#/ 
/apple_ref/doc/uid/TP30001163-CH17-SW2


:// Jake


On May 6, 2008, at 2:14 PM, Optical Ali wrote:


Hi,

What does it mean to to have both readonly and retain in property
declaration?
My understanding is that retain is for assignment.
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Sending an image to Preview to preview the image

2008-05-06 Thread Kimo
My app produces a list of images (NSData format), and I'd like the app  
Preview to display the image when the user double-clicks on an image  
in my app.


Currently I use NSPerformService as shown below, which works, but  
Preview always asks to save the file when you close its window.  I've  
seen other apps where you double-click an image and Preview opens a  
window with a title something like "Preview of " and it doesn't  
try to save the image when you close the window.


To send an image to Preview using NSPerformService:
NSData *data;  /* assume exists */
NSPasteboard *pb = [NSPasteboard pasteboardWithUniqueName];
[pb declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil];
[pb setData:data forType:NSTIFFPboardType];
NSPerformService( @"Preview/Open images", pb );

It works, but is there a better way to send image data to Preview?
Thanks in advance!


___

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

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

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

This email sent to [EMAIL PROTECTED]


WebView does not expose bindings in IB 3

2008-05-06 Thread Adam Radestock

Has anyone else come across this? -

I have a WebView in a window, with an NSProgressIndicator which  
animates when the WebView is loading it's content.
I used to bind the "Animates" binding on the progress indicator to the  
"isLoading" binding using the Inspector in Interface Builder, but now  
the WebView doesn't show up as a valid binding target...


If I open an old version of my NIB in IB 3, and inspect this setting,  
IB reports the binding target as: "".


Is this a bug in IB, or am I missing something?


Adam Radestock
Glass Monkey Software
www.glassmonkey.co.uk
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 'Raises For Not Applicable Keys' not enough to step exception raises?

2008-05-06 Thread Sean McBride
On 5/6/08 2:03 PM, Keary Suska said:

>> I have an app that uses an NSOutlineView bound to an NSTreeController in
>> entity mode.  The tree controller matches all 'Shape' entities, but
>> there are also sub-entities named 'Square' and 'Circle'.  I have a
>> master-detail UI.  All 'Shapes' have a 'name' attribute and there is no
>> problem there.  Only 'Circle' has a 'radius' attribute however, and I
>> want to show this in a textfield.  I've bound the textfield and
>> unchecked the 'Raises For Not Applicable Keys'.
>>
>> The problem is that I'm still getting an NSException raised.  It's
>> raised from [Circle valueForUndefinedKey:].  'Circle' is an
>> NSManagedObject subclass.
>>
>> Does one also have to implement valueForUndefinedKey: in this
>> situation?  I thought removing 'Raises For Not Applicable Keys' was
>> supposed to be sufficient.
>
>I think you also have to specify a "Not Applicable" placeholder as
>well--have you done that?

I have.  And it is even correctly shown in the textfield.  But I still
get the exception thrown by NSManagedObject's valueForUndefinedKey:  The
docs even say "The default implementation raises an
NSUndefinedKeyException" which seems to be what I'm seeing, but I don't
get why its happening even with 'Raises For Not Applicable Keys' off.

Thanks for your help Keary.

--

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Resource fork & metadata - max size?

2008-05-06 Thread Sean McBride
On 5/6/08 1:43 PM, Karl Moskowski said:

>My question is, how big can the resource fork and Finder info get? Is
>reading them into an in-memory NSData object feasible?

Well, Files.h has:

OSErr  FSGetForkSize(FSIORefNum forkRefNum, SInt64 *forkSize)

So looks like a fork can be very big indeed.

The folks on carbon-dev would know more...

--

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sending an image to Preview to preview the image

2008-05-06 Thread Michael Watson

Thoughts:

1. Why not build your own preview panel/window? It's remarkably easy  
to do if you already have the image data in an NSData object.


2. If you must use Preview, you could write the image to a temp file  
and tell Preview to open that via NSWorkspace's - 
openFile:withApplication: method.



--
m-s

On 06 May, 2008, at 18:08, Kimo wrote:

My app produces a list of images (NSData format), and I'd like the  
app Preview to display the image when the user double-clicks on an  
image in my app.


Currently I use NSPerformService as shown below, which works, but  
Preview always asks to save the file when you close its window.   
I've seen other apps where you double-click an image and Preview  
opens a window with a title something like "Preview of " and it  
doesn't try to save the image when you close the window.


To send an image to Preview using NSPerformService:
NSData *data;  /* assume exists */
NSPasteboard *pb = [NSPasteboard pasteboardWithUniqueName];
	[pb declareTypes:[NSArray arrayWithObject:NSTIFFPboardType]  
owner:nil];

[pb setData:data forType:NSTIFFPboardType];
NSPerformService( @"Preview/Open images", pb );

It works, but is there a better way to send image data to Preview?
Thanks in advance!


___

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

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

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


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-06 Thread Ricky Sharp


On May 6, 2008, at 10:56 AM, Jens Alfke wrote:



On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:

As the OP wants to create NSStrings with data created by his  
application I'm pretty sure he will not want the the Windows  
encoding - unless he parses text documents originating from Windows.


He didn't say where the data originates from, or what those APIs are  
that return the strings. If they're networking APIs, the data could  
very likely have originated on Windows.


Also, you missed my point about using CP1252 (WinLatin1). It's  
useful as a fallback for any unknown C strings because (a) it's a  
superset of ISO-Latin-1, which (b) has no gaps in it (as ISO does,  
from 0x80-0x9F), so decoding text into an NSString will never fail  
and return nil. (I've debugged several crashes that stemmed from nil  
NSStrings decoded from garbage strings.)



This is not entirely true.

windows1252 (CP1252) also has "holes" in it (undefined characters).

Definitely attempt to find out what platform or platforms data will  
come from.  It's often the case where your app needs "legacy" import  
features to work with the most common older Mac/Windows encodings.


Many apps offer "previews" of text that is to be imported.  Complex  
algorithms exist to determine an encoding from a block of text, but  
sometimes it's best to let users drive the show (i.e. let them pick an  
encoding and see if their preview looks valid).


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sending an image to Preview to preview the image

2008-05-06 Thread Bill


On May 6, 2008, at 3:31 PM, Michael Watson wrote:

Thoughts:

1. Why not build your own preview panel/window? It's remarkably easy  
to do if you already have the image data in an NSData object.


True, but preview has other advantages, such as saving the file to  
various formats.  Sure I could do all that, but since that  
functionality already exists in Preview



2. If you must use Preview, you could write the image to a temp file  
and tell Preview to open that via NSWorkspace's - 
openFile:withApplication: method.


I tried that also, but then there is that temp file that could end up  
in the Recovered Items folder in the Trash.  That method also exposes  
the temp folder in Preview (which is probably not a big deal, but it  
looks odd).


Thanks,
k



--
m-s

On 06 May, 2008, at 18:08, Kimo wrote:

My app produces a list of images (NSData format), and I'd like the  
app Preview to display the image when the user double-clicks on an  
image in my app.


Currently I use NSPerformService as shown below, which works, but  
Preview always asks to save the file when you close its window.   
I've seen other apps where you double-click an image and Preview  
opens a window with a title something like "Preview of " and it  
doesn't try to save the image when you close the window.


To send an image to Preview using NSPerformService:
NSData *data;  /* assume exists */
NSPasteboard *pb = [NSPasteboard pasteboardWithUniqueName];
	[pb declareTypes:[NSArray arrayWithObject:NSTIFFPboardType]  
owner:nil];

[pb setData:data forType:NSTIFFPboardType];
NSPerformService( @"Preview/Open images", pb );

It works, but is there a better way to send image data to Preview?
Thanks in advance!



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sending an image to Preview to preview the image

2008-05-06 Thread Ricky Sharp


On May 6, 2008, at 5:40 PM, Bill wrote:



On May 6, 2008, at 3:31 PM, Michael Watson wrote:

Thoughts:

1. Why not build your own preview panel/window? It's remarkably  
easy to do if you already have the image data in an NSData object.


True, but preview has other advantages, such as saving the file to  
various formats.  Sure I could do all that, but since that  
functionality already exists in Preview



2. If you must use Preview, you could write the image to a temp  
file and tell Preview to open that via NSWorkspace's - 
openFile:withApplication: method.


I tried that also, but then there is that temp file that could end  
up in the Recovered Items folder in the Trash.  That method also  
exposes the temp folder in Preview (which is probably not a big  
deal, but it looks odd).



My app currently does this as well for PDF files.  While I could (and  
may still) put in all the code to directly print, I felt it was a nice  
stepping stone to rely on Preview.


But, yes, the temp folder gets a bit clunky especially when users do a  
Save As... (they start in the temp folder in the NSSavePanel).



For another feature of the app (which also generates PDF), I changed  
the workflow to first run an NSSavePanel to let the user specify file  
name and location.  I then generate the PDF at that location and  
launch Preview to open it.  I'm not sure if this workflow works for  
you though since you probably want more of a "throw away" preview.


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: @property (readonly, retain) ???

2008-05-06 Thread Bill Bumgarner

On May 6, 2008, at 2:14 PM, Optical Ali wrote:

What does it mean to to have both readonly and retain in property
declaration?
My understanding is that retain is for assignment.


If your property is truly readonly, then retain is largely irrelevant.

However, you can also make a readonly property readwrite in a class  
extension and then use @synthesize to create both the setter/getter  
methods automatically, at which point "retain" is rather critical.


Retain seems like an implementation detail, but it really isn't.   
Switching between retain, copy and assign has a significant potential  
impact on clients, thus they are exposed in the interface.


b.bum

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Kyle Sluder
On Tue, May 6, 2008 at 10:44 AM, Michael Gardner <[EMAIL PROTECTED]> wrote:
> My actual init method has a different signature, and calls -initWithFrame:
> on its superclass. I was trying to abstract away extra details, but I
> shouldn't have made it look like an actual method signature. Sorry about
> that.

IB will never call this method.  It will always call -initWithFrame:,
as it has no way of knowing that you have designated a different
initializer.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Graham Cox
I'm not sure if it's documented as such, but I *think* this is  
expected behaviour. The reality is that the dragging is really  
implemented by the underlying window (ultimately using Carbon) so if  
the view has no reference to its window when the drag types are  
registered, they probably just "get lost". A nib-instantiated window  
won't have this problem as it's most likely built top down.


Generally it's probably wise to build structures completely (in this  
case window+views) before trying to set up high-level behaviours on  
them which probably do assume that things are fully constructed.


G.



On 7 May 2008, at 1:34 am, Michael Gardner wrote:

Upon further investigation, I've found that if I call - 
registerForDraggedTypes: before adding the view to its parent window  
with -setContentView:, I never get the -draggingEntered: messages.  
If I do so afterwards, everything works properly. Is this expected  
behavior?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-06 Thread Karl von Moller

Thanks to all that posted.


To the original poster:

How much experience do you have with threads?  I'm a little  
confused reading
through your posts, I can't tell if you are familiar with pthreads,  
and just
need to figure out NSThreads, or if you have no threading  
experience at all.



As I said earlier on, I don't have ANY experience with threading at  
all - this was my first attempt to try and understand how to implement  
a threading scheme. The Apple documentation was my first port of call  
and at least the basics of it, I got from those articles. I found a  
great deal of reading material online however I think the noise of  
hearing the same comments "Threading is hard ..." etc made this all  
the more difficult. This mailing list has in one day at least, given  
me some clear guidance on my next approach which I really appreciate.  
At some point though, to take things out of the theoretical, you have  
to put things into practice. Granted my approach may have been very  
hit and miss but it certainly accelerated my learning!




to have a pool of worker threads that render the
thumbnails/PDFviews in the background.  It would simply be a matter  
of
having a thread-safe priority queue (so if the user clicks on a  
thumbnail,
it gets jumped to the head of the queue), and let the threads grab  
whatever
happens to be the highest priority to work on, returning the  
results to the
main thread to display later.  Alternatively, each time you click  
on a
thumbnail, it could spawn a thread, with the thread returning the  
results to

the main thread when it is done.


This idea is exactly what I was trying to achieve - The idea of the  
thumbnail creation and the PDF loading happening in a separate thread.  
However to have a thread safe priority queue to organize the "Worker  
Threads" sounds like the missing link - And with that some safe way to  
cancel Threads that have been outdated by the user before that Thread  
had time to set the PDF View! I am assuming in a priority queue this  
function could exist?



Nothing prevents you from rendering to an offscreen bitmap context  
in a thread and then feeding that image back to a main view (it's  
actually fairly simple since all you need to coordinate is the  
"take the next job from the queue"/"put the result on another  
queue" which are fairly straight forward threading exercises).  I  
use this exact technique to prove a "media browser" like view and  
it works quite well (and I wouldn't be surprised if IKImageBrowser  
didn't do the same).


Rendering to an offscreen bitmap (in another thread) is also another  
idea I haven't thought much about - it sounds very cool. At least the  
Thumbnail creation component could be worked out fairly easily. Its  
the loading of the PDF's themselves that still concerns me. Does  
anyone know whether there is a way to get progress info from a PDF  
loading into a view - percentage/bytes loaded for example?



Synchronizing the PDF, it's associated thumbnail and the list in the  
Table View, appears to be my main problem with regard to threading. An  
Indexing scheme of some sort does appear to be the best solution to  
prevent the crashes I'm currently experiencing.


Cheers

Karl

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sending an image to Preview to preview the image

2008-05-06 Thread Bill

On May 6, 2008, at 3:50 PM, Ricky Sharp wrote:
For another feature of the app (which also generates PDF), I changed  
the workflow to first run an NSSavePanel to let the user specify  
file name and location.  I then generate the PDF at that location  
and launch Preview to open it.  I'm not sure if this workflow works  
for you though since you probably want more of a "throw away" preview.


I allow the user to save the image to a file, which they can then open  
in Preview.  I was just hoping to avoid the extra steps of saving the  
file to disk, opening the file with Preview, and then maybe saving the  
file in another format.  If the file was first displayed in Preview,  
then the user can either 1) close the Preview window, or 2) save it to  
disk in the format they want.


Thanks,
K



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Setting intercell spacing in NSBrowser

2008-05-06 Thread Martin Redington
Thanks Corbin,

   this over-ride seems to work. Surely this shouldn't be that obscure
though ...

- (void) addColumn
{
[super addColumn];
int lastColumnIndex = [self lastColumn];
NSMatrix *matrix = [self matrixInColumn:lastColumnIndex];
NSSize intercellSpacing = NSMakeSize(0, 1);
[matrix setIntercellSpacing:intercellSpacing];
}


On Tue, May 6, 2008 at 7:13 PM, Corbin Dunn <[EMAIL PROTECTED]> wrote:
>
>
>  On May 6, 2008, at 8:07 AM, Jens Alfke wrote:
>
> >
> > On 5 May '08, at 11:31 PM, Martin Redington wrote:
> >
> >
> > > I tried subclassing NSMatrix, and over-riding
> > >
> > > -[NSMatrix initWithFrame: mode:prototype:numberOfRows:numberOfColumns:]
> > >
> > > to set the intercellSpacing. I can see it getting called, but I don't
> > > get any gaps between rows, and when I browse the NSMatrix with
> > > F-Script, the intercellSpacing shows up as (0, 0).
> > >
> >
> > The browser is probably setting it to a default value later on when it
> initializes iself. Why not just set it in your controller's -windowDidLoad
> or -awakeFromNib method?
> >
>
>  That's too late or too early, depending on how you look at it.
>
>  You could (probably) override -addColumn in NSBrowser, call super, then get
> the last matrix, and *then* set the spacing. I haven't tried this, but it
> might work.
>
>  corbin
>



-- 
http://www.mildmanneredindustries.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: Threading - How its done?

2008-05-06 Thread John Calhoun

On May 6, 2008, at 4:51 PM, Karl von Moller wrote:
Does anyone know whether there is a way to get progress info from a  
PDF loading into a view - percentage/bytes loaded for example?


No, I can think of no way to do this.

Be careful with threading and PDF...  PDFKit classes are ultimately  
based on CFPDFDocumentRef and CGPDFPageRef — these are not thread  
safe.  You cannot for example search for text in a PDFDocument while  
rendering a PDFPage from that same PDFDocument.  Or even render two  
different PDFPages from the PDFDocument.


You can however have several CGPDFDocumwentRefs that point to the same  
underlying file/data working on separate threads.  You want separate   
PDFDocument objects though:


PDFDocument	*mainPDFDocument = [[PDFDocument alloc] initWithUR:  
someURL];
PDFDocument	*threadPDFDocument = [[PDFDocument alloc] initWithUR:  
someURL];


Note, same URL, different PDFDocument instance.

John Calhoun—___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Michael Gardner
Which is irrelevant, since I'm constructing my views programatically.  
Anyway, I've long since verified that my methods are all getting  
called as expected (except for -draggingEntered:, of course).


-Michael

On May 6, 2008, at 6:24 PM, Kyle Sluder wrote:

On Tue, May 6, 2008 at 10:44 AM, Michael Gardner  
<[EMAIL PROTECTED]> wrote:
My actual init method has a different signature, and calls - 
initWithFrame:

on its superclass. I was trying to abstract away extra details, but I
shouldn't have made it look like an actual method signature. Sorry  
about

that.


IB will never call this method.  It will always call -initWithFrame:,
as it has no way of knowing that you have designated a different
initializer.

--Kyle Sluder


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -draggingEntered: never gets called [solved?]

2008-05-06 Thread Michael Gardner
If so, it should be documented. As soon as I can get together a  
working test case, I'll submit a bug report. It would be nice to get  
some confirmation from an Apple engineer, though, since I'm having  
trouble duplicating the issue.


-Michael

On May 6, 2008, at 6:30 PM, Graham Cox wrote:

I'm not sure if it's documented as such, but I *think* this is  
expected behaviour. The reality is that the dragging is really  
implemented by the underlying window (ultimately using Carbon) so if  
the view has no reference to its window when the drag types are  
registered, they probably just "get lost". A nib-instantiated window  
won't have this problem as it's most likely built top down.


Generally it's probably wise to build structures completely (in this  
case window+views) before trying to set up high-level behaviours on  
them which probably do assume that things are fully constructed.


G.



On 7 May 2008, at 1:34 am, Michael Gardner wrote:

Upon further investigation, I've found that if I call - 
registerForDraggedTypes: before adding the view to its parent  
window with -setContentView:, I never get the -draggingEntered:  
messages. If I do so afterwards, everything works properly. Is this  
expected behavior?




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: WebView does not expose bindings in IB 3

2008-05-06 Thread Keary Suska
on 5/6/08 4:19 PM, [EMAIL PROTECTED] purportedly said:

> I have a WebView in a window, with an NSProgressIndicator which
> animates when the WebView is loading it's content.
> I used to bind the "Animates" binding on the progress indicator to the
> "isLoading" binding using the Inspector in Interface Builder, but now
> the WebView doesn't show up as a valid binding target...
> 
> If I open an old version of my NIB in IB 3, and inspect this setting,
> IB reports the binding target as: "".
> 
> Is this a bug in IB, or am I missing something?

Sounds like it was a bug in the earlier IB that allowed you do this binding.
You should not be able to bind a control to a view. It violates MVC. They
probably fixed this in IB 3, hence the change in behavior.

Best, 

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: Threading - How its done?

2008-05-06 Thread Karl von Moller
Awesome feedback! I couldn't find any info on this anywhere! At least  
I can stop the search.


With regard to Threading PDF's, while I didn't want to specifically  
build for 10.5 only, using NSOperation's or using some sort of  
priority queue process - does this offer any protection for threading  
PDF activities? As yet I have not used NSOperations but reading the  
docs this sounds like it could encapsulate much of the Threading  
detail for me.


taken from "Threading Programming Guide"
"One of the other great benefits of operation objects, though, is the  
ability to add them to an operation queue. An operation queue manages  
the execution of operation objects within separate threads of your  
application. You do not have to write any thread creation or  
management code to make this happen either. The operation queue takes  
care of all the thread management work behind the scenes so that you  
can focus on what you want to run, and not how you want to run it.  
Operation queues can also manage interoperation dependencies to make  
sure your tasks execute in the correct order."


Even though CFPDFDocumentRef etc are not thread safe would using  
NSOperations to encapsulate them and manage their tasks in the  
background work?


Cheers

Karl

On 07/05/2008, at 10:43 AM, John Calhoun wrote:


On May 6, 2008, at 4:51 PM, Karl von Moller wrote:


Does anyone know whether there is a way to get progress info from a  
PDF loading into a view - percentage/bytes loaded for example?


No, I can think of no way to do this.

Be careful with threading and PDF...  PDFKit classes are ultimately  
based on CFPDFDocumentRef and CGPDFPageRef — these are not thread  
safe.  You cannot for example search for text in a PDFDocument while  
rendering a PDFPage from that same PDFDocument.  Or even render two  
different PDFPages from the PDFDocument.


You can however have several CGPDFDocumwentRefs that point to the  
same underlying file/data working on separate threads.  You want  
separate  PDFDocument objects though:


PDFDocument	*mainPDFDocument = [[PDFDocument alloc] initWithUR:  
someURL];
PDFDocument	*threadPDFDocument = [[PDFDocument alloc] initWithUR:  
someURL];


Note, same URL, different PDFDocument instance.

John Calhoun


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Displaying one NSTextStorage with two sets of temporary attributes

2008-05-06 Thread Martin Wierschin
I think any way you do this things are going to get messy. However,  
in terms of simplicity using break characters to split one  
NSTextStorage between containers might be the easiest. Yes, you'd  
have to filter incoming content to be sure that "real" break  
characters don't pollute your content, but all the layout business is  
handled for you. Of course, some other free behavior may or may not  
be desirable, eg: Select All would select all content across all  
containers.


It might be worthwhile looking at creating a custom NSTextStorage  
subclass that provides a window into a larger storage. This has the  
benefit that everything is absolutely under your control and the  
interface points are all well defined. The problem will be mapping  
changes back and forth between the master storage. You need to be  
sure to inform all attached layout managers if the content in its  
respective window changes.


It looks like Keith has managed to use typesetter overrides to hide  
text, but I've never tried it myself:


http://www.cocoabuilder.com/archive/message/cocoa/2008/3/11/200965

As for footnotes, I don't know if there is a "normal" way to do them.  
Obviously you need a placeholder for the footnote reference in the  
main content stream. I would recommend a text attachment subclass, or  
some other unit that appears atomic to the text system. If you don't,  
then you get into hairy situations when footnote references require  
renumbering, eg: consider undo, which tracks changes by character  
offsets.


Pagination with footnotes get very tricky. The biggest issue is that  
while a line fragment with a footnote reference may fit on a page,  
the corresponding footnote text may not fit on that same page, eg:  
you'll need to force the layout system to move the line fragment  
containing the reference to the next container. There unfortunately  
isn't any standard way to do this. You'll need to write a typesetter  
subclass that can detect the situation and reject line fragments as  
appropriate, eg: override "willSetLineFragmentRect:etc:". These posts  
may help:


http://www.cocoabuilder.com/archive/message/cocoa/2004/7/5/111040
http://www.cocoabuilder.com/archive/message/cocoa/2007/3/20/180546

Best of luck!

~Martin


On May 2, 2008, at 11:52 AM, Adam C.M. Solove wrote:

First, Ross, thank you for your comments. I was going about this
somewhat wrong and you took the time to think it through.

I think you are right that it would be easiest to separate the
different note series into their own TextStorage. Then I could add
custom attributes to each text that determine where they are tied
together. The delegate methods would be lots of code, but fairly
straight-forward.

I also would be curious to hear from text experts how footnotes are
normally done. I have the luxury of small blocks of text and not
worrying about page breaks, which makes the situation somewhat easier.

-Adam

On Fri, May 2, 2008 at 10:38 AM, Ross Carter <[EMAIL PROTECTED]>  
wrote:

Hi Adam,

 I guess that the approach you will take depends on how the  
textStorage
string is set up. Sorry, I don't know anything about TEI, so I can  
only

offer general comments.

 If the textStorage series are sequential and the number and  
sequence of
series are known in advance, and the text has no page break  
characters
(NSFormFeedCharacter), you could insert a page break at the end of  
each
series. That will throw layout over to the next textContainer. If  
you have a
textContainer/textView set up for each series, then the text will  
flow into
the textViews that you have set up to show the content of each  
series.


 If you know the character range of each series, you could override
NSLayoutManager drawGlyphsForGlyphRange:atPoint: and have it send the
message to super only if the glyphs in glyphRange are in the  
character range

you want to display.

 In short, if the question is "Is there a simple way to tell  
NSLayoutManager
not to display certain character ranges," then the answer is: I  
don't think

so. Personally, I wouldn't adopt either of the approaches I mentioned
because of the complications in coordinating the various displays  
using one
textStorage. For example, if the user pasted in some text that  
contains a

form feed character, it could throw off everything.

 XML is easy to parse. I think you'll find it simpler in the end  
to split
the original string into separate series, make each series the  
textStorage

for a textView, let the user edit each series as he desires, and then
reassemble the series into a single string when you archive. Even  
if there

were a way to tell the layoutManagers to be selective about what they
display, you've still got a lot of work to do in keeping them all
synchronized as the user adds and removes text.

 That's just my opinion, though. Text experts like Douglas and  
Martin might
have a better idea. I'd be happy to continue this discussion  
offline if you

to wan

Re: Threading - How its done?

2008-05-06 Thread Adam R. Maxwell


On May 6, 2008, at 5:43 PM, John Calhoun wrote:


On May 6, 2008, at 4:51 PM, Karl von Moller wrote:
Does anyone know whether there is a way to get progress info from a  
PDF loading into a view - percentage/bytes loaded for example?


No, I can think of no way to do this.

Be careful with threading and PDF...  PDFKit classes are ultimately  
based on CFPDFDocumentRef and CGPDFPageRef — these are not thread  
safe.  You cannot for example search for text in a PDFDocument while  
rendering a PDFPage from that same PDFDocument.  Or even render two  
different PDFPages from the PDFDocument.


That's an interesting bit of information!  Would it be safe to draw  
the same CGPDFPage of the same CGPDFDocument on the main thread  
(NSView) and a worker thread (CGBitmapContext) at the same time?  I  
don't think I'm actually doing that, but I'd like to know.  Drawing  
multiple (different instances) of CGPDFDocument to bitmap contexts  
simultaneously has given me grief with font server deadlocks, but I  
think that's a separate issue.


thanks,
Adam___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-06 Thread Jens Alfke


On 6 May '08, at 10:45 AM, Aki Inoue wrote:

Actually, I don't recommend using CP1252 as the generic fallback  
encoding like this.
The encoding does have gaps, and the handling of those invalid gaps  
varies between conversion engines.  CF/NSString treat the invalid  
bytes strictly and return nil encountering those.


I wasn't aware it had gaps — I've never run into them. Where are they?

So, our recommendation now is to try UTF-8 first; then, try some  
other encoding deduced from the context (user's localization,  
intended source/destination of the data, etc).  If all failed,  
should try MacRoman as the ultimate fallback (the encoding has no  
gap so never fails).


In the contexts I've been dealing with — data fetched over HTTP from  
random websites — there hasn't been anything deducible from the  
context (assuming the HTTP Content-Type already failed.) In that  
situation MacRoman is not at all a good fallback as almost no Web  
content uses it; CP-1252 or ISO-Latin-1 are the most likely fallbacks  
after UTF-8.


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

setImage for NStepper like NSButton

2008-05-06 Thread 王仕俊
Hi,all

We know  we can setImage for a Button(NSButton),
   But now I need setImage for NSStepper. How should I do?

Many thanks!
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Resource fork & metadata - max size?

2008-05-06 Thread Jens Alfke


On 6 May '08, at 10:43 AM, Karl Moskowski wrote:

My question is, how big can the resource fork and Finder info get?  
Is reading them into an in-memory NSData object feasible?


There's a very old tech-note called "Don't Abuse The Managers" that  
describes limitations of the Resource Manager. IIRC, resource forks  
that it manages can't get very big (by today's standards) — maybe  
24MB? You should be able to find a copy of the tech-note online  
somewhere.


Of course, the fork itself can get arbitrarily large; but no one in  
their right mind would have stored anything there without using the  
Resource Manager, so I think you don't need to worry about edge cases  
like that.


Finder info is tiny, as far as I know.

—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: How to convert UInt8 array to NSString

2008-05-06 Thread Ricky Sharp


On May 6, 2008, at 9:22 PM, Jens Alfke wrote:



On 6 May '08, at 10:45 AM, Aki Inoue wrote:

Actually, I don't recommend using CP1252 as the generic fallback  
encoding like this.
The encoding does have gaps, and the handling of those invalid gaps  
varies between conversion engines.  CF/NSString treat the invalid  
bytes strictly and return nil encountering those.


I wasn't aware it had gaps — I've never run into them. Where are they?




5 characters in the 0x80..0x9F range.

So, our recommendation now is to try UTF-8 first; then, try some  
other encoding deduced from the context (user's localization,  
intended source/destination of the data, etc).  If all failed,  
should try MacRoman as the ultimate fallback (the encoding has no  
gap so never fails).


In the contexts I've been dealing with — data fetched over HTTP from  
random websites — there hasn't been anything deducible from the  
context (assuming the HTTP Content-Type already failed.) In that  
situation MacRoman is not at all a good fallback as almost no Web  
content uses it; CP-1252 or ISO-Latin-1 are the most likely  
fallbacks after UTF-8.



I will agree with this if it's web content you're dealing with.   
Although, just do a fallback to windows1252.  Lots of site content was  
authored with that encoding and mistakenly marked as ISO_8859-1.  But  
that's a topic for another forum.


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setImage for NStepper like NSButton

2008-05-06 Thread Ricky Sharp


On May 6, 2008, at 9:24 PM, 王仕俊 wrote:


   We know  we can setImage for a Button(NSButton),
  But now I need setImage for NSStepper. How should I do?


I don't think that is possible.  You could try creating a matrix with  
two NSButtonCells.


You could then set them to send events continuously.

But, this would not be the same as an NSStepper, so not sure if this  
would be a good solution for you.


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSSegmentedControl selection mode

2008-05-06 Thread Andrew Kimpton
I have an NSSegmentedControl which I'm trying to make work just like  
the one in iCal. I have two central segments (Week  & Month - no days)  
and a segment at each end for forward/back.


If the control is in 'select one' mode I can have either week or month  
selected and drawn in the darkened start. When I get a click in the  
end cells I restore the selection to either the week or month segment  
(basically restore the selection to that before the click).


This works but I get a redraw flash on the week/month cells. iCal  
doesn't suffer from this 8-)


I've tried playing with setting other tracking modes (like 'select  
any') but it that mode the control doesn't seem to reflect my  
'setSelectedSegment' messages at all and I can't get the week/month  
segments to draw in the darkened selected state.


Any other suggestions on what might be going on ?

Andrew 8-)

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSBrower selectedCells lies

2008-05-06 Thread Martin Redington
more NSBrowser problems (on Leopard, building with Xcode 2.5 for Tiger+).

My NSBrowser is set to allow multiple and branch selection. In my
custom NSBrowserCell subclass, I over-ride -[NSBrowserCell
drawInteriorWithFrame:inView:] to do some custom drawing when the cell
is selected (I need to draw a bit of extra background, and also to
make the font white).

My over-ridden method looks more or less like this.

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
BOOL isSelected = [[(NSMatrix *)controlView selectedCells]
containsObject:self];

//if([self isHighlighted])
if(isSelected)
{
// Do some custom stuff
}

[super drawInteriorWithFrame:myFrame inView:controlView];
}

What I'm finding is that if I select one NSBrowser cell, and then
click on another cell to select it instead (*not* as well as), when
drawInteriorWithFrame:inView is hit, both cells show up both in
selectedCells, and isHighlighted, breaking my custom drawing.

However, in this case, surely only one cell should be selected?

Although my custom drawing is broken, the cells do highlight
appropriately, so somewhere the "real" selection state is known.

Where/how can I intercept the "real" selection state and do my drawing
correctly?

-- 
http://www.mildmanneredindustries.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]


customize print panel dialog

2008-05-06 Thread Ghufran Ahamad
Hi All,

 

I want to customize print panel dialog. I'm adding a button on print panel
dialog but it is not getting show on dialog.

I'm using following code snippet. Let me know where the problem is

 

- (void)printShowingPrintPanel:(BOOL)flag

{

NSPrintOperation *printOp;

 

NSButton* testAccecory = [[[NSButton alloc]
initWithFrame:NSMakeRect(31,30,59,14)] autorelease];

[testAccecory setTitle:@"Check"];

[testAccecory setButtonType:NSMomentaryPushButton];

[testAccecory setTarget:self];

 

printOp = [NSPrintOperation printOperationWithView:demoView

   printInfo:[self printInfo]];

   

[printOp setAccessoryView: testAccecory];

[printOp setShowPanels:flag];

[printOp runOperation];

 

}

 

 

Thanks in Advance,

Ghufran Ahmad

+91 - 9953130470

Skype ID: ghufran_khan81

AOL ID: gahmad81

 

___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Group rotation

2008-05-06 Thread Ghufran Ahamad
Hi Graham,

Thanks for reply, still did not get any success. We are looking into your
code and trying to find out how you implement the group - rotation.

Thanks,
Ghufran Ahmad
+91 - 9953130470
Skype ID: ghufran_khan81
AOL ID: gahmad81

-Original Message-
From: Graham Cox [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 29, 2008 12:04 PM
To: Ghufran Ahamad
Cc: cocoa-dev@lists.apple.com
Subject: Re: Group rotation

Implementing grouping that really works is quite hard.

What about when groups are nested? This can go on indefinitely, so you  
need a mechanism that can take account of any number of nested groups.  
Since transforms from any level can be appended or prepended, this is  
the way to go I believe - each object has a transform that defines its  
position and rotation and size, and so does each group. When a shape  
is drawn it needs to apply all of the transforms for the whole group  
hierarchy that contains it. Also, when an object is grouped, it needs  
to have its coordinates translated so that they are relative to the  
group, (the series of transforms then compensates for this when the  
group draws its contents).

When you ungroup, what about if you have now rotated and resized and  
some of the contained groups are also rotated and resized? The effect  
is that paths can get skewed, which is valid, but you need to preserve  
all of that when you ungroup. There's a lot more to it than meets the  
eye. Getting it right is hard. ;-)

I don't think your code snippet gives enough information - the effect  
you're seeing is because of several transforms that don't match in  
some way, at least as far as I can tell.

One other thing - don't use NSUnionRect, it has really poor behaviour  
for grouping. Consider what it will do if you try and group two  
orthogonal lines separated by some distance, where their bounds have  
no height or width...


If you're interested, my DrawKit project implements grouping as  
outlined above, and as far as I can tell works as I would expect with  
any degree of nesting. You might get some useful things to go on from  
it (or just use it and save reinventing that particular wheel yet  
again):

http://apptree.net/drawkitmain.htm


hth,

G.



On 29 Apr 2008, at 3:25 pm, Ghufran Ahamad wrote:
> Hi All,
>
>
>
> I want to do group rotation for various objects. Objects are getting  
> rotate
> correctly on their center but when I group them the rotated object  
> has got
> shift. Note: In case of group only rotated object has got shift.  
> Below is
> the code snippet. Let me know I doing correct or not.
>
>
>
> -(NSRect)drawingBoundForGroup:(int)in_Group
>
> {
>
>   NSRect rect = NSZeroRect;
>
>   NSArray *objTlGraphic = [[self document] graphics];
>
>   unsigned i,c = [objTlGraphic count];
>
>   if(in_Group != 0)
>
> {
>
> for(i = 0; i < c;i++)
>
>{
>
>  if([[objTlGraphic objectAtIndex:i] GroupNO]==in_Group)
>
>  {
>
>rect=NSUnionRect(rect,[[objTlGraphic objectAtIndex:i] bounds]);
>
>NSLog(@"Object Center Log Index= %d %d",rect,i);
>
>   }
>
>}
>
>   }
>
>return rect;
>
> }
>
>
>
> int Id_Group=[curGraphic GroupNO];
>
> NSRect stRect=[curGraphic  drawingBoundForGroup:Id_Group];
>
>
>
> NSAffineTransform* xform = [NSAffineTransform transform];
>
> [currentContext saveGraphicsState];
>
> [NSBezierPath clipRect:drawingBounds];
>
> NSPoint center = NSMakePoint(NSMidX(stRect), NSMidY(stRect));
>
> [xform translateXBy:center.x yBy:center.y];
>
> [xform rotateByDegrees:[curGraphic GetAngle]];
>
> [xform translateXBy:-center.x yBy:-center.y];
>
> [xform concat];
>
> [curGraphic drawInView:self isSelected:isSelected];
>
> [currentContext restoreGraphicsState];
>
> [self setNeedsDisplay:YES];
>
>
>
>
>
> Thanks in advance,
>
> Ghufran Ahmad
>
> +91 - 9953130470
>
> Skype ID: ghufran_khan81
>
> AOL ID: gahmad81
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> 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]