Images in controls in dark mode

2020-07-24 Thread David Durkee via Cocoa-dev
I am finally updating my application to support dark mode. I’ve run into a 
hitch in a place where I use images in buttons or other controls. I formerly 
put the name of the png image in the image field of the control or segment in 
question. I updated for dark mode by creating new images for dark mode, 
creating image sets in an asset catalog, including both light and dark mode 
versions of the images in the image set, and repointing the controls or 
segments to the new image sets (which uses different names from the original 
images). 

This looks right in the xib window in Xcode when I switch between light mode 
and dark mode display. But when I build and run the program, I am only seeing 
the light mode versions of the images used even when I am in dark mode. I have 
verified that it is using the image sets by changing the images in the light 
mode slots, but it is never using the dark mode versions from those sets.

All other controls in the view are respecting light mode and dark mode changes. 
The chrome of the control that contains the image is also changing correctly.

I have also created new controls in the xib or different types and they behave 
the same way.

Any idea what I'm doing wrong?

David
___

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

Please do not post 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


Images in UI in dark mode

2020-07-24 Thread David Durkee via Cocoa-dev
I am finally updating my application to support dark mode. I’ve run into a 
hitch in a place where I use images in buttons or other controls. I formerly 
put the name of the png image in the image field of the control or segment in 
question. I updated for dark mode by creating new images for dark mode, 
creating image sets in an asset catalog, including both light and dark mode 
versions of the images in the image set, and repointing the controls or 
segments to the new image sets (which uses different names from the original 
images). 

This looks right in the xib window in Xcode when I switch between light mode 
and dark mode display. But when I build and run the program, I am only seeing 
the light mode versions of the images used even when I am in dark mode. I have 
verified that it is using the image sets by changing the images in the light 
mode slots, but it is never using the dark mode versions from those sets.

All other controls in the view are respecting light mode and dark mode changes. 
The chrome of the control that contains the image is also changing correctly.

I have also created new controls in the xib or different types and they behave 
the same way.


Any idea what I'm doing wrong?

David
___

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

Please do not post 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


Sandboxed and non-sandboxed targets

2015-12-14 Thread David Durkee
I am trying to make a sandboxed and a nonsandboxed version of my Mac 
application so that I can sell a version in the Mac App Store but also sell a 
version on my website. I have created different targets in my project for this. 
I thought this was working OK, but I recently noticed that my target with 
sandboxing turned off still seems to be building a sandboxed application. My 
URLForDirectory call to get the Application Support folder is returning the one 
in Containers//Data. The built application contains an 
archived-expanded-entitlements.cent file. And code I have in this target to 
move the application into the Applications folder fails because of sandboxing. 
It worked when I first added it, which is when I turned off sandboxing for that 
target.

I was able to get it non-sandboxed again by turning sandboxing on and back off 
again, for that target. Unfortunately, doing that removed keys from my 
entitlements file. This then broke my sandboxed version.

I think the problem is that both targets are using the same entitlements file. 
I tried removing the entitlements file from the target membership of the non 
sandbox target, but that seems to be ignored. (In fact, before I looked at it, 
it wasn’t in the membership of any of either target.) I also checked my build 
phases, and the entitlements file is only listed under Copy Bundle Resources in 
the sandboxed target, but this seems to be ignored too.

Any hints on how to solve this?

David
___

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

Please do not post 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: Sandboxed and non-sandboxed targets

2015-12-14 Thread David Durkee
I may have found the answer. Under Build Settings for the target, in the Code 
Signing section, Code Signing Entitlements was still pointing to the 
entitlements file. When I removed it for the nonsandbox target, it seemed to 
solve the problem. Both targets are building as expected now.

David

