Re: How to make Xcode launch a different app when "Running" my code?

2016-09-18 Thread Alex Zavatone
Add a post build script to launch something?

Look in build phases.

Sent from my iPhone

> On Sep 18, 2016, at 5:02 AM, Gabriel Zachmann  wrote:
> 
> When I "Run" my code in Xcode (i.e., hit CMD-R), I would like Xcode to build 
> the code, copy the product to its destination,
> and then run a *different* application, not the product it has built.
> (all on macOS, not iOS)
> 
> Does anyone know how that is possible?
> 
> I haven't found it in Xcode's documentation, and couldn't find a hint with 
> Google.
> I am using Xcode 7.3.1.
> 
> Thanks a lot in advance.
> 
> Best regards, 
> Gabriel.
> 
> 
> 
> 
> 
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.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: loadNibNamed deprecated, but newer version crashes

2016-09-18 Thread Charles Srstka
What’s the crash? Is it an exception? If so, what’s the description that gets 
posted to the console?

Charles

> On Sep 18, 2016, at 6:35 PM, Gabriel Zachmann  wrote:
> 
> I would like to replace this line of code:
>   [NSBundle loadNibNamed: @"ConfigureSheet" owner: self];
> 
> by the newer version loadNibNamed: owner:topLevelObjects:.
> 
> This runs in a screensaver. The deprecated version (loadNibNamed:owner:) 
> works.
> The new version causes a crash.
> Here are the variants I have tried:
> 
> 1.
> 
> NSBundle * bundle = [NSBundle bundleForClass:[self class]];
> NSArray * nibArray = nil;
> [bundle loadNibNamed: @"ConfigureSheet" owner: self topLevelObjects: 
> ];
> 
> 2.
> 
> NSBundle * bundle = [NSBundle bundleForClass:[self class]];
> [bundle loadNibNamed: @"ConfigureSheet" owner: self topLevelObjects: nil;
> 
> 3.
> 
> [[NSBundle mainBundle] loadNibNamed: @"ConfigureSheet" owner: self 
> topLevelObjects: nil];
> 
> 
> 
> I must be missing something.
> 
> I have checked the API docs, but I didn't see any hints. I have googled 
> extensively, to no avail.
> 
> Any hints, pointers, suggestions will be highly appreciated.
> 
> Best regards, 
> Gabriel.
> 
> 
> ___
> 
> 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/cocoadev%40charlessoft.com
> 
> This email sent to cocoa...@charlessoft.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: Package installation on MacOS Sierra

2016-09-18 Thread Shane Stanley
On 19 Sep 2016, at 8:36 AM, Graham Cox  wrote:
> 
> I have the classic .dmg approach to installation, where a disk image includes 
> an alias for /Applications and the user drags the app icon to it. On 10.12, 
> the alias appears to point to nothing, and has a generic file icon. Has this 
> kind of installer image been obsoleted by 10.12? If so, what can we do to 
> replace it in a way that works across various OS versions?

FWIW I just tried one of those .dmgs here on 10.12 and it behaved as expected.

-- 
Shane Stanley 
, 



___

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

loadNibNamed deprecated, but newer version crashes

2016-09-18 Thread Gabriel Zachmann
I would like to replace this line of code:
[NSBundle loadNibNamed: @"ConfigureSheet" owner: self];

by the newer version loadNibNamed: owner:topLevelObjects:.

This runs in a screensaver. The deprecated version (loadNibNamed:owner:) works.
The new version causes a crash.
Here are the variants I have tried:

1.

NSBundle * bundle = [NSBundle bundleForClass:[self class]];
NSArray * nibArray = nil;
[bundle loadNibNamed: @"ConfigureSheet" owner: self topLevelObjects: ];

2.

NSBundle * bundle = [NSBundle bundleForClass:[self class]];
[bundle loadNibNamed: @"ConfigureSheet" owner: self topLevelObjects: nil;

3.

[[NSBundle mainBundle] loadNibNamed: @"ConfigureSheet" owner: self 
topLevelObjects: nil];



I must be missing something.

I have checked the API docs, but I didn't see any hints. I have googled 
extensively, to no avail.

Any hints, pointers, suggestions will be highly appreciated.

Best regards, 
Gabriel.


___

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: Package installation on MacOS Sierra

2016-09-18 Thread Graham Cox

> On 19 Sep 2016, at 7:22 AM, Jonathan Mitchell  wrote:
> 
> Hi
> 
> I have a MacOS package that installs into /Applications on 10.11.
> On 10.12 it appears to install into the user’s Downloads folder.
> 
> Is this change related to the new feature in MacOS 12 to encapsulate 
> downloaded apps into a read only container?


Hi Jonathan. I don’t know the answer, but I do have a related question :)

Has /Applications moved or changed on 10.12?

I have the classic .dmg approach to installation, where a disk image includes 
an alias for /Applications and the user drags the app icon to it. On 10.12, the 
alias appears to point to nothing, and has a generic file icon. Has this kind 
of installer image been obsoleted by 10.12? If so, what can we do to replace it 
in a way that works across various OS versions?

—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

Package installation on MacOS Sierra

2016-09-18 Thread Jonathan Mitchell
Hi

I have a MacOS package that installs into /Applications on 10.11.
On 10.12 it appears to install into the user’s Downloads folder.

Is this change related to the new feature in MacOS 12 to encapsulate downloaded 
apps into a read only container?

Thanks

J
___

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: Triggering a segue from code

2016-09-18 Thread Quincey Morris
On Sep 18, 2016, at 12:22 , mail...@ericgorr.net wrote:
> 
> While I do see the log message 'How do I..', my utility panel is not shown.
> 
> How can I get this work?

Most of the problem is that storyboards and segues for the Mac are inadequately 
documented. This is exacerbated by the fact that understanding the behavior “by 
analogy with iOS” breaks down when windows are involved, since there’s no such 
thing (AFAIK) as a segue between windows on iOS.

By trial and error, I discovered that the problem in your sample project is 
that a “show” segue from a view controller does not open a new window. This 
halfway makes sense, although the fact that it does nothing and produces no 
exception or log message is pretty unhelpful. (Bug report!)

To get the button to display the panel, you need to have the window controller 
perform the segue. That means you’ll need a custom window controller subclass 
for the main window, and you can just move the action method into the window 
controller. (Hook the button up to First Responder instead of the view 
controller, too.)

Alternatively, go back to using a segue from the button to open the panel, 
which IIRC was working in an earlier version of this test project. (You posted 
that it wasn’t working, but when I went to look at your project you’d already 
fixed the problem in your project that was preventing it from working. IIRC.)

To do all the combinations of hiding and showing a singleton panel, you’ll 
probably want another custom window controller subclass for the panel itself. 
Not every window/window controller operation seems to be mapped into storyboard 
semantics, so you should expect that there are things that still need to be 
done “the old way”.

___

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

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

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

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

Triggering a segue from code

2016-09-18 Thread mail...@ericgorr.net
For reference, I have a sample project location at 

https://github.com/ericgorr/nspanel_show

It is a Document Based and Storyboard application.

On my main window, I have a toolbar with an Toolbar Item called 'Inspector'. I 
have defined a segue between this item and my Inspector Utility Panel called 
"Show Inspector". When I press the Inspector toolbar item, the utility panel 
does show as expected. I can close the panel by pushing the standard window 
close button.

What I would like to do is trigger my "Show Inspector" segue when I push the 
"Show Panel" button. I have tried the code:

@IBAction func showMyPanel( _ sender: AnyObject )
{
NSLog( "How do I show the panel?" )

self.performSegue( withIdentifier: "Show Inspector", sender: self )

}
   
While I do see the log message 'How do I..', my utility panel is not shown.

How can I get this work?

Here is an image that shows the basic setup in Interface Builder.

https://github.com/ericgorr/nspanel_show/blob/master/extra/Screen%20Shot%202016-09-17%20at%208.13.23%20PM.png


___

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: Strange toolbar item error

2016-09-18 Thread Kyle Sluder
On Sat, Sep 17, 2016, at 09:24 PM, Shane Stanley wrote:
> On 18 Sep 2016, at 3:12 AM, Kyle Sluder  wrote:
> > 
> >> For anyone seeing the same thing, the solution seems to be to change the
> >> max size of the toolbar items to the unexpected "expected" size.
> > 
> > Yes, the intent of the warning message is to get you to do that. But
> > since you’re linking against and deploying to Mavericks, I fear you’ll
> > wind up with too-big buttons on older OSes. Could you please file a bug
> > report with a sample project attached, and send me the bug number?
> 
> Will do. So if I understand you correctly, my options are:
> 
> * Change the max size as above, and have toolbar items potentially appear
> the wrong size pre-Sierra;
> 
> * Ignore the warning and have everything appear as it should in each
> version;
> 
> * Perhaps set the max size in code, based on the running OS version.

Your understanding matches mine. (I don’t work on the team that manages
NSToolbar, so I will let them have the final say in the response to your
bug report.) In the meantime, I would go with option #2.

--Kyle Sluder

> 
> FWIW, I'm also seeing it on another project, which is more complex: the
> toolbar items are all moderately subclassed, it doesn't use autolayout,
> and it's all done in code rather than a nib. I've tried a few things, but
> I can't see any way to make the warning go away. 
> 
> I think I understand the point of the message, but the adamant tone is
> going to put developers in an invidious position if users start logging
> bugs with them over it.
> 
> >> I
> >> thought I'd already tried this without success, until I realized what was
> >> happening: I had edited the values, then closed the toolbar editor in IB.
> >> I've now realised that the changes were not being saved; when I reopened
> >> the toolbar editor, the old values were still showing. Running once with
> >> the toolbar editor open seems to have made the changes 'take". (And yes,
> >> I tried cleaning at various stages.)
> > 
> > This sounds worthy of investigation. Could you please file a bug report
> > detailing the _exact_ steps that resulted in your changes being
> > forgotten? Send me that bug number too please.
> 
> It's #28348587.
> 
> >> Along the way I discovered another problem in Xcode 8: setting a button
> >> to image-only in IB still shows any title if there is one.
> > 
> > I think we have a bug report on this already.
> 
> I've already filed #28348535, which includes a simple example.
> 
> -- 
> Shane Stanley 
> , 
> 
> 

