Re: How to make whole view be drop target for small subview

2008-03-22 Thread Ben Lachman
Well, to answer my own question... Seemingly you just have to call  
all the appropriate drag... methods on the image view,  
performDragOperation won't work on its own.


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Mar 23, 2008, at 1:47 AM, Ben Lachman wrote:
I have a large NSTextView that shows my current record.  One of the  
record's attributes is an image which is displayed in a small  
NSImageView subview of the textview.  I'd like to allow images  
dropped anywhere on the textview be routed into the imageview.  My  
first thought was to override NSTextView's drag methods  
(performDragOperation, etc.) and if the pasteboard type could be  
filtered to one of the imageview's registered drag types just call  
performDragOperation: on the imageview in my customized textview's  
performDragOperation.  This doesn't seem to work.  Anyone know a  
good way to do something like this?


Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


How to make whole view be drop target for small subview

2008-03-22 Thread Ben Lachman
I have a large NSTextView that shows my current record.  One of the  
record's attributes is an image which is displayed in a small  
NSImageView subview of the textview.  I'd like to allow images  
dropped anywhere on the textview be routed into the imageview.  My  
first thought was to override NSTextView's drag methods  
(performDragOperation, etc.) and if the pasteboard type could be  
filtered to one of the imageview's registered drag types just call  
performDragOperation: on the imageview in my customized textview's  
performDragOperation.  This doesn't seem to work.  Anyone know a good  
way to do something like this?


Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Adding commandline batch mode to Cocoa app

2008-03-22 Thread Marcus


23 mar 2008 kl. 00.01 skrev Carsten:


The script installation in a more central place is an interesting
thought. Is /usr/local/bin the Apple-sanctioned place for
user-installed commandline utilities, rather than something like (the
non-existent) /Users//bin? I could also install such a
script alongside the .app bundle, which is a thought which had crossed
my mind before I decided to ask more experienced Mac developers, but
that might lead to path problems or long paths again, of course.


The problem with /usr/local/bin is that it does not exist on most Macs  
and therefore you will also have to find out a way to put in in the  
user's path. I think that most apps uses /usr/bin due to that reason.


One alternative is to put it inside the application bundle and then  
use a small Foundation tool inside /usr/bin and use NSBundle to figure  
out during runtime where the bundle is stored.


Marcus


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help with this code

2008-03-22 Thread Jens Alfke


On 22 Mar '08, at 3:23 PM, Guillem Palou wrote:

The debugger crashes in a MoviesTask call. The movie is loaded long  
before the call, but the QTMovie object is created only a few  
instants before. All the other objects look valid.


Maybe a Movie, or other important object, got deallocated. Try setting  
the environment variable NSZombieEnabled to YES, and then run the  
program. If something tried to message a deallocated object, you'll  
get a helpful message saying what happened (including what class the  
object used to be.)


—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: CoreAnimation Memory Use/Eating Memory

2008-03-22 Thread Jens Alfke


On 22 Mar '08, at 6:02 PM, Colin Cornaby wrote:

When I load the 5000x5000 image into my CALayer's contents,  
Instruments does not see any change in my memory usage, while  
Activity Monitor sees the 200 MB extra being allocated. Instruments  
also does not find any leaks in my program.


"Memory usage" can be a very slippery concept in a modern OS. What  
column in particular are you watching in Activity Monitor? The most  
useful one, generally, is RPRVT, which shows how much physical RAM is  
being taken up for memory used only by your process.


—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: Help with this code

2008-03-22 Thread Bill Monk
There's not enough context to tell what's really going on. )Also,  
quicktime-dev may be a more useful list.)


But a few things stick out. As written, the if-test is meaningless  
because no NSError is passed to the QTMethod.  
movieWithQuickTimeMovie: may be failing, so you may be passing  
garbage to setMovie, which crashes.


You can setMovie on the QTMovieView immediately. No need to wait for  
a notification. The view will register for the notifications and  
enable itself as appropriate. IOW may not need to register for that  
notification at all.


 (typed in Mail)


NSError *error = nil;
QTMovie *movie = [QTMovie movieWithQuickTimeMovie:[currentObject  
theMovie]

disposeWhenDone:NO// Really? unless you call
  // DisposeMovie on the oldstyle
  // movie, should use YES.
error:&error];// Without this, test below is 
meaningless

// don't register for notification here, don't yet know if movie is  
valid


if (nil == error)
 {
 // [movie retain]; // don't need

 // setMovie: will retain it, and it's OK to do here (assuming your  
QTMovieView exists!)

 [clipMovieView setMovie:movie];

 // even needed?
 [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(loadStateChanged:)
name:QTMovieLoadStateDidChangeNotification
object:movie];

 // if so, postNotificationName: is a handy shortcut
 [NSNotificationCenter defaultCenter]
postNotificationName:@"QTMovieLoadStateDidChangeNotification"
object:movie]];
}

}

