Re: list open application windows

2008-05-13 Thread Jens Alfke


On 12 May '08, at 8:15 PM, Ben Lowndes wrote:


I'm a cocoa newbie, so I may be missing something obvious here: I'd
like to get a list of open windows for all currently running
applications.


Nothing personal, but people seem to ask this question here about once  
a week ... and I just have to ask why? What kind of application are  
you working on? I can't think of a compelling usage for this, other  
than writing some kind of window-management utility (or malware...)


And BTW, if you search the list archives you'll find easily 100  
messages on this exact topic just in the past two or three months.


—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: Shipping common app frameworks.

2008-05-13 Thread Omar Qazi
Are your users necessarily going to have more than one of your  
applications installed? Remember that when you put the frameworks in a  
common directory, as opposed to inside the app bundle you lose the  
ability for an application to be used by a non-admin user, as well as  
the ease of a drag and drop install.


Omar Qazi
Hello, Galaxy!
1.310.294.1593

On May 12, 2008, at 11:53 AM, David Springer wrote:


Folks,

We need to ship some frameworks that are common to a few of our apps.
The question, of course, is where to put these, and how to bundle them
with apps so downloads, etc. are not huge and bloated.  I'd like to
hear other's experience with this.  Do you put common frameworks in a
place such as /Library/Frameworks, or do you put them in your own app
support directory?  How do you handle things like a drag-to-install
and move-to-trash to uninstall (or can you with common frameworks)?




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: Anybody using Pantomime or mail-core framework?

2008-05-13 Thread Jens Alfke


On 12 May '08, at 10:57 PM, Omar Qazi wrote:

I have an app that sends emails, and what I did is have it post the  
message parameters to my server. Then, a PHP page processes the  
parameters and sends mail using  PHP.


Cool! What's the address of your PHP script? I have a couple million  
V**gr* ads I need to send untraceably... ;-)


No, what I meant to say was, this seems like the sort of thing that  
could be exploited by spammers, and get you blacklisted from your  
hosting site, so watch out.


—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: list open application windows

2008-05-13 Thread Ben Lowndes
On Tue, May 13, 2008 at 4:01 PM, Jens Alfke [EMAIL PROTECTED] wrote:

  I'm a cocoa newbie, so I may be missing something obvious here: I'd
  like to get a list of open windows for all currently running
  applications.
 

  Nothing personal, but people seem to ask this question here about once a
 week ... and I just have to ask why? What kind of application are you
 working on? I can't think of a compelling usage for this, other than writing
 some kind of window-management utility (or malware...)

Yes, exactly: I'm working on a window management utility (or I'm trying to...).

  And BTW, if you search the list archives you'll find easily 100 messages on
 this exact topic just in the past two or three months.

Being new to Cocoa, at first it's difficult to phrase the question
correctly when searching for the answer; so for the benefit of future
searchers the solution seems to lie in using the accessability API or
an input manager. Is that correct?

Thanks,
Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Anybody using Pantomime or mail-core framework?

2008-05-13 Thread Omar Qazi
Well in my case, the script only let's you send email in a specific  
format (i.e. Hey __, Your friend ___ sent you _), but  
thats a good point. It's not an unsolvable problem though, all you  
need is some way to make sure the request is really coming from your  
application, like assigning a client certificate when they activate or  
something.



Omar Qazi
Hello, Galaxy!
1.310.294.1593

On May 12, 2008, at 11:07 PM, Jens Alfke wrote:



On 12 May '08, at 10:57 PM, Omar Qazi wrote:

I have an app that sends emails, and what I did is have it post the  
message parameters to my server. Then, a PHP page processes the  
parameters and sends mail using  PHP.


Cool! What's the address of your PHP script? I have a couple million  
V**gr* ads I need to send untraceably... ;-)


No, what I meant to say was, this seems like the sort of thing that  
could be exploited by spammers, and get you blacklisted from your  
hosting site, so watch out.


—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: PDFView query

2008-05-13 Thread Amrit Majumdar
Thanks for the pointerCompletely over looked the PDFThumbNailView


Regards,
Amrit

On Mon, May 12, 2008 at 12:01 PM, Antonio Nunes [EMAIL PROTECTED]
wrote:

 On May 12, 2008, at 7:20 AM, Amrit Majumdar wrote:

  I need to display all the pages of the pdf document in a couple of rows.
 


 Use a PDFThumbnailView

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

 --Kahlil Gibran
 ---






-- 
Best Regards,
Amrit.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Daniel Vollmer

Salutations!

I'm parsing a rather large text-file (usually 20MB) and in doing so  
I'm iterating over its lines with [String getParagraphStart]. I've  
found a rather noticeable speed-up in the parsing operation if I  
create the string in question from an NSData object (created via  
initWithContentsOfMappedFile) using [String initWithData:encoding:].


Now to the questions:
1) Is this safe if the file in question is being moved / deleted /  
edited during parsing?


2) Are substrings created from the original string (e.g.  
substringWithRange etc.) still backed properly after the original  
string and the NSData object are released?



Thanks for any pointers,
Daniel.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Michael Vannorsdel

On May 13, 2008, at 12:38 AM, Daniel Vollmer wrote:


Salutations!

I'm parsing a rather large text-file (usually 20MB) and in doing so  
I'm iterating over its lines with [String getParagraphStart].  
I've found a rather noticeable speed-up in the parsing operation if  
I create the string in question from an NSData object (created via  
initWithContentsOfMappedFile) using [String initWithData:encoding:].


Now to the questions:
1) Is this safe if the file in question is being moved / deleted /  
edited during parsing?



No, the system might not map the entire file (depending on size and  
available resources or implementation choices) so when you read a new,  
not yet mapped, or previously discarded page it will come from the  
current state of the file, be it untouched, modified, or deleted.   
Basically there's no guarantee you'll get the same data that was in  
the file when you first mapped it if something else modifies or  
destroys it while it's mapped.



2) Are substrings created from the original string (e.g.  
substringWithRange etc.) still backed properly after the original  
string and the NSData object are released?



Yes, they're newly created and individual string objects.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURL urlWithString return nil

2008-05-13 Thread Dex Morgan


– stringByAddingPercentEscapesUsingEncoding:

– stringByReplacingPercentEscapesUsingEncoding:

wp



Thank you it works fine
(and thanks to everyone who 
replied)___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting Pixel Data From CIImage

2008-05-13 Thread Nikolai Hellwig

Hi,

If you are using Leopard (10.5), you could do something like this:

CIImage* imageBlurred = .
NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc] initWithCIImage:  
imageBlurred] autorelease];


// Getting pixels data
// this returns a pointer to the pixel data
[bitmap bitmapData]

regards
Nikolai Hellwig


Am 13.05.2008 um 03:06 schrieb Bridger Maxwell:


Hey,
I am trying as hard as I can to get pixel data from a CIImage, but am
failing, pretty miserably. I am using
render:toBitmap:rowBytes:bounds:format:colorSpace: from CIContext and
it seems to work, but doesn't really. I get data in my int*
pointer, but it never changes! What am I doing wrong? I posted my
code. The part in need of assistance is near the bottom of
(void)captureOutput. I would greatly appreciate your help.


Thank You,
Bridger Maxwell



- (void)captureOutput:(QTCaptureOutput *)captureOutput
didOutputVideoFrame:(CVImageBufferRef)videoFrame
withSampleBuffer:(QTSampleBuffer *)sampleBuffer
fromConnection:(QTCaptureConnection *)connection

{

CIImage* image = [CIImage imageWithCVImageBuffer:videoFrame];



[monoChromeFilter setValue:image forKey:@inputImage];  //First we
monochrome it (only black and white

//[smoothingFilter setValue:[monoChromeFilter
valueForKey:@outputImage] forKey:@inputImage];



if (needsNewBackground) { //If the flag has been raised we will
capture a new background

[backgroundFilter setValue:[monoChromeFilter
valueForKey:@outputImage] forKey:@inputBackgroundImage];

if (videoDeviceInput) {

needsNewBackground = NO;

}

}



[backgroundFilter setValue:[monoChromeFilter
valueForKey:@outputImage] forKey:@inputImage]; //Now we subtract
the background from the monochrome image

[colorCorrectionFilter setValue:[backgroundFilter
valueForKey:@outputImage] forKey:@inputImage];

CIImage* finalImage = [colorCorrectionFilter  
valueForKey:@outputImage];


size_t rowBytes = [self optimalRowBytesForWidth:[finalImage
extent].size.width bytesPerPixel:4];

int* imageData;

[[[NSGraphicsContext currentContext] CIContext] render:finalImage

  toBitmap:imageData rowBytes:rowBytes

bounds:[finalImage extent]

format:kCIFormatARGB8

colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericGray)];



blobDetector-computeBlobs(imageData);

NSLog(@On Frame %i there are %i blobs. Sample byte 5:
%i,frameCount++,blobDetector-getBlobNb(),imageData[19]);



[outputView setImage:finalImage];

[outputView setNeedsDisplay:YES];

//CIContext* theContext = [outputView ciContext];

}




- (void) drawBlobsOnCIImage:(CIImage *)image {

for (int n=0 ; n blobDetector-getBlobNb() ; n++)

{

*blob = blobDetector-getBlob(n);

if (blob-isOk())

{

NSRect rectangle = NSMakeRect(blob-xMin, blob-yMin, blob-xMax -
blob-xMin , blob-yMax - blob-yMin);

}

}



}




- (size_t)optimalRowBytesForWidth: (size_t)width bytesPerPixel:
(size_t)bytesPerPixel

{

   size_t rowBytes = width * bytesPerPixel;



   //Widen rowBytes out to a integer multiple of 16 bytes

   rowBytes = (rowBytes + 15)  ~15;



   //Make sure we are not an even power of 2 wide.

   //Will loop a few times for rowBytes = 16.

   while( 0 == (rowBytes  (rowBytes - 1) ) )

   rowBytes += 16;



   return rowBytes;

}
___

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

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

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

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: list open application windows

2008-05-13 Thread Jean-Daniel Dupas


Le 13 mai 08 à 08:01, Jens Alfke a écrit :



On 12 May '08, at 8:15 PM, Ben Lowndes wrote:


I'm a cocoa newbie, so I may be missing something obvious here: I'd
like to get a list of open windows for all currently running
applications.


Nothing personal, but people seem to ask this question here about  
once a week ... and I just have to ask why? What kind of  
application are you working on? I can't think of a compelling usage  
for this, other than writing some kind of window-management utility  
(or malware...)


And BTW, if you search the list archives you'll find easily 100  
messages on this exact topic just in the past two or three months.



I don't know what the OP want to do, but just to answer your question,  
a screenshot utility may need this kind of functionality (see GrabFS  
for example), and that's exactly what the CGWindow API does.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Controller Cannot Be nil on binding NSTextField

2008-05-13 Thread Bill Cheeseman
on 2008-05-13 12:06 AM, Johnny Lundy at [EMAIL PROTECTED] wrote:

 I still have to do the crazy
 
 self.hoursString = [[NSNumber numberWithInt: self.hours] stringValue];
 
 To get a string from an int for the textField to bind to. If I bind it
 to the model deadline.hours, which is a scalar int, it displays zero
 while NSLog is merrily displaying 23 from the same variable.
 
 Is converting the int to a NSNumber and then to a string make sense
 here? Seems roundabout.

Look at the reference documentation for +[NSString stringWithFormat:], and
the String Programming Guide for Cocoa (particularly the Formatting String
Objects and String Format Specifiers sections).

--

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

PreFab Software - www.prefabsoftware.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core data model, bindings advice.

2008-05-13 Thread Steven Hamilton
I think I haven't explained myself properly. I already have the  
bindings worked out much as you have below however I can't achieve the  
functionality I'm after using the standard method.


If my transaction entity has;

memo (string)
date (date)
amount (NSNumber)
fromAccount (reverse of debit)
toAccount (reverse of credit)