> On Dec 14, 2015, at 2:18 PM, David Durkee <da...@dwdurkee.com> wrote:
> 
> I am trying to make a sandboxed and a nonsandboxed version of my Mac 
> application so that I can sell a version in the Mac App Store but also sell a 
> version on my website. I have created different targets in my project for 
> this. I thought this was working OK, but I recently noticed that my target 
> with sandboxing turned off still seems to be building a sandboxed 
> application. My URLForDirectory call to get the Application Support folder is 
> returning the one in Containers//Data. The built 
> application contains an archived-expanded-entitlements.cent file. And code I 
> have in this target to move the application into the Applications folder 
> fails because of sandboxing. It worked when I first added it, which is when I 
> turned off sandboxing for that target.
> 
> I was able to get it non-sandboxed again by turning sandboxing on and back 
> off again, for that target. Unfortunately, doing that removed keys from my 
> entitlements file. This then broke my sandboxed version.
> 
> I think the problem is that both targets are using the same entitlements 
> file. I tried removing the entitlements file from the target membership of 
> the non sandbox target, but that seems to be ignored. (In fact, before I 
> looked at it, it wasn’t in the membership of any of either target.) I also 
> checked my build phases, and the entitlements file is only listed under Copy 
> Bundle Resources in the sandboxed target, but this seems to be ignored too.
> 
> Any hints on how to solve this?
> 
> David
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/david%40dwdurkee.com
> 
> This email sent to da...@dwdurkee.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Handling close with multiple document windows

2015-09-09 Thread David Durkee
Thanks, Quincey and Mike, I wasn’t expecting it to be so simple!

David

> On Sep 8, 2015, at 4:52 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Sep 8, 2015, at 14:40 , David Durkee <da...@dwdurkee.com 
> <mailto:da...@dwdurkee.com>> wrote:
>> 
>> I haven’t been able to find a way to make trying to close the main window 
>> try to close the document even if the secondary window is open.
> 
> Set the ‘shouldCloseDocument’ property of the *main* win controller to 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Handling close with multiple document windows

2015-09-08 Thread David Durkee
I have a document-based application where the documents have a second window, 
which is used for editing a color list for the document. Originally I just 
conceived this as a modeless dialog, but recently I wanted to make the document 
able to handle the Undo command when this window has focus. To do this, I make 
it a second document window by calling the document’s addWindowController 
method.

This had the side effect of the document not closing or trying to save until 
both the main document window and the color list window were closed by the 
user. The color list window is still a secondary window, so I want to treat 
closing of the main window as a request to close the document. The first thing 
I tried was adding a windowWillClose window delegate method to the document for 
the main window, and inside that method, close the secondary window.

Unfortunately I discovered that, if both windows are open, closing the main one 
now closes both without trying to save the document, resulting in data loss.

I haven’t been able to find a way to make trying to close the main window try 
to close the document even if the secondary window is open.

David
___

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

Please do not post 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: Unrecognized Selector Exception from IBAction's?

2015-09-03 Thread David Durkee
It looks like the buttons may be hooked up to an object of the wrong class? 
Your actions aren’t defined in NSConcreteHashTable. Check your connections.

David

