Re: Core Data _NSFaultingMutableSet Exception

2009-12-21 Thread Gerriet M. Denkmann

On 22 Dec 2009, at 13:38, Graham Cox wrote:

> 
> On 22/12/2009, at 4:05 PM, Gerriet M. Denkmann wrote:
> 
>> When later I reset the filterPredicates back to the simple (working) mode, I 
>> get another exception:
>> HIToolbox: ignoring exception 'Cannot remove an observer  
>> for the key path "theBs.bValue" from  because it is 
>> not registered as an observer.' that raised inside Carbon event dispatch
>> 
>> 1. This is a Cocoa document based app, using Core Data. Why this "Carbon 
>> event dispatch". And who is HIToolbox?
> 
> 
> Cocoa sits atop Carbon. So all this means is that an exception didn't get 
> caught until it reached the Carbon layers. I don't think such exceptions were 
> previously logged before 10.6, though they undoubtedly did occur.
> 
> You need to concentrate on where the exception came from and stop it from 
> being raised, not where it ended up getting caught.

Sigh - I had hoped that this Carbon-message would indicate the source of the 
problem - obviously I was wrong.

The backtrace for the first exception '[<_NSFaultingMutableSet 0x10048a950> 
addObserver:forKeyPath:options:context:] is not supported. Key path: bValue' 
when setting the predicate 'aValue BEGINSWITH[n] "a" AND ANY theBs.bValue == 
"xx"' is:

0   CoreFoundation  0x7fff80b73444 
__exceptionPreprocess + 180
1   libobjc.A.dylib 0x7fff854630f3 
objc_exception_throw + 45
2   CoreFoundation  0x7fff80b73267 
+[NSException raise:format:arguments:] + 103
3   CoreFoundation  0x7fff80b731f4 
+[NSException raise:format:] + 148
4   Foundation  0x7fff8343480e 
-[NSSet(NSKeyValueObserverRegistration) 
addObserver:forKeyPath:options:context:] + 116
5   Foundation  0x7fff8335b16d 
-[NSKeyValueNestedProperty object:didAddObservance:recurse:] + 229
6   Foundation  0x7fff83359f3b 
-[NSObject(NSKeyValueObserverRegistration) 
_addObserver:forProperty:options:context:] + 511
7   Foundation  0x7fff833588e0 
-[NSObject(NSKeyValueObserverRegistration) 
addObserver:forKeyPath:options:context:] + 125
8   AppKit  0x7fff8267d92c 
-[_NSModelObservingTracker 
_registerOrUnregister:observerNotificationsForKeyPath:] + 273
9   AppKit  0x7fff82b4c269 
-[_NSModelObservingTracker registerModelKeyPaths:unregisterModelKeyPaths:] + 421
10  AppKit  0x7fff82715d35 
-[NSArrayController _updateAutomaticRearrangementKeysPaths] + 240
11  AppKit  0x7fff8271e5da 
-[NSArrayController _didChangeArrangementCriteriaWithOperationsMask:useBasis:] 
+ 79
12  AppKit  0x7fff8271e18d 
-[NSArrayController setFilterPredicate:] + 1344
13  ไทย Dict Both 3   0x00014d8e 
-[MyDocument(MyDocumentPrivate) newFilters] + 1473

but there is nothing here what helps me answering why the exception was raised 
(although it answers where it came from).

Kind regards,

Gerriet.

___

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

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

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

This email sent to arch...@mail-archive.com


Interfacing cocoa/obj-c within a C plug-in API

2009-12-21 Thread Rich E
Hi,

I am new to Cocoa and Objective-C both, but I need the two in order to get
tablet functionality into one of my favorite applications (Puredata) on Mac
OS X. First off, I know that you can get tablet event data through the
Carbon API, but I have ran into enough problems (along with no 64-bit
support) that I think trying it with Cocoa is worth a shot.  Puredata has an
API for writing plug-in's in C and I hear that it is possible to write the
entire plug-in in Obj-C but leave the host callback functions in standard C,
yet I still don't understand how to embark.

I learn best by examples, does anyone know of any existing C applications
that make use of Cocoa or Objective-C?  Else, any advice on how to combine
these two with a host written in C?

Thanks for any help or advice,
Rich
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data _NSFaultingMutableSet Exception

2009-12-21 Thread Graham Cox

On 22/12/2009, at 4:05 PM, Gerriet M. Denkmann wrote:

> When later I reset the filterPredicates back to the simple (working) mode, I 
> get another exception:
> HIToolbox: ignoring exception 'Cannot remove an observer  
> for the key path "theBs.bValue" from  because it is not 
> registered as an observer.' that raised inside Carbon event dispatch
> 
> 1. This is a Cocoa document based app, using Core Data. Why this "Carbon 
> event dispatch". And who is HIToolbox?


Cocoa sits atop Carbon. So all this means is that an exception didn't get 
caught until it reached the Carbon layers. I don't think such exceptions were 
previously logged before 10.6, though they undoubtedly did occur.

You need to concentrate on where the exception came from and stop it from being 
raised, not where it ended up getting caught.

--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data _NSFaultingMutableSet Exception

2009-12-21 Thread Jerry Krinock

On 2009 Dec 21, at 21:05, Gerriet M. Denkmann wrote:

> But when I use:
> [ arrayController1 setFilterPredicate: "aValue BEGINSWITH[n] "a" AND ANY 
> theBs.bValue == "xx""];
> I get an exeption:
> 
> HIToolbox: ignoring exception '[<_NSFaultingMutableSet 0x1001f5d00> 
> addObserver:forKeyPath:options:context:] is not supported. Key path: bValue' 
> that raised inside Carbon event dispatch

I believe I've seen this message when I try to observe the "many" end of a 
to-many relation using KVO.  That's against the law.  (And I do remember 
reading that one in the documentation, mmalc!)  Probably it was in the KVO 
Programming guide??

Bindings uses KVO.  Clue: Look at any bindings hanging on that array controller.

> When later I reset the filterPredicates back to the simple (working) mode, I 
> get another exception:
> HIToolbox: ignoring exception 'Cannot remove an observer  
> for the key path "theBs.bValue" from  because it is not 
> registered as an observer.' that raised inside Carbon event dispatch
> 
> 1. This is a Cocoa document based app, using Core Data. Why this "Carbon 
> event dispatch". And who is HIToolbox?

Do not worry about these words.  It is definitely an error you need to deal 
with.  Don't worry about where it came from -- it came from "the bowels of the 
Mac OS".  "HI" probably means "Human Interface" but knowing that doesn't help 
you at all.

___

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

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

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

This email sent to arch...@mail-archive.com


NSTabView Bindings

2009-12-21 Thread Gerriet M. Denkmann

I am trying to bind "editable" of an NSTableColumn to ObjectController 
tabView.selectedIndex
(The tab view has two items: Read and Edit. When the first item is selected, my 
table column should not be editable).

But I am told:
[ valueForUndefinedKey:]: this class is not key value 
coding-compliant for the key selectedIndex.

On the other hand, the Cocoa Bindings Reference for NSTabView says: 
"selectedIndex
An integer value that specifies the index of the selected item in the 
NSTabView. When the selection changes in the NSTabView, this value is updated 
with the index of the newly selected item."

So: what is going on? 
And: how do I make my table column editable if and only if the first tab view 
item is selected?

Kind regards,

Gerriet.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Localization strategies?

2009-12-21 Thread John Joyce


On Dec 21, 2009, at 8:18 PM, Uli Kusterer wrote:

On 20.12.2009, at 21:30, Ricky Sharp wrote:
Thus, I'm wondering if it would ultimately be worth it to  
externalize all strings from my nibs and just put everything in my  
single .strings file.  This will clearly involve me adding tons of  
IBOutlet ivars just so that at runtime I can set their text with  
NSLocalizedString APIs.


One approach to avoid the whole IBOutlet excess would be to create  
subclasses of the standard view classes which, when they are loaded,  
use their contents/title as the key and pass it to NSLocalizedString 
(). That way, your NIBs only contain keys, and the .strings files  
can hold the actual strings, including comments.


Another possibility: instead of creating a bunch of subclasses and  
having to specify that subclass for each view you create in IB, you  
could write a method that recurses through all views in a window.   
Check each view for a "title" or "name" property (maybe "stringValue"  
too), and maybe use some convention like #TITLE# to indicate you want  
to replace that title or name with a localized string to be gotten via  
NSLocalizedString().  Check whether the view is a table view that  
displays column headers, and if so, iterate through its columns.  Do  
similar special-casing for tab views and segmented views and anything  
else that needs it.


This method could be in its own utility class, where it could be  
called by awakeFromNib.  Offhand I think this is how I would do it if  
I wanted to take the approach of putting keys in the nib.


--Andy

It's best not to localize in a locale unless you are going to do it  
correctly!
That means hand tooling the UI. Apple realized long ago that GUI  
elements must be localized correctly. This means far more than  
translation with the inevitable string length differences. This means  
making an interface make sense in a localized format. One size fits  
all only when the UI is intuitive and self explanatory. (Photobooth is  
an excellent example)


It tends to be true that your UI could use improvement if it is overly  
textual. A good UI design can avoid localization being painful. This  
is the true shortcut in localization 
___


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

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

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

This email sent to arch...@mail-archive.com


Re: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Henry McGilton (Boulevardier)

On Dec 21, 2009, at 8:02 PM, Development wrote:

> Then I don't understand how to do this.
> 
> Do I create the context at this larger size? because that's what I did.
> Do I drawInRect the image at it's original size? Because that's what I did. 
> 
> As near as I can tell, no matter what I do, the image itself, not accounting 
> for the shadow, is drawn in the upper left corner. this causes a negative 
> shadow, or one to the upper left, to be cut off by the edge of the context. 
> I have attempted using drawAtPoint, and accounting for the negative shadow by 
> moving the point an amount that should accommodate the shadow. It did not 
> work.
> 
> Now if the shadow is to the lower right, the adjustments I make work 
> perfectly every time and the shadow is exactly what it should be. 
> 
> I think the point is that I do not understand the context drawing. I thought 
> I did but it should be painfully obvious from this thread that I do not.

Are you aware that the  context you get from   UIGraphicsBeginImageContext  has 
its origin
at upper left ?

In any case, I have posted a mini example that *appears* to do what you want, 
but based
on the descriptions, I might have misunderstood, in which case please excuse me 
for
wasting bandwidth . . .

The project is here:

http://www.trilithon.com/download/Shadow.zip

Cheers,
. . . . . . . .Henry


> 
> 
> 
> 
> On Dec 21, 2009, at 8:45 PM, Graham Cox wrote:
> 
>> 
>> On 22/12/2009, at 1:49 PM, Development wrote:
>> 
>>> however what I am getting now is a larger image, offset in the view and 
>>> still cutting off the shadow. So I honestly do not know how I am suppose to 
>>> draw this shadow. I would really be grateful for some additional direction.
>> 
>> 
>> Try thinking instead of flailing about throwing code at it.
>> 
>> You need a bigger image to accommodate the shadow. But the image you want to 
>> composite on top is the same size as it always was. So you need to keep its 
>> original size around so you can draw it at that size but into the larger 
>> image context. If you draw it at the new size you are back at square one, 
>> but larger.
>> 
>> --Graham
>> 
>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/appledeveloper%40trilithon.com
> 
> This email sent to appledevelo...@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 arch...@mail-archive.com


Core Data _NSFaultingMutableSet Exception

2009-12-21 Thread Gerriet M. Denkmann
Core Data model with two entities: A and B.

A has property aValue and a relation theBs to one or more Bs.

B has a property bValue.

Two NSTableViews (tabelView1 and tableView2 ) with each controlled by an 
NSArrayController (arrayController1 and arrayController2).

Everything works fine when I send:
 [ arrayController1 setFilterPredicate: "aValue BEGINSWITH[n] "a""];
 [ arrayController2 setFilterPredicate: "aValue containsInside: "a""];
(Well, I do send real predicates, but they contain the strings shown above. 
"containsInside:" is declared in a category on NSString)

But when I use:
 [ arrayController1 setFilterPredicate: "aValue BEGINSWITH[n] "a" AND ANY 
theBs.bValue == "xx""];
I get an exeption:

 HIToolbox: ignoring exception '[<_NSFaultingMutableSet 0x1001f5d00> 
addObserver:forKeyPath:options:context:] is not supported. Key path: bValue' 
that raised inside Carbon event dispatch

When later I reset the filterPredicates back to the simple (working) mode, I 
get another exception:
 HIToolbox: ignoring exception 'Cannot remove an observer  
for the key path "theBs.bValue" from  because it is not 
registered as an observer.' that raised inside Carbon event dispatch

1. This is a Cocoa document based app, using Core Data. Why this "Carbon event 
dispatch". And who is HIToolbox?

2. I have an identical app, which works perfectly.
(Obviously these two apps are NOT identical, but I really cannot find any 
differences. I tried to remove all changes I made to the newer app, but the 
exception remains).

I spend now more than a day chasing this exception. Any hints would be most 
welcome. 10.6.2.


Kind regards,

Gerriet.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data validateForUpdate