And my transaction tableview has

date
memo
account transferred to/from
credit amount
debit amount

Then it's not a direct match between entity and view. I've partially  
acheived this by using a fetched property in the account entity that  
returns all transactions with the account in the from or to field  
however this means I can't add: to the transaction list.


How would I best handle translating the data from the entity model to  
the view model? I see two options;


1) Munge around with Valuetransformers. If toAccount = selected  
account then credit = amount, debit = blank, opposite if fromAccount =  
selected account. I still have the add: issue.


2) Write my own datasource for the transactionView and do away with  
bindings for this view. This may also have the benefit of solving the  
add to the array issue brought about by using a fetched property which  
gives me an immutable contentArray.


3) Would a filter be more appropriate? Is it possible to filter the  
transaction list and use the account selection (from the tree view) in  
the filter predicate?


On 13/05/2008, at 12:27 AM, Steven Huey wrote:


Steven,

In my app I have a similar setup, although without the detail view.

I have the Table Column of my NSOutlineView bound to a  
NSTreeController using the Controller Key arrangedObjects and the  
Model Key Path set to the name of a method in the custom  
NSManagedObject subclass that my NSTreeController is managing.


The table columns of my NSTableView are bound to an  
NSArrayController whose content set is bound to my  
NSTreeController's selection. Each column is then bound to a  
property of the entity returned by the array controller's content.


I think you could bind your detail view similarly, to the current  
selection of your array controller.


Take a look at: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html 
 for lots of great examples of how to use bindings.


Best regards,
Steven Huey

--
Steven Huey Software - http://www.stevenhuey.com

On May 12, 2008, at 8:03 AM, Steven Hamilton wrote:


Hi folks,
Continuing my learning into Cocoa I'm developing a personal finance  
application. An admirable project I believe since none available  
suit my purposes and it always pays to have a project that one  
would use to learn from.


I have a simple core data model consisting of AccountGroup,  
Account, Transaction and I've jammied these all into a window with  
outline view, transaction tableview and detail at the bottom. The  
model looks like this;


AccountGroup (Asset, expense, income etc)name (string)
accounts (relationship to Account)Account (Bank, Savings etc)name  
(string)

transactions (fetched properties explained below)
credit (relationship to transaction)
debit (relationship to transaction)Transaction
memo (string)
date (date)
amount (NSNumber)
fromAccount (reverse of debit)
toAccount (reverse of credit)
I believe this to be the true model as a transaction is an object  
and is of an amount that goes from somewhere to somewhere. This is  
double entry accounting. My problem is in presenting this to the  
user.


Problem 1

Most finance apps, and mine included you select an account from a  
list (my outlineview) and it then displays all the transactions  
involved. So I created a fetched property with a predicate that  
included any transactions that had the selected account name in  
either fromAccount or toAccount. This works to a point. My  
tableview displays all the transactions of the selected account but  
since its a fetched properties (contentArray) the list isn't the  
true transaction array (contentSet), therefore I cannot add to it  
using the bound detail table below it.


I must admit the bindings for this are really playing with my head.  
I struggled quite immensely getting the selection from the  
treecontroller and in the end it started working without me fully  
understanding why. I have further complications to come as I have  
the decide whether the transaction amount is a debit or credit  
(based on the from/to account relationships) and then display the  
amount in the correct column and then also work out a way to add  
transactions back in like this.


It seems even though I'm set on what I believe to be the correct  
data model for this, the method of which a user expects to see this  
information is a little too different. Does anyone have any advice?  
Have I talked too much?

___

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

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


WWDC 2008 Sessions PDF Generator

2008-05-13 Thread Johannes Fahrenkrug
Hi,

I'm a regular reader but not a too regular poster here. Well, I think
it's time to give something back :)
It's not much, but here we go: Attending WWDC is great, but I need to
print the available sessions. Just looking at them online is not
enough, I need to have a piece of paper to actually circle the ones I
like.
Some browsers (Safari, for example) have trouble printing Ajax pages.
So I wrote a Ruby script that downloads the sessions.xml and creates a
PDF from it. You can find it here:

http://blog.springenwerk.com/2008/05/wwdc-2008-session-pdf-generator-in-ruby.html

I hope this is helpful to some of you guys!

- Johannes

-- 
http://blog.springenwerk.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: Controller Cannot Be nil on binding NSTextField

2008-05-13 Thread Graham Cox


On 13 May 2008, at 2:06 pm, Johnny Lundy wrote:


It works now, but I still have to do the crazy

self.hoursString = [[NSNumber numberWithInt: self.hours] stringValue];



Or you could just do:

self.hoursString = [NSString stringWithFormat:@%d, self.hours];



G.
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDictionaryController with NSTableView and sorting of numeric data

2008-05-13 Thread [EMAIL PROTECTED]

Hello list

I have bound an NSDictionaryController to an NSTableView.
The keys in my bound dictionary are numeric strings 1... n
The dictionary keys and values display okay but the sorting of the key  
column is not numeric but alphabetic.

The value column sorts fine for objects of type NSNumber.
I have tried using NSNumber keys and an NSValueTransformer subclass  
but the controller seems to need an NSString key.


I know I am being dumb here. Please put me out of my misery.

Thanks

Jonathan

___

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

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

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

This email sent to [EMAIL PROTECTED]


How to deal with property and Undo?

2008-05-13 Thread Laurent Cerveau
When reading through the doc for Document based application the advice  
is to implement undo by making setter invoking  
prepareInvocationWithTarget.


Is there a way to have this done automatically with properties. For  
now it looks to me like I have to remove all @synthetize directive and  
rewrite accessors for this.


Best

laurent

___

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

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

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

This email sent to [EMAIL PROTECTED]


how to change the rect of an edit text in each cell on an NSTableView?

2008-05-13 Thread Norio
I really need your help.
I try to make a view which is like a table view, and which has a text edit
area when focus comes to the view. And the editing area must change its
frame depending on the column. The editing area moves to the next, previous,
above, and below cell when user types tab or return key. User also can point
a cell with the mouse to select the edit area in the cell.
The size of an editing area is about half width and half height of the cell,
and the other is the same size of the cell.
NSTableView can have an editing area but its size becomes its text size.

At first I came to mind to make a subclass of NSMatrix, but it requests to
have the same size of cell. But the column width of my view is various.
Then I try to make a subclass of NSTableView. But at this point I was
wondering if it could have different size of editing area. If so, how?

Any suggestion and ideas would be VERY appreciated. Alternative also would
be grateful.

Thank you,
Norio
___

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

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

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

This email sent to [EMAIL PROTECTED]


Controller Cannot Be nil on binding NSTextField

2008-05-13 Thread Johnny Lundy

Thanks Bill and Graham.

D'oh! I've got dozens of stringWithFormat calls in my main app and  
this never occurred to me. I was thinking that somehow an NSTextField  
would take a number and convert it itself.


This will let me merge all three components of the time into one  
string with separator colons and the whole shebang.


I was looking to use NSDate to get an hh:mm:ss result that allowed  
hours  24, but I do not think that is possible, so I went the  
NSCalendarDate route. I remember having the same problem in  
AppleScript with the time portion of a date.


Thanks a bunch for taking time to clue me in.

Johnny
On May 13, 2008, at 7:27 AM, [EMAIL PROTECTED] wrote:


From: Bill Cheeseman [EMAIL PROTECTED]
Subject: Re: Controller Cannot Be nil on binding NSTextField
To: Cocoa-Dev Mail cocoa-dev@lists.apple.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain;   charset=US-ASCII

on 2008-05-13 12:06 AM, Johnny Lundy at [EMAIL PROTECTED] wrote:


I still have to do the crazy

self.hoursString = [[NSNumber numberWithInt: self.hours]  
stringValue];


To get a string from an int for the textField to bind to. If I bind  
it

to the model deadline.hours, which is a scalar int, it displays zero
while NSLog is merrily displaying 23 from the same variable.

Is converting the int to a NSNumber and then to a string make sense
here? Seems roundabout.


Look at the reference documentation for +[NSString  
stringWithFormat:], and
the String Programming Guide for Cocoa (particularly the Formatting  
String

Objects and String Format Specifiers sections).

--

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

PreFab Software - www.prefabsoftware.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Jens Alfke


On 12 May '08, at 11:38 PM, Daniel Vollmer wrote:

I'm parsing a rather large text-file (usually 20MB) and in doing so  
I'm iterating over its lines with [String getParagraphStart].  
I've found a rather noticeable speed-up in the parsing operation if  
I create the string in question from an NSData object (created via  
initWithContentsOfMappedFile) using [String initWithData:encoding:].


It sounds like you're creating a single NSString containing the entire  
contents of the file, then?



Now to the questions:
1) Is this safe if the file in question is being moved / deleted /  
edited during parsing?


The string initializer you're using copies the data. This might just  
involve calling -copy on the NSData instead of copying the bytes into  
a new buffer; I'm not sure.


If the NSString made its own copy of the bytes, then you're totally  
safe; the data from the mapped file isn't being used at all anymore.


If it's using the bytes in the NSData, you're mostly safe. Moving or  
deleting the mapped file won't break the mapping (a deleted file isn't  
actually deleted until all open file descriptors close.) A typical  
safe-save won't alter the data either, since it creates a new file  
and then deletes the old one. The only problem would be if something  
overwrote the file in place, in which case the overwritten data would  
suddenly show up in the NSData.


2) Are substrings created from the original string (e.g.  
substringWithRange etc.) still backed properly after the original  
string and the NSData object are released?


Yes. Even if the NSString is still using the NSData's contents for its  
buffer, it retained them, so releasing the NSData won't make it go  
away until the string is done with it.


—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: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Jens Alfke


On 13 May '08, at 12:15 AM, Michael Vannorsdel wrote:

Basically there's no guarantee you'll get the same data that was in  
the file when you first mapped it if something else modifies or  
destroys it while it's mapped.


You're correct about modifications, but not about deletions. An open  
file descriptor counts as a link to a file, so the unlink(2) system  
call will not actually delete the file from disk because there's still  
a link to it. Once you close the mapped file, the last link goes away  
and then the file is actually deleted.


This is sometimes used as a technique for creating anonymous temporary  
files — create a temp file with open(2), then unlink(2) it so it  
doesn't exist in the directory tree anymore, then its yours to write/ 
read until you close(2) it.


While we're on the topic, it's worth noting that memory-mapping files  
on removable or network filesystems can be dangerous. If you read/ 
write a mapped memory location, and the kernel has to page it in, but  
the file's filesystem is no longer accessible due to a network issue  
or a yanked USB cable ... you get a bus-error. I've seen discussion of  
ways to handle this by installing a signal handler whenever you access  
mapped memory, but it would be pretty tricky to pull off. The  
conclusion was that it's only safe to memory-map files that are either  
(a) on the boot filesystem, or (b) in the user's home directory. (The  
latter might be on a networked filesystem, but if it ever gets  
disconnected, most of the upper layers of the OS and applications will  
be hosed anyway...)


—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 deal with property and Undo?

2008-05-13 Thread Mike Abdullah
In which case you need to set up KVO of the properties in a controller  
object of some kind and use that to register the undos. Of course,  
Core Data does this all automatically :)


On 13 May 2008, at 13:47, Laurent Cerveau wrote:

When reading through the doc for Document based application the  
advice is to implement undo by making setter invoking  
prepareInvocationWithTarget.


Is there a way to have this done automatically with properties.  
For now it looks to me like I have to remove all @synthetize  
directive and rewrite accessors for this.


Best

laurent

___

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

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

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

2008-05-13 Thread Jens Alfke


On 12 May '08, at 11:13 PM, Ben Lowndes wrote:

Yes, exactly: I'm working on a window management utility (or I'm  
trying to...).


This might not be a good introductory Cocoa project. My hunch is that  
doing anything interesting with/to the windows will become either  
difficult or impossible [without using Top Seekrit internal window- 
server APIs.] It depends on what you want to do, of course.


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