// needed?
-(void)loadStateChanged:(NSNotification *) notification
{

QTMovie *movie = [notification object];
long loadState = [[movie attributeForKey:QTMovieLoadStateAttribute]
longValue];

//if (loadState >= kMovieLoadStatePlaythroughOK) // 2
; // nothing to do, at least as regards setMovie:


}




___

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

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

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 properties inside a relationship entity

2008-03-22 Thread Andrew Merenbach

Hi, Malcom,

Note that in such cases, it is often easier to write:

NSString *tmp = [[[view textStorage] string] copy];

or, if your new string should be mutable:

NSMutableString *tmp = [[[view textStorage] string] mutableCopy];

Cheers,
Andrew


On Mar 22, 2008, at 11:45 AM, malcom wrote:


Ok I've just found a solution.
Make a new NSString object with a copy of the textview string and  
pass it.


NSString *tmp = [[NSString alloc] initWithString: [[view  
textStorage] string]];

___

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

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


CoreAnimation Memory Use/Eating Memory

2008-03-22 Thread Colin Cornaby
I have a document based app that loads layers of certain sizes in a  
document based on user input. As I've been optimizing my app, I  
noticed that loading a 5000x5000 image into a layer causes my  
application to consume 200 more MB of memory. Seems a little high, but  
fair enough. But more interestingly, I noticed that according to  
Activity Monitor, after the document is closed, the memory is not  
freed. When the document is closed, my application tears down the  
entire layer tree and dealloc's all layers, all my backing contexts  
and CGLayers, and yet the memory still lives on.


I've tried tracking where this memory is coming from, but Instruments  
won't even see this extra memory being allocated. When I load the  
5000x5000 image into my CALayer's contents, Instruments does not see  
any change in my memory usage, while Activity Monitor sees the 200 MB  
extra being allocated. Instruments also does not find any leaks in my  
program.


Creating a new document with the 5000x5000 image in a layer in my app  
doesn't seem to reuse the memory, it just adds another 200 MB.


At first I thought this is unique to my program, but I did some  
testing, and Pixelmator exhibits the same behavior (I tested  
Pixelmator because it is also a heavily GL accelerated program). If I  
create a new 5000x5000 document, it allocates around another 100 megs  
of memory, and doesn't release it after the document is closed. I can  
create document after document and watch the memory pile up. This  
could be coincidence, and it's possible the Pixelmator crew shipped  
their app with some sort of leak, but it's very similar behavior.


Is CoreAnimation doing some sort of bizarre GL related caching? If so,  
is there some sort of way I can manage it? When rendering multiple  
large images in CoreAnimation, the memory really starts to pile up and  
actually can run my process entirely out of memory in extreme cases,  
despite me deallocing unneeded layers (because whatever they are  
caching stays in memory).


I apologize in advance if this is some newb thing. I was up late last  
night trying to track down this issue, and it's been a long week for  
me. I'm not really running on all cylinders right now...


Thanks,
Colin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Adding commandline batch mode to Cocoa app

2008-03-22 Thread Carsten
The script installation in a more central place is an interesting
thought. Is /usr/local/bin the Apple-sanctioned place for
user-installed commandline utilities, rather than something like (the
non-existent) /Users//bin? I could also install such a
script alongside the .app bundle, which is a thought which had crossed
my mind before I decided to ask more experienced Mac developers, but
that might lead to path problems or long paths again, of course.

Automator-enabling is something which I would tackle at a later stage,
I think. It might not be hard, but it could take me a lot of reading
and learning to get to the point where I would realise this :) I will
focus on separating engine from GUI cleanly, for now, and learning
Cocoa.

Thanks for the reply. I think that'll get me going in the right
general direction.

Carsten