___

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 make Xcode launch a different app when "Running" my code?

2016-09-18 Thread Uli Kusterer
On 18 Sep 2016, at 12:02, Gabriel Zachmann  wrote:
> When I "Run" my code in Xcode (i.e., hit CMD-R), I would like Xcode to build 
> the code, copy the product to its destination,
> and then run a *different* application, not the product it has built.
> (all on macOS, not iOS)

 Sure! Pick "Edit Scheme..." from the target selection popup in your Xcode 
window's toolbar. There, select the "Run" entry on the left. In the "Info" tab, 
you can set the executable to run to any executable in your project, or another 
arbitrary one. 

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: How to make Xcode launch a different app when "Running" my code?

2016-09-18 Thread Pascal J. Bourguignon
You could try  adding a run shell script phase at the end of the compilation to 
substitute the executable. 

-- 
__Pascal Bourguignon__

> On 18 Sep 2016, at 12:02, Gabriel Zachmann  wrote:
> 
> When I "Run" my code in Xcode (i.e., hit CMD-R), I would like Xcode to build 
> the code, copy the product to its destination,
> and then run a *different* application, not the product it has built.
> (all on macOS, not iOS)
> 
> Does anyone know how that is possible?
> 
> I haven't found it in Xcode's documentation, and couldn't find a hint with 
> Google.
> I am using Xcode 7.3.1.
> 
> Thanks a lot in advance.
> 
> Best regards, 
> Gabriel.
> 
> 
> 
> 
> 
> ___
> 
> 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/pjb%40informatimago.com
> 
> This email sent to p...@informatimago.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: Replacement for CGContextSelectFont ?