Remote Contol Wrapper

2008-05-13 Thread Yvan BARTHÉLEMY

Hi,

I am a Cocoa developer currently coding a user interface using a  
custom IR Remote extending the functionalities of Apple one.


My company have a partnership with a remote maker, and we asked them  
to make a remote using Apple Remote IR codes, plus some custom ones.


Unfortunately, we have not been able to get the events back using the  
Remote Control Wrapper. Do you know the reason why IO HID API is not  
providing the customized events sent by the remote, and eventually how  
can I access them.


I saw in Remote Control Wrapper code that you have been able to add  
support for Keyspan remote. Should I use a similar path to add support  
for my Remote ?


Regards,
Yvan BARTHÉLEMY___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: list open application windows

2008-05-13 Thread John Clayton

Hi Ben,

Take a look at the new Leopard only CGWindowListCopyWindowInfo  
method.  Its probably what you are looking for and is able to provide  
a list of windows in z-order, including rect position (screen relative  
of course), pid, title etc.  You cant modify windows using this API,  
but you'll be able to query them at least.


Enjoy.

--
John Clayton
http://www.coderage-software.com/


On May 13, 2008, at 8:13 AM, Ben Lowndes wrote:

On Tue, May 13, 2008 at 4:01 PM, Jens Alfke [EMAIL PROTECTED]  
wrote:



I'm a cocoa newbie, so I may be missing something obvious here: I'd
like to get a list of open windows for all currently running
applications.



Nothing personal, but people seem to ask this question here about  
once a
week ... and I just have to ask why? What kind of application are  
you
working on? I can't think of a compelling usage for this, other  
than writing

some kind of window-management utility (or malware...)


Yes, exactly: I'm working on a window management utility (or I'm  
trying to...).


And BTW, if you search the list archives you'll find easily 100  
messages on

this exact topic just in the past two or three months.


Being new to Cocoa, at first it's difficult to phrase the question
correctly when searching for the answer; so for the benefit of future
searchers the solution seems to lie in using the accessability API or
an input manager. Is that correct?

Thanks,
Ben
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/john_clayton 
%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: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Douglas Davidson


On May 13, 2008, at 8:08 AM, Jens Alfke wrote:

While we're on the topic, it's worth noting that memory-mapping  
files on removable or network filesystems can be dangerous. If you  
read/write a mapped memory location, and the kernel has to page it  
in, but the file's filesystem is no longer accessible due to a  
network issue or a yanked USB cable ... you get a bus-error. I've  
seen discussion of ways to handle this by installing a signal  
handler whenever you access mapped memory, but it would be pretty  
tricky to pull off. The conclusion was that it's only safe to memory- 
map files that are either (a) on the boot filesystem, or (b) in the  
user's home directory. (The latter might be on a networked  
filesystem, but if it ever gets disconnected, most of the upper  
layers of the OS and applications will be hosed anyway...)


I would add, (c) files that are on the same volume as the executable;  
for example, files in your application bundle or one of your framework  
bundles should be safe to map in.  The reasoning here is that if a  
volume containing an executable your application is currently using  
goes away, the application is dead anyway--in fact, the executables  
themselves are usually mapped.  I'm not so certain about (b); it may  
be possible to survive the loss or temporary absence of the user's  
home directory, depending on what your application is doing.  However,  
the files I typically have wanted to map in have been fixed data files  
that are part of the system, the application, or one of its  
frameworks, for which the home directory would be an unlikely location  
anyway.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Rotating a CATextLayer

2008-05-13 Thread william van braam
Rotating a text layer to any angle with CATransform3DMakeRotation in a  
transaction goes fine, unless you stop rotating at 135 or 315 degrees  
clockwise from the vertical normal. In those two cases  
bounds.size.width and bounds.size.height appear to exchange values, so  
that the string gets clipped.


This has got me puzzled for days now, and wondering if it's a bug in CA.
Any comments greatly appreciated.


The setup is very simple.
A CALayer *rL, including:
rL.layoutManager = [CAConstraintLayoutManager layoutManager];

Add a sublayer to rL: CATextLayer *tL, with a:
tL.string = (NSString *)@This is a long string;

Color the border of tL, so as to see what happens to tL when rotating.
Fix tL in the center of rL for an axis of rotation:
[tL addConstraint:[CAConstraint  
constraintWithAttribute:kCAConstraintMidX

relativeTo:@superlayer attribute:kCAConstraintMidX ]];
[tL addConstraint:[CAConstraint  
constraintWithAttribute:kCAConstraintMidY

relativeTo:@superlayer attribute:kCAConstraintMidY ]];

Rotate tL:
[CATransaction begin];
[CATransaction setValue:[NSNumber numberWithFloat:3.0f]  
forKey:kCATransactionAnimationDuration];

tL.transform = CATransform3DMakeRotation(phi, 0.0, 0.0, 1.0);
[CATransaction commit];

That goes well, except when stopping the rotation at
phi = M_PI_2 + M_PI_4 (135 degrees), or phi = M_PI + M_PI_2 + M_PI_4  
(315 degrees, which is opposite 135 degrees).


Thanks.
Regards,
William
___

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

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

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 question

2008-05-13 Thread Craig Hopson

No, not using bindings, but good point  yes, the param type was a typo.
While everything 'seems' to be working now, the info that I got in the  
debugger when I was seeing problems looked suspiciously like the state  
of things when an object has been released but is then referenced.  I  
need to dig deeper and make sure that I'm not going to be bitten later  
on - like in production code...


Thanks for all of the input.
-Craig

On May 12, 2008, at 5:20 PM, Quincey Morris wrote:



On May 12, 2008, at 15:19, Craig Hopson wrote:

I think I've been the victim of some side effect that I cannot  
track down. With no other changes, I tried again with each style,

[ self.fieldArray addObject:inFoo ];
[ fieldArray addObject:inFoo ];
replacing all occurrences for each test, and both work - what I  
would have expected.


Incidentally, neither version is KVO-compliant. If you happen to  
have something (e.g. a NSArrayController) bound to the array  
property, to show Foos in the user interface, the effect of  
addObject (and therefore addFoo) will be to leave what's displayed  
out of date. This could possibly lead to unpredictable behavior or a  
crash.


The KVO-compliant way to add something to an array property would be  
something like this:


- (void)addFoo:( Bar* )inFoo
{
[ [self mutableArrayValueForKey:@fieldArray] addObject:inFoo ];
}

P.S. I just noticed that the inFoo looks like it needs to be a Foo*,  
not a Bar*. I assume this was just a typo when you stripped down  
your example for posting?

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSAlert beeping

2008-05-13 Thread Dale Jensen
I've got a situation where an alert, attached as a sheet, just beeps  
when it's called (instead of displaying and interacting with the  
user.)  I'm about 99.99% certain that this is being caused by a sheet  
that comes up prior to the alert (not at the same time -- the previous  
sheet is long gone, theoretically, from the window when this alert is  
called.)


Weird thing is that the exact same code in a different class works a- 
ok, so I'm a little mystified, but knowing why an alert would just  
beep, rather than come up, would be a great start.  The previous sheet  
is a progress metre, which comes up and goes away without any user  
involvement.  If I call the progress metre twice, there's another beep  
and the panel is displayed detached from the window.


The endpanel function, which does get called, contains nothing more  
than an orderOut:nil.  Adding a close call neither helps nor hinders.


So, what have I done to my window with this first sheet which causes  
subsequent alerts to beep instead of displaying?


Thanks!


dale

--
Dale Jensen
Ntractive, LLC
[EMAIL PROTECTED]
http://www.ntractive.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]


Fullscreen on secondary displays

2008-05-13 Thread Dennis Munsie
Hello everyone,

I have an app right now that I've added a fullscreen mode to.  RIght
now it works for fullscreen when I go to fullscreen on the main
display.  If I attempt to do this on the secondary display, I get a
blank screen.

I think one problem is probably the way I am identifying which screen
to use -- I use [NSWindow screen] to find where my current window is
and use that to capture the screen and place a new fullscreen window
over it.  One potential problem I see is when the window spans across
two displays -- how do I reasonably choose which screen to display it
on?  What screen does [NSWindow screen] return?

So to recap -- this code currently works correctly in the case when
the _mainWindow is on the primary display.  The code does not work
correctly when it is on a secondary display.  And I haven't tested the
case where the code spans displays -- I am assuming that it just flat
out doesn't work :)

here is the code from my enterFullscreen method -- mostly pulled from
sample code off developer.apple.com:

-(void)enterFullscreen
{
NSScreen *windowScreen = [_mainWindow screen];
NSDictionary *screenInfo = [windowScreen deviceDescription];
NSNumber *screenID = [screenInfo objectForKey:@NSScreenNumber];

// capture the screen
CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID longValue];
CGDisplayErr err = CGDisplayCapture(displayID);
if(err == CGDisplayNoErr) {
if(!_fullscreenWindow) {
// Create the full-screen window.
NSRect winRect = [windowScreen frame];
_fullscreenWindow = [[NSWindow alloc]
initWithContentRect:winRect styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:NO screen:windowScreen];

// Establish the window attributes.
[_fullscreenWindow setReleasedWhenClosed:NO];
[_fullscreenWindow setDisplaysWhenScreenProfileChanges:YES];
[_fullscreenWindow setDelegate:self];   
}

// move our view over to the fullscreen window
[_mainWindow setContentView:nil];
[_fullscreenWindow setContentView:_mainView];
[_mainWindow setNeedsDisplay:YES];

// The window has to be above the level of the shield window.
int32_t shieldLevel = CGShieldingWindowLevel();
[_fullscreenWindow setLevel:shieldLevel];

// Show the window.
[_fullscreenWindow makeKeyAndOrderFront:self];

_fullscreenFlag = YES;
}
}

Sorry about the formatting -- it got a bit messed up when i pasted it
into gmail.

Thanks!
dennis
___

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

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

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

This email sent to [EMAIL PROTECTED]


Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
Hello,

I am interested in adding additional button to the NSPrintPanel dialog
at the very bottom line. Between ( PDF v ) and ( Cancel ). Is that
possible under Leopard? Custom accessory view is not suitable for me.
Even topics from Extending Printing Dialogs does not help, because
they does not cover information about how to modify PrintPanel UI
outside changeable panes.
I could do this by getting NSPrintPanel window, accessing its content
view and so on... but I wanted to be sure that this is the only way to
do that. Is there any right way to achieve this?

Regards,

Rimas.
___

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

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

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

This email sent to [EMAIL PROTECTED]


OT: Looking for Cocoa contractor for project

2008-05-13 Thread Kris Thom White


Our company needs a specific small Cocoa app developed that is a  
teleprompter/sound recorder for doing voiceovers. I posted on  
elance.com but not getting much reaction and a macslash posting  
mentioned listing here. We're looking for bids for the project now,  
and anyone interested can contact me for the specs.


Thanks,

Kris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: list open application windows

2008-05-13 Thread Ken Thomases

On May 13, 2008, at 1:13 AM, Ben Lowndes wrote:


[...] the solution seems to lie in using the accessability API or
an input manager. Is that correct?


Please, please, please _don't_ write an input manager.  They are a  
gross hack, using mechanisms that (as I understand it) Apple is  
planning on removing from the OS because they are destabilizing and  
unsafe.  We've been plagued by incompatibilities between poorly- 
written but widely-deployed input managers and our product, and we're  
far from the only ones.  Search the web a bit for Logitech Control  
Center, for an example.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread David Duncan

On May 13, 2008, at 10:23 AM, Rimas wrote:


I am interested in adding additional button to the NSPrintPanel dialog
at the very bottom line. Between ( PDF v ) and ( Cancel ). Is that
possible under Leopard?


There no simple way to do this, and I would highly discourage trying  
to do so.