On 22/03/2008, Tom Harrington <[EMAIL PROTECTED]> wrote:
> On Sat, Mar 22, 2008 at 4:26 PM, Carsten <[EMAIL PROTECTED]> wrote:
>  >  However, image processing apps can benefit from batch modes, and
>  >  although some things can be nicely handled by an in-app batch manager,
>  >  the ideal would be to also allow the application to be run from the
>  >  commandline, as a traditional unix utility.
>  >
>  >  Given the .app bundle format of Cocoa apps, I don't quite see how I
>  >  would do this. In main(), I have added an if contingent on the
>  >  existence of commandline parameters (which can be refined in case Mac
>  >  OS X uses these to launch drag-n-drop scenarios, something which I
>  >  don't know yet), which doesn't load the GUI in case the app has been
>  >  launched in commandline batch mode, but the executable is deep inside
>  >  the .app bundle...
>  >
>  >  What is the traditional Mac OS X/Cocoa way of handling such a
>  >  scenario, or is it simply not do it like this, and to force the user
>  >  to use an in-app batch manager?
>
>
> You could just use the executable in the .app bundle, though it would
>  lead to some very long command lines.  For example you can run
>  TextEdit with "/Applications/TextEdit.app/Contents/MacOS/TextEdit".
>
>  One approach that some apps take is to have a separate command-line
>  tool which could be installed in /usr/local/bin or some other more
>  normal-seeming place.  With this approach you'd probably have a
>  regular drag-install app bundle with a menu item to optionally install
>  the command-line tool.  Depending on your architecture the
>  command-line tool could be as simple as a symbolic link to the main
>  bundle's binary.
>
>  Depending on your requirements, you might consider whether the
>  batch-mode processing would be better implemented as an Automator
>  action.
>
>  --
>  Tom Harrington
>  [EMAIL PROTECTED]
>  AIM: atomicbird1
>  ___
>
>  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>  Please do not post admin requests or moderator comments to the list.
>  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>  Help/Unsubscribe/Update your Subscription:
>  http://lists.apple.com/mailman/options/cocoa-dev/dev%40whimster.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: Adding commandline batch mode to Cocoa app

2008-03-22 Thread Tom Harrington
On Sat, Mar 22, 2008 at 4:26 PM, Carsten <[EMAIL PROTECTED]> wrote:
>  However, image processing apps can benefit from batch modes, and
>  although some things can be nicely handled by an in-app batch manager,
>  the ideal would be to also allow the application to be run from the
>  commandline, as a traditional unix utility.
>
>  Given the .app bundle format of Cocoa apps, I don't quite see how I
>  would do this. In main(), I have added an if contingent on the
>  existence of commandline parameters (which can be refined in case Mac
>  OS X uses these to launch drag-n-drop scenarios, something which I
>  don't know yet), which doesn't load the GUI in case the app has been
>  launched in commandline batch mode, but the executable is deep inside
>  the .app bundle...
>
>  What is the traditional Mac OS X/Cocoa way of handling such a
>  scenario, or is it simply not do it like this, and to force the user
>  to use an in-app batch manager?

You could just use the executable in the .app bundle, though it would
lead to some very long command lines.  For example you can run
TextEdit with "/Applications/TextEdit.app/Contents/MacOS/TextEdit".

One approach that some apps take is to have a separate command-line
tool which could be installed in /usr/local/bin or some other more
normal-seeming place.  With this approach you'd probably have a
regular drag-install app bundle with a menu item to optionally install
the command-line tool.  Depending on your architecture the
command-line tool could be as simple as a symbolic link to the main
bundle's binary.

Depending on your requirements, you might consider whether the
batch-mode processing would be better implemented as an Automator
action.

-- 
Tom Harrington
[EMAIL PROTECTED]
AIM: atomicbird1
___

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

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

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

This email sent to [EMAIL PROTECTED]


Adding commandline batch mode to Cocoa app

2008-03-22 Thread Carsten
I am new to Cocoa and Mac development, but not to development, being a
C/C++ graphics programmer by trade. I am working my way through
Hillegass' book, and although I am forgetting the details as fast as I
am reading them, it all makes sense, and I suppose it will come
together and stick in my head once I start using Cocoa in earnest.

I plan to develop an image processing application, with a Cocoa GIU,
bit by bit. I will likely write the core in platform-independent C++,
partly because I am used to this, and partly because it would make
porting the application easier later, in case this should become
desirable. The GUI will be done with Interface Builder and Cocoa, in
Objective-C.

However, image processing apps can benefit from batch modes, and
although some things can be nicely handled by an in-app batch manager,
the ideal would be to also allow the application to be run from the
commandline, as a traditional unix utility.

Given the .app bundle format of Cocoa apps, I don't quite see how I
would do this. In main(), I have added an if contingent on the
existence of commandline parameters (which can be refined in case Mac
OS X uses these to launch drag-n-drop scenarios, something which I
don't know yet), which doesn't load the GUI in case the app has been
launched in commandline batch mode, but the executable is deep inside
the .app bundle...

What is the traditional Mac OS X/Cocoa way of handling such a
scenario, or is it simply not do it like this, and to force the user
to use an in-app batch manager?

Thanks for any hints.

Carsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help with this code

2008-03-22 Thread Guillem Palou
The debugger crashes in a MoviesTask call. The movie is loaded long before
the call, but the QTMovie object is created only a few instants before. All
the other objects look valid.

The only thing is that when setting the movie object, I'm trying to set an
invalid QTMovie object but I don't see the point because I check that the
movie  (Movie struct) from which is created the QTMovie object is valid
before all this process.

I'll keep on looking at it to see if I find the error...

Thanks to all,


Guillem

On Sat, Mar 22, 2008 at 9:29 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:

>
> On 22 Mar '08, at 12:19 PM, Guillem Palou wrote:
>
> > It crashes when I call the setMovie method of the QTMovieView
> > Object. The
> > code seems to work with movieWithFile instead of
> > movieWithQuicktimeMovie.
>
>
> Use the debugger, then.
>
> How does it crash?
> In the debugger, what's the backtrace?
> What's the value of 'movie' at the time of the call? Does it look valid?
> What's the value of 'clipMovieView' at the time of the call? Does it
> look valid?
> Does "po clipMovieView" print the description of the view, or does it
> fail?
>
> Answering those questions should give you a better idea about what's
> going on.
>
> —Jens
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: base64 NSData to NSString

2008-03-22 Thread Marco Cassinerio


On Mar 22, 2008, at 9:24 PM, Jens Alfke wrote:



On 22 Mar '08, at 1:19 PM, Marco Cassinerio wrote:

I've done what you said, but nothing changed. I get the same data  
content, like this:


ImgR\362FBIL\346\326\303\331\376\247H+\222!\222C\303\351-+	 
\377\376\377\377\377\377\222!\221\302\221\301

\2161\216a
mfile.icnsMacintosh HD>Developer/Applications/Xcode.app/Contents/ 
Resources/mfile.icns/\377\377


That's not base64. If I recall, you're looking at file aliases in a  
plist? In that case, what you have is an NSData object containing  
the raw data from an AliasHandle. You'll need to copy that into a  
handle, and use the CoreServices API  to get an FSRef or  
path to the destination file. Actually, there are a couple of  
existing Cocoa wrappers for the Aliases API, and I'd recommend  
finding and using one of those instead, unless you're really  
familiar with Carbon concepts like handles and FSRefs.


—Jens


Thank you.

I found NDAlias http://homepage.mac.com/nathan_day/pages/source.xml on  
the network and it works fine.


Marco

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help with this code

2008-03-22 Thread Jens Alfke


On 22 Mar '08, at 12:19 PM, Guillem Palou wrote:

It crashes when I call the setMovie method of the QTMovieView  
Object. The
code seems to work with movieWithFile instead of  
movieWithQuicktimeMovie.



Use the debugger, then.

How does it crash?
In the debugger, what's the backtrace?
What's the value of 'movie' at the time of the call? Does it look valid?
What's the value of 'clipMovieView' at the time of the call? Does it  
look valid?
Does "po clipMovieView" print the description of the view, or does it  
fail?


Answering those questions should give you a better idea about what's  
going on.


—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: base64 NSData to NSString

2008-03-22 Thread Jens Alfke


On 22 Mar '08, at 1:19 PM, Marco Cassinerio wrote:

I've done what you said, but nothing changed. I get the same data  
content, like this:


ImgR\362FBIL\346\326\303\331\376\247H+\222!\222C\303\351-+	 
\377\376\377\377\377\377\222!\221\302\221\301

\2161\216a
mfile.icnsMacintosh HD>Developer/Applications/Xcode.app/Contents/ 
Resources/mfile.icns/\377\377


That's not base64. If I recall, you're looking at file aliases in a  
plist? In that case, what you have is an NSData object containing the  
raw data from an AliasHandle. You'll need to copy that into a handle,  
and use the CoreServices API  to get an FSRef or path to  
the destination file. Actually, there are a couple of existing Cocoa  
wrappers for the Aliases API, and I'd recommend finding and using one  
of those instead, unless you're really familiar with Carbon concepts  
like handles and FSRefs.


—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: base64 NSData to NSString

2008-03-22 Thread Marco Cassinerio


On Mar 22, 2008, at 8:46 PM, Jens Alfke wrote:



On 22 Mar '08, at 12:40 PM, Marco Cassinerio wrote:

Using NSPropertyListSerialization means that the .plist file is a  
binary representation and not an XML representation, is it true?


No. You can choose either format when writing a plist, and when  
reading a plist it automatically detects the type and reads either  
one.


Provided you use plist APIs to read the property lists, you  
shouldn't have to care what format they're in. You'll get a  
collection of objects and can work with them directly.


—Jens


I've done what you said, but nothing changed. I get the same data  
content, like this:


ImgR\362FBIL\346\326\303\331\376\247H+\222!\222C\303\351-+	 
\377\376\377\377\377\377\222!\221\302\221\301

\2161\216a
mfile.icnsMacintosh HD>Developer/Applications/Xcode.app/Contents/ 
Resources/mfile.icns/\377\377


I've tried to write a parser, but is very hard.

Marco
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: base64 NSData to NSString

2008-03-22 Thread Jens Alfke


On 22 Mar '08, at 12:40 PM, Marco Cassinerio wrote:

Using NSPropertyListSerialization means that the .plist file is a  
binary representation and not an XML representation, is it true?


No. You can choose either format when writing a plist, and when  
reading a plist it automatically detects the type and reads either one.


Provided you use plist APIs to read the property lists, you shouldn't  
have to care what format they're in. You'll get a collection of  
objects and can work with them directly.


—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: base64 NSData to NSString

2008-03-22 Thread Marco Cassinerio

>They aren't "base64 NSData objects", they are NSData objects which
>happen to be stored using base64. This is an implementation detail and
>you shouldn't need to care about it.

>The .plist extension implies that these are property lists. You can
>read them with NSPropertyListSerialization. This will take care of
>decoding the NSData objects however they are represented, and will
>also do nice things like not fail utterly when Apple decides that this
>plist should be stored using the binary format instead of the XML
>format.

>Mike
I'm a bit confused. Property list documentation says "Data bytes are  
base-64 encoded between the  and  tags."
Using NSPropertyListSerialization means that the .plist file is a  
binary representation and not an XML representation, is it true?

Marco


___

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

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

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

This email sent to [EMAIL PROTECTED]


Help with this code

2008-03-22 Thread Guillem Palou
Hi all, anyone knows what's wrong with this code?

-(void)loadStateChanged:(NSNotification *) notification
{
QTMovie *movie = [notification object];
long loadState = [[movie attributeForKey:QTMovieLoadStateAttribute]
longValue];
if (loadState >= 2)
[clipMovieView
setMovie:movie]; <--- crash
}


QTMovie *movie = [QTMovie movieWithQuickTimeMovie:[currentObject theMovie]
disposeWhenDone:NO error:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(loadStateChanged:)
name:QTMovieLoadStateDidChangeNotification object:movie];

if (nil == error)
{
  [movie retain];
  [[NSNotificationCenter defaultCenter] postNotification:[NSNotification
notificationWithName:@"QTMovieLoadStateDidChangeNotification"
object:movie]];
}

It crashes when I call the setMovie method of the QTMovieView Object. The
code seems to work with movieWithFile instead of movieWithQuicktimeMovie.

Anyone knows what happens?

Thanks to all!

Guillem
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: base64 NSData to NSString

2008-03-22 Thread Michael Ash
On Sat, Mar 22, 2008 at 1:22 PM, Marco Cassinerio
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>  i'm trying to read the com.apple.recentitems.plist file and i found
>  that "Alias" and "Icon" key are base64 NSData object.
>  NSData and NSString don't provide methods to manage base64 data.

They aren't "base64 NSData objects", they are NSData objects which
happen to be stored using base64. This is an implementation detail and
you shouldn't need to care about it.

The .plist extension implies that these are property lists. You can
read them with NSPropertyListSerialization. This will take care of
decoding the NSData objects however they are represented, and will
also do nice things like not fail utterly when Apple decides that this
plist should be stored using the binary format instead of the XML
format.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Best Way To Lookup From a Huge Table

2008-03-22 Thread Thomas Engelmeier


On 21.03.2008, at 21:51, John Stiles wrote:

std::map actually does more than NSDictionary—it sorts its entries  
instead of keeping them in random order. Also, it copies its keys  
instead of just keeping a reference to them, which is also more work— 
it would be a much fairer test if you used std::string* pointers for  
your keys and values instead of std::string objects, but it'd also  
be a little more work since you'd need a custom comparator and you'd  
need to consider memory management (which boost smart pointers  
apparently can manage pretty well).


No need to pull in the whole boost overhead for smart(er) pointers as  
of gcc 4.0.


#include 
using std::tr1::shared_ptr;

And for the presorting time - TR1 includes also an unordered_map and  
unordered_set.


Regards,
Tom_E

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing properties inside a relationship entity

2008-03-22 Thread malcom
Ok I've just found a solution.
Make a new NSString object with a copy of the textview string and pass it.

NSString *tmp = [[NSString alloc] initWithString: [[view textStorage] string]];
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: base64 NSData to NSString

2008-03-22 Thread Jeff LaMarche
I really wouldn't do it this way.  There are many ways of doing this  
within your app without spawning a task. LibCrypto offers functions  
for encoding and decoding  Base64 as does LibSSL (which is going to be  
the same code as you're currently trying to use, but without spawning  
a task). There are also several categories on NSData floating around  
out there that will allow you to decode and encode Base64 right in  
your application, some of which are very well tested.


You can find some good discussion on the topic here:

http://www.cocoadev.com/index.pl?BaseSixtyFour

The category from Colloquy that is discussed has moved to a new  
location. You can find it at its new location here:


http://colloquy.info/project/browser/trunk/Additions/NSBundleAdditions.h
http://colloquy.info/project/browser/trunk/Additions/NSBundleAdditions.m

HTH
Jeff


On Mar 22, 2008, at 1:22 PM, Marco Cassinerio wrote:

i'm trying to read the com.apple.recentitems.plist file and i found  
that "Alias" and "Icon" key are base64 NSData object.

NSData and NSString don't provide methods to manage base64 data.
I've searched with Google and i found some "pathces" for NSString  
and NSData but they don' t seem to work.
I've also tried to write NSData object content to file and pass it  
to openssl command from bash:


openssl base64 -d -in in.txt -out out.txt

but it always create a blank file.

Any suggestions?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: base64 NSData to NSString

2008-03-22 Thread Paolo Manna
Marco,

> I've searched with Google and i found some "pathces" for NSString and NSData 
> but they
> don' t seem to work.
I've used the one contained in Eric Czarny's XML-RPC library, and it
seems to work:
http://sourceforge.net/projects/xml-rpc/

That is based on:
http://ranchero.com/cocoa/xmlrpc/

Note that there, the methods are implemented as class methods, and
they're categories (this is the right name, not "patches") of NSString
(for encoding) and NSData (for decoding).

Paolo
___

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

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

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

This email sent to [EMAIL PROTECTED]


base64 NSData to NSString

2008-03-22 Thread Marco Cassinerio

Hi,

i'm trying to read the com.apple.recentitems.plist file and i found  
that "Alias" and "Icon" key are base64 NSData object.

NSData and NSString don't provide methods to manage base64 data.
I've searched with Google and i found some "pathces" for NSString and  
NSData but they don' t seem to work.
I've also tried to write NSData object content to file and pass it to  
openssl command from bash:


openssl base64 -d -in in.txt -out out.txt

but it always create a blank file.

Any suggestions?

Thanks
Marco
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTreeController, "canRemove" binding

2008-03-22 Thread Alexey Zakhlestin
SOLVED

NSToolbarItem, which I was trying to "disable" had "Autovalidates"
checked. After switching that off everything works as supposed

On 3/22/08, Alexey Zakhlestin <[EMAIL PROTECTED]> wrote:
> On 3/22/08, Jeff Nouwen <[EMAIL PROTECTED]> wrote:
>  > On Mar-22-2008, at 3:20 AM, Alexey Zakhlestin wrote:
>  >  > I have NSOutlineView bound to NSTreeController
>  >  > Additionally, I have a button, which is bound to "canRemove" of
>  >  > NSTreeController. Unfortunately, button never gets disabled (even if I
>  >  > have an empty selection in NSOutlineView)
>  >
>  >
>  > I've run into this before and in my case it was because I forgot to
>  >  bind the Selection Index Paths of my Outline View Content to the
>  >  selectionIndexPaths key path of my tree controller. Forgetting this
>  >  setting caused additional problems like insert: inserting after the
>  >  last-created entry instead of where the selection in the UI was.
>  >
>  >  Do you have this binding set on your outline view?
>
>
> Tried it now, but that did not help.
>
>  Actually, I am binding column of NSOutlineView to NSTreeController
>  using "value" binding. Documentation says, that explicit binding of
>  selectionIndexPaths is not needed this way
>
>
>  --
>  Alexey Zakhlestin
>  http://blog.milkfarmsoft.com/
>


-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.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: NSTreeController, "canRemove" binding

2008-03-22 Thread Alexey Zakhlestin
On 3/22/08, Jeff Nouwen <[EMAIL PROTECTED]> wrote:
> On Mar-22-2008, at 3:20 AM, Alexey Zakhlestin wrote:
>  > I have NSOutlineView bound to NSTreeController
>  > Additionally, I have a button, which is bound to "canRemove" of
>  > NSTreeController. Unfortunately, button never gets disabled (even if I
>  > have an empty selection in NSOutlineView)
>
>
> I've run into this before and in my case it was because I forgot to
>  bind the Selection Index Paths of my Outline View Content to the
>  selectionIndexPaths key path of my tree controller. Forgetting this
>  setting caused additional problems like insert: inserting after the
>  last-created entry instead of where the selection in the UI was.
>
>  Do you have this binding set on your outline view?

Tried it now, but that did not help.

Actually, I am binding column of NSOutlineView to NSTreeController
using "value" binding. Documentation says, that explicit binding of
selectionIndexPaths is not needed this way

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.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]


Installer is automatically diverting the applications location in Leopard

2008-03-22 Thread JanakiRam
Hi All,

 I've came across a strange situation with Installer on Leopard.
Please help me to solve this.

 I've created a pkg installer for my cocoa application in Tiger
using the following code snippet.

*/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
-build -p "$STAGING_AREA/MyApplication/MyApplication.pkg"  -f
$STAGING_AREA/dstroot -r $STAGING_AREA/Resources -i  CurrentInfo.plist -d
CurrentDescription.plist*
**
 The package created using this installed fine in Tiger , recently
i've tried to install the .pkg file in Leopard - observed that Applications
are diverted to the development location instead of /Applications.

 Please help me to solve this. Thanks in Advance.

-JanakiRam.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Unable to unload Launch Daemon using Cocoa Application.

2008-03-22 Thread JanakiRam
Hi All,

   I'm developing a cocoa application which needs to unload my Launch
Daemon for one particular requirement. I've used Authorization Services to
perform unload of Launch Daemon ( previlaged action ). But couldn't succeed
in this. I'm getting the following error on executed  my code.

*Output :*
**
*lauchctl : Error in unloading mydaemon*
**
*Note :* Attaching my code snippet for your reference.

  Please help me to solve this problem. Thanks in Advance.

-JanakiRam

 *Code Snippet :*
**
*- (void) UnloadDaemon
{
// setup our authorization environment.
AuthorizationItem authItems[1];  // we only want to get authorization
for one command
BOOL authorized = NO;  // are we authorized?
char *args[4];

char *command = "/bin/launchctl";

authItems[0].name = kAuthorizationRightExecute; // we want the right to
execute
authItems[0].value = command;  // the path to the startup script
authItems[0].valueLength = strlen(command); // length of the command
authItems[0].flags = 0;// no extra flags

authRights.count = 1;  // we have one item
authRights.items = authItems; // here is the values for our item

authFlags = kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagExtendRights;

// lets find out if we are authorized

ourStatus = AuthorizationCopyRights(authorizationRef,&authRights,
kAuthorizationEmptyEnvironment, authFlags, NULL);

authorized = (errAuthorizationSuccess==ourStatus);

if (authorized)
{
// we are authorized, so let's tell the security framework to
execute
// our command as root
  args[0] = "unload";
args[1] = "-w";
  args[2] = "/Library/LaunchDaemons/org.mycompany.launchdaemon.plist";
  args[3] = NULL;

ourStatus = AuthorizationExecuteWithPrivileges(authorizationRef,
 command,
 kAuthorizationFlagDefaults,
args, NULL);

if(ourStatus != errAuthorizationSuccess)
{
NSLog(@"unload has failed");
}
}
else
{
  NSLog(@"error in authentication");
}
}*
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating custom sheets

2008-03-22 Thread Ken Thomases

On Mar 21, 2008, at 9:44 AM, Sherm Pendley wrote:
On Fri, Mar 21, 2008 at 9:42 AM, Ken Thomases <[EMAIL PROTECTED]>  
wrote:

On Mar 20, 2008, at 7:37 PM, Kevin Dixon wrote:
> I want to create a custom sheet that displays a bit of text, a
> progress
> bar and an abort button. The Apple docs say use interface builder to
> make
> the UI for the sheet, but what should I add to my NIB, a window,
> panel, or
> custom view?

A window.  :)

That's what I'd use for new work. But, as someone else noted in  
another recent discussion, an NSPanel works just as well, so I  
wouldn't bother changing any NIBs that were created with NSPanel.


Notice the argument types for the beginSheet... and related methods.

NSPanel is a subclass of NSWindow, and one can usually pass  
subclasses of the declared argument type.


And so my answer was correct.  :)  Creating an NSPanel is creating a  
window.