2009-12-21 Thread Matthew Lindfield Seager
On Tuesday, December 22, 2009, Gerriet M. Denkmann  wrote:
> What I ended up was: subclassing NSArrayController and overriding "newObject" 
> to return a new object prefilled with some some nice values, including 
> setting my uniqueKey to "undefined", "undefined_1", "undefined_2", etc.
> This will break of course if the user (out of sheer perversity) has already 
> created an "undefined_4".
Plus 1. I've done something similar in the past. My approach was to
see if "Untitled" was already taken, if so try "Untitled 2", etc. From
memory I kept going until 20 (a number all but the most perverse user
wouldn't reach in my case). If "Untitled 20" (& everything preceding)
was taken it got named with a date stamp, "Untitled 2009122215353803"
for example.

Regards,
Matt
___

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

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

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

This email sent to arch...@mail-archive.com


Re: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Development
Then I don't understand how to do this.

Do I create the context at this larger size? because that's what I did.
Do I drawInRect the image at it's original size? Because that's what I did. 

As near as I can tell, no matter what I do, the image itself, not accounting 
for the shadow, is drawn in the upper left corner. this causes a negative 
shadow, or one to the upper left, to be cut off by the edge of the context. 
I have attempted using drawAtPoint, and accounting for the negative shadow by 
moving the point an amount that should accommodate the shadow. It did not work.

Now if the shadow is to the lower right, the adjustments I make work perfectly 
every time and the shadow is exactly what it should be. 

I think the point is that I do not understand the context drawing. I thought I 
did but it should be painfully obvious from this thread that I do not.




On Dec 21, 2009, at 8:45 PM, Graham Cox wrote:

> 
> On 22/12/2009, at 1:49 PM, Development wrote:
> 
>> however what I am getting now is a larger image, offset in the view and 
>> still cutting off the shadow. So I honestly do not know how I am suppose to 
>> draw this shadow. I would really be grateful for some additional direction.
> 
> 
> Try thinking instead of flailing about throwing code at it.
> 
> You need a bigger image to accommodate the shadow. But the image you want to 
> composite on top is the same size as it always was. So you need to keep its 
> original size around so you can draw it at that size but into the larger 
> image context. If you draw it at the new size you are back at square one, but 
> larger.
> 
> --Graham
> 
> 

___

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

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

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

This email sent to arch...@mail-archive.com


Re: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Graham Cox

On 22/12/2009, at 1:49 PM, Development wrote:

> however what I am getting now is a larger image, offset in the view and still 
> cutting off the shadow. So I honestly do not know how I am suppose to draw 
> this shadow. I would really be grateful for some additional direction.


Try thinking instead of flailing about throwing code at it.

You need a bigger image to accommodate the shadow. But the image you want to 
composite on top is the same size as it always was. So you need to keep its 
original size around so you can draw it at that size but into the larger image 
context. If you draw it at the new size you are back at square one, but larger.

--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data validateForUpdate

2009-12-21 Thread Gerriet M. Denkmann

On 22 Dec 2009, at 04:50, Sean McBride wrote:

> On 12/20/09 3:19 PM, Gerriet M. Denkmann said:
> 
>> What I try to accomplish:
>> SomeEntity has a property called "uniqueKey" and this is (no big
>> surprise) meant to be unique.
>> 
>> When the "UniqueKey" column in my table view gets edited,
>> validateUniqueKey:error: gets called, I check the new value for
>> uniqueness and all is fine.
>> 
>> But hitting the "+" button several times inserts several objects with
>> the same key (Default Value).
> 
> As others have said, you probably want awakeFromInsert.
> 
> Depending what kind of 'unique' value you want, you could create a
> unique string like this:
> 
>   CFUUIDRef uuid = CFUUIDCreate (kCFAllocatorDefault);
>   if (uuid)
>   {
>   uuidStr = NSMakeCollectable (CFUUIDCreateString 
> (kCFAllocatorDefault,
> uuid));
>   CFRelease (uuid);
>   }
> 
> If you want/need to compare to other objects of the same entity type,
> then be warned that performing a fetch within awakeFromInsert is
> probably not a good idea.  NSArrayController doesn't like it when you do that.

Thanks for all your help and suggestions.

What I ended up was: subclassing NSArrayController and overriding "newObject" 
to return a new object prefilled with some some nice values, including setting 
my uniqueKey to "undefined", "undefined_1", "undefined_2", etc.
This will break of course if the user (out of sheer perversity) has already 
created an "undefined_4".

But as "real" entries never will look like "undefined_..." there is no problem 
with eliminating duplicating entities later.

And, as I said, editiing "undefined_..." into some "real" value will (via: 
Validates immediately) catch real duplicates.

Kind reagards,

Gerriet.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: iPhone and GC

2009-12-21 Thread Michael Ash
On Tue, Dec 22, 2009 at 8:54 AM, Lorenzo Thurman  wrote:
> Why can't iPhone apps use GC? Is it resources? Performance? Some combination
> of the two or other reasons altogether?
> Just curious, thanks.

I know that this will be unsatisfying, but the real reason that iPhone
apps can't use GC is because Apple has not yet made GC available for
the iPhone.

Anything further would be pure speculation, because Apple doesn't talk
about things like that.

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 arch...@mail-archive.com


Re: Localization strategies?

2009-12-21 Thread Andy Lee
On Dec 21, 2009, at 8:18 PM, Uli Kusterer wrote:
> On 20.12.2009, at 21:30, Ricky Sharp wrote:
>> Thus, I'm wondering if it would ultimately be worth it to externalize all 
>> strings from my nibs and just put everything in my single .strings file.  
>> This will clearly involve me adding tons of IBOutlet ivars just so that at 
>> runtime I can set their text with NSLocalizedString APIs.
> 
> One approach to avoid the whole IBOutlet excess would be to create subclasses 
> of the standard view classes which, when they are loaded, use their 
> contents/title as the key and pass it to NSLocalizedString(). That way, your 
> NIBs only contain keys, and the .strings files can hold the actual strings, 
> including comments.

Another possibility: instead of creating a bunch of subclasses and having to 
specify that subclass for each view you create in IB, you could write a method 
that recurses through all views in a window.  Check each view for a "title" or 
"name" property (maybe "stringValue" too), and maybe use some convention like 
#TITLE# to indicate you want to replace that title or name with a localized 
string to be gotten via NSLocalizedString().  Check whether the view is a table 
view that displays column headers, and if so, iterate through its columns.  Do 
similar special-casing for tab views and segmented views and anything else that 
needs it.

This method could be in its own utility class, where it could be called by 
awakeFromNib.  Offhand I think this is how I would do it if I wanted to take 
the approach of putting keys in the nib.

--Andy

___

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

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

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

This email sent to arch...@mail-archive.com


Re: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Development
I have changed the code I added:

CGSize newSize  = rotatingView.bounds.size;
newSize.width += (abs(myShadowOffset.width) + spread);
newSize.height += (abs(myShadowOffset.height) + spread);

CGRect newSelf = CGRectMake(self.frame.origin.x, self.frame.origin.y,
newSize.width, 
newSize.height);

self.frame = newSelf;

UIGraphicsBeginImageContext(newSize);


however what I am getting now is a larger image, offset in the view and still 
cutting off the shadow. So I honestly do not know how I am suppose to draw this 
shadow. I would really be grateful for some additional direction.


On Dec 21, 2009, at 7:09 PM, David Duncan wrote:

> On Dec 21, 2009, at 5:29 PM, Development wrote:
> 
>> I'll try my question again. Ok, I have a UIImageView. I am trying to draw a 
>> shadow under the UIImage it holds. Now if I make the UIImageView's bounds 
>> some ungodly size, like the size of the screen it draws shadows perfectly 
>> but obviously this is not acceptable. So I don't understand what I am doing 
>> wrong. I've tried turning off the clipstobounds but that doesn't help unless 
>> the context I am drawing is is clipping in which case I do not know how to 
>> turn it off. But at least in the UIImageView it is not clipping. 
> 
> 
> Your drawing to an offscreen context, and in doing so your asking to create a 
> context that is a certain size. If you draw outside of that area, then your 
> going to lose that drawing, period, because there is no place to put it.
> 
> If you want to add a shadow, your going to have to calculate how much extra 
> space you need and increase the context you draw by that size. A reasonable 
> approximation is the shadow offset plus the shadow spread. Either way, your 
> not going to be able to use the image's original size as the final size 
> because you are explicitly asking to draw outside of that original image.
> --
> David Duncan
> Apple DTS Animation and Printing
> 

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data Migration

2009-12-21 Thread mmalc Crawford

On Dec 20, 2009, at 11:40 pm, Chaitanya Pandit wrote:

> One weird thing that is happening is that just after the 
> "configurePersistentStoreCoordinatorForURL..." call, the contents of my 
> document on the disk are changed, even if i didn't save the document
> 
It's not clear in what sense this is "weird"?  This is expected behaviour...

On Dec 21, 2009, at 5:56 pm, Jerry Krinock wrote:
> But something else should happen, which is that, if the filename is, for 
> example,  SomeDoc.myapp, the original file will be copied to SomeDoc~.myapp.  
> Note the tilde.
> I've never seen this documented anywhere, though.
> 
"If the migration proceeds successfully, the existing store at storeURL is 
renamed with a “~” suffix before any file extension and the migrated store 
saved to storeURL."


mmalc

___

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

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

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

This email sent to arch...@mail-archive.com


Re: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Development
Ok
I was wondering if that was what I was doing wrong. I've tried messing with the 
size of the context but it gives me trouble. Do I need to adjust the size of 
the UIImageView also? or since clipping is off is it ok in it's original size?
Also will the drawing to the offscreen context take place at it's center or do 
I need to set a center and specifically tell the image to draw there? Finally 
when I call [rotatingView.image drawInRect:rotatingView.bounds 
blendMode:kCGBlendModeNormal alpha:1.0]; is the rotatingView.bounds the correct 
rect to draw in to?


On Dec 21, 2009, at 7:09 PM, David Duncan wrote:

> On Dec 21, 2009, at 5:29 PM, Development wrote:
> 
>> I'll try my question again. Ok, I have a UIImageView. I am trying to draw a 
>> shadow under the UIImage it holds. Now if I make the UIImageView's bounds 
>> some ungodly size, like the size of the screen it draws shadows perfectly 
>> but obviously this is not acceptable. So I don't understand what I am doing 
>> wrong. I've tried turning off the clipstobounds but that doesn't help unless 
>> the context I am drawing is is clipping in which case I do not know how to 
>> turn it off. But at least in the UIImageView it is not clipping. 
> 
> 
> Your drawing to an offscreen context, and in doing so your asking to create a 
> context that is a certain size. If you draw outside of that area, then your 
> going to lose that drawing, period, because there is no place to put it.
> 
> If you want to add a shadow, your going to have to calculate how much extra 
> space you need and increase the context you draw by that size. A reasonable 
> approximation is the shadow offset plus the shadow spread. Either way, your 
> not going to be able to use the image's original size as the final size 
> because you are explicitly asking to draw outside of that original image.
> --
> David Duncan
> Apple DTS Animation and Printing
> 

___

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

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

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

This email sent to arch...@mail-archive.com


Re: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread David Duncan
On Dec 21, 2009, at 5:29 PM, Development wrote:

> I'll try my question again. Ok, I have a UIImageView. I am trying to draw a 
> shadow under the UIImage it holds. Now if I make the UIImageView's bounds 
> some ungodly size, like the size of the screen it draws shadows perfectly but 
> obviously this is not acceptable. So I don't understand what I am doing 
> wrong. I've tried turning off the clipstobounds but that doesn't help unless 
> the context I am drawing is is clipping in which case I do not know how to 
> turn it off. But at least in the UIImageView it is not clipping. 


Your drawing to an offscreen context, and in doing so your asking to create a 
context that is a certain size. If you draw outside of that area, then your 
going to lose that drawing, period, because there is no place to put it.

If you want to add a shadow, your going to have to calculate how much extra 
space you need and increase the context you draw by that size. A reasonable 
approximation is the shadow offset plus the shadow spread. Either way, your not 
going to be able to use the image's original size as the final size because you 
are explicitly asking to draw outside of that original image.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data Migration

2009-12-21 Thread Jerry Krinock

On 2009 Dec 20, at 23:40, Chaitanya Pandit wrote:

> I'm working on the migration for one of my Core Data document based 
> application
> 
> One weird thing that is happening is that just after the 
> "configurePersistentStoreCoordinatorForURL..." call, the contents of my 
> document on the disk are changed ... i can no longer open that document in 
> 1.0 as it has changed the data and it throws an alert saying the version of 
> the model has been changed

But something else should happen, which is that, if the filename is, for 
example,  SomeDoc.myapp, the original file will be copied to SomeDoc~.myapp.  
Note the tilde.

I've never seen this documented anywhere, though.  Also, I've never tried to 
open such a migrated document with an earlier app version, but it would make 
sense that the earlier version would look for and automatically load the old 
tilde document if it couldn't load the current document due to model changed.

I recently had alot of trouble with Core Data migration, and saw alot of crap, 
but never saw a migration occur without the tilde doc appearing.  If you figure 
out how you broke it, let us know.  I'm worried that I might need to know 
someday ;)

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Menu shortcuts without modifiers?

2009-12-21 Thread Peter Ammon


On Dec 21, 2009, at 7:29 AM, Uli Kusterer wrote:

> On 18.09.2009, at 23:07, Peter Ammon wrote:
>> For key events without modifiers, like hitting the spacebar, the first 
>> responder of the key window should get first crack via keyDown:.  So I'm not 
>> sure why you're seeing the behavior you describe.  I wrote a quick test with 
>> a focused text field in the key window and a main menu item with Space as 
>> its key equivalent, and the text field "won" for spacebar.
> 
> Hi Peter,
> 
> just got back to this issue after having to drop it for some urgent work. A 
> short recap: It seems the "winning" works for the space bar in Cocoa windows, 
> but not for the arrow keys. In a Carbon window, neither of these keys get 
> passed to the edit field, the menu items get triggered immediately. I've 
> attached a short Cocoa test app with some Carbon and Cocoa windows, and two 
> menu items that exhibits the problem. Just type into any of the text fields 
> and then try to use the space or arrow key. You will get an NSAlert whenever 
> the menu items get the shortcut instead of the text field. 
> 
> 
[...]
> 
> As an alternative, do you know if there is a way to find out what item 
> (Carbon or Cocoa, both) really has the focus right now? If I had an 
> NSView*/NSWindow*/NSResponder* or an HIViewRef/HIWindowRef, that I know has 
> the actual focus right now, I could probably remove the menu item shortcut 
> dynamically depending on what is focused.
> 

Cocoa windows have the peculiar behavior that key down events without the 
command, control, or function key mask get sent to the window first, and then 
the menu.  Events with any of those flags set get sent to the main menu first.  
Pressing an arrow key generates an event with the function key mask set, but 
the spacebar does not set any of these mask bits, which explains the behavior 
you're seeing.  Carbon windows (including NSCarbonWindow) send all events to 
the main menu first, which is why the behavior is different between Cocoa and 
Carbon windows.

I think your suggestion of dynamically adding or removing the key equivalent is 
sound.  The best place to do this would be in either an implementation of 
menuNeedsUpdate: in the menu's delegate, or in validateMenuItem: in the target 
of the menu item.

To get Carbon's notion of the focus, you can do this:

HIViewRef focusedView = NULL;
HIViewGetFocus(GetUserFocusWindow(), &focusedView, NULL);

To get Cocoa's notion, you would write:

NSResponder *fr = [[NSApp keyWindow] firstResponder]

The question of "who really has the focus" is a little complicated, because it 
depends on who is dispatching events.  If you have a Carbon window in a Cocoa 
app, HIViewGetFocus() will normally give you a NULL view if a Cocoa window is 
focused, so you might start by checking with Carbon, and then checking with 
Cocoa if the Carbon focus is not a text field.

Hope this helps,
-Peter

___

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

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

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

This email sent to arch...@mail-archive.com


UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Development
Ok ok, sorry for double posting. Honestly I'm thinking I'm trying to do 
something that simply isn't possible though. 

I'll try my question again. Ok, I have a UIImageView. I am trying to draw a 
shadow under the UIImage it holds. Now if I make the UIImageView's bounds some 
ungodly size, like the size of the screen it draws shadows perfectly but 
obviously this is not acceptable. So I don't understand what I am doing wrong. 
I've tried turning off the clipstobounds but that doesn't help unless the 
context I am drawing is is clipping in which case I do not know how to turn it 
off. But at least in the UIImageView it is not clipping. 

So the first question: How do I turn of clipping in the context I'm drawing too?

Second, is the problem something else in my code? Like I said before I get a 
perfect shadow unfortunately it is clipped to the edges of the view so it's 
useless. 
I have tried to enlarge the view by the amount of the offset but this does 
nothing except make the view bigger. The image still draws in the same upper 
right location rather than the center as I thought I had set it to with the 
content mode.  I've also tried using the CG draw image method but it draws 
upside down and since I don't want to go through flipping the image every time 
I add a shadow I gave up on that. It didn't give me any better results though 
otherwise I'd have used it. Do I need to do some kind of Affinetransform to 
translate the context? 

Lastly if I am wasting my time with this please let me know. I've spent hours 
now on Google and cannot find any examples of adding a shadow to a UIImage, at 
least not this way.

-(void)addShadow:(CGSize)myShadowOffset darkness:(CGFloat)darkness 
spread:(CGFloat)spread
{

UIGraphicsBeginImageContext(rotatingView.bounds.size);
CGContextRef myContext =  UIGraphicsGetCurrentContext();

float   myColorValues[] = {0, 0, 0, darkness};
CGColorRef  myColor;
CGColorSpaceRef myColorSpace;


myColorSpace = CGColorSpaceCreateDeviceRGB ();
myColor = CGColorCreate (myColorSpace, myColorValues);


CGContextSetShadowWithColor (myContext, myShadowOffset, spread, 
myColor);

[rotatingView.image drawInRect:rotatingView.bounds
 blendMode:kCGBlendModeNormal 
alpha:1.0];


CGColorRelease (myColor);
CGColorSpaceRelease (myColorSpace);

UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
rotatingView.image  = imageCopy;

}___

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

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

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

This email sent to arch...@mail-archive.com


Re: Version number objects

2009-12-21 Thread Uli Kusterer
On 21.12.2009, at 22:25, Gregory Weston wrote:
> How well does it handle something like 1.0.1b5, or something to that effect, 
> though? I knocked out a category on NSString several years ago that converts 
> back and forth between a string and Apple's NumVersion structure and provides 
> a comparison method. I'm willing to share, or can post it somewhere if 
> there's a common site for such things.

 I'd suggest you submit it as a patch to/subclass of Sparkle's 
SUVersionComparator.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://groups.yahoo.com/group/mac-gui-dev/

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Localization strategies?

2009-12-21 Thread Uli Kusterer
On 20.12.2009, at 21:30, Ricky Sharp wrote:
> Thus, I'm wondering if it would ultimately be worth it to externalize all 
> strings from my nibs and just put everything in my single .strings file.  
> This will clearly involve me adding tons of IBOutlet ivars just so that at 
> runtime I can set their text with NSLocalizedString APIs.

 One approach to avoid the whole IBOutlet excess would be to create subclasses 
of the standard view classes which, when they are loaded, use their 
contents/title as the key and pass it to NSLocalizedString(). That way, your 
NIBs only contain keys, and the .strings files can hold the actual strings, 
including comments.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Please if some one knows

2009-12-21 Thread Uli Kusterer
On 21.12.2009, at 23:46, Graham Cox wrote:
> It's not good etiquette t repost the same question repeatedly, especially 
> under different titles - that just breaks up the thread and makes it less 
> likely you'll get an answer.

 At least, not within the same week.

-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.masters-of-the-void.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 arch...@mail-archive.com


Re: iPhone and GC

2009-12-21 Thread Shawn Erickson
On Mon, Dec 21, 2009 at 4:54 PM, Lorenzo Thurman  wrote:
> Why can't iPhone apps use GC? Is it resources? Performance? Some combination
> of the two or other reasons altogether?

Yes.
___

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

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

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

This email sent to arch...@mail-archive.com


iPhone and GC

2009-12-21 Thread Lorenzo Thurman
Why can't iPhone apps use GC? Is it resources? Performance? Some  
combination of the two or other reasons altogether?

Just curious, thanks.

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

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

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

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

This email sent to arch...@mail-archive.com


Re: Localization strategies?

2009-12-21 Thread Jerry Krinock

On 2009 Dec 21, at 01:27, Symadept wrote:

> Now pass these files to Localization
> team and they shall simply copy paste the other version of the string in RHS
> of the corresponding files.

Well, of course there are tools for this.  I use and recommend Max Seelemann's 
Localization Suite, and just learned that it has now been open-sourced.  This 
is great news, since a localization tool is something that you'll often want to 
tweak.  For example, I'd love to make it scriptable from the command line so I 
can add it to my Build script.

http://www.loc-suite.org/

More good news is that Max is that it looks like Max is actively working on it.

> If you go with multiple nib files for various locale, UI maintainance will
> become hectic.

We discussed the pros and cons of this recently -- read this...

http://lists.apple.com/archives/Cocoa-dev/2009/Dec/msg00363.html (*)

On 2009 Dec 20, at 12:30, Ricky Sharp wrote:

> In getting quotes from many localization companies, I've found that some have 
> different processes.  For example, one company would prefer if I just provide 
> .string files.  During their QA process, they'll then run the app and look at 
> everything in context.

Since any app can by definition do an infinite number of tricks (and errors), 
the "test coverage" they get when they "run the app" is going to be 85% at best 
before they get tired of mousing around and ship it back to you.  So, I would 
recommend giving this localizer good comments.  I try to make my strings files 
read like API documentation, with comments defining the "contract" stating how 
each string can be used (and re-used).

> How have others tackled localization?

The dearth of replies should tell you something :)

Here's my answer:  A combination of techniques.  Localization is always costly, 
iterative, compromised, and imperfect.  Some have used each of the techniques 
you propose, and others have rejected them.  They may well be optimum for your 
situation.  Judging from your post, you are a good tech writer and thus might 
want to rely heavily on .strings comments as I do, and choose localizers which 
do the same.

Jerry

(*) I can rarely get Apple's List Search to find threads, even if I'm looking 
at an email I sent and copy keywords exactly.  But then I found it in a Google 
search  Bug has been filed -- again -- 7490709.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Localization strategies?

2009-12-21 Thread François Guillet
Just my 2c gained from translating UIs in french. Localized strings can show a 
great variation in length even among close languages such as english and 
french. Moreover, english allows for short sentence/syntax whereas french does 
not, at least not easily.

From what I've seen, there are two strategies to adapt to different strings 
lengths :
-a managed layout (not too bad but not perfect)
-designing as many UI elements as locales (perfect but tedious).

AFAIK Apple chose the second solution, so that's about the only way to go on 
this platform I suppose. Substitution of localized strings in english UI 
elements (eg dialogs) will result in either text being clipped out of labels, 
label frames too wide in english because they have to make way for other 
localized strings or localized strings too short to make sense because they 
have to fit.

And sometimes, the syntax has to change anyway and the dialog has to be 
rethought somewhat. So all in all, specifically designing UI elements for each 
locale make sense if you want the best results. It is also time consuming and 
thus (probably) expensive.

