SOLVED: Document Icon won't change

2012-12-23 Thread Jerry Krinock
While fixing this problem, I found quite quite a few people with the same issue 
in the list archives.

Problem:  Want to change the document icon for an app.  Success is indicated 
when the new icon shows in Finder windows, and in the title bar of document 
windows.

Expected Steps:
• Produce 1024x1024 MyDocument.png.
• Produce from this a MyDocument.iconset folder.
• Add the MyDocument.iconset file to the project's app target.
• Change the string in Info.plist ▸ CFBundleDocumentTypes ▸ 0 ▸ 
CFBundleTypeIconFile to "MyDocument.icns".
• Clean.
• Build.
• Verify that Xcode produced a MyDocument.icns file in Contents/Resources of 
the build.
• Verify that the new CFBundleTypeIconFile was in the new Info.plist.

Important, non-obvious step:
• Delete any previous versions of the app.

• Restart.

I don't know where Mac OS X stores these icon refs.  I couldn't find anything 
in the keys of ~/Library/Preferences/com.apple.LaunchServices.plist.  I suppose 
this is a system-wide thing, probably in /Library somewhere.

Merely placing the new app version in /Applications and restarting is 
insufficient.

Adding a Info.plist ▸ UTExportedTypeDeclarations ▸ 0 ▸ UTTypeIconFile does not 
help.


___

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

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

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

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

NSPopover will not morph or resize

2012-12-23 Thread Gordon Apple
I¹m having a few issues with NSPopover.  ³animates² is the default, but is
explicitly set anyway.  I have a tear-off window that instantly comes up
where it wants when the popover is clicked.  It does not morph.  Also, it
leaves the popover up, although I now explicitly close if when the window
launches.

Another issue is that the popover will not resize when its content view size
changes.  It does come up initially in the right size.  I even tried
subclassing NSPopover, put an observer on the content view frame, then set
contentSize.  (I think NSPopover must do this itself, because I had problems
when I forgot to call ³super² in my observer.) That did not work.  Content
view changes to the right size, but popover size does not adjust.  Any
solutions?
___

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

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

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

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

Re: SOLVED: Document Icon won't change

2012-12-23 Thread Shane Stanley
FWIW, you might try duplicating the built app in the Finder. I've had similar 
problems changing AppleScript applet icons, and that seems to force whatever 
needs to be updated to be updated.

-- 
Shane Stanley 
'AppleScriptObjC Explored' 


___

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

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

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

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


Re: SOLVED: Document Icon won't change

2012-12-23 Thread Jerry Krinock

On 2012 Dec 23, at 16:30, Shane Stanley  wrote:

> FWIW, you might try duplicating the built app in the Finder. I've had similar 
> problems changing AppleScript applet icons, and that seems to force whatever 
> needs to be updated to be updated.

Next time, Shane.  I'm not going to try and change it back now :))


___

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

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

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

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


Re: NSPopover will not morph or resize

2012-12-23 Thread Gordon Apple
Bug 12930212 filed. Popover not resizing is shown in simple modification of
Popover sample code project.  Haven¹t found answer on failure to morph.
Works in sample code.  Our content view is considerably more complex.
Something is defeating it.

On 12/23/12 5:06 PM, "Gordon Apple"  wrote:

> I¹m having a few issues with NSPopover.  ³animates² is the default, but is
> explicitly set anyway.  I have a tear-off window that instantly comes up where
> it wants when the popover is clicked.  It does not morph.  Also, it leaves the
> popover up, although I now explicitly close if when the window launches.
> 
> Another issue is that the popover will not resize when its content view size
> changes.  It does come up initially in the right size.  I even tried
> subclassing NSPopover, put an observer on the content view frame, then set
> contentSize.  (I think NSPopover must do this itself, because I had problems
> when I forgot to call ³super² in my observer.) That did not work.  Content
> view changes to the right size, but popover size does not adjust.  Any
> solutions?


___

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

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

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

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

Low-level text, why so hard?

2012-12-23 Thread Graham Cox
I need to use Quartz to draw a single character - a check mark - in a graphics 
context. I don't need anything elaborate, no typesetting etc, I just want to 
draw a single checkmark.