-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: NSTreeController, "canRemove" binding

2008-03-22 Thread Jeff Nouwen

On Mar-22-2008, at 3:20 AM, Alexey Zakhlestin wrote:

I have NSOutlineView bound to NSTreeController
Additionally, I have a button, which is bound to "canRemove" of
NSTreeController. Unfortunately, button never gets disabled (even if I
have an empty selection in NSOutlineView)


I've run into this before and in my case it was because I forgot to  
bind the Selection Index Paths of my Outline View Content to the  
selectionIndexPaths key path of my tree controller. Forgetting this  
setting caused additional problems like insert: inserting after the  
last-created entry instead of where the selection in the UI was.


Do you have this binding set on your outline view?

- Jeff

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [iPhone] NSTableView and NSIndexPath

2008-03-22 Thread Cathy Shive
Noone's going to answer your question.  A general rule of thumb to  
follow (at least until CocoaTouch SDK is out of beta) - don't ask  
about any classes whose names don't start with the letters "NS" or  
"CA" on this list.  I'm sure that there are exceptions - maybe "QT",  
but generally this list is for "NS" and "CA" questions.


Best,
Cathy

On Mar 22, 2008, at 2:31 PM, Ryan Homer wrote:


NSTableView has a delegate method as follows:

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
withAvailableCell:(UITableViewCell *)availableCell