2016-09-18 Thread Graham Cox

> On 18 Sep 2016, at 7:24 PM, Gabriel Zachmann  wrote:
> 
> But if anyone could suggest modifications to make it better (e.g., remove a 
> bug, make it simpler, or more future proof),
> I will greatly appreciate it.


Have you looked at or tried CATextLayer? It already does all of this internally 
- you just have to set up its font, size, string, etc.

Since you’re drawing this into a CALayer anyway, I think you’re going to lose 
the sub-pixel antialiasing that you get using Core Graphics. I think (but maybe 
misremembered) that CATextLayer does something to ensure that works. But even 
if it doesn’t, it’ll still be a better option than replicating its 
functionality.

—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

How to make Xcode launch a different app when "Running" my code?

2016-09-18 Thread Gabriel Zachmann
When I "Run" my code in Xcode (i.e., hit CMD-R), I would like Xcode to build 
the code, copy the product to its destination,
and then run a *different* application, not the product it has built.
(all on macOS, not iOS)

Does anyone know how that is possible?

I haven't found it in Xcode's documentation, and couldn't find a hint with 
Google.
I am using Xcode 7.3.1.

Thanks a lot in advance.

Best regards, 
Gabriel.





___

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: Replacement for CGContextSelectFont ?

2016-09-18 Thread Gabriel Zachmann
Dear Graham, dear Alex, dear Will,