> On Sep 3, 2015, at 7:09 AM, Dave  wrote:
> 
> Hi,
> 
> This is a Mac Project.
> 
> I’m getting an Unrecognized Selector Exceptions when clicking on a Button 
> Control:
> 
> 2015-09-03 12:46:04.464 LTWTest1[1970:896242] -[NSConcreteHashTable 
> leftButtonAction:]: unrecognized selector sent to instance 0x601221c0
> 2015-09-03 12:46:04.464 LTWTest1[1970:896242] -[NSConcreteHashTable 
> leftRightAction:]: unrecognized selector sent to instance 0x601221c0
> 2015-09-03 12:46:04.464 LTWTest1[1970:896242] -[NSConcreteHashTable 
> toggleDisclosureAction:]: unrecognized selector sent to instance 
> 0x601221c0
> 
> I’ve checked in IB and the controls in question seem to be wired up correctly.
> 
> The way this works is that I have a WindowController that has a NIB file 
> which contains a View Hierarchy. The WindowController then creates an 
> Instance of a View Controller (LTWDetailViewController) and adds its View to 
> a StackView which is inside a Scroll View. The View Outlets seem to be wired 
> up ok, but the IBAction’s cause an Exception.
> 
> Please see the following code:
> 
> LTWDisclosureViewController.h
> 
> @interface LTWDisclosureViewController : NSViewController
> {
> NSView*   _disclosedView;
> BOOL  _disclosureIsClosed;
> }
> 
> @property (nonatomic,weak) IBOutlet NSTextField*  
> titleTextField;
> @property (nonatomic,weak) IBOutlet NSButton* 
> disclosureButton;
> @property (nonatomic,weak) IBOutlet NSView*   
> headerView;
> 
> 
> -(IBAction) toggleDisclosureAction:(id) theSender;
> //* Causes Exception when Clicked (the methods 
> are defined in the corresponding .m file).
> 
> @end
> 
> ——
> LTWDetailViewController.h
> 
> @interface LTWDetailViewController : LTWDisclosureViewController
> {
> }
> 
> -(id) initWithWindowKind:(NSString*) theWindowKind;
> -(NSView*) startup;
> 
> @property (nonatomic,weak)IBOutlet NSView*
> pDetailView;
> 
> 
> -(IBAction) leftButtonAction:(id) theSender;  
> //* Causes Exception when Clicked (the methods are 
> defined in the corresponding .m file).
> -(IBAction) rightButtonAction:(id) theSender; 
> //* Causes Exception when Clicked (the methods are 
> defined in the corresponding .m file).
> 
> @end
> 
> 
> 
> 
> ——
> 
> This code is in the Window Controller, setupStackView is called from 
> awakeFromNib.
> 
> -(void) setupStackView 
> {
> CGFloat   myMinunumWidth;
> NSView*   myDetailView;
> BOOL  
> myClipStackViewHorizFlag;
> NSMutableDictionary*  myViewsDictionary;
> NSNotificationCenter* myNotificationCenter;
> LTWDetailViewController*  myValidationDetailViewController;
> 
> myNotificationCenter = [NSNotificationCenter defaultCenter];
> 
> myValidationDetailViewController = [[LTWDetailViewController alloc] 
> initWithWindowKind:@"Validation"];
> 
> [myValidationDetailViewController setTitle:@"* Test Title 1 *"];
> myDetailView = myValidationDetailViewController.view;
> 
> 
> [self.pValidationListStackView addView:myDetailView 
> inGravity:NSStackViewGravityTop];
> 
> //**
> //**  Use the size of this view as an Minimum
> //**
> myMinunumWidth = myDetailView.frame.size.width;
> 
> //**
> //**  Vertically Centered Stack  
> //**
> self.pValidationListStackView.orientation = 
> NSUserInterfaceLayoutOrientationVertical;
> self.pValidationListStackView.alignment = NSLayoutAttributeTop;
> self.pValidationListStackView.spacing = 0;
> 
> //**
> //**  Do Not Hug Horizontally - Let the Fixed Width Subviews Float Centrally
> //**
> [self.pValidationListStackView setHuggingPriority:NSLayoutPriorityDefaultLow 
> forOrientation:NSLayoutConstraintOrientationHorizontal];
> 
> //**
> //**  Allow StackView Clipping
> //**
> myClipStackViewHorizFlag = YES;
> 
> //**
> //**  Do Not Resist clipping Horizontally
> //**
> //**  NSScrollView Wrapper Will Allow the Clipped View to be Scrolled into 
> View.
> //**
> if (myClipStackViewHorizFlag == YES)
>   [self.pValidationListStackView 
> setClippingResistancePriority:NSLayoutPriorityDefaultLow 
> forOrientation:NSLayoutConstraintOrientationHorizontal];
> 
> //**
> //**  The StackView Min Width Will Match the SubView 

Targets with same app name

2015-09-02 Thread David Durkee
Hi,

I’m trying to build three targets for my Mac application that are nearly 
identical, and that I want to have the same app name. One is a demo version, 
that will expire a certain time after it is first launched. Another is a beta, 
that expires a certain time after it is built, and the last is the version of 
the App Store. To do this I made three identical targets, using the same 
info.plist and the same name for the .app bundle, but a different .pch file for 
each with #defines to force the differences.

My problem is that they all build in the same location, so if I change schemes 
(to change target) and debug, it uses the target I was previously using, not 
the one I just changed to. I can Clean the project, but I don’t want to have to 
remember that.

I’ve tried everything I can think of to get them to build in different 
locations. I tried changing Build Products Path in Build Locations under Build 
Settings (seems like a no-brainer, right?) from “build” to “build_beta”, but it 
seems to have no effect. (The actual path where the build product is going has 
“Build” in it, but not “build”, and it didn’t change.)

I found this document about Changing the Build Location:

https://developer.apple.com/library/ios/recipes/xcode_help-locations_preferences/Build/Build.html
 
<https://developer.apple.com/library/ios/recipes/xcode_help-locations_preferences/Build/Build.html>

From reading it, it sounds like the only way to get a build location based on 
target settings is in Preferences->Locations using an option labeled Legacy. I 
don’t like this for two reasons: I don’t want it to affect other projects in 
the future, which is implied that it would by being in Preferences, and the 
fact that it’s called Legacy implies that things aren’t done this way anymore 
which makes me think I’m taking an entirely wrong approach.

Any suggestions?

David Durkee
___

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

Please do not post 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: Targets with same app name

2015-09-02 Thread David Durkee
Thanks for the suggestion. However, I just tried it and a couple of things went 
wrong. The name in the build settings was what appeared in the about box (when 
I ran in debug). And the program (the one that I archived and then exported) 
crashed on launch, apparently because the bundle identifier doesn’t match what 
it thinks is the product name. 

Process:   Comic Strip Factory Beta [12405]
Path:  /Applications/Comic Strip 
Factory.app/Contents/MacOS/Comic Strip Factory Beta
Identifier:com.dwdurkee.Comic-Strip-Factory-Beta
Responsible:   Comic Strip Factory Beta [12405]
Sandbox creation failed: Unable to get bundle identifier for container ID 
com.dwdurkee.Comic-Strip-Factory-Beta: (null)
Unable to get bundle identifier for container ID 
com.dwdurkee.Comic-Strip-Factory-Beta: (null)
   0x1 -0x10011efff +com.dwdurkee.Comic-Strip-Factory-Beta 
(1.0.b7 [588] - 1.0.107) <1283BF83-D4C8-3C70-925B-22661D1B16C3> 
/Applications/Comic Strip Factory.app/Contents/MacOS/Comic Strip Factory Beta
 
David

> On Sep 2, 2015, at 4:06 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Sep 2, 2015, at 12:21 , David Durkee <da...@dwdurkee.com 
> <mailto:da...@dwdurkee.com>> wrote:
>> 
>> I’m trying to build three targets for my Mac application that are nearly 
>> identical, and that I want to have the same app name.
> 
> I’m happy to be corrected if wrong, but I don’t think it really matters what 
> you do in Xcode, since the actual app bundle name (as seen by users) is 
> always determined later on.
> 
> Therefore, you may as well give your targets 3 different names, and let Xcode 
> do its default thing of giving the executable files 3 different names, and 
> nominally giving the built bundles 3 different names. This is what you will 
> see during testing (that is, when running a target from Xcode), but *you* 
> don’t care about the names at that point.
> 
> In order to release an app to others, you’ll need to archive the app in 
> Xcode, then extract the app bundle from the archive (for the non-app-store 
> version) or submit the app bundle from the archive (for the 
> app-store-version). In the first case you go through a Save dialog to give 
> the app bundle its  final name (or you can give it any name and rename it yet 
> later in the Finder before you give it to any users). In the second case, I 
> don’t think it matters what the bundle is called, because the App Store is 
> going to deliver it to users under the name that’s in the iTunes Connect 
> metadata, which is independent of the upload bundle name.
> 

___

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

Please do not post 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: Predicate warning from text view

2015-07-08 Thread David Durkee
I am seeing this in my application too, and turning off Markup did eliminate 
it. I was really glad to see your email about that. Makes me want to see if any 
other mysterious bugs go away with Markup turned off.

In my case it is not a subclass of a NSTextView, but a straight instance of one.

David

 On Jul 8, 2015, at 12:23 AM, Shane Stanley sstan...@myriad-com.com.au wrote:
 
 On 25 Oct 2014, at 10:23 am, Martin Wierschin mar...@nisus.com wrote:
 
 I have a subclass of a text view in my app. When I double-click on other 
 than a word (ie, a space or return), I get entries like these in the 
 Console:
 
 _NSExtensionIsSafeExpressionForObjectWithSubquerySubstitutions: Expression 
 considered unsafe: SUBQUERY(extensionItems, $extensionItem, 
 $extensionItem.attachments.@count == 1 AND 
 SUBQUERY($extensionItem.attachments, $attachment, (NOT ANY 
 $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO com.adobe.pdf) AND 
 (NOT ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO 
 public.image)).@count == 0).@count
 
 
 I observed this log statement during the Yosemite beta period, on a stock 
 system with no additional extensions/apps installed, aside from my own app 
 being tested on OS X 10.10. My app (which also uses an NSTextView subclass) 
 produced that log statement, but TextEdit also produced a very similar log:
 
 TextEdit[578]: 
 _NSExtensionIsSafeExpressionForObjectWithSubquerySubstitutions: Expression 
 considered unsafe: SUBQUERY($extensionItem.attachments, $attachment, ANY 
 $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO public.image)
 
 
 I filed it as rdar://17541734 rdar://17541734 which was marked as a 
 duplicate of rdar://17432480 rdar://17432480 which is apparently closed 
 now. Perhaps the problem was reintroduced, or this has a different source? 
 
 In any case, I never observed any actual ill effects in my app whenever the 
 logging was triggered.
 
 Just coming back to this...
 
 I *think* that the number of these entries seems to have increased since I 
 upgraded to 10.10.4  -- Console can be flooded with dozens at a time. But 
 I've also found that they *stop* if turn off the Markup extension, and start 
 back up when I turn it back on.
 
 Can anyone else who is seeing the problem confirm that turning Markup solves 
 the problem? nd aAny thoughts on how I might get Markup to stop poking in my 
 window, especially as it can't actually do anything there?
 
 -- 
 Shane Stanley sstan...@myriad-com.com.au
 www.macosxautomation.com/applescript/apps/
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/david%40dwdurkee.com
 
 This email sent to da...@dwdurkee.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: How to draw a NSView on top of a WebView and don't get overriden trying

2015-05-14 Thread David Durkee
This is an entirely different approach, and requires a different skill set, but 
could you use JavaScript to inject your content into the DOM of the web page 
being displayed as a floating element? Use 
stringByEvaluatingJavaScriptFromString: to execute your own JavaScript.

David

 On May 13, 2015, at 8:31 PM, Juanjo Conti jjco...@carouselapps.com 
 mailto:jjco...@carouselapps.com wrote:
 
 I'm writing a screen saver, so using another window is not possible :(
 

___

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

Please do not post 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: Rotate a standard Cocoa control?

2015-05-09 Thread David Durkee
Although this can be a pain if the control is in a view that also scrolls. I 
think some Adobe applications have this issue. 

David

 On May 9, 2015, at 11:18 PM, Steve Mills sjmi...@mac.com wrote:
 
 On May 9, 2015, at 22:44:01, Graham Cox graham@bigpond.com wrote:
 
 P.S. if you can think of any obvious improvements, bugs, etc, let me know.
 
 Personally, I like it when controls also respond to the scrollwheel for 
 inc/dec actions, like the way active Photoshop fields will inc/dec when you 
 move the cursor into it and scrollwheel up/down. This would also be a nice 
 way to move knobs/sliders.
 
 --
 Steve Mills
 Drummer, Mac geek
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/david%40dwdurkee.com
 
 This email sent to da...@dwdurkee.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Issues with implementing WYWIWYG font menu

2015-05-05 Thread David Durkee
Yes, this approach has worked much better. I see only two drawbacks.

1) The first time the menu is opened, it takes as much as two seconds for it to 
appear. This only seems to be true for the first instance of the menu that is 
opened. (It’s a popup menu in a document window, so different documents will 
each have their own instance of it.) Is there a way I can precache whatever it 
is that takes so long that first time (the fonts I’m guessing)?

