Re: Unnecessary Boolean Warning

2011-08-03 Thread Andy Lee
On Aug 3, 2011, at 11:20 PM, Graham Cox wrote:
> On 04/08/2011, at 1:17 PM, Preston Sumner wrote:
> 
>> I find short-circuit evaluation easier to read and much more concise, and, 
>> of course, it's always nice to avoid unnecessary levels of nesting.
> 
> 
> I wouldn't necessarily disagree, but companies often have their own coding 
> standards that forbid that sort of thing.

I guess I wouldn't protest either way, especially since "doThis && doThat" is a 
common idiom at the command line.

--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: Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
I've downloaded it and looks like it works on Lion. Never used it, so I may 
have to spend some time looking at tutorials.

Thanks for the suggestion,

Andre Masse


On 03/08/2011, at 22:02 , Andy Lee wrote:

> Does F-Script Anywhere work on Lion? Maybe you can inspect the view and find 
> a clue. A bit of a long shot if they're doing totally custom drawing, but 
> might be worth a try. Maybe they're using a custom cell of some kind and you 
> can look at the font settings.
> 
> --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


How to Identify if the device is used in iAD supported Regions

2011-08-03 Thread Sasikumar JP
I am planning to use iAD for my iOS application. As the iAD available
only in USA,UK,France,Italia,Deutschland,España AppStores.

I want to display iAD only for supported regions. This will avoid
displaying "Test Advertisement" from iAD.I can use AdMob for all other
regions.

I am not sure, how to identify the iOS Device is used in supported region?

Any help is highly appreciated.

Thanks

Sasikumar JP
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unnecessary Boolean Warning

2011-08-03 Thread Graham Cox

On 04/08/2011, at 1:17 PM, Preston Sumner wrote:

> I find short-circuit evaluation easier to read and much more concise, and, of 
> course, it's always nice to avoid unnecessary levels of nesting.


I wouldn't necessarily disagree, but companies often have their own coding 
standards that forbid that sort of thing.

--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: Unnecessary Boolean Warning

2011-08-03 Thread Preston Sumner

On Aug 3, 2011, at 8:10 PM, Andy Lee wrote:

> On Aug 3, 2011, at 9:51 PM, Graham Cox wrote:
>> I think the point they wanted to get across was that they didn't want to see 
>> code like this:
>> 
>> if( someFunction() && someOtherFunction()){ ... }
>> 
>> instead of:
>> 
>> if( someFunction())
>> {
>>   if( someOtherFunction())
>>   {
>>   
>>   }
>> }
> 
> 
> This I agree with. I "know"[1] about the short-circuiting behavior of && and 
> still I'd prefer the conditional flow be super-clear rather than have to 
> think about operator rules even a tiny bit. But now we're back where we 
> started.

I find short-circuit evaluation easier to read and much more concise, and, of 
course, it's always nice to avoid unnecessary levels of nesting.

Preston___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unnecessary Boolean Warning

2011-08-03 Thread Andy Lee
On Aug 3, 2011, at 9:51 PM, Graham Cox wrote:
> I think the point they wanted to get across was that they didn't want to see 
> code like this:
> 
> if( someFunction() && someOtherFunction()){ ... }
> 
> instead of:
> 
> if( someFunction())
> {
>if( someOtherFunction())
>{
>
>}
> }


This I agree with. I "know"[1] about the short-circuiting behavior of && and 
still I'd prefer the conditional flow be super-clear rather than have to think 
about operator rules even a tiny bit. But now we're back where we started.

--Andy

[1] Bearing in mind that what we "know" sometimes isn't so. :)

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing text like Lion's Mail

2011-08-03 Thread Andy Lee
Does F-Script Anywhere work on Lion? Maybe you can inspect the view and find a 
clue. A bit of a long shot if they're doing totally custom drawing, but might 
be worth a try. Maybe they're using a custom cell of some kind and you can look 
at the font settings.

--Andy

On Aug 3, 2011, at 7:18 PM, Andre Masse wrote:

> Good guess but no luck. Looks like a demi bold version of Helvetica, but 
> since there's no font inside Mail's package, it can't be. Well, I don't 
> really need to be perfect. Close but pretty would be enough. It's definitely 
> 19.0pt its though. Could be drawn letter by letter, you never know :-)
> 
> Thanks,
> 
> Andre Masse
> 
> 
> On 03/08/2011, at 18:41 , Kyle Sluder wrote:
>> 
>> Helvetica Neue?
>> 
>> It's very clearly not Lucida Grande.
>> 
>> --Kyle Sluder


___

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

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

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

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


Re: Unnecessary Boolean Warning

2011-08-03 Thread Graham Cox

On 04/08/2011, at 11:36 AM, glenn andreas wrote:

> More likely the somebody that interviewed you didn't have it correct in the 
> first place, scarring you for life...


Well, that part's true :)

I seem to recall I failed that question, the only one I did. So I got the 
lecture and never questioned it. I did get that job anyway, though in hindsight 
I'd rather I hadn't, but that's another story...

I think the point they wanted to get across was that they didn't want to see 
code like this:

if( someFunction() && someOtherFunction()){ ... }

instead of:

if( someFunction())
{
if( someOtherFunction())
{

}
}


where (they claimed) in the first case someOtherFunction() may or may not run 
depending on compiler implementation, and not dependent on the result of 
someFunction().


On the other hand, this was easily 15 years ago, maybe I've just forgotten the 
question and what it was all about. It happens - I forget so much stuff these 
days.

--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: Unnecessary Boolean Warning

2011-08-03 Thread Scott Ribe
On Aug 3, 2011, at 7:27 PM, Graham Cox wrote:

> In my defence, I saw this in a job interview but it was prior to 1999. Maybe 
> C99 tightened up on something that was previously vague.

Nope, been that way since K&R 1st edition ;-)

--  
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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

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

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

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


Re: Unnecessary Boolean Warning

2011-08-03 Thread glenn andreas

On Aug 3, 2011, at 8:27 PM, Graham Cox wrote:

> 
> On 04/08/2011, at 11:19 AM, Greg Parker wrote:
> 
>>> This is a classic question for coding job interviews.
>> 
>> Incorrect.
> 
> 
> Ah well, I guess I didn't get the job :)
> 
> In my defence, I saw this in a job interview but it was prior to 1999. Maybe 
> C99 tightened up on something that was previously vague.
> 
> --G.
> 

My copy of K&R  © 1978 says:

"More interesting are the logical connectives && and ||.  Expressions connected 
by && or || are evaluated left to right, and evaluation stops as soon as the 
truth or falsehood of the result is known.  These properties are critical to 
writing programs that work."

(p 38)

and later in Appendix A: C Reference Manual:

"Unlike &, && guarantees left-to-right evaluations; moreover the second operand 
is not evaluated if the first operand is 0"

(p190, section 7.11 Logical AND operator)

"Unlike |, || guarantees left-to-right evaluations; moreover the second operand 
is not evaluated if the first operand is non-zero"

(p191, section 7.12 Logical OR operator)


Nothing vague there.  More likely the somebody that interviewed you didn't have 
it correct in the first place, scarring you for life...


Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

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


Correct way to use contextInfo with ARC

2011-08-03 Thread Kevin Bracey
Hi All,

A case of me not grasping C or/and ARC;-)
I'm trying to pass the NSMutableArray across the void to the didEndSelector so 
I can access it if the user clicks ok.

/snippits

NSMutableArray *someInfo = [NSArray arrayWithObjects:@"made" , @"it", 
@"across",. nil];

[holdAlert beginSheetModalForWindow:[self window] modalDelegate:self 
didEndSelector:@selector( alertDidEnd:returnCode:contextInfo: ) 
contextInfo:?how to send someInfo?];


-(void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode  
contextInfo:(void  *)contextInfo
{
// not happy maybe use a sheet and block
NSMutableArray *holdArray = ?contextInfo?;

what magic do I use to pass it in and get it out;-)

cheers
Kevin___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unnecessary Boolean Warning

2011-08-03 Thread Roland King
The C99 spec I can find on the net has 6.5.13 (3) and (4). 

3. The && operator shall yield 1 if both of it's operands compare unequal to 0; 
otherwise it yields 0. The result has type int. 

4. Unlike the bitwise binary & operator, the && operator guarantees 
left-to-right evaluation; there is a sequence point after the evaluation of the 
first operand. If the firt operand compares equal to 0, the second operand is 
not evaluated. 

To my reading, and unless I have a totally bogus spec, that makes exactly the 
guarantee Jean-Daniel claims. 



On Aug 4, 2011, at 8:56, Graham Cox  wrote:

> 
> On 04/08/2011, at 1:52 AM, Jean-Daniel Dupas wrote:
> 
>> One important difference for instance is that if you write if (a() & b()), 
>> both a() and b() will always be executed, while if you write if (a() && 
>> b()), b() will be executed only if a() is true.
> 
> 
> The C language doesn't make any guarantees about that. While this 
> optimisation is to be expected, the order of execution (left to right) and 
> the optimisation (b not executed) is implementation dependent.
> 
> This is a classic question for coding job interviews.
> 
> --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/rols%40rols.org
> 
> This email sent to r...@rols.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: Unnecessary Boolean Warning

2011-08-03 Thread Graham Cox

On 04/08/2011, at 11:19 AM, Greg Parker wrote:

>> This is a classic question for coding job interviews.
> 
> Incorrect.


Ah well, I guess I didn't get the job :)

In my defence, I saw this in a job interview but it was prior to 1999. Maybe 
C99 tightened up on something that was previously vague.

--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: Unnecessary Boolean Warning

2011-08-03 Thread Greg Parker
On Aug 3, 2011, at 5:56 PM, Graham Cox wrote:
> On 04/08/2011, at 1:52 AM, Jean-Daniel Dupas wrote:
>> One important difference for instance is that if you write if (a() & b()), 
>> both a() and b() will always be executed, while if you write if (a() && 
>> b()), b() will be executed only if a() is true.
> 
> The C language doesn't make any guarantees about that. While this 
> optimisation is to be expected, the order of execution (left to right) and 
> the optimisation (b not executed) is implementation dependent.
> 
> This is a classic question for coding job interviews.

Incorrect. The C language guarantees short-circuit evaluation for '&&'. The 
left side is evaluated first. If it is false, then the right side is not 
evaluated. '||' and '?:' similarly guarantee short-circuit evaluation. 

You're correct for all other operators. '&' does not guarantee short-circuit 
evaluation or any particular order of execution.


C99 6.5.13.4 (Logical AND operator)
"Unlike the bitwise binary & operator, the && operator guarantees left-to-right 
evaluation; there is a sequence point after the evaluation of the first 
operand. If the first operand compares equal to 0, the second operand is not 
evaluated."

C99 6.5.14.4 (Logical OR operator)
"Unlike the bitwise | operator, the || operator guarantees left-to-right 
evaluation; there is a sequence point after the evaluation of the first 
operand. If the first operand compares unequal to 0, the second operand is not 
evaluated."

C99 6.5.15.4 (Conditional operator)
"The first operand is evaluated; there is a sequence point after its 
evaluation. The second operand is evaluated only if the first compares unequal 
to 0; the third operand is evaluated only if the first compares equal to 0; the 
result is the value of the second or third operand (whichever is evaluated), 
converted to the type described below.95) If an attempt is made to modify the 
result of a conditional operator or to access it after the next sequence point, 
the behavior is undefined."


-- 
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: Unnecessary Boolean Warning

2011-08-03 Thread Graham Cox

On 04/08/2011, at 1:52 AM, Jean-Daniel Dupas wrote:

> One important difference for instance is that if you write if (a() & b()), 
> both a() and b() will always be executed, while if you write if (a() && b()), 
> b() will be executed only if a() is true.


The C language doesn't make any guarantees about that. While this optimisation 
is to be expected, the order of execution (left to right) and the optimisation 
(b not executed) is implementation dependent.

This is a classic question for coding job interviews.

--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: Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
Forget that last one. Found how and it's worst :-)

Andre Masse

PS: if anybody want that, here's how:

CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] 
graphicsPort];
CGContextSetShouldAntialias(context, NO);


On 03/08/2011, at 20:10 , Andre Masse wrote:

> Think I could be close if I could turn off anti-aliasing. Is there any way to 
> do that in -drawRect ?
> 
> Thanks,
> 
> Andre Masse
> ___
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
Think I could be close if I could turn off anti-aliasing. Is there any way to 
do that in -drawRect ?

Thanks,

Andre Masse
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
Good guess but no luck. Looks like a demi bold version of Helvetica, but since 
there's no font inside Mail's package, it can't be. Well, I don't really need 
to be perfect. Close but pretty would be enough. It's definitely 19.0pt its 
though. Could be drawn letter by letter, you never know :-)

Thanks,

Andre Masse


On 03/08/2011, at 18:41 , Kyle Sluder wrote:
> 
> Helvetica Neue?
> 
> It's very clearly not Lucida Grande.
> 
> --Kyle Sluder

___

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

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

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

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


Re: Drawing text like Lion's Mail

2011-08-03 Thread Kyle Sluder
On Wed, Aug 3, 2011 at 3:26 PM, Andre Masse  wrote:
> Thanks but after having done 10+ screenshots and doing side by side 
> comparisons, it clearly isn't Lucida Grande. It's very close to Helvetica but 
> the kerning is different.

Helvetica Neue?

It's very clearly not Lucida Grande.

--Kyle Sluder
___

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

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

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

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


Re: Crasher due to unsafe block implementation in -[NSTextView checkTextInRange:types:options:]?

2011-08-03 Thread Aki Inoue
Kyle,

It appears you're right.

Another approach is to use multiple field editor objects so that you keep the 
first editor content unmodified.

Aki

On 2011/08/02, at 18:37, Kyle Sluder wrote:

> On Tue, Aug 2, 2011 at 6:09 PM, Aki Inoue  wrote:
>> Hi Tom,
>> 
>> Definitely write a Radar.
> 
> I just got this distilled down into an extremely simple demo project.
> rdar://problem/9886471
> 
> The demo project is here for any interested third parties: 
> http://db.tt/7hA7i8m
> 
>> One thing you could try is overriding both -checkTextInRange:types:options: 
>> & -handleTextCheckingResults:forRange:types:options:orthography:wordCount: 
>> for your field editor.
>> 
>> You can have some kind of the field editor session ID.
>> 
>> Every time a new field editor starts, you increment the ID.  Then, inside 
>> your -checkTextInRange:, you can pass the session ID via the options dict to 
>> super.
>> 
>> Inside -handleTextCheckingResult:, validate the session ID inside the 
>> options dict against the current ID.  Forward the message to super only when 
>> they match.
> 
> The problem isn't within -handleTextCheckingResult:…, but rather
> within the block that -handleTextCheckingResult:… passes to
> -[NSSpellChecker showCorrectionIndicatorOfType:…]. That block is
> assuming that whenever it gets executed, the text view will still be
> attached to the same field editor it was attached to when it was
> enqueued on the main thread.
> 
> We would need to inject this session ID check into the
> completionHandler. The only way I can think of accomplishing that
> would be to swizzle -showCorrectionIndicatorOfType:….
> 
> --Kyle Sluder

___

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

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

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

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


Re: Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
Thanks but after having done 10+ screenshots and doing side by side 
comparisons, it clearly isn't Lucida Grande. It's very close to Helvetica but 
the kerning is different.

Andre Masse

On 03/08/2011, at 17:52 , Thomas Davie wrote:

> 
> No – it's using the system font – Lucida Grande.
> 
> Bob

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing text like Lion's Mail

2011-08-03 Thread Thomas Davie

On 3 Aug 2011, at 22:40, Andre Masse wrote:

> One less pass is good. Thanks.
> 
> Unfortunately, text is not as clean as Mail at this point. Small characters 
> like "e" loose sharpness (white space inside the character is reduced). Still 
> trying to find a winner by mixing different values. I'm not so sure Mail is 
> using Helvetica now.
> 
> Thanks for your help,

No – it's using the system font – Lucida Grande.

Bob___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
One less pass is good. Thanks.

Unfortunately, text is not as clean as Mail at this point. Small characters 
like "e" loose sharpness (white space inside the character is reduced). Still 
trying to find a winner by mixing different values. I'm not so sure Mail is 
using Helvetica now.

Thanks for your help,

Andre Masse

On 03/08/2011, at 16:51 , Jens Alfke wrote:

> You can draw it in one pass using NSShadowAttributeName.
> 
> —Jens

___

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

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

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

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


Re: draggingEntered Not Working As Expected

2011-08-03 Thread Raleigh Ledet

On Aug 3, 2011, at 12:29 PM, Chris Tracewell wrote:

> XCode 4, 10.6 GC -- I have an IKImageBrowserView which I have implemented 
> drag and drop for. I have set my view controller as the image browser's drag 
> delegate, registered for pasteboard drag types in awakeFromNib and 
> implemented DnD protocol methods like so...
> 
> -(void)awakeFromNib
>   {
>   [myProductImageBrowser registerForDraggedTypes: [[NSArray 
> arrayWithObjects:@"productIndexObjectType",NSFilenamesPboardType, nil] 
> arrayByAddingObjectsFromArray:[NSImage imagePasteboardTypes]]];
>   }
> 
> -(NSDragOperation)draggingEntered:(id )sender
>   {
>   NSLog(@"DND Entered");
>   return NSDragOperationNone;
>   }
> 
> -(NSDragOperation)draggingUpdated:(id )sender // validate 
> position
>   {
>   NSLog(@"DND Uppdated");
>   if ([myProductImageBrowser dropOperation] == IKImageBrowserDropOn)
>   {
>   return NSDragOperationEvery;
>   }
>   
>   return NSDragOperationNone;
>   }
> 
> -(BOOL)performDragOperation:(id )sender // Drop Occured
>   {
>   NSLog(@"DND Perform");
>   NSArray *theFileArray = [[sender draggingPasteboard] 
> propertyListForType:NSFilenamesPboardType];
>   
>   if ([theFileArray count] == 1)
>   {
>   NSImage *theImage = [[NSImage alloc] 
> initWithContentsOfFile:[theFileArray objectAtIndex:0]];
>   
>   if (theImage) 
>   {
>   TKProductMaster *theProductMaster = 
> [[myProductMasterArrayController arrangedObjects] 
> objectAtIndex:[myProductImageBrowser indexAtLocationOfDroppedItem]];
>   [theProductMaster setMyImage:theImage];
>   [theProductMaster setImageVersion:[theProductMaster 
> imageVersion] + 1]; // up the version number so the image browser knows to 
> trash onld image cache
> 
>   [myProductImageBrowser reloadData];
>   return YES;
>   }
>   }
>   
>   return NO;
>   }
> 
> QUESTION #1
> I will test for the other pboard types later, but right now what is confusing 
> me is that draggingEntered, which returns NSDragOperationNone, is not 
> stopping anything. The logs are showing so it is getting called. I did read 
> in the NSDraggingDestination Protocol Reference that draggingUpdated & 
> draggingExited will still get called even if draggingEntered returns 
> NSDragOperationNone. Okay, but when I comment out draggingUpdated the image 
> browser still accepts drags. Why? Shouldn't it cut off dragging altogether if 
> draggingUpdated is never called to return NSDragOperationEvery?