Custom accessory view is not suitable for me.
Even topics from Extending Printing Dialogs does not help, because
they does not cover information about how to modify PrintPanel UI
outside changeable panes.


What are you trying to accomplish?


I could do this by getting NSPrintPanel window, accessing its content
view and so on... but I wanted to be sure that this is the only way to
do that. Is there any right way to achieve this?



There is no right way to do this. The content outside of any  
accessory views that you add to the print panel does not belong to you  
and should be considered an implementation detail.

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
Thank you for reply.

  What are you trying to accomplish?
Basicaly I am trying to merge Page setup and Print dialogs. That
is easy by using NSPrintPanel's setOptions. But I want to keep Page
setup functionality also. I mean, I want to be able to change paper
size for example, without printing. This is quite difficult to do that
when having only Cancel and Print buttons.

Best Regards,

Rimas.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread David Duncan

On May 13, 2008, at 11:52 AM, Rimas wrote:


What are you trying to accomplish?

Basicaly I am trying to merge Page setup and Print dialogs. That
is easy by using NSPrintPanel's setOptions. But I want to keep Page
setup functionality also. I mean, I want to be able to change paper
size for example, without printing. This is quite difficult to do that
when having only Cancel and Print buttons.



This is already handled inside the existing print dialog, although not  
in its collapsed state. Clicking the disclosure button adds controls  
to allow you to select the paper size and orientation. There are other  
controls you can add (or remove) as well, search the documentation for  
NSPrintPanelOptions (used with NSPrintPanel's -setOptions: method).

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread Rimas
You are right. And that works very well. Except one thing. After
changing paper size in Print dialog I have two options - to press
Cancel (and revert changes I have made) or to press Print and save new
options + print document. I want only to change paper size and save
that information for later print. I do not want to print at this
moment. In other words, I want to have Print and Page Setup (without
printing) functionality in one (Print) dialog.

  This is already handled inside the existing print dialog, although not in
 its collapsed state. Clicking the disclosure button adds controls to allow
 you to select the paper size and orientation. There are other controls you
 can add (or remove) as well, search the documentation for
 NSPrintPanelOptions (used with NSPrintPanel's -setOptions: method).

Rimas.
___

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

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

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

This email sent to [EMAIL PROTECTED]


re: CoreData and conflictList error during save

2008-05-13 Thread Ben Trumbull

At 10:44 AM -0700 5/12/08, [EMAIL PROTECTED] wrote:

Hello,
I'm using core-data in a program of mine. It uses two context where 
one of these is used in a second thread to perform saving operation.
Sometimes at the end of all operations when I perform a save operation 
on my main context I receive a

conflictList error.
Is there any way to avoid it by merging changes?
I've tried with
[[self managedObjectContext] processPendingChanges];
[[self managedObjectContext] commitEditing];


-commitEditing is for controllers bound to this 
NSManagedObjectContext.  It doesn't do anything from Core Data's 
perspective, it just passes the message along.


You should check out the merge policies in the Core Data Reference 
Guide, and the Core Data Programming Guide.  The default policy is 
error out so you actually have to think about what you want done.


http://developer.apple.com/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectContext_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Merge_Policies
--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Xcode-like window menu?

2008-05-13 Thread Gerd Knops
I have a document based application with multiple windows per  
document, using window controllers.


I was hoping that the window menu would magically group windows  
belonging to the same document together, similar to what Xcode does.  
But apparently that is not the case. Am I missing something, or is  
that something that needs to be implemented from scratch?


Gerd

___

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

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

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

This email sent to [EMAIL PROTECTED]


re: Core data model, bindings advice.

2008-05-13 Thread Ben Trumbull
I must admit the bindings for this are really playing with my head. I 
struggled quite immensely getting the selection from the 
treecontroller and in the end it started working without me fully
understanding why. I have further complications to come as I have the 
decide whether the transaction amount is a debit or credit (based on 
the from/to account relationships) and then display the amount in the 
correct column and then also work out a way to add transactions back

in like this.


Steven,

You might find it beneficial to learn about Cocoa Bindings and Core 
Data separately to minimize frustration.  For example, you can take 
the 'Foundation tool' project template for creating command line 
apps, add CoreData.framework to the list of frameworks linked 
against, import the header, and go your merry way.


Separately, the tree controller in Cocoa Bindings does seem to be a 
little thorny, especially on 10.4.  It got a big overhaul in 10.5. 
You might try googling for community articles about using it and the 
outline view.

--

-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing NSPrintPanel UI in 10.5

2008-05-13 Thread David Duncan

On May 13, 2008, at 12:05 PM, Rimas wrote:


You are right. And that works very well. Except one thing. After
changing paper size in Print dialog I have two options - to press
Cancel (and revert changes I have made) or to press Print and save new
options + print document. I want only to change paper size and save
that information for later print. I do not want to print at this
moment. In other words, I want to have Print and Page Setup (without
printing) functionality in one (Print) dialog.



If you want that functionality, then we recommend that you have a  
separate Page Setup menu item to invoke that dialog as this is the  
standard Mac OS X behavior and what users will expect.

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fullscreen on secondary displays

2008-05-13 Thread Ricky Sharp


On May 13, 2008, at 12:11 PM, Dennis Munsie wrote:


I have an app right now that I've added a fullscreen mode to.  RIght
now it works for fullscreen when I go to fullscreen on the main
display.  If I attempt to do this on the secondary display, I get a
blank screen.

I think one problem is probably the way I am identifying which screen
to use -- I use [NSWindow screen] to find where my current window is
and use that to capture the screen and place a new fullscreen window
over it.  One potential problem I see is when the window spans across
two displays -- how do I reasonably choose which screen to display it
on?  What screen does [NSWindow screen] return?

So to recap -- this code currently works correctly in the case when
the _mainWindow is on the primary display.  The code does not work
correctly when it is on a secondary display.  And I haven't tested the
case where the code spans displays -- I am assuming that it just flat
out doesn't work :)

here is the code from my enterFullscreen method -- mostly pulled from
sample code off developer.apple.com:

-(void)enterFullscreen
{
NSScreen *windowScreen = [_mainWindow screen];
NSDictionary *screenInfo = [windowScreen deviceDescription];
NSNumber *screenID = [screenInfo objectForKey:@NSScreenNumber];

// capture the screen
	CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID  
longValue];

CGDisplayErr err = CGDisplayCapture(displayID);
if(err == CGDisplayNoErr) {
if(!_fullscreenWindow) {
   // Create the full-screen window.
   NSRect winRect = [windowScreen frame];
   _fullscreenWindow = [[NSWindow alloc]
initWithContentRect:winRect styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:NO screen:windowScreen];

   // Establish the window attributes.
   [_fullscreenWindow setReleasedWhenClosed:NO];
   [_fullscreenWindow  
setDisplaysWhenScreenProfileChanges:YES];

   [_fullscreenWindow setDelegate:self];
   }

// move our view over to the fullscreen window
[_mainWindow setContentView:nil];
[_fullscreenWindow setContentView:_mainView];
[_mainWindow setNeedsDisplay:YES];

   // The window has to be above the level of the shield window.
   int32_t shieldLevel = CGShieldingWindowLevel();
   [_fullscreenWindow setLevel:shieldLevel];

   // Show the window.
   [_fullscreenWindow makeKeyAndOrderFront:self];

_fullscreenFlag = YES;
}
}



Ack.  Do not expect to use AppKit with a captured display.  I really  
wish all those archived code examples out there would just vanish;  
just leads to more folks doing this.


Anyhow, if you really must capture the display using the CG APIs,  
please note that there's different mechanisms for getting data onto  
the screen.  Search cocoa-dev and quartz-dev for the details on why  
you cannot use AppKit with captured displays.


If you must use AppKit, you can always use a call to SetSystemUIMode  
(to hide menu bar and dock).  Then, enumerate all screens and put up  
blanking windows on each one.  Then, put up your content window  
over a particular blanking one.  See the child window APIs for how you  
can ensure that the content window is never brought forward over the  
blanking one.


This latter approach is what I've done for the past few years and has  
worked great.


___
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: Fullscreen on secondary displays

2008-05-13 Thread Dennis Munsie
In this case, what I am trying to accomplish is something along the
lines of how Keynote and Powerpoint behave.  I only want to take over
one display, most likely connected up to a projector.  But, I also
occasionally want to have it in a window.  I'm not expecting any
controls to work -- this is strictly a view-only window.

Also -- the code currently works just fine for the case of a single
display machine or when the window is on the main display.  I just
need to make it work when the window is on another display.

thanks!
dennis

On Tue, May 13, 2008 at 4:23 PM, Ricky Sharp [EMAIL PROTECTED] wrote:


  Ack.  Do not expect to use AppKit with a captured display.  I really wish
 all those archived code examples out there would just vanish; just leads to
 more folks doing this.

  Anyhow, if you really must capture the display using the CG APIs, please
 note that there's different mechanisms for getting data onto the screen.
 Search cocoa-dev and quartz-dev for the details on why you cannot use AppKit
 with captured displays.

  If you must use AppKit, you can always use a call to SetSystemUIMode (to
 hide menu bar and dock).  Then, enumerate all screens and put up blanking
 windows on each one.  Then, put up your content window over a particular
 blanking one.  See the child window APIs for how you can ensure that the
 content window is never brought forward over the blanking one.

  This latter approach is what I've done for the past few years and has
 worked great.

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





-- 
dennis
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fullscreen on secondary displays

2008-05-13 Thread John Stiles

None of this really refutes what Ricky posted.
You are just lucky that it works in the one-display case. It really 
isn't designed to work, and on some configurations, it just won't.

Is there anything preventing you from following Ricky's advice?


Dennis Munsie wrote:

In this case, what I am trying to accomplish is something along the
lines of how Keynote and Powerpoint behave.  I only want to take over
one display, most likely connected up to a projector.  But, I also
occasionally want to have it in a window.  I'm not expecting any
controls to work -- this is strictly a view-only window.

Also -- the code currently works just fine for the case of a single
display machine or when the window is on the main display.  I just
need to make it work when the window is on another display.

thanks!
dennis

On Tue, May 13, 2008 at 4:23 PM, Ricky Sharp [EMAIL PROTECTED] wrote:
  

 Ack.  Do not expect to use AppKit with a captured display.  I really wish
all those archived code examples out there would just vanish; just leads to
more folks doing this.

 Anyhow, if you really must capture the display using the CG APIs, please
note that there's different mechanisms for getting data onto the screen.
Search cocoa-dev and quartz-dev for the details on why you cannot use AppKit
with captured displays.

 If you must use AppKit, you can always use a call to SetSystemUIMode (to
hide menu bar and dock).  Then, enumerate all screens and put up blanking
windows on each one.  Then, put up your content window over a particular
blanking one.  See the child window APIs for how you can ensure that the
content window is never brought forward over the blanking one.

 This latter approach is what I've done for the past few years and has
worked great.

 ___
 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: Fullscreen on secondary displays

2008-05-13 Thread dan sinclair
I was playing a bit with Cocoa and full screen and I wrote a quick blog
entry about it: http://everburning.com/news/going-fullscreen-with-medium/

I'm not sure if it's the correct way, or the best way, but it does seem to
work for me (although I believe it will limit the OS version you can run
under).

dan

On Tue, May 13, 2008 at 1:40 PM, Dennis Munsie [EMAIL PROTECTED] wrote:

 In this case, what I am trying to accomplish is something along the
 lines of how Keynote and Powerpoint behave.  I only want to take over
 one display, most likely connected up to a projector.  But, I also
 occasionally want to have it in a window.  I'm not expecting any
 controls to work -- this is strictly a view-only window.

 Also -- the code currently works just fine for the case of a single
 display machine or when the window is on the main display.  I just
 need to make it work when the window is on another display.

 thanks!
 dennis

 On Tue, May 13, 2008 at 4:23 PM, Ricky Sharp [EMAIL PROTECTED] wrote:
 
 
   Ack.  Do not expect to use AppKit with a captured display.  I really
 wish
  all those archived code examples out there would just vanish; just leads
 to
  more folks doing this.
 
   Anyhow, if you really must capture the display using the CG APIs,
 please
  note that there's different mechanisms for getting data onto the screen.
  Search cocoa-dev and quartz-dev for the details on why you cannot use
 AppKit
  with captured displays.
 
   If you must use AppKit, you can always use a call to SetSystemUIMode
 (to
  hide menu bar and dock).  Then, enumerate all screens and put up
 blanking
  windows on each one.  Then, put up your content window over a
 particular
  blanking one.  See the child window APIs for how you can ensure that the
  content window is never brought forward over the blanking one.
 
   This latter approach is what I've done for the past few years and has
  worked great.
 
   ___
   Ricky A. Sharp mailto:[EMAIL PROTECTED]
   Instant Interactive(tm)   http://www.instantinteractive.com
 
 



 --
 dennis
 ___

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

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

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


NSSearchField in menu item weirdness

2008-05-13 Thread Jim Turner
I have a custom NSView that contains static text and a NSSearchField,
it's your run-of-the-mill attempt to provide live search in a menu, a
la the Apple help menu.

My issue is that while I can get the cursor into the search field, if
I type something other than standard text (arrow keys, home, end,
etc), the search field's action is fired and I receive the character
value of said key.  As you can surmise, this doesn't really return the
right results.  I would like the user to be able to use the down arrow
key to move out of the search field, so I implemented
controlView:textView:doCommandBySelector: for the search field's
delegate to catch moveDown:

This never gets called unless I actually click in the search field.
My custom NSView has this as it's implementation of
viewDidMoveToWindow to move the cursor into the field:

-(void) viewDidMoveToWindow
{
[[self window] makeFirstResponder:searchField];
}

It almost seems like this isn't really making the field the first
responder, at least not in the way that clicking on the field does.
Any thoughts on how to properly assign first responder status to a
text field in a view of a NSMenuItem?

And as a somewhat related question, can one programmatically change
the highlighted item in a menu?  There doesn't appear to be a
selectMenuItemAtIndex: method...

As always, thanks

-- 
Jim
http://nukethemfromorbit.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: Fullscreen on secondary displays

2008-05-13 Thread Dennis Munsie
Other than me wanting to avoid re-writing my view drawing code?  :)