It's weird to see big companies fall into localization blunders. Pixar's 
Wall.E, for example, shows at some point in the movie the axiom ship "Operation 
Manual" which in french is translated as "Manuel d'Opération", an easy 
translation except we never refer to operation manuals using this term  
(although it's grammatically correct).   

Le 21 déc. 2009 à 10:27, Symadept a écrit :

> 
> Hi Ricky,
> 
> Even in my one of the project I am doing the same. Localizable.strings
> (english) version shall have all the strings in Key-Value pair format,
> "Hello" = "Hello"; And you can keep the comment on top of the string /*
> Welcome text */.
> 
> And you can have many IBOutlets to set the string at runtime, as you
> mentioned, with NSLocalizedString(@"Hello", nil). Now you generate various
> language localizable.strings by Add Localization (mail me if you think you
> need more info) from XCode and change the file format to UTF16. Now these
> files shall still show you english. Now pass these files to Localization
> team and they shall simply copy paste the other version of the string in RHS
> of the corresponding files.
> 
> If you go with multiple nib files for various locale, UI maintainance will
> become hectic. Hence you are in right track.
> 
> All the best.
> 
> Regards
> Mustafa Shaik
> 
> 
> On Mon, Dec 21, 2009 at 4:30 AM, Ricky Sharp  wrote:
> 
>> 
>> In getting quotes from many localization companies, I've found that some
>> have different processes.  For example, one company would prefer if I just
>> provide .string files.  During their QA process, they'll then run the app
>> and look at everything in context.
>> 
>> While generating .strings from nibs is easy to do, there's a problem in
>> that there seems to be no method of putting contextual comments into a nib.
>> And there's no way I would hand-edit comments in the generated .strings
>> files.
>> 
>> Thus, I'm wondering if it would ultimately be worth it to externalize all
>> strings from my nibs and just put everything in my single .strings file.
>> This will clearly involve me adding tons of IBOutlet ivars just so that at
>> runtime I can set their text with NSLocalizedString APIs.
>> 
>> I still plan on having separate nibs though for each language (to account
>> for text bounds, font sizes, etc.)
>> 
>> How have others tackled localization?
>> 
>> ___
>> Ricky A. Sharp mailto:rsh...@instantinteractive.com
>> 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/symadept%40gmail.com
>> 
>> This email sent to symad...@gmail.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/francois.guillet%40wanadoo.fr
> 
> This email sent to francois.guil...@wanadoo.fr
> 

François





___

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

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

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

This email sent to arch...@mail-archive.com


Re: Remember Window and Inspector Positions

2009-12-21 Thread Graham Cox

On 22/12/2009, at 6:44 AM, Sherm Pendley wrote:

> Yes, you can do that in IB. It's the "Autosave" in the Attributes pane
> of the inspector panel.


I've noticed that doing this now throws a warning when the xib is compiled that 
the autosave name should be supplied by an override of the 
-windowFrameAutosaveName method in the window controller, and not set in IB. 
Setting the string empty in IB removes the warning. I don't think I saw any 
mention of this in the release notes, so what's that all about?

--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


Re: passing a method name?

2009-12-21 Thread Graham Cox

On 22/12/2009, at 4:48 AM, Matt Neuburg wrote:

>> That's what I thought the OP was saying, and I agree. It would mean that 
>> doing
> a refactor and changing a method's name, or even adding a new parameter to a
>> method, would break the code in some unrelated method. That's a huge 
>> maintenance
>> problem.
>> 
> Well, I took the OP to mean just the opposite. Procedures often have to be
> broken into two parts, esp. because of sheets; so, you might start out in
> doMyThing:, but then you show a sheet and after the delegate callback you
> want to proceed to doMyThingPart2:. Since the latter name is derivable from
> the former, passing _cmd is a sensible way to generalize this situation, and
> it's the exact opposite of a huge maintenance problem; provided the naming
> convention is obeyed (a common enough pattern in Cocoa), pairs of methods
> can be introduced or removed at will as development proceeds. m.

On 21/12/2009, at 12:18 AM, Chunk 1978 wrote:

> i have a bunch of methods that will call one method.  currently, i'm
> passing a string object so the called method will know which method
> had called it, and complete the proper task based on the method that
> called it.


Well, perhaps the OP would like to clarify what he did mean. It seems 
unambiguous to me, but sometimes it is hard to make oneself understood when 
describing code, rather than just posting the code.

Regarding the use of different completion methods based on manipulating some 
common root name, I think that's a bit strange, misguided even. It's a lot 
simpler and self-documenting just to declare a protocol, formal or informal, 
and have the callback conform to that, passing a different target to be called 
back. That's what Cocoa itself does for sheets and elsewhere, and I follow that 
pattern as well, on the basis that Apple are leading by example. I've never 
seen the other approach taken in Apple's code, though if you have a concrete 
counterexample, I'd be interested to see it.

--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Please if some one knows

2009-12-21 Thread Graham Cox

On 22/12/2009, at 9:19 AM, Development wrote:

> I really could use some help on this shadow issue I have been having. Does 
> any one know anything about drawing shadows around images in UIImageViews?


If someone does, they'll answer eventually, I'm sure.

It's not good etiquette t repost the same question repeatedly, especially under 
different titles - that just breaks up the thread and makes it less likely 
you'll get an answer.

--Graham


___

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

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

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

This email sent to arch...@mail-archive.com


Please if some one knows

2009-12-21 Thread Development
I really could use some help on this shadow issue I have been having. Does any 
one know anything about drawing shadows around images in UIImageViews?

Below is code that gives me a shadow but the shadow is clipped to the edge of 
the view, how can I get an unclipped shadow?

UIGraphicsBeginImageContext(self.frame.size);
CGContextRef myContext =  UIGraphicsGetCurrentContext();



   float   myColorValues[] = {0, 0, 0, darkness};// 3
   CGColorRef  myColor;// 4
   CGColorSpaceRef myColorSpace;
   CGContextSaveGState(myContext);// 6

   myColorSpace = CGColorSpaceCreateDeviceRGB ();// 9
   myColor = CGColorCreate (myColorSpace, myColorValues);// 10
   CGContextSetShadowWithColor (myContext, myShadowOffset, spread, myColor);// 
11
   // Your drawing code here// 12
  // CGContextDrawImage(myContext, rotatingView.frame,imgRef);


rotatingView.clipsToBounds = NO;
[rotatingView.image drawInRect:rotatingView.frame
 blendMode:kCGBlendModeNormal 
alpha:.5];
   CGColorRelease (myColor);// 13
   CGColorSpaceRelease (myColorSpace); // 14

UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
CGContextRestoreGState(myContext);
UIGraphicsEndImageContext();

rotatingView.image = 
imageCopy;___

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

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

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

This email sent to arch...@mail-archive.com


Re: Outline View Enter Edit Mode.

2009-12-21 Thread Sean McBride
On 12/21/09 3:19 PM, Sandro Noël said:

>How do you tell an Outline View item to enter edit mode from a pop up menu.
>Just like when i double click on it?
>
>I Looked Around, but when i call the Edit Message, i get an error that
>it is an unknown selector.



--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to arch...@mail-archive.com


Re: App not stopping at _NSLockError breakpoint

2009-12-21 Thread Greg Parker
On Dec 21, 2009, at 12:14 PM, PCWiz wrote:
> I keep getting these errors in the Console:
> 
> 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** -[NSRecursiveLock unlock]: 
> lock ( '(null)') unlocked when not locked
> 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** Break on _NSLockError() to 
> debug.
> 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** -[NSRecursiveLock finalize]: 
> lock ( '(null)') finalized while still in use
> 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** Break on _NSLockError() to 
> debug.
> 
> And as the instructions say, I've set a breakpoint on _NSLockError and it 
> seems to be set properly as show here:
> 
> http://img39.imageshack.us/img39/9477/screenshot20091221at110.png
> 
> But when I run with "Build and Debug" it never stops at that breakpoint.

This is a bug in Foundation (rdar://6855192). The compiler optimizer inlined 
away the call to _NSLockError() inside Foundation, so it bypasses the 
breakpoint. Try putting a breakpoint on NSLog() instead.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

This email sent to arch...@mail-archive.com


Re: tracking EXC_BAD_ACCESS error in applescript command

2009-12-21 Thread François Guillet
That was a copy of the original call stack before I subclass NSScriptCommand. 
If I subclass NSScriptCommand and call executeCommand from this subclass, then 
the crash occurs as before, but of course the call stack changes accordingly. 
Anyway I put breakpoints in my subclass' methods to make sure I get through 
them.

I've found a workaround which anyway is the way I originally wanted scripting 
to work. I have the document return an object of (say) FooClass through the 
property foo. Then I declare an object-first command (say check) and implement 
the command handler in the FooClass class. Then the applescript statement :

check foo of front document

does work fine. So I can't find a way of doing "check front document" using 
NSScriptCommand's executeCommand but I can do so on an object contained by the 
document...

Le 21 déc. 2009 à 03:19, Jerry Krinock a écrit :

> 
> 
> On 2009 Dec 20, at 13:50, François Guillet wrote:
> 
>> EXC_BAD_ACCESS error :
>> #0  0x7fff86951466 in -[NSScriptCommand _sendToRemainingReceivers] ()
>> #1  0x7fff86951fe5 in -[NSScriptCommand executeCommand] ()
>> #2  0x7fff8696902e in -[NSScriptingAppleEventHandler 
>> handleCommandEvent:withReplyEvent:] ()
> 
>> I implemented a subclass of NSScriptCommand used both for verb first or 
>> object first command : everything works fine, I can call [[self 
>> evaluatedReceivers] handleCommmand:self] from  executeCommand without any 
>> problem. The EXC_BAD_ACCESS error, though, always happens if I try to call 
>> NSScriptCommand's executeCommand.
> 
> Not sure about the crash, but if you've subclassed NSScriptCommand, should 
> not your subclass name appear in the call stack shown above, instead of 
> NSScriptCommand?  In your sdef, have you specified your subclass to be the 
> Cocoa Class of this command?
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/francois.guillet%40wanadoo.fr
> 
> This email sent to francois.guil...@wanadoo.fr
> 

François





___

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

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

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

This email sent to arch...@mail-archive.com


Re: Core Data validateForUpdate

2009-12-21 Thread Sean McBride
On 12/20/09 3:19 PM, Gerriet M. Denkmann said:

>What I try to accomplish:
>SomeEntity has a property called "uniqueKey" and this is (no big
>surprise) meant to be unique.
>
>When the "UniqueKey" column in my table view gets edited,
>validateUniqueKey:error: gets called, I check the new value for
>uniqueness and all is fine.
>
>But hitting the "+" button several times inserts several objects with
>the same key (Default Value).

As others have said, you probably want awakeFromInsert.

Depending what kind of 'unique' value you want, you could create a
unique string like this:

CFUUIDRef uuid = CFUUIDCreate (kCFAllocatorDefault);
if (uuid)
{
uuidStr = NSMakeCollectable (CFUUIDCreateString 
(kCFAllocatorDefault,
uuid));
CFRelease (uuid);
}

If you want/need to compare to other objects of the same entity type,
then be warned that performing a fetch within awakeFromInsert is
probably not a good idea.  NSArrayController doesn't like it when you do that.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Version number objects

2009-12-21 Thread Gregory Weston
Ken Tabb wrote:

> I've got an app that needs to keep track of version numbers (eg.  
> "10.6.2") of things, and needs to be able to sort by these too. Is  
> there a class in Cocoa that handles this?