However, Quartz seemingly makes the trivial very difficult. Why for example, 
does this code not work? Specifically, it returns 0 from 
CGFontGetGlyphWithGlyphName meaning that the glyph name is unknown. But I see 
it right there in the 'Special Characters' palette. The alternative of use the 
CGShowTextAtPoint is no use either, because it only support MacRoman or 'font 
specific' encoding, neither of which apparently allow unicode, at least as far 
as the API is presented. The check mark has a unicode value of 0x2713, so can't 
be represented by a char.

The higher-level string drawing methods are not really appropriate here because 
this is part of a -drawInContext: method of a custom CALayer. It also has to 
work across iOS and Mac.

C'mon, this has got to be easy, hasn't it?



CGFontRef font = CGFontCreateWithFontName( CFSTR("Lucida Grande"));
CGContextSetFont( ctx, font );
CGContextSetFontSize( ctx, 16 );

CGGlyph cv = CGFontGetGlyphWithGlyphName( font, CFSTR("CHECK MARK"));

if( self.value > 0 )
{
CGAffineTransform tfm = CGAffineTransformMakeScale( 1.0, -1.0 );
CGContextSetTextMatrix( ctx, tfm );
CGContextShowGlyphsAtPoint( ctx, sr.origin.x + 2.0, sr.origin.y 
+ sr.size.height, &cv, 1 );
}

CGFontRelease( font );



--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Low-level text, why so hard?

2012-12-23 Thread Quincey Morris
On Dec 23, 2012, at 21:32 , Graham Cox  wrote:

> C'mon, this has got to be easy, hasn't it?

Before iOS 6, the go-to cross-platform string drawing would be CoreText. For 
something like what you described, I'd suggest you look here:


https://developer.apple.com/library/mac/#documentation/StringsTextFonts/Conceptual/CoreText_Programming/Operations/Operations.html#//apple_ref/doc/uid/TP40005533-CH4-SW18

under "Simple Text Labels".

Since iOS 6, NSAttributedString is probably your easiest cross-platform choice:


https://developer.apple.com/library/ios/#documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/Reference/Reference.html

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/Reference/Reference.html

and use something like 'drawAtPoint:...'

> The check mark has a unicode value of 0x2713, so can't be represented by a 
> char.

In either of the above cases, you're using NS/CFString, so you can represent 
unicode easily. (You can even put the literal character in a string in your 
source code, by copying it from the special characters panel.)




___

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

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

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

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


Window resizing autolayout?

2012-12-23 Thread Antonio Nunes
I asked this question a little while back, but probably not in a clear or smart 
way. I hope I can explain what I need better this time.

In the process of localising my app, i find that I need some sheets and some 
popovers to have different sizes, depending on the user's chosen language. 
Mostly, I need increased width and/or height when the language is not English. 
I've watched the auto layout related videos from WWDC 2012 and 2011, and am 
able to create layouts that, when the window is resized will limit how far it 
can be resized down vertically and horizontally, but what I need is for windows 
to be loaded from nibs and open in a size larger than the size saved in the nib 
when it was created, rather than resized by the user.

Currently, in awakeFromNib, I adjust all user facing interface elements to the 
target language, and I had hoped that with wider, and sometimes higher 
controls, the containing sheet/popover would automatically resize to compensate 
for the larger dimensions. It doesn't. I find I need to calculate the new size 
of the container and set it manually.

Is there a way to specify auto layout settings such that all this is taken care 
of automatically by the autlayout system?

The app requires 10.7 and up, so I'd rather not use 10.8 specific enhancements 
to auto layout.

To be explicit, lets say I have a very simple popover with a label followed by 
a text field:

|-20-[some label]-8-[some text field]-20-|

In the nib, which is laid out for the English language, the layout has a 
certain width:

Lets say the label  as laid out in the nib file has width 80 and the text field 
has width 120=>   total width = 20+80+8+120+20 = 248

Let's say the user's system is set to French, the label now needs width 110, 
resulting in a total required width of 278.

Ideally,  controls' containers would resize from 248 to 278, after the 
localisation during loading of the nib, but before the sheet or popover is 
shown to the user. As it is, I see that the label has resized, after changing 
its stringValue, and the text field has moved out of the way towards the right, 
but since the container has not, the text field is clipped by the window's 
bounds.