thanks a lot for your helpful suggestions. 

So far, I have written this code as a replacement for CGContextSelectFont().
I am putting it here for the record (i.e., Google's archives).
But if anyone could suggest modifications to make it better (e.g., remove a 
bug, make it simpler, or more future proof),
I will greatly appreciate it.


Best regards, 
Gabriel.




@implementation TextLayerDelegate
- (void) drawLayer: (CALayer *) theLayer inContext: (CGContextRef) ctxt
{
NSMutableString * mesg;
// fill mesg
// create font
NSDictionary *fontAttributes = [NSDictionary 
dictionaryWithObjectsAndKeys:
@"Andale Mono", 
(NSString *) kCTFontFamilyNameAttribute,
@"Regular", (NSString 
*) kCTFontStyleNameAttribute,
[NSNumber 
numberWithFloat: 16.0],
(NSString *) 
kCTFontSizeAttribute,
nil ];
// kCTFontStyleNameAttribute variants could be "Bold" "Semi-Bold" -- 
check in FontBook
CTFontDescriptorRef descriptor = CTFontDescriptorCreateWithAttributes( 
(CFDictionaryRef) fontAttributes );
CTFontRef font = CTFontCreateWithFontDescriptor( descriptor, 0.0, NULL 
);
CFRelease( descriptor );

// create an attributed string
CGColorRef textcolor = CGColorCreateGenericRGB( 0.2, 0.2, 0.2, 1.0 );   
   // color of the "shadow"
CFMutableDictionaryRef attributes = CFDictionaryCreateMutable( 
kCFAllocatorDefault, 0,
   
,
   
 );
CFDictionaryAddValue( attributes, kCTFontAttributeName, font );
CFDictionaryAddValue( attributes, kCTForegroundColorAttributeName, 
textcolor );
CFAttributedStringRef attrString = CFAttributedStringCreate( 
kCFAllocatorDefault, (CFStringRef)mesg, attributes );

// offset from bottom left corner
float offset = 7.0f;
if ( theLayer.bounds.size.height > 900 )
offset = 15.0f;

// draw the string as one line
CTLineRef line = CTLineCreateWithAttributedString( attrString );
CGContextSetTextPosition( ctxt, theLayer.bounds.origin.x + offset, 
theLayer.bounds.origin.y + offset );
CTLineDraw( line, ctxt );
// draw it again on top of it, with another color
CFRelease( textcolor );
textcolor = CGColorCreateGenericRGB( 1.0, 1.0, 1.0, 1.0 );
// color of the foreground text
CFDictionaryReplaceValue( attributes, kCTForegroundColorAttributeName, 
textcolor );
CFRelease( attrString );
attrString = CFAttributedStringCreate( kCFAllocatorDefault, 
(CFStringRef)mesg, attributes );
CFRelease( line );
line = CTLineCreateWithAttributedString( attrString );
CGContextSetTextPosition( ctxt, theLayer.bounds.origin.x + offset + 3, 
theLayer.bounds.origin.y + offset + 3 );
CTLineDraw( line, ctxt );

// release everything that was constructed by a function that has 
"Create" or "Copy" in it
CFRelease( attributes );
CFRelease( line );
CFRelease( attrString );
CFRelease( font );
CFRelease( textcolor );
[mesg release];
}

// this function gets called byway of the following in the main:

textLayer_ = [CALayer layer];
TextLayerDelegate * textlayer_delegate = [[TextLayerDelegate alloc] 
initWith: self];
// ... set up this layer
[textLayer_ setNeedsDisplay];
[mainLayer_ addSublayer: textLayer_ ];



___

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