To which Clark Cox replied:

> NSString's -compare:options: already handles mixed
> alphanumeric strings like this when passed the NSNumericSearch option.

How well does it handle something like 1.0.1b5, or something to that effect, 
though? I knocked out a category on NSString several years ago that converts 
back and forth between a string and Apple's NumVersion structure and provides a 
comparison method. I'm willing to share, or can post it somewhere if there's a 
common site for such things.

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 arch...@mail-archive.com


Re: Simple question on Menus and Document-based apps

2009-12-21 Thread Sherm Pendley
2009/12/21 Henri Häkkinen :
>
> So I have a simple document-based application which has MyDocument with some 
> other classes. The application has the default MainMenu.xib and 
> MyDocument.xib interface files. I would like to add a menu item to the 
> MainMenu, which would call an IBAction method on the MyDocument class. 
> However, the document class and the main menu are on different xib files so I 
> can't make the connection.
>
> What is the Right Way to handle these kinds of things in Cocoa?

Connect the menu item to the "First Responder" in Interface Builder.
At runtime, Cocoa's event-handling machinery will then look through
the responder chain (which includes, among other things, the
currently-active document) to find an object that has the required
action method.

For details, have a look at:




sherm--

-- 
Cocoa programming in Perl:
http://www.camelbones.org
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Releasing an NSBundle

2009-12-21 Thread Dave DeLong
I hadn't considered that the system might retain the bundles (but that makes a 
lot of sense).  Nevertheless, I've decided to reorganize my code a bit to 
maintain an active retain on the NSBundle objects.

Thanks for the info!

Dave

On Dec 21, 2009, at 11:12 AM, Douglas Davidson wrote:

> 
> On Dec 21, 2009, at 10:06 AM, Dave DeLong wrote:
> 
>> My question is this (and the documentation, from what I've seen, is mute on 
>> the subject):  when an NSBundle object is deallocated, is its associated 
>> code automatically unloaded, or does it stay loaded in the runtime?
> 
> For compatibility reasons, there are a number of cases in which NSBundle 
> objects will continue to be retained by the system even when you have 
> released all of your references to them, so you may not see your bundles 
> deallocated, but in any event what I would recommend is that if you have 
> loaded an NSBundle and wish to continue to use the code from it, you should 
> keep a reference to the NSBundle for as long as you continue to use it.  This 
> is definitely the case for code loaded using CFBundle--if you want to 
> continue using it, keep a reference to the CFBundle.
> 
> Douglas Davidson
> 



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 arch...@mail-archive.com

Simple question on Menus and Document-based apps

2009-12-21 Thread Henri Häkkinen
Hello.

This is probably a basic question but I haven't been able to find an answer 
from the ADC guides so far.

So I have a simple document-based application which has MyDocument with some 
other classes. The application has the default MainMenu.xib and MyDocument.xib 
interface files. I would like to add a menu item to the MainMenu, which would 
call an IBAction method on the MyDocument class. However, the document class 
and the main menu are on different xib files so I can't make the connection.

What is the Right Way to handle these kinds of things in Cocoa?

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Is this possible?