if your IKImageBrowserView DnD delegate does not implement -draggingUpdated: 
(because you commented it out) then IKImageBrowserView makes it's own best 
guess for drag operation. You must implement -draggingUpdated: and return the 
appropriate value.

> 
> QUESTION #2
> I do not understand the difference between prepareForDragOperation: and 
> performDragOperation: as they both seem to be called at the same time and 
> have access to the same sender / info. As it is, I am only implementing 
> performDragOperation to validate the final drop and perform the final work.

There are actually 3 methods concerned with the drop… 
-prepareForDragOperation:,  -performDragOperation:, and 
-concludeDragOperation:. In prepare you can make one last determination and 
decide if you really can accept the drop of not. If you return NO, then the 
drag is cancelled and perform and conduced are not called. In 
-performDragOperation:, you should actually update your data modal and return 
if this was successful or not. If you return NO, conclude is not called. In 
-concludeDragOperation:, you do any clean up that you need to do (like call 
setNeedsDisplay or reload). Often you only care about -performDragOperation: 
and should only implement that one.

In Lion, these 3 methods additional meaning and responsibilities when you are 
dealing with multi-image, animated drag and drop. In -prepareForDragOperation: 
you inform the draggingInfo if you want to animate the drop (by modifying 
properties on sender, the return value still has the same meaning discussed 
above). If so, then in -performDragOperation: you update your data modal and 
setup drag item destinations and any animations that you view needs to perform 
to create drop holes. On return, the drop animation is performed and then 
-concludeDragOperation: is called. In -concludeDragOperation:, you should 
invalidate where you are drawing holes and do any needed cleanup,  such that 
the next call to DrawRect will draw the final version of the dropped items in 
place.

-raleigh

> 
> 
> --Chris___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moder

Re: UITableViewController, with table view not the root of its nib?

2011-08-03 Thread glenn andreas

On Aug 3, 2011, at 3:49 PM, Jens Alfke wrote:

> I’ve got an iOS screen that incorporates a UITableView. This screen is run by 
> a UIViewController subclass. I’d like to subclass UITableViewController 
> instead, to get more table behaviors for free. The problem I’m running into 
> is that the table view is not the root view of my nib. (There’s a text field 
> above the table that’s a sibling of it.)
> 
> As far as I can tell, UITableViewController only works when the table is the 
> root of the nib. It does have a separate ‘tableView’ property, but this isn’t 
> an IBOutlet so there’s no way to wire it up to the table view in the nib. 
> Instead, the class assumes that the ‘view’ outlet — which must point to the 
> nib’s root view — is the table view, and raises an assertion failure 
> otherwise.
> 
> I’m trying to figure out a way around this, but every workaround I think of 
> makes the project more complicated, canceling out the benefit of switching to 
> UITableViewController. Is there a clean way of doing it that I’m missing?
> 

UITableViewController, like all UIViewControllers, expect their view to be the 
"root" of the window (where "root" is defined as either being the only subview 
of the UIWindow) or the current/topmost view controller of a 
UINavigationController, UITabViewController, UISplitViewController, etc...

UIViewControllers are not designed to have their views inside other arbitrary 
views (except for the previously mentioned UINavigationController, etc...).  
For more detail, there was a WWDC session on "Implementing UIViewController 
Containment".

To add a text field (or other arbitrary views) "along side" the table view, you 
have a couple of choices:
- Put it in the table view header view.  Disadvantage is that it can get 
scrolled off screen
- Put the view in a row in its own section.  Similar to previous
- Put it in the first section's header view.  Only works well if you have a 
single section, are in non-grouped mode
- Put the view into the navigation controller's title view.  Limits the height 
of your view, and assumes you've got a nav controller, and aren't already using 
the title

You can also play games where you add the view to the tableview itself, and, 
since the tableview is a scrollview, adjust the content to allow that item to 
show, and then, upon scrolling, make sure the view is on the top of the screen 
(both in Y and Z coordinates, since the table view may have made a new cell 
that ends up layered covering your view)


Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drawing text like Lion's Mail

2011-08-03 Thread Jens Alfke
You can draw it in one pass using NSShadowAttributeName.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


UITableViewController, with table view not the root of its nib?

2011-08-03 Thread Jens Alfke
I’ve got an iOS screen that incorporates a UITableView. This screen is run by a 
UIViewController subclass. I’d like to subclass UITableViewController instead, 
to get more table behaviors for free. The problem I’m running into is that the 
table view is not the root view of my nib. (There’s a text field above the 
table that’s a sibling of it.)

As far as I can tell, UITableViewController only works when the table is the 
root of the nib. It does have a separate ‘tableView’ property, but this isn’t 
an IBOutlet so there’s no way to wire it up to the table view in the nib. 
Instead, the class assumes that the ‘view’ outlet — which must point to the 
nib’s root view — is the table view, and raises an assertion failure otherwise.

I’m trying to figure out a way around this, but every workaround I think of 
makes the project more complicated, canceling out the benefit of switching to 
UITableViewController. Is there a clean way of doing it that I’m missing?

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