2) The attributed title is also displayed in the NSPopupButton, where I would 
rather see the font name displayed int he system font. (As in the font popup in 
Pages.) Is there a way to force the button to not use the attributedTitle of 
the selected NSMenuItem?

David

 On Apr 29, 2015, at 9:44 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font
 
 
 This isn’t really necessary - you can just set an attributed title on a 
 standard menu item and it will draw in the Font given in the attributes. You 
 might find that is easier and less buggy than adding a view to the item.
 
 —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: time of the build

2015-04-29 Thread David Durkee
I’m not concerned with the time, but I get the build date as an NSDate with 
this method:

- (NSDate*) buildDate
{
NSString* dateStr = [NSString stringWithUTF8String: __DATE__];
NSDateFormatter* dater = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [[NSLocale alloc] 
initWithLocaleIdentifier:@en_US_POSIX];

[dater setLocale:enUSPOSIXLocale];
[dater setDateFormat:@MMM dd ];
NSDate* date = [dater dateFromString: dateStr];
return date;
}

David

 On Apr 29, 2015, at 6:39 AM, Torsten Curdt tcu...@vafer.org wrote:
 
 I would like to embed the timestamp of the build into my executable.
 
 I know there is __DATE__ and __TIME__ but converting those into a timestamp
 at runtime isn't ideal.
 
 So I guess I somehow need to make the output of date +%s available to the
 preprocessor. But user defines allow only static values aren't they?
 
 I am not aware that a run script phase can export anything but files.
 
 How would you do this?
 
 Hope this is not too OT as this is more Xcode/build tools related.
 Happy to ask elsewhere if it is.
 
 cheers,
 Torsten
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/david%40dwdurkee.com
 
 This email sent to da...@dwdurkee.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Issues with implementing WYWIWYG font menu