You can figure out which section and row of the table is in  
question using indexPath.section and indexPath.row respectively.  
However, I'm having a hard time creating my own NSIndexPath that  
has section and row as properties. Is this a special case of  
NSIndexPath?


What I'm really trying to do is that once I have my table built up  
(think of the contact list, where each section is labeled A, B, C,  
etc. and in each section there are multiple rows, one for each  
contact starting with that letter) I would like to programatically  
scroll to a particular section using UITableView's


scrollToRowAtIndexPath:atScrollPosition:animated:


However, I'm not sure how to create the NSIndexPath that's needed  
for the first parameter so that I can scroll to, say, section 3,  
row 0.


Any ideas?

Thanks!
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


[iPhone] NSTableView and NSIndexPath

2008-03-22 Thread Ryan Homer

NSTableView has a delegate method as follows:

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
withAvailableCell:(UITableViewCell *)availableCell


You can figure out which section and row of the table is in question  
using indexPath.section and indexPath.row respectively. However, I'm  
having a hard time creating my own NSIndexPath that has section and  
row as properties. Is this a special case of NSIndexPath?


What I'm really trying to do is that once I have my table built up  
(think of the contact list, where each section is labeled A, B, C,  
etc. and in each section there are multiple rows, one for each contact  
starting with that letter) I would like to programatically scroll to a  
particular section using UITableView's