New allowsExternalBinaryDataStorage in Core Data

2011-08-03 Thread Frédéric Testuz
Hello,

I looked at the Core Data release notes of Lion, I also looked the "What's new 
in Core Data on Mac OS X" video of the WWDC 2011. And I have a question about 
the new allowsExternalBinaryDataStorage option for binary attribute.

I did some test with an attribute for images. I can see that when I put an big 
image in the data, the file did not grow.

But where the external file/data is put? If the file is moved or copied, what 
about theses external data? I tried to find info, but the documentation is very 
sparse.

Frédéric___

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

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


[RESOLVED] NSSegmentedControl

2011-08-03 Thread koko
So I set the images for seg 0 and seg 3 to those for seg 1 and seg 2 which were 
displaying 

All segs now display an image

So, I made all images the same size as those that displayed.  I noticed that 
one image that did not display has a resolution of 88.xxx pixels/inch the 
others were 72.01 so I made them all the same.

Now each seg has a correctly displayed image.

Weird, as this has worked on many machines and OSXv10.5.8 up to Lion with the 
exception of this one machine.

Thanks for the suggestions.

-koko







On Aug 3, 2011, at 1:53 PM, Jens Alfke wrote:

> 
> On Aug 3, 2011, at 12:30 PM, koko wrote:
> 
>> The path type for the images for segments 0 and 3 and segments 1 and 2 is 
>> "Relative to Enclosing Group".
> 
> No, I mean the image names as specified in the control in Interface Builder.
> 
> —Jens

___

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

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

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

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


Problem with AXPosition

2011-08-03 Thread Diego Alvarez Nogueira
Hi, 

Why the "AXPosition" doesn't return a window position in another workspace like 
"AXSize"? Someone already had this problem?

AXUIElementCopyAttributeValue(element, (CFStringRef)@"AXPosition", 
&thePosition);
AXUIElementCopyAttributeValue(element, (CFStringRef)@"AXSize", &theSize);

Thanks!

--
Atenciosamente,

Diego Alvarez Nogueira
Blog: http://diegonogueira.com.br | http://papoinformal.com
Skype: nogueiradiego
Twitter: @nogueiradiego

___

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

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


Drawing text like Lion's Mail

2011-08-03 Thread Andre Masse
Hi,

In the new Mail, when there's no selection, the detail's view show "No Message 
Selected" in an what seems to be embossed text. My various attempts to emulate 
that, have failed. Well it kinda work but it's a bit ugly.

Here's what I've done:

- (BOOL)isFlipped
{
return YES;
}

- (void)drawRect:(NSRect)dirtyRect
{
[[NSColor whiteColor] set];
[NSBezierPath fillRect:[self bounds]];  
[[NSColor grayColor] set];
[NSBezierPath strokeRect:[self bounds]];
// draw image
CGFloat imgW = [banner size].width;
CGFloat imgH = [banner size].height;
CGFloat centerX = [self bounds].size.width / 2.0f;
CGFloat centerY = [self bounds].size.height /2.0f;
CGFloat x = centerX - (imgW / 2.0f);
CGFloat y = centerY - (imgH / 2.0f);
NSRect rectToDraw = NSMakeRect(x, y, imgW, imgH);
NSRect imgRect = NSMakeRect(0.0f, 0.0f, imgW, imgH);
[banner drawInRect:rectToDraw fromRect:imgRect operation:NSCompositeCopy 
fraction:1.0];
// draw text
CGFloat fontSize = 18.0f;
NSString *fontName = @"Helvetica";
NSString *message = @"No Message Selected";
CGFloat offset = 1.0f;

NSDictionary *attributes = [NSDictionary 
dictionaryWithObjectsAndKeys:[NSFont fontWithName:fontName size:fontSize],
NSFontAttributeName,
[NSColor grayColor],
NSForegroundColorAttributeName, 
nil];

NSAttributedString * currentText=[[NSAttributedString alloc] 
initWithString:message attributes: attributes];
CGFloat textW = [currentText size].width;
NSPoint textPt = NSMakePoint(centerX - (textW / 2.0f), centerY + (imgH / 
2.0f) + 10);
[currentText drawAtPoint:textPt];
[NSGraphicsContext restoreGraphicsState];

NSDictionary *attributesOffset = [NSDictionary 
dictionaryWithObjectsAndKeys:[NSFont fontWithName:fontName size:fontSize],
NSFontAttributeName,
[NSColor lightGrayColor],
NSForegroundColorAttributeName, 
nil];

NSAttributedString * currentTextOffset=[[NSAttributedString alloc] 
initWithString:message attributes: attributesOffset];
//textPt.x += offset;
textPt.y += offset;
[currentTextOffset drawAtPoint:textPt];
}

Any suggestions?

Thanks,

Andre Masse
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSSegmentedControl

2011-08-03 Thread Jens Alfke

On Aug 3, 2011, at 12:30 PM, koko wrote:

> The path type for the images for segments 0 and 3 and segments 1 and 2 is 
> "Relative to Enclosing Group".

No, I mean the image names as specified in the control in Interface Builder.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: NSSegmentedControl

2011-08-03 Thread koko
The path type for the images for segments 0 and 3 and segments 1 and 2 is 
"Relative to Enclosing Group".

The images names all lower case. The remote systems is running OSXv10.5.8.

Looking at fs_usage now.


On Aug 3, 2011, at 12:59 PM, Jens Alfke wrote:

> 
> On Aug 3, 2011, at 11:51 AM, koko wrote:
> 
>> I have a NSSegmentedControl as an item in a toolbar.  There are 4 segments 
>> each with a different image.
>> When I build, create an installer package and install on my system the 
>> control draws as expected.
>> Using the same installer package on a remote system the control does not 
>> draw the image for segments 0 and 3.  Inspecting the Resources folder in the 
>> App bundle shows the images for segments 0 and 3 to be present.
> 
> When I get an only-works-on-my-machine problem, the first thing I do is check 
> for hardcoded absolute paths. I.e. did the segmented control’s image names 
> somehow get set to absolute paths instead of names?
> 
> It’s also worth checking capitalization of the image names, in case the 
> remote system has a case-sensitive filesystem (unlikely but possible.)
> 
> Beyond that, I’d start using fs_usage to track what files the app tries to 
> open on launch.
> 
> —Jens