2015-04-29 Thread David Durkee
I’m creating a WYSIWYG font menu using a custom view in each NSMenuItem to draw 
the name of the font in its own font. One problem I am having with it is that 
the first item under the mouse when it pops up is drawn highlighted, but when I 
move the mouse to the next item, the first one is not redrawn, even when the 
next one is drawn highlighted. So I have two items shown highlighted. After 
that, every time the mouse moves from one item to another one, both are 
redrawn. If I move back in to the first one, and then out again, the 
highlighting is redrawn correctly. It’s just the first time I exit the first 
item it doesn’t need to get notified to redraw. 

I could try hooking up KVO to the menu’s highlightedItem property, but it 
doesn’t seem like I should have to.

Another question I have regarding the WYSIWYG font menu is that it should 
identify some fonts as unsuitable for drawing their own font names, and revert 
to using the system font for those items. (Some fonts just don’t have alpha 
characters, others seem to font substitute when used but display with really 
goofy vertical metrics. So far I haven’t found any info on NSFont that is 
suitable for this test. I tried coveredCharacterSet and testing to see if it is 
a superset of the title characters, but it didn’t catch all cases and 
eliminated some fonts it shouldn’t have.

David
___

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

Please do not post 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: Issues with implementing WYWIWYG font menu

2015-04-29 Thread David Durkee
Oh, wow, I looked all over for something like that. Thanks,  I'll try that 
tomorrow. 

-David

 On Apr 29, 2015, at 9:44 PM, Graham Cox graham@bigpond.com wrote:
 
 
 On 30 Apr 2015, at 6:33 am, David Durkee da...@dwdurkee.com wrote:
 
 using a custom view in each NSMenuItem to draw the name of the font in its 
 own font
 
 
 This isn’t really necessary - you can just set an attributed title on a 
 standard menu item and it will draw in the Font given in the attributes. You 
 might find that is easier and less buggy than adding a view to the item.
 
 —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