-António

---
Don't believe everything you think
---





___

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

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

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

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

Re: Low-level text, why so hard?

2012-12-23 Thread Jens Alfke

On Dec 23, 2012, at 9:32 PM, Graham Cox  wrote:

> However, Quartz seemingly makes the trivial very difficult. Why for example, 
> does this code not work? Specifically, it returns 0 from 
> CGFontGetGlyphWithGlyphName meaning that the glyph name is unknown.

The CGText APIs might be too low-level to do font substitution for Unicode 
characters? The checkmark probably isn’t in Lucida Grande but in a fallback 
font (likely Symbol).

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Window resizing autolayout?

2012-12-23 Thread Quincey Morris
On Dec 23, 2012, at 22:44 , Antonio Nunes  wrote:

> Currently, in awakeFromNib, I adjust all user facing interface elements to 
> the target language, and I had hoped that with wider, and sometimes higher 
> controls, the containing sheet/popover would automatically resize to 
> compensate for the larger dimensions. It doesn't. I find I need to calculate 
> the new size of the container and set it manually.
> 
> Is there a way to specify auto layout settings such that all this is taken 
> care of automatically by the autlayout system?

Have you read this:


https://developer.apple.com/library/mac/#releasenotes/UserExperience/RNAutomaticLayout/_index.html

or this:


https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AutolayoutPG/Articles/Introduction.html

? The first might be more appropriate for you because it's older -- was written 
for 10.7, while the second was updated a couple of months ago.

It seems to me that changing the UI elements in awakeFromNib probably isn't 
enough, since that doesn't tell the layout system that something has changed. 
Anyway, these documents try to explain the correct place to make the 
adjustments (see "Core Layout Runtime"), though it might take some studying.

It may also be that the container view *is* resizing due to the updated layout 
conditions, but something else is forcibly doing a setFrame on it shortly 
afterwards. Do any of the layout debugging aids (see "Debugging") tell you what 
the sequence of events is in your case?


___

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

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

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

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


Re: Low-level text, why so hard?

2012-12-23 Thread Kyle Sluder
On Sun, Dec 23, 2012, at 09:32 PM, Graham Cox wrote:
> I need to use Quartz to draw a single character - a check mark - in a
> graphics context. I don't need anything elaborate, no typesetting etc, I
> just want to draw a single checkmark.

By far the simplest approach here is going to be to make an image that
contains a checkmark. Developers are discouraged from using low-level
text attributes because it completely ignores all the important
high-level stuff that goes in to making text look good. You're not
really drawing text here.

> However, Quartz seemingly makes the trivial very difficult. Why for
> example, does this code not work? Specifically, it returns 0 from
> CGFontGetGlyphWithGlyphName meaning that the glyph name is unknown.

CGFontGetGlyphWithGlyphName (and all of CGFont) deals in TrueType/AAT
concepts, NOT Unicode concepts. Unicode does not even name glyphs; it
names codepoints. The glyph names you provide to this function are the
kind that would be found in the font's `post` table, not Unicode
codepoint names.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Window resizing autolayout?

2012-12-23 Thread Kyle Sluder
On Sun, Dec 23, 2012, at 11:25 PM, Quincey Morris wrote:
> It seems to me that changing the UI elements in awakeFromNib probably
> isn't enough, since that doesn't tell the layout system that something
> has changed.

Changing the text of a label will cause it to call [self
invalidateIntrinsicContentSize], which will ensure a layout pass happens
on the next window update.

My hunch is that NSPopover manually manages the size of its window to
match is contentSize, and it doesn't do so using constraints (or if it
does, those constraints have mandatory priority).

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSPopover will not morph or resize

2012-12-23 Thread Kyle Sluder
On Sun, Dec 23, 2012, at 03:06 PM, Gordon Apple wrote:
> Another issue is that the popover will not resize when its content view
> size
> changes.  It does come up initially in the right size.  I even tried
> subclassing NSPopover, put an observer on the content view frame, then
> set
> contentSize.

-[NSView frame] is not KVO-compliant. The correct way to observe a
view's frame is to register for NSViewFrameDidChangeNotification.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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