I will probably look into doing this -- of the unanswered questions
that I have is will I be able to toggle (relatively) easily between a
full-screen context and a windowed context?  Do I need to completely
throw out my NS* drawing code?  Or can I legitimately get away with
throwing out my NSWindow and NSView usage while in fullscreen mode?

Part of this stems from the fact that this is only a personal use app
right now -- so I'm not necessarily tied to the right way of doing
things at the moment.  If I decide to distribute this in any way, I
would be all for ripping things out and re-writing as necessary.  But
right now, I just need to have something working on my laptop only :)

thanks!
dennis

On Tue, May 13, 2008 at 5:00 PM, John Stiles [EMAIL PROTECTED] wrote:

  None of this really refutes what Ricky posted.
  You are just lucky that it works in the one-display case. It really isn't
 designed to work, and on some configurations, it just won't.
  Is there anything preventing you from following Ricky's advice?




  Dennis Munsie wrote:
  In this case, what I am trying to accomplish is something along the
 lines of how Keynote and Powerpoint behave. I only want to take over
 one display, most likely connected up to a projector. But, I also
 occasionally want to have it in a window. I'm not expecting any
 controls to work -- this is strictly a view-only window.

 Also -- the code currently works just fine for the case of a single
 display machine or when the window is on the main display. I just
 need to make it work when the window is on another display.

 thanks!
 dennis

 On Tue, May 13, 2008 at 4:23 PM, Ricky Sharp [EMAIL PROTECTED] wrote:


  Ack. Do not expect to use AppKit with a captured display. I really wish
 all those archived code examples out there would just vanish; just leads to
 more folks doing this.

  Anyhow, if you really must capture the display using the CG APIs, please
 note that there's different mechanisms for getting data onto the screen.
 Search cocoa-dev and quartz-dev for the details on why you cannot use AppKit
 with captured displays.

  If you must use AppKit, you can always use a call to SetSystemUIMode (to
 hide menu bar and dock). Then, enumerate all screens and put up blanking
 windows on each one. Then, put up your content window over a particular
 blanking one. See the child window APIs for how you can ensure that the
 content window is never brought forward over the blanking one.

  This latter approach is what I've done for the past few years and has
 worked great.

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










-- 
dennis
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fullscreen on secondary displays

2008-05-13 Thread Jean-Daniel Dupas
Switch to fullscreen in a couple of line and without capturing display  
('uiView' is your custom view with custom drawing code):


SetSystemUIMode(kUIModeAllSuppressed, kUIOptionAutoShowMenuBar);
NSScreen *screen = [[uiView window] screen];
NSWindow *window = [[NSWindow alloc] initWithContentRect:[screen  
frame]

styleMask:NSBorderlessWindowMask
  
backing:NSBackingStoreBuffered

   defer:NO
  screen:screen];
[uiView retain];
[uiView removeFromSuperview];
[window setContentView:uiView];
[uiView release];
[window makeKeyAndOrderFront:sender];
[NSCursor setHiddenUntilMouseMoves:YES];


Revert to the window mode is left as an exercice for the reader ;-)


Le 13 mai 08 à 23:47, Dennis Munsie a écrit :


Other than me wanting to avoid re-writing my view drawing code?  :)

I will probably look into doing this -- of the unanswered questions
that I have is will I be able to toggle (relatively) easily between a
full-screen context and a windowed context?  Do I need to completely
throw out my NS* drawing code?  Or can I legitimately get away with
throwing out my NSWindow and NSView usage while in fullscreen mode?

Part of this stems from the fact that this is only a personal use app
right now -- so I'm not necessarily tied to the right way of doing
things at the moment.  If I decide to distribute this in any way, I
would be all for ripping things out and re-writing as necessary.  But
right now, I just need to have something working on my laptop only :)

thanks!
dennis

On Tue, May 13, 2008 at 5:00 PM, John Stiles [EMAIL PROTECTED]  
wrote:


None of this really refutes what Ricky posted.
You are just lucky that it works in the one-display case. It really  
isn't

designed to work, and on some configurations, it just won't.
Is there anything preventing you from following Ricky's advice?




Dennis Munsie wrote:
In this case, what I am trying to accomplish is something along the
lines of how Keynote and Powerpoint behave. I only want to take over
one display, most likely connected up to a projector. But, I also
occasionally want to have it in a window. I'm not expecting any
controls to work -- this is strictly a view-only window.

Also -- the code currently works just fine for the case of a single
display machine or when the window is on the main display. I just
need to make it work when the window is on another display.

thanks!
dennis

On Tue, May 13, 2008 at 4:23 PM, Ricky Sharp [EMAIL PROTECTED] wrote:


Ack. Do not expect to use AppKit with a captured display. I really  
wish
all those archived code examples out there would just vanish; just  
leads to

more folks doing this.

Anyhow, if you really must capture the display using the CG APIs,  
please
note that there's different mechanisms for getting data onto the  
screen.
Search cocoa-dev and quartz-dev for the details on why you cannot  
use AppKit

with captured displays.

If you must use AppKit, you can always use a call to  
SetSystemUIMode (to
hide menu bar and dock). Then, enumerate all screens and put up  
blanking
windows on each one. Then, put up your content window over a  
particular
blanking one. See the child window APIs for how you can ensure that  
the

content window is never brought forward over the blanking one.

This latter approach is what I've done for the past few years and has
worked great.

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











--
dennis
___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSearchField in menu item weirdness

2008-05-13 Thread Peter Ammon


On May 13, 2008, at 2:32 PM, Jim Turner wrote:



This never gets called unless I actually click in the search field.
My custom NSView has this as it's implementation of
viewDidMoveToWindow to move the cursor into the field:

-(void) viewDidMoveToWindow
{
[[self window] makeFirstResponder:searchField];
}

It almost seems like this isn't really making the field the first
responder, at least not in the way that clicking on the field does.
Any thoughts on how to properly assign first responder status to a
text field in a view of a NSMenuItem?


Hi Jim,

This is a known bug.




And as a somewhat related question, can one programmatically change
the highlighted item in a menu?  There doesn't appear to be a
selectMenuItemAtIndex: method...

As always, thanks


No, this isn't possible yet.

Sorry I don't have better news,
-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSearchField in menu item weirdness

2008-05-13 Thread Peter Ammon


On May 13, 2008, at 4:22 PM, Peter Ammon wrote:



On May 13, 2008, at 2:32 PM, Jim Turner wrote:



This never gets called unless I actually click in the search field.
My custom NSView has this as it's implementation of
viewDidMoveToWindow to move the cursor into the field:

-(void) viewDidMoveToWindow
{
[[self window] makeFirstResponder:searchField];
}

It almost seems like this isn't really making the field the first
responder, at least not in the way that clicking on the field does.
Any thoughts on how to properly assign first responder status to a
text field in a view of a NSMenuItem?


Hi Jim,

This is a known bug.


...I meant to follow this up with and I don't know of good any  
workaround yet.


-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Jens Alfke


On 13 May '08, at 12:55 PM, Daniel Vollmer wrote:

It sounds like you're creating a single NSString containing the  
entire contents of the file, then?


Yes. Is that something I shouldn't do? I mean, I feel a tiny bit  
silly creating such huge strings but I didn't find a nice  
alternative (e.g. like the Ruby for each line iterators on file  
objects).


Unfortunately streams are not Foundation's strong suit. You can use  
NSStream or NSFileHandle to read incrementally from a file, but the  
API's pretty low-level and you'll have to do things like decoding  
UTF-8 and parsing for line ends by yourself.


But now that means that the strings are endangered from in-place  
file modification for the lifetime of my objects created during  
parsing, not just the initial parsing itself, correct?


The big 20MB string might be, yes. If you created any new NSStrings as  
substrings of it, I am pretty sure those have their own copies of the  
character data, so they should be immune.


Note that even if you used a stream to read the file incrementally,  
you wouldn't be immune to something else modifying the file while you  
were reading it. So the effect isn't all that different. Just be sure  
to release and stop using the big 20MB string right after you finish  
scanning it.


—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: Anybody using Pantomime or mail-core framework?

2008-05-13 Thread Jens Alfke


On 13 May '08, at 4:35 PM, Matt Burnett wrote:


Its not hard to enable HTTP authentication.


It's also not hard to eavesdrop on the HTTP session using tcpdump, or  
to debug or disassemble the app to recover the password.
In other words, putting a shared secret into an application  
distributed to end-users is not secure.


Probably not a realistic fear in this particular case, but there are  
many, many instances of web scripts like this being abused to send  
spam, so I don't think I'm being overly paranoid :)


—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 deal with property and Undo?

2008-05-13 Thread Graham Cox
This is quite straightforward - it's covered by Aaron Hillegasse in  
his excellent book. I use this technique and it works beautifully.  
I've also wrapped up the common functionality into a class that  
undoable observables can derive from, and once I had that, each  
class that wants undo just needs to do 2 things:


1. publish a list of those properties that it wants to be undoable  
(this is just a list of strings).
2. Return a user-readable string for the undo action name for each  
undoable property. The undo manager sets this as the undo action name  
- this is not required to make this actually work but you probably  
don't want the Undo menu just to say Undo, but instead tell you what  
it will undo.


So, when an object wants to start having its properties be undoable,  
the controller uses the list of properties it publishes and starts  
observing each one. Every change to any property ends up calling - 
observeValueForKeyPath:ofObject:change:context: which converts the  
change to an undo task using the undo manager's usual - 
prepareWithInvocationTarget: method. The cunning thing is that the  
target is the controller, and the method invoked is some private  
method you declare. On invoking Undo, this private method then  
reroutes the undo change back to the original object and property- 
setting method. It completely unifies undo for all KVO-compliant  
properties for any number of subsidiary objects - in my case I have  
many different ones, all with many different properties. Undo just  
works for all of them, once I provide the list of properties to the  
controller.