___

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

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

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

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


draggingEntered Not Working As Expected

2011-08-03 Thread Chris Tracewell
XCode 4, 10.6 GC -- I have an IKImageBrowserView which I have implemented drag 
and drop for. I have set my view controller as the image browser's drag 
delegate, registered for pasteboard drag types in awakeFromNib and implemented 
DnD protocol methods like so...

-(void)awakeFromNib
{
[myProductImageBrowser registerForDraggedTypes: [[NSArray 
arrayWithObjects:@"productIndexObjectType",NSFilenamesPboardType, nil] 
arrayByAddingObjectsFromArray:[NSImage imagePasteboardTypes]]];
}

-(NSDragOperation)draggingEntered:(id )sender
{
NSLog(@"DND Entered");
return NSDragOperationNone;
}

-(NSDragOperation)draggingUpdated:(id )sender // validate 
position
{
NSLog(@"DND Uppdated");
if ([myProductImageBrowser dropOperation] == IKImageBrowserDropOn)
{
return NSDragOperationEvery;
}

return NSDragOperationNone;
}

-(BOOL)performDragOperation:(id )sender // Drop Occured
{
NSLog(@"DND Perform");
NSArray *theFileArray = [[sender draggingPasteboard] 
propertyListForType:NSFilenamesPboardType];

if ([theFileArray count] == 1)
{
NSImage *theImage = [[NSImage alloc] 
initWithContentsOfFile:[theFileArray objectAtIndex:0]];

if (theImage) 
{
TKProductMaster *theProductMaster = 
[[myProductMasterArrayController arrangedObjects] 
objectAtIndex:[myProductImageBrowser indexAtLocationOfDroppedItem]];
[theProductMaster setMyImage:theImage];
[theProductMaster setImageVersion:[theProductMaster 
imageVersion] + 1]; // up the version number so the image browser knows to 
trash onld image cache

[myProductImageBrowser reloadData];
return YES;
}
}

return NO;
}

QUESTION #1
I will test for the other pboard types later, but right now what is confusing 
me is that draggingEntered, which returns NSDragOperationNone, is not stopping 
anything. The logs are showing so it is getting called. I did read in the 
NSDraggingDestination Protocol Reference that draggingUpdated & draggingExited 
will still get called even if draggingEntered returns NSDragOperationNone. 
Okay, but when I comment out draggingUpdated the image browser still accepts 
drags. Why? Shouldn't it cut off dragging altogether if draggingUpdated is 
never called to return NSDragOperationEvery?

QUESTION #2
I do not understand the difference between prepareForDragOperation: and 
performDragOperation: as they both seem to be called at the same time and have 
access to the same sender / info. As it is, I am only implementing 
performDragOperation to validate the final drop and perform the final work.


--Chris___

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

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

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

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


Re: NSSegmentedControl

2011-08-03 Thread Jens Alfke

On Aug 3, 2011, at 11:51 AM, koko wrote:

> I have a NSSegmentedControl as an item in a toolbar.  There are 4 segments 
> each with a different image.
> When I build, create an installer package and install on my system the 
> control draws as expected.
> Using the same installer package on a remote system the control does not draw 
> the image for segments 0 and 3.  Inspecting the Resources folder in the App 
> bundle shows the images for segments 0 and 3 to be present.

When I get an only-works-on-my-machine problem, the first thing I do is check 
for hardcoded absolute paths. I.e. did the segmented control’s image names 
somehow get set to absolute paths instead of names?

It’s also worth checking capitalization of the image names, in case the remote 
system has a case-sensitive filesystem (unlikely but possible.)

Beyond that, I’d start using fs_usage to track what files the app tries to open 
on launch.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


NSSegmentedControl

2011-08-03 Thread koko
I have a NSSegmentedControl as an item in a toolbar.  There are 4 segments each 
with a different image.

When I build, create an installer package and install on my system the control 
draws as expected.

Using the same installer package on a remote system the control does not draw 
the image for segments 0 and 3.  Inspecting the Resources folder in the App 
bundle shows the images for segments 0 and 3 to be present.

Where can I look to resolve this issue?

-koko___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTableView with autoResizing Column: How to trigger auto-resizing after setFrame:?

2011-08-03 Thread Quincey Morris
On Aug 3, 2011, at 05:41, Daniel Vollmer wrote:

> Now, what I'm trying to do is resize the tableview horizontally inside the 
> scrollview *without* changing the size of the window itself[1]. I can do that 
> easily enough by modifying its frame, but this seems to ignore the column 
> auto-resizing and leaves the column at the original width. Of course, I could 
> just set the new column width explicitly, but I'm trying use the autoresizing 
> so that I can use NSViewAnimation to animate this transition.
> Any ideas on why the column autosizing doesn't work when setting the frame 
> directly? I tried calling various NSView and NSControl methods to force a 
> relayout after changing the size, but had no success.

By modifying the frame of what? You should be changing the scroll view frame, 
but you make it sound like you're changing the table view frame.