2009-12-21 Thread Development
Ok,
I have managed to get a beautiful shadow drawn in my rotating view (A 
view I used to rotate images so they don't distort). The rotating view sits 
inside an an image view.  so it is layered as follows: 
ImageView(parent)->rotatingView(child)->image

Anyway. I get a lovely shadow, but there is still a problem, well two actually. 
First the shadow appears to be drawn on top of the image rather than under it. 
Second, it gets clipped to the edges of the rotating image view. I have already 
set rotatingView.clipsToBounds = NO; but that does not help.

Below is the code.

UIGraphicsBeginImageContext(self.frame.size);
CGContextRef myContext =  UIGraphicsGetCurrentContext();



float   myColorValues[] = {0, 0, 0, darkness};// 3
CGColorRef  myColor;// 4
CGColorSpaceRef myColorSpace;
CGContextSaveGState(myContext);// 6

myColorSpace = CGColorSpaceCreateDeviceRGB ();// 9
myColor = CGColorCreate (myColorSpace, myColorValues);// 10
CGContextSetShadowWithColor (myContext, myShadowOffset, spread, myColor);// 
11
// Your drawing code here// 12
   // CGContextDrawImage(myContext, rotatingView.frame,imgRef);


rotatingView.clipsToBounds = NO;
[rotatingView.image drawInRect:rotatingView.frame
 blendMode:kCGBlendModeNormal 
alpha:.5];
CGColorRelease (myColor);// 13
CGColorSpaceRelease (myColorSpace); // 14

UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
CGContextRestoreGState(myContext);
UIGraphicsEndImageContext();

rotatingView.image = 
imageCopy;___

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

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

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

This email sent to arch...@mail-archive.com


Outline View Enter Edit Mode.

2009-12-21 Thread Sandro Noël
Greetings

This is probably a simple question.

How do you tell an Outline View item to enter edit mode from a pop up menu.
Just like when i double click on it?

I Looked Around, but when i call the Edit Message, i get an error that it is an 
unknown selector.

any clues?

regards.
Sandro Noel.



___

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

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

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

This email sent to arch...@mail-archive.com


App not stopping at _NSLockError breakpoint

2009-12-21 Thread PCWiz
I keep getting these errors in the Console:

2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** -[NSRecursiveLock unlock]: lock 
( '(null)') unlocked when not locked
2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** Break on _NSLockError() to debug.
2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** -[NSRecursiveLock finalize]: 
lock ( '(null)') finalized while still in use
2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** Break on _NSLockError() to 
debug.

And as the instructions say, I've set a breakpoint on _NSLockError and it seems 
to be set properly as show here:

http://img39.imageshack.us/img39/9477/screenshot20091221at110.png

But when I run with "Build and Debug" it never stops at that breakpoint.

Thanks

Independent Cocoa Developer, Macatomy Software
http://macatomy.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 arch...@mail-archive.com


Re: Remember Window and Inspector Positions

2009-12-21 Thread Sherm Pendley
On Mon, Dec 21, 2009 at 2:38 PM, Alexander Spohr  wrote:
>
> Am 21.12.2009 um 20:22 schrieb David Blanton:
>
>> I have a main window and a few floating inspectors. I would like to come 
>> back to the position the user left these upon relaunch. Do I have to program 
>> this or is there some Cocoa or other construct that does this for me?
>
> You can put that into UserDefaults.
> And I think a window just needs a name (in IB even?)

Yes, you can do that in IB. It's the "Autosave" in the Attributes pane
of the inspector panel.

sherm--

-- 
Cocoa programming in Perl:
http://www.camelbones.org
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Remember Window and Inspector Positions

2009-12-21 Thread David Blanton
Ok.  I thought I had some automagic behaviour before but in doing a  
sample I did not observe it.  I had not named the window in IB.  I'll  
give that a go now.


Happy Healtcare!

db
On Dec 21, 2009, at 12:38 PM, Alexander Spohr wrote:



Am 21.12.2009 um 20:22 schrieb David Blanton:

I have a main window and a few floating inspectors. I would like to  
come back to the position the user left these upon relaunch. Do I  
have to program this or is there some Cocoa or other construct that  
does this for me?


You can put that into UserDefaults.
And I think a window just needs a name (in IB even?) and some BOOL  
set to YES to that automagic. But I am not sure about the latter.


atze






___

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

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

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

This email sent to arch...@mail-archive.com


Re: Remember Window and Inspector Positions

2009-12-21 Thread Alexander Spohr

Am 21.12.2009 um 20:22 schrieb David Blanton:

> I have a main window and a few floating inspectors. I would like to come back 
> to the position the user left these upon relaunch. Do I have to program this 
> or is there some Cocoa or other construct that does this for me?

You can put that into UserDefaults.
And I think a window just needs a name (in IB even?) and some BOOL set to YES 
to that automagic. But I am not sure about the latter.

atze

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Persistent NSOperation?

2009-12-21 Thread Ken Thomases
On Dec 21, 2009, at 11:26 AM, McLaughlin, Michael P. wrote:

> Could anyone point me to sample code that shows how to implement a
> persistent NSOperation that could be enqueued repeatedly?

You can't.  It's a fundamental part of the design of NSOperation.

It's not just that support for it was left out of the design.  In 
multi-threaded coding, it is sometimes very important that certain state 
changes can only go in one direction (not cancelled -> cancelled, not executing 
or finished -> executing and not finished -> not executing and finished, etc.). 
 It is very likely that NSOperationQueue would break if an NSOperation could 
change state in the other direction.


> Currently, I initialize NSOps just prior to launching but this involves
> copying large datasets (to avoid R/W contention) and it would be more
> efficient if I could initialize a fixed set of NSOps just once and reuse
> them.

Make your NSOperations have a relationship to some other object which holds the 
state that persists.  Serially create NSOperations which each have a 
relationship to this persistent state object, one after the other.

Regards,
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 arch...@mail-archive.com


Remember Window and Inspector Positions

2009-12-21 Thread David Blanton
I have a main window and a few floating inspectors. I would like to  
come back to the position the user left these upon relaunch. Do I have  
to program this or is there some Cocoa or other construct that does  
this for me?


db

___

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

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

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

This email sent to arch...@mail-archive.com


[A] Resizing a window to show full rows from a table view

2009-12-21 Thread Chuck Remes
I searched around but could not find an answer to the problem of  
enforcing a particular window size so that only "whole" rows are shown  
in a table view. I have archives of this list going back to 2002 but  
nothing suitable popped up.


Here's the code in objective-j (Cappuccino framework).

/*
 * Enforce a window size that shows only whole rows instead
 * of the default fractional rows.
 */
- (void)windowDidResize:(CPNotification)notification
{
var window = [self window],
superFrame = [window frame],
tableSize = [scrollView contentSize],
frameDelta = superFrame.size.height - tableSize.height,
rowHeight = [theTable rowHeight],
visibleRows = FLOOR(tableSize.height / rowHeight);

tableHeight = rowHeight * visibleRows;

superFrame.size.height = tableHeight + frameDelta;

[window setFrame:superFrame];
}


Four items of note regarding this code.

1. This should be done in the windowWillResize:toSize delegate method  
instead of a direct call to setFrame but Cappuccino doesn't support  
that delegate yet.


2. The line "window = [self window]" should probably be "window =  
[notification object]" when translating to objective-c but for some  
reason that isn't working right in Cappuccino.


3. FLOOR is a macro corresponding to whatever is Math.floor in your  
host language. Adjust accordingly.


4. Computing a frame delta between the table view's visible content  
size and the window frame gives us the correct behavior even when  
there are other controls or elements inside the window. Some sample  
code I saw was tracking the size of specific fields and doing a lot  
more math just to accomplish this task.


If anyone has an improved methodology, please share.

cr

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Detecting system protected folders.

2009-12-21 Thread Sandro Noël
Is there anything in Cocoa/Carbon to retrieve ACL From files?
Or do i have to mess around with the ACL Library directly ?

Regards.

Sandor Noel.


On 2009-12-19, at 12:27 PM, Sandro Noël wrote:

> 
>> 
>> Testing this in Terminal:
>> mv ~/Music ~/lose
>> 
>> I get a Permission denied error message, which suggests an ACL.
>> 
>> It's confirmed by this command:
>> 
>> ls -led ~/Music
>> 
>> Based on this, my new guess is that NSFileManager isn't using the ACL to 
>> check for writability.  You may want to look at other NSFileManager methods, 
>> or look into other ways to read the ACL.
> 
> Greg, thank you for the pointer.
> 
> Regards.
> Sandro noel.___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/sandro.noel%40gestosoft.com
> 
> This email sent to sandro.n...@gestosoft.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 arch...@mail-archive.com


Re: Releasing an NSBundle

2009-12-21 Thread Douglas Davidson


On Dec 21, 2009, at 10:06 AM, Dave DeLong wrote:

My question is this (and the documentation, from what I've seen, is  
mute on the subject):  when an NSBundle object is deallocated, is  
its associated code automatically unloaded, or does it stay loaded  
in the runtime?


For compatibility reasons, there are a number of cases in which  
NSBundle objects will continue to be retained by the system even when  
you have released all of your references to them, so you may not see  
your bundles deallocated, but in any event what I would recommend is  
that if you have loaded an NSBundle and wish to continue to use the  
code from it, you should keep a reference to the NSBundle for as long  
as you continue to use it.  This is definitely the case for code  
loaded using CFBundle--if you want to continue using it, keep a  
reference to the CFBundle.


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 arch...@mail-archive.com


Releasing an NSBundle

2009-12-21 Thread Dave DeLong
Hi everyone,

I'm working on a simple plugin-based Foundation tool, and I have a question 
regarding NSBundles.

I have a function in my tool that discovers all classes that conform to my 
plugin protocol.  It does this by iterating through the list of loaded classes 
and testing each class to see if it conforms to my plugin protocol.  If it 
does, it adds that class to an array for later use.

This function also looks inside a plugins directory for plugins that might be 
created later to add extra functionality.  It creates an NSBundle object for 
each item in the plugins directory, and then tries to retrieve the 
principalClass from the bundle to test for protocol conformance.  If the class 
is compliant, it gets added to the list.  If it doesn't, the bundle gets 
explicitly unloaded.  However, after either case, the NSBundle object itself is 
released, because once I have the class object, I don't need the bundle object 
itself anymore.

Here's the basic idea of what I'm doing (minus obvious error checking, etc)

for (NSString * potentialPluginPath in pluginFolder) {
  NSBundle * plugin = [[NSBundle alloc] initWithPath:potentialPluginPath];
  [plugin load];
  Class principalClass = [plugin principalClass];
  if ([principalClass conformsToProtocol:myPluginProtocol]) {
[plugins addObject:principalClass];
  } else {
[plugin unload];
  }
  [plugin release];
}

My question is this (and the documentation, from what I've seen, is mute on the 
subject):  when an NSBundle object is deallocated, is its associated code 
automatically unloaded, or does it stay loaded in the runtime?

Thanks!

Dave

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 arch...@mail-archive.com

Re: Is this possible?

2009-12-21 Thread Development
I either got no shadow, or a distorted image or the image went empty. Once in a 
while I'd get a duplicate of the image blurred but it was not grey black like  
shadow instead it was the color of the original.


On Dec 21, 2009, at 10:34 AM, David Duncan wrote:

> On Dec 21, 2009, at 7:38 AM, Development wrote:
> 
>> I asked about adding a shadow to a uiimage nestled within a uiimageview and 
>> no one seemed to know so I am wondering if it is even possible to add a 
>> shadow to a uiimage that way?
> 
> 
> You seemed to have something that should work (creating a new image context, 
> drawing the image with shadow, assigning that image to a UIImageView).
> 
> What didn't work about that?
> --
> David Duncan
> Apple DTS Animation and Printing
> 

___

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

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

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

This email sent to arch...@mail-archive.com


Re: passing a method name?

2009-12-21 Thread Matt Neuburg
On Sun, 20 Dec 2009 15:39:08 -0800, Dave Carrigan  said:
>
>On Dec 20, 2009, at 3:29 PM, Graham Cox wrote:
>
>> I think what the OP was talking about was making a called method sensitive to
its caller, which is a no-no.
>
>
>That's what I thought the OP was saying, and I agree. It would mean that doing
a refactor and changing a method's name, or even adding a new parameter to a
method, would break the code in some unrelated method. That's a huge maintenance
problem.

Well, I took the OP to mean just the opposite. Procedures often have to be
broken into two parts, esp. because of sheets; so, you might start out in
doMyThing:, but then you show a sheet and after the delegate callback you
want to proceed to doMyThingPart2:. Since the latter name is derivable from
the former, passing _cmd is a sensible way to generalize this situation, and
it's the exact opposite of a huge maintenance problem; provided the naming
convention is obeyed (a common enough pattern in Cocoa), pairs of methods
can be introduced or removed at will as development proceeds. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Is this possible?

2009-12-21 Thread David Duncan
On Dec 21, 2009, at 7:38 AM, Development wrote:

> I asked about adding a shadow to a uiimage nestled within a uiimageview and 
> no one seemed to know so I am wondering if it is even possible to add a 
> shadow to a uiimage that way?


You seemed to have something that should work (creating a new image context, 
drawing the image with shadow, assigning that image to a UIImageView).

What didn't work about that?
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSAttributedString fill with gradient

2009-12-21 Thread David Duncan
On Dec 19, 2009, at 6:21 PM, BravoBug Software wrote:

> [[NSColor selectedMenuItemColor] set];
> NSRectFill(someRect);

This works because the selectedMenuItemColor is a pattern that happens to draw 
a gradient. You could just as easily draw nearly anything with a pattern, and 
Quartz treats patterns just like colors.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to arch...@mail-archive.com


Persistent NSOperation?

2009-12-21 Thread McLaughlin, Michael P.
Could anyone point me to sample code that shows how to implement a
persistent NSOperation that could be enqueued repeatedly?

Currently, I initialize NSOps just prior to launching but this involves
copying large datasets (to avoid R/W contention) and it would be more
efficient if I could initialize a fixed set of NSOps just once and reuse
them.

In case it matters, I am targeting Leopard.

Thanks in advance.

-- 
Mike McLaughlin

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Version number objects

2009-12-21 Thread Clark Cox
On Mon, Dec 21, 2009 at 10:18 AM, Ken Tabb  wrote:
> Hi folks,
>
> I've got an app that needs to keep track of version numbers (eg. "10.6.2")
> of things, and needs to be able to sort by these too. Is there a class in
> Cocoa that handles this?
>
> I could have sworn I heard mention of it in a previous WWDC (probably about
> 10.5), but all attempts at searching result in a load of pages pointing me
> towards Info.plist to get the version number :-/
>
> The other people who I went with think I'm dreaming it...
>
> If one doesn't exist, then I'm guessing doing an NSString subclass would be
> the order of the day (so that I can support / sort alphanumeric version
> "numbers" such as 10C540, or 1.0.1.2b), and then scanning for each period or
> change from number <-> letter, to break the version number down into its
> component parts (eg. so that 10C540 ends up being {10, C, 540}?

No need, NSString's -compare:options: already handles mixed
alphanumeric strings like this when passed the NSNumericSearch option.

-- 
Clark S. Cox III
clarkc...@gmail.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 arch...@mail-archive.com


Re: Menu shortcuts without modifiers?

2009-12-21 Thread Uli Kusterer
On 18.09.2009, at 23:07, Peter Ammon wrote:
> For key events without modifiers, like hitting the spacebar, the first 
> responder of the key window should get first crack via keyDown:.  So I'm not 
> sure why you're seeing the behavior you describe.  I wrote a quick test with 
> a focused text field in the key window and a main menu item with Space as its 
> key equivalent, and the text field "won" for spacebar.

Hi Peter,

just got back to this issue after having to drop it for an urgent issue. A 
short recap: It seems the "winning" works for the space bar in Cocoa windows, 
but not for the arrow keys. In a Carbon window, neither of these keys get 
passed to the edit field, the menu items get triggered immediately. I've 
uploaded a short Cocoa test app with some Carbon and Cocoa windows and two menu 
items to http://dl.dropbox.com/u/34351/CarbonInCocoaShortcuts.zip. Just type 
into any of the text fields and then try to use the space or arrow key. You 
will get an NSAlert whenever the menu items get the shortcut instead of the 
text field.

> Can you post the backtrace of the call to the action method of your menu 
> item?  It's possible it's being invoked from some place other than 
> -[NSApplication handleKeyEquivalent:].

It is sent from somewhere else than handleKeyEquivalent:, but maybe that's due 
to changes in the meantime (10.6 has been released, after all):

#0  0x5c47 in -[AppDelegate testShortcutsAction:] at AppDelegate.mm:118
#1  0x98c6df86 in -[NSApplication sendAction:to:from:]
#2  0x98c6de39 in -[NSMenuItem _corePerformAction]
#3  0x98c6db2a in -[NSCarbonMenuImpl 
performActionWithHighlightingForItemAtIndex:]
#4  0x98c6da16 in -[NSMenu performActionForItemAtIndex:]
#5  0x98c6d9c9 in -[NSMenu _internalPerformActionForItemAtIndex:]
#6  0x98c6d873 in -[NSCarbonMenuImpl 
_carbonCommandProcessEvent:handlerCallRef:]
#7  0x98c61f79 in NSSLMMenuEventHandler
#8  0x90923e29 in DispatchEventToHandlers
#9  0x909230f0 in SendEventToEventTargetInternal
#10 0x90945981 in SendEventToEventTarget
#11 0x90971e3b in SendHICommandEvent
#12 0x90996b20 in SendMenuCommandWithContextAndModifiers
#13 0x90996ad7 in SendMenuItemSelectedEvent
#14 0x90b22131 in _HIMenuSendItemSelectedEvent
#15 0x90ad15aa in HIMenuBar::HandleKeyboardEvent
#16 0x90924423 in HIObject::EventHook
#17 0x90923e29 in DispatchEventToHandlers
#18 0x909230f0 in SendEventToEventTargetInternal
#19 0x90922f4f in SendEventToEventTargetWithOptions
#20 0x909576ec in ToolboxEventDispatcherHandler
#21 0x9092427a in DispatchEventToHandlers
#22 0x909230f0 in SendEventToEventTargetInternal
#23 0x90945981 in SendEventToEventTarget
#24 0x98efdb7b in -[NSCarbonWindow sendEvent:]
#25 0x98c5db2f in -[NSApplication sendEvent:]
#26 0x98bf14ff in -[NSApplication run]
#27 0x98be9535 in NSApplicationMain
#28 0x31af in main at main.m:14