Here's part of the code in the controller. The cunning private  
method is ultra-simple:


- (void)	changeKeyPath:(NSString*) keypath ofObject:(id) object  
toValue:(id) value

{
if([value isEqual:[NSNull null]])
value = nil;

[object setValue:value forKeyPath:keypath];
}


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

{
#pragma unused(context)

	NSKeyValueChange ch = [[change objectForKey:NSKeyValueChangeKindKey]  
intValue];

BOOL wasChanged = NO;

if ( ch == NSKeyValueChangeSetting )
{
		if(![[change objectForKey:NSKeyValueChangeOldKey] isEqual:[change  
objectForKey:NSKeyValueChangeNewKey]])

{
			[[[self undoManager] prepareWithInvocationTarget:self]	 
changeKeyPath:keypath


ofObject:object

toValue:[change objectForKey:NSKeyValueChangeOldKey]];
wasChanged = YES;
}
}
	else if ( ch == NSKeyValueChangeInsertion || ch ==  
NSKeyValueChangeRemoval )

{
		// Cocoa has a bug (at least on 10.4) where array insertion/deletion  
changes don't properly record the old array.

// GCObserveableObject gives us a workaround

NSArray* old = [object oldArrayValueForKeyPath:keypath];

		[[[self undoManager] prepareWithInvocationTarget:self]	 
changeKeyPath:keypath


ofObject:object

toValue:old];   


wasChanged = YES;
}

	if ( wasChanged  !([[self undoManager] isUndoing] || [[self  
undoManager] isRedoing]))

{
		if([object  
respondsToSelector:@selector(actionNameForKeyPath:changeKind:)])
			[[self undoManager] setActionName:[object  
actionNameForKeyPath:keypath changeKind:ch]];

else
			[[self undoManager] setActionName:[GCObservableObject  
actionNameForKeyPath:keypath objClass:[object class]]];

}
}




On 14 May 2008, at 1:10 am, Mike Abdullah wrote:

In which case you need to set up KVO of the properties in a  
controller object of some kind and use that to register the undos.  
Of course, Core Data does this all automatically :)


___

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

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

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 question

2008-05-13 Thread Roland King
Can someone expand on this a little more please and fill in some blanks 
about why the first version isn't KVO compliant and what it is about the 
second one which makes KVO work? That second piece of code


   [ [ self mutableArrayValueForKey:@fieldArray ] addObjectInFoo ];

is not perhaps the first thing which would spring to mind when writing 
new code.


Quincey Morris wrote:



On May 12, 2008, at 15:19, Craig Hopson wrote:

I think I've been the victim of some side effect that I cannot track  
down. With no other changes, I tried again with each style,

[ self.fieldArray addObject:inFoo ];
[ fieldArray addObject:inFoo ];
replacing all occurrences for each test, and both work - what I  
would have expected.



Incidentally, neither version is KVO-compliant. If you happen to have  
something (e.g. a NSArrayController) bound to the array property, to  
show Foos in the user interface, the effect of addObject (and  
therefore addFoo) will be to leave what's displayed out of date. This  
could possibly lead to unpredictable behavior or a crash.


The KVO-compliant way to add something to an array property would be  
something like this:


- (void)addFoo:( Bar* )inFoo
{
[ [self mutableArrayValueForKey:@fieldArray] addObject:inFoo ];
}

P.S. I just noticed that the inFoo looks like it needs to be a Foo*,  
not a Bar*. I assume this was just a typo when you stripped down your  
example for posting?

___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Anybody using Pantomime or mail-core framework?

2008-05-13 Thread Jens Alfke


On 13 May '08, at 5:40 PM, Matt Burnett wrote:


Now your talking about hackers instead of spammers.


There's not really a difference nowadays, since most spam is sent from  
pwned servers/PCs.


It is hard to sniff a HTTP session, you have to penetrate your  
victim's network enough to be able to do so.


We're talking about a downloadable app. All I have to do is download a  
copy of it and either sniff its network traffic, or run it in gdb and  
set breakpoints on likely API calls that set up HTTP authentication.  
Then I know the URL and password.


(None of this may be likely, but security requires thinking about the  
worst possible scenarios.)


—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: Cocoa coding style (was Re: Did I reinvent the wheel?)

2008-05-13 Thread Scott Ribe
 So I think that having to write your own Cocoa object graph management
 and persistence framework is a realistic and necessary evil

Agreed. Also because of the wide variety of usage pattersn and design
trade-offs.

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Xcode eats 100% CPU and more while typing

2008-05-13 Thread William Squires
What about dtrace on Leopard? Isn't it supposed to let you view  
several aspects of program performance simultaneously, including a  
stack trace? Maybe if you could tie where it consumes the CPU cycles  
with the stack trace, it'll reveal a pattern? Just a thought.


On May 9, 2008, at 2:18 PM, Lyndsey Ferguson wrote:



On May 9, 2008, at 11:51 AM, Andy O'Meara wrote:


In any case, I'll definitely be filing a radar next time it  
happens.  Problem is, it's next to impossible get a repro the  
problem given the number of variables (environment, SCM, project,  
the file itself, and whatever UI actions/history that led up to  
that point), so we come back to the strange fact that only certain  
projects seem to be affected.




When ever I want to submit bugs to Apple regarding Xcode's  
performance, I keep SpinControl running with a focus on Xcode. That  
generally generates enough files to submit.


Lyndsey


---
Mr. Lyndsey Ferguson
[EMAIL PROTECTED]

http://winterlandexpat.blogspot.com/







 ___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/wsquires% 
40satx.rr.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]


Passing argument with different width due to prototype: warning

2008-05-13 Thread R.L. Grigg
Im using Xcode 3.0 and building a Foundation Tool (debug, PPC). The  
base SDK path is $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk and Ive included  
Foundation.framework in the project under External Frameworks and  
Libraries.


There is a line of my code that is giving me a warning I cant' douse:

  #import Foundation/Foundation.h
  . . .
  NSSocketPort *socketPort=[[NSSocketPort alloc] initWithTCPPort:1234];
  . . .
  warning: passing argument 1 of 'initWithTCPPort:' with different  
width due to prototype


I checked the NSPort header file for the NSSocketPort method  
prototype, /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Versions/C/Headers/NSPort.h:


- (id)initWithTCPPort:(unsigned short)port;

What am I doing wrong? Below is the full text output of the compile.

Russ


CompileC build/NetHub.build/Debug/NetHub.build/Objects-normal/ppc/ 
NetHub.o /Users/russ/projects/NetHub/NetHub.m normal ppc objective-c  
com.apple.compilers.gcc.4_0

cd /Users/russ/projects/NetHub
/Developer/usr/bin/gcc-4.0 -x objective-c -arch ppc -pipe -Wno- 
trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wswitch - 
Wunused-variable -Wshadow -Wsign-compare -Wconversion -fmessage- 
length=0 -mtune=G5 -mfix-and-continue -mmacosx-version-min=10.5 - 
gdwarf-2 -I/Users/russ/projects/NetHub/build/NetHub.build/Debug/ 
NetHub.build/NetHub.hmap -F/Users/russ/projects/NetHub/build/Debug -I/ 
Users/russ/projects/NetHub/build/Debug/include -I/Users/russ/projects/ 
NetHub/build/NetHub.build/Debug/NetHub.build/DerivedSources -isysroot / 
Developer/SDKs/MacOSX10.5.sdk -include /Library/Caches/com.apple.Xcode. 
502/SharedPrecompiledHeaders/NetHub_Prefix- 
cqkgtiwyvaysckdocenjyhyqyejn/NetHub_Prefix.pch -c /Users/russ/projects/ 
NetHub/NetHub.m -o /Users/russ/projects/NetHub/build/NetHub.build/ 
Debug/NetHub.build/Objects-normal/ppc/NetHub.o

/Users/russ/projects/NetHub/NetHub.m: In function 'main':
/Users/russ/projects/NetHub/NetHub.m:127: warning: passing argument 1  
of 'initWithTCPPort:' with different width due to prototype


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Passing argument with different width due to prototype: warning

2008-05-13 Thread Nick Zitzmann


On May 13, 2008, at 7:10 PM, R.L. Grigg wrote:


There is a line of my code that is giving me a warning I cant' douse:

 #import Foundation/Foundation.h
 . . .
 NSSocketPort *socketPort=[[NSSocketPort alloc] initWithTCPPort:1234];
 . . .
 warning: passing argument 1 of 'initWithTCPPort:' with different  
width due to prototype



Is this really 1234, or is it something larger? An unsigned short has  
to be between 0 and 65535.


If it really is 1234, or at least something = 65535, then try casting  
the constant to unsigned short. Normally integer constants are treated  
by the compiler as ints.


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Passing argument with different width due to prototype: warning

2008-05-13 Thread Jack Repenning

On May 13, 2008, at 6:10 PM, R.L. Grigg wrote:


 NSSocketPort *socketPort=[[NSSocketPort alloc] initWithTCPPort:1234];
 . . .
 warning: passing argument 1 of 'initWithTCPPort:' with different  
width due to prototype


I checked the NSPort header file for the NSSocketPort method  
prototype, /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Versions/C/Headers/NSPort.h:


- (id)initWithTCPPort:(unsigned short)port;

What am I doing wrong?


Have you tried this?

 NSSocketPort *socketPort=[[NSSocketPort alloc] initWithTCPPort: 
(unsigned short)1234];



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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Xcode-like window menu?

2008-05-13 Thread John Joyce

Gerd,
What XCode probably does, is simply switch documents, rather than  
switching windows.
But yes, you probably need to programmatically interact with your  
NSDocument, NSDocumentController, NSWindowController objects.

remember the hierarchy
NSDocumentController  NSDocument (multiple distinct document  
instances possible)  NSWindowController (multiple instances possible  
within a document for multi-window documents).


Responder-chain.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Passing argument with different width due to prototype: warning

2008-05-13 Thread Christopher Nebel

On May 13, 2008, at 6:10 PM, R.L. Grigg wrote:

Im using Xcode 3.0 and building a Foundation Tool (debug, PPC). The  
base SDK path is $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk and Ive  
included Foundation.framework in the project under External  
Frameworks and Libraries.


There is a line of my code that is giving me a warning I cant' douse:

 #import Foundation/Foundation.h
 . . .
 NSSocketPort *socketPort=[[NSSocketPort alloc] initWithTCPPort:1234];
 . . .
 warning: passing argument 1 of 'initWithTCPPort:' with different  
width due to prototype


I checked the NSPort header file for the NSSocketPort method  
prototype, /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Versions/C/Headers/NSPort.h:


- (id)initWithTCPPort:(unsigned short)port;

What am I doing wrong?


Nothing, really, unless you count using -Wconversion in the first  
place.  -Wconversion isn't very useful these days -- it's mostly  
intended for use when you're working with pre-ANSI C without function  
prototypes.  Quoting from gcc(1), -Wconversion warns if a prototype  
causes a type conversion that is different from what would happen to  
the same argument in the absence of a prototype.  Since unprototyped  
integral arguments are passed as int, a parameter that's explicitly  
declared as any other integral type, such as unsigned short, will  
provoke this warning.  Notice that it's how the *prototype* is  
declared, not how you're calling the function, that causes the  
warning, so there's nothing you can do to make it go away aside from  
turning off -Wconversion.



--Chris Nebel
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Passing argument with different width due to prototype: warning

2008-05-13 Thread R.L. Grigg


On May 13, 2008, at 6:41 PM, Christopher Nebel wrote:


On May 13, 2008, at 6:10 PM, R.L. Grigg wrote:

Im using Xcode 3.0 and building a Foundation Tool (debug, PPC). The  
base SDK path is $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk and Ive  
included Foundation.framework in the project under External  
Frameworks and Libraries.


There is a line of my code that is giving me a warning I cant' douse:

#import Foundation/Foundation.h
. . .
NSSocketPort *socketPort=[[NSSocketPort alloc] initWithTCPPort:1234];
. . .
warning: passing argument 1 of 'initWithTCPPort:' with different  
width due to prototype


I checked the NSPort header file for the NSSocketPort method  
prototype, /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Foundation.framework/Versions/C/Headers/NSPort.h:


- (id)initWithTCPPort:(unsigned short)port;

What am I doing wrong?


Nothing, really, unless you count using -Wconversion in the first  
place.  -Wconversion isn't very useful these days -- it's mostly  
intended for use when you're working with pre-ANSI C without  
function prototypes.  Quoting from gcc(1), -Wconversion warns if a  
prototype causes a type conversion that is different from what would  
happen to the same argument in the absence of a prototype.  Since  
unprototyped integral arguments are passed as int, a parameter  
that's explicitly declared as any other integral type, such as  
unsigned short, will provoke this warning.  Notice that it's how  
the *prototype* is declared, not how you're calling the function,  
that causes the warning, so there's nothing you can do to make it go  
away aside from turning off -Wconversion.


Thanks, Chris, that was it! Prototype Conversion was enabled for the  
project.


Russ

___

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

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

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

This email sent to [EMAIL PROTECTED]


openURL is not applied to POST-argument of local html file in leopard.

2008-05-13 Thread Doo-Hyun Jang
hi~ all!

because of security, we can't use GET method ( remain of browser history )
I make temp file like this, ( after 5 sec, it's deleted.)

form name = 'BridgeForm' method = 'POST' action =
'http://sms.nate.com/nateonsms.jsp?'
input type = hidden name = 'TICKET' value =
'3324FF8B7EF929D78BAB7E25DD45CFD204CC4CB1EEE5067B7DF71884C4163A52A92C3C54EFCCDDB6B31EE013D7EEB5230FC8B99641C5475663F778F91C2C310F7292CAB5A603E63AAE46D5DFD4FF0FD68B2677F1C016B3CA8432F2B5F2E682DA6469C1B874B5308A597B0DB8AFCE3D4F0EA4AE6A98A0A8FB95AF5BC5211F9F0DE839BFD760F181AF9435E0FFCDCD1C056EE161471E9DDDBC5916E680703561AE25595743BAB8CA7A93FF7994BDDD9EC7B88E0A9380C068AF6B0E1CF91EF4E4CDE183D2F556C9CCEC'
input type = hidden name = 'ID' value = '[EMAIL PROTECTED]'
input type = hidden name = 'mobile' value = ''
/form

and call like this,

[[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:bridgeFile]];

it's well done in tiger, but leopard is not.

I found POST-args not applied in leopard.
I don't know why POST-args's not applied. :(
( because of it's local html file??? security??? )
but tiger's local html file  is well done.

how can i solve it?

also I want to open POST web site without temp file.
it's possible, it's the best.

I appreciate your read and sorry my poor english. ;-)

Doo-Hyun Jang
in South korea.
-- 
[Blog]
Old : http://lum7671.egloos.com
New : http://lum7671.blogspot.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 question

2008-05-13 Thread Kyle Sluder
On Tue, May 13, 2008 at 8:41 PM, Roland King [EMAIL PROTECTED] wrote:
 Can someone expand on this a little more please and fill in some blanks
 about why the first version isn't KVO compliant and what it is about the
 second one which makes KVO work?

KVO requires that you use the supplied -mutableValueForKey: method to
get a proxy NSMutableArray object.  Otherwise, it has no idea that you
have modified the array underneath its feet.

--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: list open application windows

2008-05-13 Thread Henry McGilton (Starbase)


On May 12, 2008, at 11:01 PM, Jens Alfke wrote:



On 12 May '08, at 8:15 PM, Ben Lowndes wrote:


I'm a cocoa newbie, so I may be missing something obvious here: I'd
like to get a list of open windows for all currently running
applications.


Nothing personal, but people seem to ask this question here about  
once a week ... and I just have to ask why? What kind of  
application are you working on? I can't think of a compelling usage  
for this, other than writing some kind of window-management utility  
(or malware...)


I have a couple of screen measurement tools for which I could
have used those APIs had I ever been able to make any sense
of them.For instance, in the GuideLines app, I would like
to be able to query the top-most window under the cursor for
its content view and sub-views so as to align the guides to
a document's borders.

And, yes, perusing a bunch of 'private' APIs a couple of years
ago, I wondered about the potential for malicious or mischievous
apps.The  CGWindowListCopyWindowInfo  mentioned later sounds
like what I could use, and it's read-only . . .

Cheers,
  Henry


===+
  Henry McGilton, Boulevardier |Trilithon Software
   Objective-C/Java Composer   | Seroia Research
---+
  mailto:[EMAIL PROTECTED]   |   http://www.trilithon.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 question

2008-05-13 Thread Chris Hanson

On May 13, 2008, at 5:41 PM, Roland King wrote:

Can someone expand on this a little more please and fill in some  
blanks about why the first version isn't KVO compliant and what it  
is about the second one which makes KVO work? That second piece of  
code


  [ [ self mutableArrayValueForKey:@fieldArray ] addObjectInFoo ];

is not perhaps the first thing which would spring to mind when  
writing new code.


When you wrote [fieldArray addObject:foo], what you were changing was  
not a property in the key-value observing sense, but the array used to  
implement that property.


What you get back from -mutableArrayValueForKey: is a representation  
of the property itself, rather than to the array that is used to  
implement the property; it will thus broadcast KVO change  
notifications when it's mutated.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fullscreen on secondary displays

2008-05-13 Thread Dennis Munsie
This code worked for me -- with one change: the NSRect from [screen
frame] has the offset set to it's relative location to the main
display.  This is what was throwing me off the entire time :)  By
setting the offset to 0,0 I was able to get a visible full screen
window.

BTW -- not that it matters for the app that I'm working on, but since
SetSystemUIMode is in Carbon, are there plans to move it to Cocoa?  Is
this function available for 64-bit apps?

Thanks to everyone that helped!

regards,
dennis

On Tue, May 13, 2008 at 6:30 PM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:
 Switch to fullscreen in a couple of line and without capturing display
 ('uiView' is your custom view with custom drawing code):


 SetSystemUIMode(kUIModeAllSuppressed, kUIOptionAutoShowMenuBar);
 NSScreen *screen = [[uiView window] screen];
 NSWindow *window = [[NSWindow alloc] initWithContentRect:[screen frame]

 styleMask:NSBorderlessWindowMask

 backing:NSBackingStoreBuffered
defer:NO
   screen:screen];
 [uiView retain];
 [uiView removeFromSuperview];
 [window setContentView:uiView];
 [uiView release];
 [window makeKeyAndOrderFront:sender];
 [NSCursor setHiddenUntilMouseMoves:YES];


 Revert to the window mode is left as an exercice for the reader ;-)



 Le 13 mai 08 à 23:47, Dennis Munsie a écrit :


 Other than me wanting to avoid re-writing my view drawing code?  :)

 I will probably look into doing this -- of the unanswered questions
 that I have is will I be able to toggle (relatively) easily between a
 full-screen context and a windowed context?  Do I need to completely
 throw out my NS* drawing code?  Or can I legitimately get away with
 throwing out my NSWindow and NSView usage while in fullscreen mode?

 Part of this stems from the fact that this is only a personal use app
 right now -- so I'm not necessarily tied to the right way of doing
 things at the moment.  If I decide to distribute this in any way, I
 would be all for ripping things out and re-writing as necessary.  But
 right now, I just need to have something working on my laptop only :)

 thanks!
 dennis

 On Tue, May 13, 2008 at 5:00 PM, John Stiles [EMAIL PROTECTED] wrote:

  None of this really refutes what Ricky posted.
  You are just lucky that it works in the one-display case. It really isn't
 designed to work, and on some configurations, it just won't.
  Is there anything preventing you from following Ricky's advice?




  Dennis Munsie wrote:
  In this case, what I am trying to accomplish is something along the
 lines of how Keynote and Powerpoint behave. I only want to take over
 one display, most likely connected up to a projector. But, I also
 occasionally want to have it in a window. I'm not expecting any
 controls to work -- this is strictly a view-only window.

 Also -- the code currently works just fine for the case of a single
 display machine or when the window is on the main display. I just
 need to make it work when the window is on another display.

 thanks!
 dennis

 On Tue, May 13, 2008 at 4:23 PM, Ricky Sharp [EMAIL PROTECTED] wrote:


  Ack. Do not expect to use AppKit with a captured display. I really wish
 all those archived code examples out there would just vanish; just leads to
 more folks doing this.

  Anyhow, if you really must capture the display using the CG APIs, please
 note that there's different mechanisms for getting data onto the screen.
 Search cocoa-dev and quartz-dev for the details on why you cannot use AppKit
 with captured displays.

  If you must use AppKit, you can always use a call to SetSystemUIMode (to
 hide menu bar and dock). Then, enumerate all screens and put up blanking
 windows on each one. Then, put up your content window over a particular
 blanking one. See the child window APIs for how you can ensure that the
 content window is never brought forward over the blanking one.

  This latter approach is what I've done for the past few years and has
 worked great.

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










 --
 dennis
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]






-- 
dennis
___

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

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

Help/Unsubscribe/Update your Subscription:

Re: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Michael Vannorsdel
I actually tested this a month back and not all operations/programs  
respect link counts nor does the system appear to enforce them.  For  
instance an rm -f will destroy the file regardless of link count, as  
well as some obscure APIs.  After the file was removed the mapping  
program crashed when trying to read more of the file; it failed to  
load new map data.



On May 13, 2008, at 9:08 AM, Jens Alfke wrote:

You're correct about modifications, but not about deletions. An open  
file descriptor counts as a link to a file, so the unlink(2) system  
call will not actually delete the file from disk because there's  
still a link to it. Once you close the mapped file, the last link  
goes away and then the file is actually deleted.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Michael Vannorsdel
Also I should add, I've yet to find a way to protect a file from  
editing or deletion on OS X that can't just be ignored by something  
else.  Things like flock appear to be optionally supported and not  
globally enforced.  As long as a way exists to get around any kind of  
file lock there's no way to guarantee a specific file will be  
unchanged during usage.  This is partially done to prevent file lock  
abuse I'm guessing.


As Mr. Davidson pointed out, the best you can do is only map files you  
can be reasonably sure no one will want to modify unless purposely  
trying to corrupt your program.



On May 13, 2008, at 9:57 PM, Michael Vannorsdel wrote:

I actually tested this a month back and not all operations/programs  
respect link counts nor does the system appear to enforce them.  For  
instance an rm -f will destroy the file regardless of link count, as  
well as some obscure APIs.  After the file was removed the mapping  
program crashed when trying to read more of the file; it failed to  
load new map data.



On May 13, 2008, at 9:08 AM, Jens Alfke wrote:

You're correct about modifications, but not about deletions. An  
open file descriptor counts as a link to a file, so the unlink(2)  
system call will not actually delete the file from disk because  
there's still a link to it. Once you close the mapped file, the  
last link goes away and then the file is actually deleted.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Weird crash in sendEvent - right click vs control click

2008-05-13 Thread Brett Powley

Hi,

I'm having a rather weird crash in a Cocoa application.  If I control- 
click on a window, my application crashes instantly.  If I right  
click, it doesn't (and indeed my rightMouse method is eventually  
called as I want it to be).


I've tried enabling zombies, but that doesn't catch anything.

The stack trace is rather short:

objc_msgSend
-[NSWindow sendEvent:]
-[MyWindow sendEvent:]
-[NSApplication sendEvent:]
-[MyApplication sendEvent:]
-[NSApplication run]
NSApplicationMain
main