Also, check that you've enabled column resizing correctly in *both* places -- 
the column resizing behavior of the table view itself (it's a popup -- resize 
first column/resize last column/etc)  AND the resizing behavior of the column 
(it's a checkbox prior to Xcode 4 IIRC, and a popup in Xcode 4).


___

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

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


finding my UIViewController

2011-08-03 Thread Roland King
I feel I've asked this question before but google doesn't think I have. 

My code is dealing with a button press in a control on a UITableViewCell in a 
UITableView which is contained in another UIView subclass and on and up through 
several views until eventually there is a topmost UIView which was presented 
from a UIViewController subclass. I want the button press to pop up a modal 
UIImagePickerController which will eventually pick the image for the cell I'm 
in. To pop it up I need a UIViewController instance to pop it up from, and to 
pop it down again afterwards. 

Is there any way to find, given a UIView, what the closest presenting 
UIViewController is? 

I tried going the other way, used [ [ UIView window ] rootViewController ] to 
pop up the image picker, that pops it up fine, but popping it down leaves a 
black screen, not really surprising, that's not the UIViewController which was 
really the controller at the point I pushed it, that's the root one, there's a 
few on the stack after that. I wasn't able to find a way to navigate down the 
UIViewController stack to find the bottom one, even if I could it sounds a bit 
fragile. 

Do I really need to pass the UIViewController down through why whole view 
hierarchy to my UITableViewCells so they know what to use for a modal popup and 
down; or crawl upwards superview by superview until I find one which perhaps 
implements some interface telling me it knows what the UIViewController which 
presented it was? 

I must have missed a method somewhere which does this. This is iOS 4.x on the 
phone.  ___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  (xcode-us...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/rols%40rols.org

This email sent to r...@rols.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: Unnecessary Boolean Warning

2011-08-03 Thread Jean-Daniel Dupas

Le 3 août 2011 à 16:40, Thomas Davie a écrit :

> 
> On 3 Aug 2011, at 15:15, Scott Ribe wrote:
> 
>> On Aug 3, 2011, at 7:54 AM, Thomas Davie wrote:
>> 
>>> Not really – both C ands are the same and… they're just operating on 
>>> different representations of booleans.
>> 
>> No, they're not the same at all. One is a bitwise operation on binary ints.
> 
> Yes – it performs the logical and operation on booleans represented by bits 
> (lots of booleans at once in this instance).  The other performs the same 
> logical and operation on booleans represented by entire ints.  Same op, 
> different representations.
> 



They are 2 different operators.

One important difference for instance is that if you write if (a() & b()), both 
a() and b() will always be executed, while if you write if (a() && b()), b() 
will be executed only if a() is true.


-- Jean-Daniel





___

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

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

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

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


Re: Unnecessary Boolean Warning

2011-08-03 Thread Thomas Davie

On 3 Aug 2011, at 15:15, Scott Ribe wrote:

> On Aug 3, 2011, at 7:54 AM, Thomas Davie wrote:
> 
>> Not really – both C ands are the same and… they're just operating on 
>> different representations of booleans.
> 
> No, they're not the same at all. One is a bitwise operation on binary ints.

Yes – it performs the logical and operation on booleans represented by bits 
(lots of booleans at once in this instance).  The other performs the same 
logical and operation on booleans represented by entire ints.  Same op, 
different representations.

Bob

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unnecessary Boolean Warning

2011-08-03 Thread Scott Ribe
On Aug 3, 2011, at 7:54 AM, Thomas Davie wrote:

> Not really – both C ands are the same and… they're just operating on 
> different representations of booleans.

No, they're not the same at all. One is a bitwise operation on binary ints.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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

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

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

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


Re: Unnecessary Boolean Warning

2011-08-03 Thread Thomas Davie

On 3 Aug 2011, at 14:29, Scott Ribe wrote:

> On Aug 3, 2011, at 1:53 AM, Dale Miller wrote:
> 
>> A decent language (IMHO) would not confuse things with two different "and's".
> 
> Well, there *are* two different and's, regardless of whether your favored 
> languages allow you access to both or not.

Not really – both C ands are the same and… they're just operating on different 
representations of booleans.  Any *reasonably high level* language wouldn't 
have two representations of booleans.  But that gets rather to the point of 
this – C isn't high level, for good reasons.

Bob___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unnecessary Boolean Warning

2011-08-03 Thread Scott Ribe
On Aug 3, 2011, at 1:53 AM, Dale Miller wrote:

> A decent language (IMHO) would not confuse things with two different "and's".

Well, there *are* two different and's, regardless of whether your favored 
languages allow you access to both or not.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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

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

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

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


Re: quick look question

2011-08-03 Thread Rick Corteza
Hi again,

I double-checked but isn't it that this one is just to create thumbnails?
 Actually running /usr/bin/qlmanage -p is exactly what I'm trying to do
because I want to display short video clips not just still images.  If only
it didn't put [DEBUG] in the title bar it would probably be good enough!
 What would be the best approach to doing this because I need it to work on
10.5?  Thanks!


On Tue, Aug 2, 2011 at 7:00 PM, jonat...@mugginsoft.com <
jonat...@mugginsoft.com> wrote:

>
> On 2 Aug 2011, at 11:39, Rick C. wrote:
>
> > Hi all,
> >
> > I want to include this feature in my app and the way I want it to work is
> if a user selects a file in my table view and clicks a button it will open
> that file in a quick look panel just the way it works in Finder.  Actually
> if there was only a way to trigger that easily like NSWorkspace or something
> I'd use it!  Now I need to support 10.5 still and unfortunately I see a lot
> of it became formal in 10.6.  But is it possible to achieve what I'm looking
> to do?  I have download QuickLook Sketch sample code am I going in the right
> direction because I wasn't hoping to make any plugins.  Any pointers would
> be great thanks!
> >
>
> Checkout NSImage+QuickLook available at http://mattgemmell.com/source.
> This doesn't use the formal 10.6+ API but calls /usr/bin/qlmanage instead.
> Works fine on 10.5, 10.6 and 10.7
>
>
> Regards
>
> Jonathan Mitchell
>
> Developer
> Mugginsoft LLP
> http://www.mugginsoft.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/rickcorteza%40gmail.com
>
> This email sent to rickcort...@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


NSTableView with autoResizing Column: How to trigger auto-resizing after setFrame:?

2011-08-03 Thread Daniel Vollmer
Hello all,

I have a window covered with an NSTableView inside an NSScrollView. The 
tableview has a single column which is set to autoresize with the tableview. 
This works as expected when I resize the window, the column extends correctly 
to fill the newly available space.

Now, what I'm trying to do is resize the tableview horizontally inside the 
scrollview *without* changing the size of the window itself[1]. I can do that 
easily enough by modifying its frame, but this seems to ignore the column 
auto-resizing and leaves the column at the original width. Of course, I could 
just set the new column width explicitly, but I'm trying use the autoresizing 
so that I can use NSViewAnimation to animate this transition.
Any ideas on why the column autosizing doesn't work when setting the frame 
directly? I tried calling various NSView and NSControl methods to force a 
relayout after changing the size, but had no success.


Thanks,
Daniel.

[1]  Why? My column content stretches out to fill all available space and 
display a higher resolution representation, and I want to have a zoom operation 
that shows content in more detail (albeit only in 1 dimension) without changing 
the current window dimensions.___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Deprecated methods usage

2011-08-03 Thread Mike Abdullah
Yes, you have to use it if you want your app to run on 10.4.

For extra points, check at runtime if the newer method is available, and use 
that instead.

On 3 Aug 2011, at 08:16, Vyacheslav Karamov wrote:

> Hi All!
> 
> Could I use deprecated methods in my application?
> I have to support OS X 10.4+ and for example need to obtain file modification 
> date,
> so could I use [NSFileManager fileAttributesAtPath:traverseLink:] which is 
> deprecated in 10.5?
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Deprecated methods usage

2011-08-03 Thread Gregory Weston
Vyacheslav Karamov wrote:

> Could I use deprecated methods in my application?
> I have to support OS X 10.4+ and for example need to obtain file 
> modification date,
> so could I use [NSFileManager fileAttributesAtPath:traverseLink:] which 
> is deprecated in 10.5?

Deprecation is your warning that at some point in the planned future this 
routine is going away. You should be looking for a replacement. If you still 
need to support an OS version for which no suitable replacement is available or 
constructible then use it, but it's best to do so conditionally - use some 
mechanism provided by your compiler and/or runtime environment to use the new 
API if available and the old only when necessary.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: How to detect Time Machine volume?

2011-08-03 Thread Stephane Sudre
I agree that the idea is to skip the Time Machine directory (current
or old), not the entire partition.

On Tue, Aug 2, 2011 at 8:51 PM, Charles Srstka  wrote:
> On Aug 2, 2011, at 12:37 PM, Stephane Sudre wrote:
>
> Worse case: an old time machine partition has been replaced by a new
> one. Since the old partition is some kind of a second backup, the user
> has not removed the Time Machine files.
[...]
> Typical scenario: Encountering a Time Machine drive causes a nice and quick
> recursive search through not many files, since most users don’t store too
> many extra files on their Time Machine backup drive.
> In either case, you *will* find the file you need, regardless of whether or
> not there happens to be a Backups.backupdb there.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Long delay of NSPopUpButton first click

2011-08-03 Thread Rimas M.
Hi Glenn,

Thank you for answering. Now I can understand why menu item title is black
in fonts popup of iWork apps. Even if they are selected.

Regards,

RImas M.

On Tue, Aug 2, 2011 at 6:13 PM, Glenn L. Austin wrote:
>
> Yes -- don't do that!!!
>
> You are asking the system to not only iterate through all of the fonts and
> styles, but to also set each menu item's text to that font and style.  The
> iteration part is fairly quick, setting the item text requires that the font
> be loaded and prepared for use just to draw that *one text item*.  Preparing
> each font takes a small amount of time, but multiplied by the 100+ fonts on
> a system gives you a noticeable time delay.
>
> Most applications that draw the font menu using the fonts actually
> pre-create the menu items as images of the menu item text, then only display
> the image in the menu.
>
> (History: I've worked on both the AppleWorks and the Microsoft Office 2011
> font menus in my career.)
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Unnecessary Boolean Warning

2011-08-03 Thread Dale Miller
You are correct. I get that wrong a lot. But that reinforces my point.  
A decent language (IMHO) would not confuse things with two different  
"and's". And my typo "'1001'" for "OX1001" probably was a Freudian  
slip because of my fervent dislike of C's syntax for hex numbers. Or  
maybe it was too late into the wee hours. - Dale Miller


On Aug 2, 2011, at 23:43 , Charles Srstka wrote:

On Aug 2, 2011, at 7:57 PM, Dale Miller wrote:

It is disconcerting that if A = 0x'0110' and B = '1001' then A & B  
returns true but A && B returns 0, so "if (A && B)' is executed, the  
'true' leg is not taken


Don’t you have that backwards? Assuming B was supposed to be hex, i.e.  
0x1001, then A & B would be 0, whereas A && B would be true.


Charles







___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ARC and Singletons

2011-08-03 Thread Andreas Grosam

On Aug 3, 2011, at 2:29 AM, Dave Zarzycki wrote:

> Karl,
> 
> This is not on our todo list or any list that I know of. Please file a bug 
> report if this enhancement request is interesting to you.
> 
> Thanks! :-)

Oh, we need to file an enhancement request when we would like to have class 
variables?  ;)