scrollToRowAtIndexPath:atScrollPosition:animated:


However, I'm not sure how to create the NSIndexPath that's needed for  
the first parameter so that I can scroll to, say, section 3, row 0.


Any ideas?

Thanks!
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: XML to RTF transformation via XSL

2008-03-22 Thread Andrew Farmer

On 22 Mar 08, at 01:46, Ian Jackson wrote:
I'd like to have my XML file read by my app, and save the file, or  
display it in a NSTextView, as RTF (with the appropriate formatting  
etc).


So I have been trying to use:

- (id)objectByApplyingXSLTAtURL:(NSURL *)xsltURL arguments: 
(NSDictionary *)argumentserror:(NSError **)error


Which is happily giving me the HTML document that would be expected.

<...>
And these things either give an error in the console, or at best  
just give HTML. Also, I can't see how any of these settings (except  
the target properties) would give me RTF (rather than plain text).


Am I barking up the wrong tree here? I was expecting RTF output with  
bigger bolder text corresponding to  etc.


Reading the documentation, there doesn't appear to be any magic HTML- 
>RTF pixie dust in objectByApplyingXSLTAtURL. To get RTF output,  
you'll probably need to write a stylesheet that generates RTF data  
instead of HTML.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing properties inside a relationship entity

2008-03-22 Thread malcom
I've noticed a strange thing.
If I take my NSString from an NSTextField it seems to works, while if
I use textStorage] string] from an NSTextView it simply put an empty
string or still remain the old value into the NSManagedObject (however
with GDB the textStorage] string] return the correct value).
I really don't know why... :|