That leads to the questions:

(1) What's the difference between a control click and a right click  
that would lead the former to cause a crash and the latter not to?


(2) What's likely to be the cause of a crash in NSWindow sendEvent: ?

Thanks,
Brett


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Save as and Open conditional code samples? tutorials?

2008-05-13 Thread Omar Qazi

John:

Check this out:
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Articles/MultiDocument.html#/ 
/apple_ref/doc/uid/TP40003382


Hope that helps. The developer documentation is your friend :)

Omar Qazi
Hello, Galaxy!
1.310.294.1593

On May 13, 2008, at 8:56 PM, John Joyce wrote:

Does anybody have any code samples or tutorials on opening/saving  
documents with conditional handling for different file types?
Conceptually, handling the content is not a problem. The thing I'm  
not sure about is how to hook up a document-based app to handle  
additional file types but with the preferred native document type.
My app's documents are little more than an array of strings, where  
each string is a sub document.
The thing I want to do is export all as a single text file or as  
individual text files, and likewise import a text file with simple  
string symbols as separators (basically like a CSV file).

Handling the text and doing things with it is easy.
I just don't know what sort of design patterns exist for handling  
additional file types.




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: Weird crash in sendEvent - right click vs control click

2008-05-13 Thread Andrew Merenbach

Hi, Brett,

Is it possible that you have any haxies, or any Input Managers, of any  
sort installed?  Logitech Control Center, for instance, or perhaps  
APE?  That's the only thing that I could think of that might be  
yielding such a crash.


Cheers,
Andrew

On May 13, 2008, at 9:21 PM, Brett Powley wrote:


Hi,

I'm having a rather weird crash in a Cocoa application.  If I  
control-click on a window, my application crashes instantly.  If I  
right click, it doesn't (and indeed my rightMouse method is  
eventually called as I want it to be).


I've tried enabling zombies, but that doesn't catch anything.

The stack trace is rather short:

objc_msgSend
-[NSWindow sendEvent:]
-[MyWindow sendEvent:]
-[NSApplication sendEvent:]
-[MyApplication sendEvent:]
-[NSApplication run]
NSApplicationMain
main

That leads to the questions:

(1) What's the difference between a control click and a right click  
that would lead the former to cause a crash and the latter not to?


(2) What's likely to be the cause of a crash in NSWindow sendEvent: ?

Thanks,
Brett


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

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]


how to create PLIST file

2008-05-13 Thread Shashi Kumar
Hi All,
 I am newb in quartz. when we right-click on .qtz file open with 
PLIST editor we get PLIST file, which lists its all nodes and properties. And I 
wanted to convert PLIST file to .qtz file programmatically. (I don't wanna use 
quartz composer to do this.)  My final aim to create that PLIST file 
dynamically from UI. 
 How this can be done ? Can any one help me in achieving it ? 


saahil.


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Michael Vannorsdel
I suggest reading in the entire file into your NSData with  
initWithContentsOfFile: if there's a significant chance of file  
modification.  I know this sounds like a huge memory usage but this  
way you can know your data is static and the system is designed to  
handle high memory usage programs.  If there's some pages of your data  
you haven't touched in a while the system will swap those out and use  
the physical pages for something that needs them.


When making substrings from the data you can save making redundant  
copies using initWithBytesNoCopy:length:encoding:freeWhenDone: for  
string objects that only reference the characters from the data.  They  
depend on the NSData object so it needs to be valid for these strings  
to work.  If you want permanent copies of some substrings you can use  
initWithString: to make them; I'm not sure if using copy will just  
make another object only referencing the data like the original.  If  
you make the substrings with any of NSString's substring* methods, the  
returned strings will be independent and won't become invalid if the  
NSData or base string are released.



On May 13, 2008, at 1:55 PM, Daniel Vollmer wrote:


On May 13, 2008, at 17:00, Jens Alfke wrote:



On 12 May '08, at 11:38 PM, Daniel Vollmer wrote:
It sounds like you're creating a single NSString containing the  
entire contents of the file, then?


Yes. Is that something I shouldn't do? I mean, I feel a tiny bit  
silly creating such huge strings but I didn't find a nice  
alternative (e.g. like the Ruby for each line iterators on file  
objects).


Yes. Even if the NSString is still using the NSData's contents for  
its buffer, it retained them, so releasing the NSData won't make it  
go away until the string is done with it.


But now that means that the strings are endangered from in-place  
file modification for the lifetime of my objects created during  
parsing, not just the initial parsing itself, correct?
Also, it feels a bit silly to have a retain on the 20MB NSData  
object while I still hold references to about 5KB of string bytes  
from various places in the file. Usually all this behind-the- 
scenes storage retaining doesn't matter much, but I'd quite like to  
make sure I drop most of the 20MB once I'm done parsing. This  
question of course also applies if I'm not mapping the file and  
creating a String from it directly



FWIW, my current iteration looks like this (String being the big  
20MB one);


NSUInteger length = [String length];
NSUInteger paraStart = 0, paraEnd = 0, contentsEnd = 0;

while (paraEnd  length)
{
	[String getParagraphStart:paraStart end:paraEnd  
contentsEnd:contentsEnd forRange:NSMakeRange(paraEnd, 0)];
	line = [String substringWithRange:NSMakeRange(paraStart,  
contentsEnd - paraStart)];

// do lots of menial parsing of line
}

If I leave the mmaped reading in, it sounds like a sensible idea to  
check whether the file is on the same drive as the app. So thanks  
for that suggestion.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Xcode eats 100% CPU and more while typing

2008-05-13 Thread Wade Tregaskis
In any case, I'll definitely be filing a radar next time it  
happens.  Problem is, it's next to impossible get a repro the  
problem given the number of variables (environment, SCM, project,  
the file itself, and whatever UI actions/history that led up to that  
point), so we come back to the strange fact that only certain  
projects seem to be affected.


In hard to reproduce cases like this, often the easiest way to get a  
handle on them is to have Shark sit in the background running a 'Time  
Profile (WTF)' against Xcode while you work, and that'll enable you to  
grab a session including not just the time in which Xcode is  
misbehaving, but also the period leading up to that - often critical  
in figuring out how and even what state the app has gotten itself into.


The overhead of doing this is negligible, and certainly won't impact  
your normal Xcode work.


For more information you can read up on Time Profiling in the Shark  
user manual, and specifically Windowed Time Facility (WTF).


A bug report with such a session attached is much more likely to  
receive attention than simply stating there's a problem.  As noted,  
it's also likely to be more useful than a simple profile or  
traditional 'sample', and is easier to obtain.


Wade
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Weird crash in sendEvent - right click vs control click

2008-05-13 Thread Brett Powley

Hi Andrew,

I did think about that.

I've poked around in Contextual Menu Items and Input Methods folders  
and can't find anything there.  I don't have LCC installed, and I  
avoid installing anything that uses APE.  I have just had a quick  
check and can't see any evidence that APE has been installed without  
my knowledge.


The odd thing is that the client I'm writing this for is seeing the  
same crash (of course it's possible that both of us have the same hack  
installed somewhere).


I should add that the stack trace is actually even shorter than the  
one I pasted before -- I had overridden the sendEvent: method to see  
if I could catch the crash:


objc_msgSend
-[NSWindow sendEvent:]
-[NSApplication sendEvent:]
-[NSApplication run]
NSApplicationMain
main

i.e. my code hasn't even been called yet (unless of course  
objc_msgSend is trying to dispatch something to one of my objects, in  
which case I'd like to know what it is)


Cheers,
Brett




On 14/05/2008, at 2:33 PM, Andrew Merenbach wrote:


Hi, Brett,

Is it possible that you have any haxies, or any Input Managers, of  
any sort installed?  Logitech Control Center, for instance, or  
perhaps APE?  That's the only thing that I could think of that might  
be yielding such a crash.


Cheers,
Andrew

On May 13, 2008, at 9:21 PM, Brett Powley wrote:


Hi,

I'm having a rather weird crash in a Cocoa application.  If I  
control-click on a window, my application crashes instantly.  If I  
right click, it doesn't (and indeed my rightMouse method is  
eventually called as I want it to be).


I've tried enabling zombies, but that doesn't catch anything.

The stack trace is rather short:

objc_msgSend
-[NSWindow sendEvent:]
-[MyWindow sendEvent:]
-[NSApplication sendEvent:]
-[MyApplication sendEvent:]
-[NSApplication run]
NSApplicationMain
main

That leads to the questions:

(1) What's the difference between a control click and a right click  
that would lead the former to cause a crash and the latter not to?


(2) What's likely to be the cause of a crash in NSWindow sendEvent: ?

Thanks,
Brett


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andrew.merenbach%40ucla.edu

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: Xcode eats 100% CPU and more while typing

2008-05-13 Thread Wade Tregaskis
For more information you can read up on Time Profiling in the Shark  
user manual, and specifically Windowed Time Facility (WTF).


Somewhere along the way someone ate my links.  Thanks a lot, anonymous  
gremlin. :)


Time Profiling: http://developer.apple.com/documentation/DeveloperTools/Conceptual/SharkUserGuide/TimeProfiling/chapter_3_section_1.html#/ 
/apple_ref/doc/uid/TP40005233-CH3-SW1
Windowed Time Facility (WTF): http://developer.apple.com/documentation/DeveloperTools/Conceptual/SharkUserGuide/SelectingExecutiontoSampleorTrace/chapter_6_section_5.html#/ 
/apple_ref/doc/uid/TP40005233-CH13-SW1


Wade
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to create PLIST file

2008-05-13 Thread Brett Powley
I don't know specifically about the .qtz file, but you can create a  
plist programmatically from an NSDictionary rather trivially using the  
writeToFile:atomically: method.


Cheers,
Brett


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: openURL is not applied to POST-argument of local html file in leopard.

2008-05-13 Thread Jens Alfke
If you want to POST a form, don't create a temporary file to make  
Safari do it! Just use NSURLConnection to send the request yourself.


—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: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Jens Alfke


On 13 May '08, at 9:39 PM, Michael Vannorsdel wrote:

If there's some pages of your data you haven't touched in a while  
the system will swap those out and use the physical pages for  
something that needs them.


Yes, but it's less efficient than a mapped file, which doesn't have to  
be swapped out at all.


The OS may have virtual memory, but swapping when the system is under  
memory pressure is the chief performance problem in OS X; when I  
worked at Apple, the performance people drilled it into us that the  
most important optimization is saving memory. (For example, that's why  
Release builds use -Os by default instead of -O2.)


When making substrings from the data you can save making redundant  
copies using initWithBytesNoCopy:length:encoding:freeWhenDone: for  
string objects that only reference the characters from the data.   
They depend on the NSData object so it needs to be valid for these  
strings to work.


This is tricky and dangerous. It's very difficult to predict object  
lifespans in a ref-counted or GC'd environment, and if any of those  
little strings are still being retained by something when you free the  
big string, they all turn into land mines that will crash the app the  
next time they're referenced.


It's possible to make this work, but I would only try it as a last- 
ditch optimization if the sheer volume of copied strings was choking  
performance.


(Or -initWithBytesNoCopy: might just copy the bytes anyway. It's only  
a hint, not a guarantee. I believe it can only use the raw bytes  
without copying if they're in UTF-16 or ascii or MacRoman encoding.)


—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: Create NSStrings from a mapped NSData object - safe?

2008-05-13 Thread Jens Alfke


On 13 May '08, at 8:57 PM, Michael Vannorsdel wrote:

I actually tested this a month back and not all operations/programs  
respect link counts nor does the system appear to enforce them.  For  
instance an rm -f will destroy the file regardless of link count, as  
well as some obscure APIs.  After the file was removed the mapping  
program crashed when trying to read more of the file; it failed to  
load new map data.


I'm surprised to hear that. If it's true, that would be some kind of  
OS bug. You should file a bug report, or at least bring it up on  
filesystem-dev, if you haven't already.


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