Hm, maybe it would help how the syntax should be defined (e.g., access through 
properties is mandatory). I have no idea myself, but some others have, for sure!


> 
> davez
> 
> 
> On Aug 2, 2011, at 4:59 PM, Karl Goiser wrote:
> 
>> Hi Greg,
>> 
>> Is that wishful thinking or a hint about the future?
>> :-)
>> 
>> 
>> All I have to say is: yes please!!
>> 
>> 
>> Regards,
>> 
>> Karl
>> 
>> 
>> On 03/08/2011, at 5:43 AM, Greg Parker wrote:
>> 
>>> On Aug 1, 2011, at 9:02 PM, Kyle Sluder wrote:
 if we had class storage (which in practice would be no different from
 static global variables except for scope), class methods would still
 be appropriate for a different set of tasks.
>>> 
>>> Not necessarily. Class variables could be defined differently from global 
>>> variables. If a class variable were defined in the natural way, as an 
>>> instance variable for the class instance described by the metaclass, then 
>>> class variables would be inherited in the same way that instance variables 
>>> are. A subclass object would have its own copy of its superclass's 
>>> variables, just like a subclass instance object has its own copy of its 
>>> superclass instance's variables. 
>>> 
>>> -- 
>>> 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/zarzycki%40apple.com
>> 
>> This email sent to zarzy...@apple.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/agrosam%40onlinehome.de
> 
> This email sent to agro...@onlinehome.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


Deprecated methods usage

2011-08-03 Thread Vyacheslav Karamov

Hi All!

Could I use deprecated methods in my application?
I have to support OS X 10.4+ and for example need to obtain file 
modification date,
so could I use [NSFileManager fileAttributesAtPath:traverseLink:] which 
is deprecated in 10.5?


___

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

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

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

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