As an alternative, do you know if there is a way to find out what item (Carbon 
or Cocoa, both) really has the focus right now? If I had an 
NSView*/NSWindow*/NSResponder* or an HIViewRef/HIWindowRef, that I know has the 
actual focus right now, I could probably remove the menu item shortcut 
dynamically depending on what is focused.

Cheers,
-- Uli Kusterer
"The witnesses of TeachText are everywhere..."
___

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

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

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

This email sent to arch...@mail-archive.com


freeing memory from an NSOperation

2009-12-21 Thread Michael Thon
Are NSOperations freed when they finish running or when the whole queue is 
finished?  My NSOperations seem to hang around, taking up memory even after 
they have finished their job.  At least, as far as I can tell using the Object 
Allocations instrument which shows them as living.  I am using an NSOperation 
with the garbage collector turned on, on Snow Leopard.  I subclassed main and 
put my computations in there.  When the NSOperationQueue is finished they no 
longer show as live.  Is this normal behavior?
Thanks
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 arch...@mail-archive.com


Is this possible?

2009-12-21 Thread Development
I asked about adding a shadow to a uiimage nestled within a uiimageview and no 
one seemed to know so I am wondering if it is even possible to add a shadow to 
a uiimage that way?___

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

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

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

This email sent to arch...@mail-archive.com


Version number objects

2009-12-21 Thread Ken Tabb

Hi folks,

I've got an app that needs to keep track of version numbers (eg.  
"10.6.2") of things, and needs to be able to sort by these too. Is  
there a class in Cocoa that handles this?


I could have sworn I heard mention of it in a previous WWDC (probably  
about 10.5), but all attempts at searching result in a load of pages  
pointing me towards Info.plist to get the version number :-/


The other people who I went with think I'm dreaming it...

If one doesn't exist, then I'm guessing doing an NSString subclass  
would be the order of the day (so that I can support / sort  
alphanumeric version "numbers" such as 10C540, or 1.0.1.2b), and then  
scanning for each period or change from number <-> letter, to break  
the version number down into its component parts (eg. so that 10C540  
ends up being {10, C, 540}?


Merry Christmas to all who celebrate it, and thanks in advance for any  
help you can give,

Ken

- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer Science
University of Hertfordshire, UK


___

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

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

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

This email sent to arch...@mail-archive.com


CSWeekView classes available

2009-12-21 Thread David Hirsch
A little while ago I posted a query here asking if anybody knew of a Cocoa 
class to create a weekly calendar, somewhat like the iCal week view.  Although 
there were a couple of promising replies, I decided to roll my own, 
"CSWeekView".  I've released it on GitHub under the LGPL.

For my program's needs, it was better to have it's orientation be horizontal 
rather than vertical like iCal.  Here is a screenshot of the result:
http://sites.google.com/site/csweekview/_/rsrc/1261385235599/home/SampleWeekView.png

And here is a demo app with the classes:
http://github.com/davehirsch/CSWeekView

I hope this is useful for other folks out there.

(Note that CS stands for ClassScheduler, the program for which I wrote the 
code).

Happy to give back a little,
Dave

P.S. I know there is much room for improvement, but this works, and seemed like 
a good place to get some code out there for others.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: IKImageBrowserView managing the number of columns manually

2009-12-21 Thread Thomas Goossens
Hi Nicolas,

On Dec 20, 2009, at 12:21 PM, Nicolas Berloquin wrote:

> Hi !
> 
> I'm using an IKImageBrowserView to show a series of image captures
> and it works really well. I would like to be able to manage the number
> of images shown in a row in a precise way, and I'd like to know if there
> is any "public" way to do this ?
> The zoom variable is nice, but I don't like having to rely on calculations
> from the view size, and zoom value just to guess how many images will
> be shown...
> Is there something I missed ?
> Oh, and I'd also like to be able to determine the height (or widths) of
> cells...
> Right now cells are square, but my capture are have a 4/3 ratio, which
> leaves
> a lot of empty space between rows...
> Should I hack into the hidden variables in order to do that ?

With "setCellSize:" you should be able to control the number of cell per row 
more easily.

> And one more thing :)
> I tried saving the browserview as a jpeg. After searching the net I found
> out that
> it was using opengl to render. Could someone please point me to an easy
> way to save the whole view (if bigger than what's shown on screen) to a file
> ?

Saving the whole view will be difficult because it's representation doesn't 
really exist. I mean the images not on the screen are probably not loaded, 
the layout is not computed and the backbuffer that stores the rendering is 
allocated only for the visible area of the view.

So if you want to create an image of everything you would probably have to 
iterate, scroll the view several times, do several snapshot of the view each 
time and to tile the images yourself (and also do all that in a separate 
offscreen window).

> 
> thanks for any help ! :)
> (I'm starting to think that I should rather use the NSCollectionView if I
> want more
> handles into what is done, am I right ?)

The snapshot part will be probably easier with a NSCollectionView yes.

-- Thomas
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Localization strategies?

2009-12-21 Thread Symadept
Hi Ricky,

Even in my one of the project I am doing the same. Localizable.strings
(english) version shall have all the strings in Key-Value pair format,
"Hello" = "Hello"; And you can keep the comment on top of the string /*
Welcome text */.

And you can have many IBOutlets to set the string at runtime, as you
mentioned, with NSLocalizedString(@"Hello", nil). Now you generate various
language localizable.strings by Add Localization (mail me if you think you
need more info) from XCode and change the file format to UTF16. Now these
files shall still show you english. Now pass these files to Localization
team and they shall simply copy paste the other version of the string in RHS
of the corresponding files.

If you go with multiple nib files for various locale, UI maintainance will
become hectic. Hence you are in right track.

All the best.

Regards
Mustafa Shaik


On Mon, Dec 21, 2009 at 4:30 AM, Ricky Sharp  wrote:

>
> In getting quotes from many localization companies, I've found that some
> have different processes.  For example, one company would prefer if I just
> provide .string files.  During their QA process, they'll then run the app
> and look at everything in context.
>
> While generating .strings from nibs is easy to do, there's a problem in
> that there seems to be no method of putting contextual comments into a nib.
>  And there's no way I would hand-edit comments in the generated .strings
> files.
>
> Thus, I'm wondering if it would ultimately be worth it to externalize all
> strings from my nibs and just put everything in my single .strings file.
>  This will clearly involve me adding tons of IBOutlet ivars just so that at
> runtime I can set their text with NSLocalizedString APIs.
>
> I still plan on having separate nibs though for each language (to account
> for text bounds, font sizes, etc.)
>
> How have others tackled localization?
>
> ___
> Ricky A. Sharp mailto:rsh...@instantinteractive.com
> 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/symadept%40gmail.com
>
> This email sent to symad...@gmail.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 arch...@mail-archive.com