Ah I forgot the screenshot but at this time I don't think it could help.
___

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

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

2008-03-22 Thread malcom
Hello,
I'm working with Core-Data.
I've a simple cd structure (look here: ) with two entities: Draft and
Data. Draft contains some infos about the draft itself while the data
entity contains the body of the draft (I've used it in order to avoid
to load the entire article while I need to put some basic info in a
tableview).
Now I need to store the body into the body. My statments are:

NSManagedObject *linkedData = [draftObj valueForKey: DraftPackage_LinkedBody];
[linkedData setValue: [[ass_editingTextView textStorage] string]
forKey: DraftPackage_DataBody];

It's simple...but it does not works. I've tried to  put an NSLog at
the end of the second line and the data was written correctly into the
entity but, when I read it again (for example when I select the draft
from the table) it returns the old value (or a empty string?!!?).
These operations was made inside the main managedobjectcontext and
inside the main app thread.
I've tried to make a refreshObject:mergeChanges with YES in merge but
it does not work.
Same thing by doing processPendingChanges.
I've also tried to saving it to disk with save: command.
What's the way to propagate changes, insert, deletes? Need I to fetch
this entity instead of taking it from draftObject relationship?
Thanks a lot.
malcom
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: disabling NSButton?

2008-03-22 Thread Kevin Dixon
I have a TableView. In order to update the state of the buttons that
operate on the items in the list, I call my function
"updateActionEnabledState" when my controller receives the tableView
message (which is triggered by calling [uiAudioFileTableView reloadData]
when the data source is altered).

Is there anything wrong with this approach, or should I call the
updateActionEnabledState along with calling reloadData?

-Kevin

> On Fri, Mar 21, 2008 at 2:46 PM, Kevin Dixon <[EMAIL PROTECTED]> wrote:
>>  I needed to call [uiButton displayIfNeeded] instead of setNeedsDisplay
>
> Where are you doing this?  Essentially what you have done is
> short-circuited the coalesced update of dirty rectangles for drawing,
> which leads me to believe that you're doing something in an inner loop
> or a special run loop mode which you perhaps shouldn't be doing.
>
> --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]


NSTreeController, "canRemove" binding

2008-03-22 Thread Alexey Zakhlestin
Mac OS X 10.5.2

I have NSOutlineView bound to NSTreeController
Additionally, I have a button, which is bound to "canRemove" of
NSTreeController. Unfortunately, button never gets disabled (even if I
have an empty selection in NSOutlineView)

I added NSLog() to the method, which handles click on button and put
value of "canRemove" — the value is correct there (NO when nothing is
selected, YES, when something is selected).

Visually, whenever I remove selection in NSOutlineView button gets
disabled for half-a-second, and then becomes enabled again.

What can be done to solve this issue?

-- 
Alexey Zakhlestin
http://www.milkfarmsoft.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]

XML to RTF transformation via XSL

2008-03-22 Thread Ian Jackson
I'd like to have my XML file read by my app, and save the file, or  
display it in a NSTextView, as RTF (with the appropriate formatting  
etc).


So I have been trying to use:

- (id)objectByApplyingXSLTAtURL:(NSURL *)xsltURL arguments: 
(NSDictionary *)argumentserror:(NSError **)error


Which is happily giving me the HTML document that would be expected.

The dev docs say that the return value for this method depends on the  
intended output. For RTF, an NSData object is returned.


So, how do I get this NSData object that I'd like?

I've tried:

 in my xsl file.

[xmlDoc setDocumentContentKind:NSXMLDocumentTextKind]; before doing   
the objectByApplyingXSLTAtURL


I've set the target properties to handle RTF.

I've cast the objectByApplyingXSLTAtURL message -

i.e. NSData *xmlData = (NSData *)[xmlDoc objectByApplyingXSLTAtURL: 
[NSURL fileURLWithPath:xsltPath] arguments:nil error:&err];


And these things either give an error in the console, or at best just  
give HTML. Also, I can't see how any of these settings (except the  
target properties) would give me RTF (rather than plain text).


Am I barking up the wrong tree here? I was expecting RTF output with  
bigger bolder text corresponding to  etc.


Ian.
___

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

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

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

This email sent to [EMAIL PROTECTED]