Re: printing black

2019-01-22 Thread Alastair Houghton
On 22 Jan 2019, at 08:16, Georg Seifert wrote: > > Hi > > I have a app that can print black shapes (using normal cocoa view based > printing). A lot users complain that the printouts are not really black (the > printouts are rastered, so the color sync tries to simulate a CMJK black but > eve

Re: NSImage to JPEG file?

2019-01-17 Thread Alastair Houghton
On 16 Jan 2019, at 20:17, Jens Alfke wrote: > >> On Jan 16, 2019, at 9:59 AM, Carl Hoefs >> wrote: >> >> But all of that would come "for free" if NSImage inherited from NSData, no? > > Well, that wouldn’t make sense, because an NSImage isn’t a piece of data. It > can have multiple data repre

Re: Custom NSButton image effects for pressed/disabled

2018-12-13 Thread Alastair Houghton
On 12 Dec 2018, at 01:03, Lars C. Hassing wrote: > > If I assign an image to an NSButton it is displayed with nice pressed and > disabled effects. > > In my custom NSButton, that should display image1+title+image2, I override > drawRect:, but how do I obtain the EXACT SAME system effects for t

Re: XPC Question

2018-09-18 Thread Alastair Houghton
On 18 Sep 2018, at 16:48, Sandor Szatmari wrote: > > Thanks Alistair! > > Anyone else have additional info? Well, Cocoa has Distributed Objects, which you could use for this purpose. DO has some interesting behaviour (in particular, watch out - it can throw exceptions, even when calling meth

Re: touchesMoved value setting

2018-09-18 Thread Alastair Houghton
> On 18 Sep 2018, at 13:44, Eric E. Dolecki wrote: > > I have a UI control that can be adjusted up and down using touch & drag. > I've been asked to provide a control value based on how far the drag is via > distance. So far so good. > > What my designer wants is a value change of every 20 pixel

Re: XPC Question

2018-09-18 Thread Alastair Houghton
On 18 Sep 2018, at 13:37, Sandor Szatmari wrote: > > Can you do XPC RPC over an IP connection? Or, in other words… Can you do XPC > between two computers? Not as far as I’m aware. As far as I know, XPC is built on top of Mach messaging, which in theory can be used across the network but IIRC

Re: keyboard focus handling in custom controls

2018-09-10 Thread Alastair Houghton
On 10 Sep 2018, at 13:21, iain wrote: > > I have an application, which has 3 controls > > [button] [custom view] [button] > > I’ve set the NextKeyView of each of them to the control to the right > [button] -> [custom view] -> [button] > > And the tab and shift tab works between them as expecte

Re: C++ pointer to Cocoa object

2018-09-10 Thread Alastair Houghton
On 8 Sep 2018, at 15:32, Casey McDermott wrote: > >>> If you are using ARC and want to get a strong > reference on the object, you have to use __bridge_retained > > That is handy to know! I see there is also __bridge_transfer to go the other > way. IMO the Core Foundation wrappers CFBridgingR

Re: How to clear macOS app bundle cache

2018-09-06 Thread Alastair Houghton
On 6 Sep 2018, at 13:59, Andreas Falkenhahn wrote: > > On 06.09.2018 at 11:31 Alastair Houghton wrote: > >> On 6 Sep 2018, at 05:23, Jeff Szuhay wrote: >> Did you try clearing the defaults persistent domain in your code? >> I don’t think that is likely to help. A

Re: How to clear macOS app bundle cache

2018-09-06 Thread Alastair Houghton
On 6 Sep 2018, at 05:23, Jeff Szuhay wrote: > > Did you try clearing the defaults persistent domain in your code? I don’t think that is likely to help. Andreas was complaining that the code in his bundle was being cached somewhere, so when he rebuilt it didn’t always load the new version. User

Re: How to clear macOS app bundle cache

2018-09-05 Thread Alastair Houghton
On 4 Sep 2018, at 19:57, Andreas Falkenhahn wrote: > > On 04.09.2018 at 18:27 Marco S Hyman wrote: > >> Have you tried disabling SMB client side caching? >> https://support.apple.com/en-us/HT207520 > > Doesn't change anything. Maybe because the share is SMB 1, not SMB 2 or 3 as > stated in th

Re: How to clear macOS app bundle cache

2018-09-04 Thread Alastair Houghton
On 4 Sep 2018, at 14:30, Shane Stanley wrote: > > On 4 Sep 2018, at 11:28 pm, Alastair Houghton > wrote: >> >> On 4 Sep 2018, at 00:19, Shane Stanley wrote: >>> >>> On 3 Sep 2018, at 11:31 pm, Andreas Falkenhahn >>> wrote: >>>&

Re: How to clear macOS app bundle cache

2018-09-04 Thread Alastair Houghton
On 4 Sep 2018, at 00:19, Shane Stanley wrote: > > On 3 Sep 2018, at 11:31 pm, Andreas Falkenhahn wrote: >> >> I'm looking for a solution to flush the app bundle cache > > If you find one, I'd love to know what it is. I had no luck at all. Is the application in question sandboxed? If so, have

Re: Carbon -> Cocoa

2018-08-24 Thread Alastair Houghton
On 24 Aug 2018, at 20:01, Tor Arne Vestbø wrote: > > On 23 Aug 2018, at 12:06, Alastair Houghton > wrote: >> >> Run loops are based on dispatch queues too, these days. > > Are they? We use CFRunLoop in the Qt event dispatchers on macOS and iOS, and > I these be

Re: Carbon -> Cocoa

2018-08-23 Thread Alastair Houghton
On 22 Aug 2018, at 21:42, Saagar Jha wrote: > >> Are they? kqueue() supports monitoring of fds, Mach ports and timers, so >> there’s really no reason that CFRunLoop would have to spawn a background >> thread just to monitor some file descriptors. As far as I can tell, the >> current CFRunLoop

Re: Carbon -> Cocoa

2018-08-23 Thread Alastair Houghton
On 22 Aug 2018, at 19:32, Jens Alfke wrote: > >> On Aug 22, 2018, at 10:40 AM, Alastair Houghton >> mailto:alast...@alastairs-place.net>> wrote: >> >> Well, yes and no. If the network library works that way, it’ll fire its >> callbacks on the backgro

Re: Carbon -> Cocoa

2018-08-22 Thread Alastair Houghton
On 22 Aug 2018, at 17:53, Jens Alfke wrote: > >> On Aug 21, 2018, at 8:33 AM, Alastair Houghton > <mailto:alast...@alastairs-place.net>> wrote: >> >> So, for instance, it’s not so good on macOS or iOS if its event dispatcher >> is based on select(),

Re: Carbon -> Cocoa

2018-08-21 Thread Alastair Houghton
On 21 Aug 2018, at 10:09, Mike Crawford wrote: > >> drag C developers away from the POSIX sockets API > > Don't be dismayed if you're not happy with NIO: > > There are numerous APIs that do such dragging, for example the > ADAPTIVE Communications Environment (ACE): > > http://www.dre.vanderb

Re: Carbon -> Cocoa

2018-08-20 Thread Alastair Houghton
On 20 Aug 2018, at 14:27, Casey McDermott wrote: > > Moving anything from Obj-C to C++ objects is easy, because the .mm file can > contain both. > > Moving back is hard, because C++ can't reference Obj-C classes. It can, but only if it’s either (a) in a .mm file, or (b) prepared to call the O

Re: Carbon -> Cocoa

2018-08-20 Thread Alastair Houghton
On 18 Aug 2018, at 20:45, Mike Crawford wrote: > > "older OS versions", porting to 10.6 or later vs. 10.10 or later: > > I at first intended all the drivers I write for my clients to work on > Snow Leopard 10.6, but after actually attempting to do so I settled > upon supporting El Capitan 10.11,

Re: Carbon -> Cocoa

2018-08-20 Thread Alastair Houghton
On 17 Aug 2018, at 17:45, Casey McDermott wrote: > >>> By now, Cocoa may be the new Carbon. if your app is large, I'd wait to >>> see what happens with Marzipan. > > This is true, and very scary. Makes us wonder about sunk cost fallacy. I don’t actually think it’s very likely that Marzipan

Re: NSComboBox

2018-07-26 Thread Alastair Houghton
On 26 Jul 2018, at 01:18, Casey McDermott wrote: > > We have a 1/2 decent version working right now based on NSTextField. It shows > a scrolling table > with a NSWindowController, and selects from the table (and beeps if not > there). It also > has a NSPopUpButton on the side to use as an addit

Re: NSDrawer

2018-07-02 Thread Alastair Houghton
On 3 Jul 2018, at 03:08, Casey McDermott wrote: > > NSDrawer is deprecated, but it's also perfect for our application. > We still haven't found a good substitute. [snip] > Is there a work-around for an attached window that pops out on the side, > and acts like a drawer? NSDrawer isn’t partic

Re: Scrolling differences when using Trackpad or Mouse-Wheel

2018-06-20 Thread Alastair Houghton
On Jun 19, 2018, at 2:56 AM, Michael Starke mailto:michael.sta...@hicknhack-software.com>> wrote: > > Hi list, > > I'm currently trying to find the bottleneck in my app MacPass that's causing > the scrolling in the main table to be sluggish. > > Before diving deeply into Instruments to find th

Re: Exception handling

2018-06-16 Thread Alastair Houghton
On 15 Jun 2018, at 19:30, Jens Alfke wrote: > >> On Jun 14, 2018, at 5:58 PM, Quincey Morris >> wrote: >> >> as someone already mentioned, NSExceptions can’t successfully cross >> dylib/framework boundaries. > > They can, actually; there is no problem with this at the ABI/runtime level. > >

Re: Exception handling

2018-06-14 Thread Alastair Houghton
On 14 Jun 2018, at 18:00, Jens Alfke wrote: > >> On Jun 13, 2018, at 7:22 PM, Casey McDermott wrote: >> >> Our Carbon event loop had a try/catch block, which caught most exceptions, >> and then >> continued. It started as an expedient in early production, but it remained >> in production cod

Re: Exception handling

2018-06-14 Thread Alastair Houghton
On 14 Jun 2018, at 03:53, Quincey Morris wrote: > > On Jun 13, 2018, at 19:22 , Casey McDermott wrote: >> >> Nearly always, the event loop is the best place to escape to. > > This is not how current thinking goes, unless you mean something different > from what I think you’re saying. Agreed

Re: Crashes inside CFStringDeallocate

2018-06-10 Thread Alastair Houghton
On 10 Jun 2018, at 19:14, Dave wrote: > > Override the dealloc method and log when its called - its probably being > over-released! That isn’t quite as simple as it sounds, because this is NSString we’re talking about, which is a class cluster. Most actual NSString instances are really NSCFS

Re: Crashes inside CFStringDeallocate

2018-05-29 Thread Alastair Houghton
On 25 May 2018, at 22:18, Vojtěch Meluzín wrote: > > Ok so I got a solution - it's the utf16 indeed. When I use [NSString > stringWithUTF8String] instead, it doesn't crash. Considering it does that > only on 10.10 (and probably older), it seems like OSX malfunction... oh > well... Fortunately no

Re: Implementing an import command in NSDocument-based app

2018-05-16 Thread Alastair Houghton
On 16 May 2018, at 08:55, Pascal Bourguignon wrote: >> Le 16 mai 2018 à 09:26, Rick Mann a écrit : >> >> I'm working on a little NSDocument-based app. The documents are packages (a >> directory containing multiple files). One of the operations is to import a >> music file into the document, w

Re: Avoiding link conflicts with a static library

2018-04-04 Thread Alastair Houghton
On 4 Apr 2018, at 17:25, Redler Eyal wrote: > > We're developing an SDK for iOS, the SDK is delivered in a statically-linked > framework. Our library uses openCV and we link OpenCV into the delivered > framework binary. > > This SDK was deployed successfully with some clients but we're having

Re: Creating NSTableView programmatically

2017-12-11 Thread Alastair Houghton
On 11 Dec 2017, at 13:53, Eric Matecki wrote: > > Thanks Jonathan, > > I got a lot further now. > So it is NSTableCellView, not NSTableViewCell as stated in the doc ! FWIW, NSTableViewCell is the old way to do it, before view-based tables were the norm, which probably explains your confusion h

Re: NSString equivalent of CFSTR macro?

2017-12-05 Thread Alastair Houghton
On 4 Dec 2017, at 22:47, Rick Mann wrote: > > I have to use some C header file that #defines some string constants. Is > there an equivalent to CFSTR() that constructs NSString literals? E.g., > > > #define NSSTR(s) (@ ## s) <-- magic; this > doesn't work > #defin

Re: Inserting a button into another application's toolbar

2017-09-19 Thread Alastair Houghton
> On 19 Sep 2017, at 06:01, Jack Brindle wrote: > > Actually, there may be a way. It all depends on exactly where in the menu bar > you want to place the menu item. I think the OP wanted to inject a *toolbar* item into another app’s window’s toolbar, not a menu bar item/status item. FWIW, a s

Re: Is "-init" really needed?

2017-08-10 Thread Alastair Houghton
On 10 Aug 2017, at 15:24, Jeremy Hughes wrote: > >> On 10 Aug 2017, at 15:15, Alastair Houghton >> wrote: >> >> On 10 Aug 2017, at 15:09, Charles Srstka wrote: >>> >>> They’re equivalent syntactically, but performance-wise, +array and friends

Re: Is "-init" really needed?

2017-08-10 Thread Alastair Houghton
On 10 Aug 2017, at 15:09, Charles Srstka wrote: > > They’re equivalent syntactically, but performance-wise, +array and friends > will cause the object to be put into an autorelease pool. Therefore, +new is > better for performance. Not with ARC they don’t. The ARC logic circumvents the autore

Re: Is "-init" really needed?

2017-08-10 Thread Alastair Houghton
On 10 Aug 2017, at 14:57, gerti-cocoa...@bitart.com wrote: > > On Aug 10, 2017, at 02:18, Alastair Houghton > wrote: >> >> Personally I *would* still discourage +new in favour of class-specific >> convenience constructors because I think it’s less expressive and al

Re: Is "-init" really needed?

2017-08-10 Thread Alastair Houghton
On 10 Aug 2017, at 00:28, Doug Hill wrote: > >> - Performance - it incurs an extra message send (which would have been an >> issue back in the day) > > +new requires no extra message. It's just a shorthand for [[SomeClassname > alloc] init] Er, yes it does. It sends a +new message to the cla

Re: Is "-init" really needed?

2017-08-09 Thread Alastair Houghton
On 8 Aug 2017, at 17:38, Doug Hill wrote: > > As others have mentioned, I too have never seen any evidence or statements > from Apple that discourages +new or -init. I suspect it was ObjC programmers themselves rather than Apple/NeXT that discouraged it. As for why, well I can imagine a few r

Re: Best practice with NSProgressIndicator

2017-07-28 Thread Alastair Houghton
On 28 Jul 2017, at 16:57, Mark Allan wrote: > > I'm wondering if anyone has any thoughts about or links to best practices > when using determinate NSProgressIndicators. [snip] > I'm debating doing it with an NSTimer firing every second, but wondered if > anyone had any other suggestions? I’d

Re: Who owns a child view controller?

2017-07-14 Thread Alastair Houghton
On 14 Jul 2017, at 12:03, Jeremy Hughes wrote: > >> On 13 Jul 2017, at 20:29, Alex Zavatone wrote: >> >> One thing that I had to learn was to break my expectations of when a view >> controller (one that is tied to a navigationController) is deallocated. > > I’m not sure that view controllers

Re: Increasing stack size of NSDocument's open file thread

2017-07-06 Thread Alastair Houghton
On 6 Jul 2017, at 16:33, Graham Cox wrote: > > I appreciate your answer, and I realise there’s no API that could set the > stack size after the thread is created. > > But presumably the stack size of the thread is set somewhere as a parameter > to the thread when it’s created - certainly if I

Re: Increasing stack size of NSDocument's open file thread

2017-07-06 Thread Alastair Houghton
On 6 Jul 2017, at 06:57, Graham Cox wrote: > > I’m wondering if there’s a way to increase the stack size of the thread that > opens my NSDocument in the background. There’s no way an API could exist that did that - in general it’d have to copy the entire existing stack to a new location, then

Re: Is cloning the same as copying in APFS?

2017-06-28 Thread Alastair Houghton
On 27 Jun 2017, at 22:45, Rick Mann wrote: > > Agreed. Thanks for the code, and for showing the other techniques. In my > case, I still have to support HFS+, and I want to do that with hard links. I > wish there was an API to clone-or-hardlink, but I can do that. Perhaps worth emphasising here

Re: Is cloning the same as copying in APFS?

2017-06-27 Thread Alastair Houghton
On 27 Jun 2017, at 06:28, Jens Alfke wrote: > >> On Jun 26, 2017, at 7:38 PM, Rick Mann wrote: >> >> But there's actually a POSIX "clone" API, and so I wonder if a copy is >> different from a clone. > > The low level file copying API that I’m aware of is , which is > Apple specific. It has o

Re: file encription/decriptoin iOS

2017-06-27 Thread Alastair Houghton
On 27 Jun 2017, at 03:25, Sandor Szatmari wrote: > > This is an interesting thread. The OP's original question made me think of > the functionality Apple recently (how recently I'm not sure) added to the iOS > Notes app. It allows you to selectively 'encrypt' (password protect) a note. > Th

Re: file encription/decriptoin iOS

2017-06-26 Thread Alastair Houghton
On 24 Jun 2017, at 21:12, yu...@aim.com wrote: > > I hope i am at the right place to ask for help on file encryption/decryption > for iOS. > > I need to encrypt a pdf file during download and to decrypt it for display > later on. Can i get some pointers about implementing the > decryption/enc

Re: How to create an animated gif?

2017-06-21 Thread Alastair Houghton
On 21 Jun 2017, at 16:09, Jens Alfke wrote: > > On Jun 20, 2017, at 11:17 PM, Gerriet M. Denkmann wrote: >> >> Assume that I have two NSImages, both with the same size, how can I create >> an animated gif which alternates between these two images? > > You might have to use a 3rd party image l

Re: NSTimer or what?

2017-06-20 Thread Alastair Houghton
On 20 Jun 2017, at 04:04, Gerriet M. Denkmann wrote: > > macOS 11+ > > Some Cocoa app which has to do: > 1. something a few seconds later The main issue here isn’t energy use so much as whether you want to be able to cancel the operation. If you need to be able to cancel it before it fires,

Re: Repository of older (outdated) PDF Guides?

2017-05-19 Thread Alastair Houghton
On 19 May 2017, at 15:17, Richard Charles wrote: > >> Honestly. The fact that Apple now actively prevents us from having access to >> such lovely, useful, EASY TO UNDERSTAND AND SEARCH documents like these is >> just so disappointing. > > Very well said. The sad part is that there’s still a l

Re: Does file-mapping a memory allocation work around RAM limits?

2017-05-04 Thread Alastair Houghton
To answer the OP’s original question, I’m not sure about the exact rules Apple is using on iOS, but I’d expect the memory limit to apply to *private* memory, namely that allocated using malloc() et al, plus dirty pages mapped with mmap()’s MAP_PRIVATE flag. Read-only and shared mappings that ar

Re: Current, preferred way to add help to your Mac app?

2017-04-10 Thread Alastair Houghton
On 9 Apr 2017, at 23:00, Richard Charles wrote: > >> On Apr 9, 2017, at 11:55 AM, Alastair Houghton >> wrote: >> >> The documentation isn’t exactly great (at least, the last time I had to use >> it). You might find the following article interesting/

Re: Current, preferred way to add help to your Mac app?

2017-04-09 Thread Alastair Houghton
On 9 Apr 2017, at 10:31, J.E. Schotsman wrote: > > On 08 Apr 2017, at 21:00,Jeff Szuhay wrote: > >> Nevermind. I found the “Apple Help Programming Guide.” > > Good luck. That’s a weird mix of obsolete and newer API descriptions. The > newer ones don’t work for me. > openHelpAnchor:inBook: fail

Re: disable group of controls

2017-04-05 Thread Alastair Houghton
On 5 Apr 2017, at 12:05, J.E. Schotsman wrote: > >> On 05 Apr 2017, at 11:48, Jack Carbaugh wrote: >> >> Get a list of the controls then loop through it, setting each enabled >> property to false. The container holding them will hold a reference to them > > That way you lose the latent enable

Re: disable group of controls

2017-04-05 Thread Alastair Houghton
On 5 Apr 2017, at 10:45, J.E. Schotsman wrote: > > On 03 Apr 2017, at 21:00, J.E. Schotsman wrote: >> >> What is the Cocoa way of enabling/disabling a group of controls? >> In Carbon I used to use a user pane for that. >> I thought I would try an NSBox but then I realized it is not a control. >

Re: Normalisation of filenames

2017-04-05 Thread Alastair Houghton
On 5 Apr 2017, at 09:09, Jean-Daniel wrote: > >> Le 5 avr. 2017 à 07:49, Gerriet M. Denkmann a écrit : >> >> Apple uses (as far as I remember) a variant of Unicode’s canonical >> decomposition form. > > Yes they do. I think is due to lack of backward compatibility for > normalisation. I don’

Re: Can't use +initialize, now what?

2017-03-30 Thread Alastair Houghton
On 29 Mar 2017, at 21:17, Jens Alfke wrote: > >> On Mar 29, 2017, at 10:52 AM, Quincey Morris >> wrote: >> >> If willFinishLaunching is not early enough, then you can put code in your >> “main” function, but I don’t know how feasible that is in Swift. > > Another trick to run stuff earlier a

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-23 Thread Alastair Houghton
On 23 Mar 2017, at 17:57, Ed Wynne wrote: > >> Shouldn’t the VFS layer actually be doing this? It is part of its whole >> raison d’être, no? Just have -[NSURL fileSystemRepresentation] normalize >> things according to the correct Unicode rules, and let the VFS layer >> translate that to HFS+’s

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-23 Thread Alastair Houghton
On 22 Mar 2017, at 18:00, David Duncan wrote: > > So there was another explanation posted on the bug that I’m not certain you > got, but which I think may explain. > > Basically the concept is that since APFS doesn’t normalize file names, if you > store file names in some other storage (say in

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-23 Thread Alastair Houghton
On 22 Mar 2017, at 19:13, Chris Ridd wrote: > >> On 22 Mar 2017, at 09:05, Alastair Houghton >> wrote: >> >> In the context of filesystems (and specifically filenames), the phrases “bag >> of bytes” and “bunch of bytes” have a fairly specific meaning. The

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-22 Thread Alastair Houghton
On 21 Mar 2017, at 20:49, Quincey Morris wrote: > > On Mar 20, 2017, at 14:23 , davel...@mac.com wrote: >> >> "iOS HFS Normalized UNICODE names , APFS now treats all file[ name]s as a >> bag of bytes on iOS . We are requesting that Applications developers call >> the correct Normalization rou

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-21 Thread Alastair Houghton
On 21 Mar 2017, at 12:33, Jean-Daniel wrote: > > This is what the reply suggest but that make no sens for me. If you are > accessing the file using URL, that the work of the framework to convert the > URL into the right file system representation. Agreed, IMO the framework should be responsibl

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-07 Thread Alastair Houghton
On 7 Mar 2017, at 12:47, Jean-Daniel wrote: > > Did you try to use NSString -fileSystemRepresentation instead of UTF-8, or > even better, use URL. While using UTF-8 for path worked well on HFS+, It was > never guaranteed to work on all FS. FWIW, the macOS kernel does use UTF-8 at the VFS inter

Re: Unicode filenames with Apple File System and UIManagedDocument

2017-03-07 Thread Alastair Houghton
On 7 Mar 2017, at 18:00, Jens Alfke wrote: > > On Mar 7, 2017, at 8:13 AM, davel...@mac.com wrote: >> >> NSFileManager *fm = [[NSFileManager alloc] init]; >> const char *data = [name fileSystemRepresentation]; >> NSString *filename = [fm stringWithFileSystemRepresentation:data >> length:s

Re: Sometimes all my menus are disabled

2017-02-14 Thread Alastair Houghton
On 14 Feb 2017, at 22:15, Graham Cox wrote: > >> On 15 Feb 2017, at 12:39 AM, Andreas Falkenhahn >> wrote: >> >> I knew how to use IB on the old PowerPC Mac, >> but that was 10 years ago. > > Well, it hasn’t changed that much in principle. In fact it’s got a lot better > in most respects bec

Re: setFontManagerFactory:

2017-01-27 Thread Alastair Houghton
On 26 Jan 2017, at 19:06, Raglan T. Tiger wrote: > > According to the docs if one does: > > [ NSFontManager setFontManagerFactory:[ EFontManager class ] ]; > > before the main nib file is loaded and where EFontManager is a subclass of > NSFontManager and EFontManager does implement init as i

Re: On NSIncrementalStore UUID Uniqueness

2017-01-16 Thread Alastair Houghton
On 14 Jan 2017, at 10:41, Daryle Walker wrote: > > Could I base the UUID off a hash of the URL? Maybe, but it wouldn’t survive > file moves. There are file references in macOS, which would be more stable, > but I read that there’s a bug in the URL class where it would degrade > file-reference

Re: NSNetServiceBrowser vs. mDNSResponder

2017-01-13 Thread Alastair Houghton
On 13 Jan 2017, at 09:40, Gerriet M. Denkmann wrote: > > iOS (10.2) app does: > > SERVICE_TYPE = 1 to 63 ascii chars; no spaces; no ‘.’; no ‘[‘; can use ‘_' > or '-'; case insensitive > Note: I did not find these rules documented anywhere, they are just the > result of trial and error. [snip

Re: On NSIncrementalStore UUID Uniqueness

2017-01-11 Thread Alastair Houghton
On 11 Jan 2017, at 00:16, Saagar Jha wrote: > > Small quibble: UUIDs are not guaranteed to be unique. It's just extremely > likely they will be, and they be sufficient for almost all applications, > including this one. If we’re going to be pedantic, properly issued version 1 and 2 UUIDs *are*

Re: Requires High Performance Graphic Card - Why?

2016-12-15 Thread Alastair Houghton
On 16 Dec 2016, at 04:11, Gerriet M. Denkmann wrote: > > macOS 12.2; MacBook Pro (Retina, Mid 2012). > > Activity Monitor → Energy tells me that my app requires a "High Performance > Graphic Card”. > > The problem: it has absolutely no reason to do so. > The app does some WiFi stuff and displa

Re: Large "Data" support

2016-12-06 Thread Alastair Houghton
On 6 Dec 2016, at 01:15, Jens Alfke wrote: > >> On Dec 5, 2016, at 4:12 PM, Daryle Walker wrote: >> >> For the Swift 3 "Data" type, if I want to represent a multi-gigabyte file, >> it won't try to do it all in memory, would it? > > The Data type specifically represents in-memory data, so ye

Re: Vertically Centered Colon

2016-12-01 Thread Alastair Houghton
On 1 Dec 2016, at 19:05, Doug Hill wrote: > > Just made another breakthrough. I finally figured out why we have the > vertically centerd colon (I’ll now call it VCC) by default but has > requirements of numbers on either side of the colon. > The SF font setting is “Contextual Alternatives” (I’l

Re: Vertically Centered Colon

2016-12-01 Thread Alastair Houghton
On 1 Dec 2016, at 15:57, Alex Zavatone wrote: > > If we are able to do it right, then we don't have to worry about waiting for > it or aren't put behind an 8 ball if Apple decides to pull the rug out from > under us if it decides to change the feature (which happens). > > With these features i

Re: Vertically Centered Colon

2016-12-01 Thread Alastair Houghton
On 30 Nov 2016, at 18:33, Doug Hill wrote: > >> On Nov 29, 2016, at 11:06 PM, Alex Zavatone wrote: >> >> On Nov 30, 2016, at 12:10 AM, Doug Hill wrote: >> >>> After some trial and error, I figured out how to accomplish the San >>> Francisco font features described below. I updated my document

Re: Vertically Centered Colon

2016-11-28 Thread Alastair Houghton
On 28 Nov 2016, at 16:18, Gerriet M. Denkmann wrote: > > >> On 28 Nov 2016, at 22:13, Eric E. Dolecki wrote: >> >> You could probably use an attributed string and add an attribute for the >> last colon: NSBaselineOffsetAttributeName > > Yes; but this would be some rather desperate work-aroun

Re: Fonts in TableView

2016-11-07 Thread Alastair Houghton
On 6 Nov 2016, at 06:18, Quincey Morris wrote: > > 5. It’s rather indeterminate what glyphs the bounding box should reflect. In > particular, in digital typography using Unicode characters, a font as > perceived by the user may be a composite of multiple actual fonts. For > example, there’s l

Re: Prioritizing drawing of the important stuff

2016-10-31 Thread Alastair Houghton
On 29 Oct 2016, at 10:37, Jonathan Taylor wrote: > > This is a bit of a general question, but hopefully people may have some > suggestions. I've got some drawing code that synthesizes an image in a > window, which will change in response to sliders (e.g. changing the camera > perspective). My

Re: How to count Atoms

2016-10-07 Thread Alastair Houghton
On 7 Oct 2016, at 08:19, Gerriet M. Denkmann wrote: > So what is the proper way to count something atomicly and undeprecatedly? or is the approved source for this kind of thing. In C++, you might write #include std::atomic counter; then you can just do ++counter; --counter; as u

Re: Where are the ICU Headers?

2016-10-06 Thread Alastair Houghton
On 6 Oct 2016, at 10:43, dangerwillrobinsondan...@gmail.com wrote: > > Pretty sure the reason is a simple one. > If you look at the history of open source in the OS on the Apple open source > page, you'll notice they pretty much bump the ICU version they use annually. > Although unlikely, ICU m

Re: Stupid objective-c question

2016-09-27 Thread Alastair Houghton
On 27 Sep 2016, at 05:31, Britt Durbrow wrote: > > FWIW, it’s currently an implementation detail that SELs do map into the > global address space in a way that doesn’t collide with anything else; but > technically, they are in their own address space and the system could map > them otherwise

Re: Stupid objective-c question

2016-09-27 Thread Alastair Houghton
On 27 Sep 2016, at 02:17, Slipp Douglas Thompson wrote: > > I'm just going to throw this out there as a solution, not because I recommend > this approach (it's API misuse after all) but because it would work. > > Instead of using an `NSString *` you could use a `SEL` (AKA `struct > objc_selec

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 10:04, Quincey Morris wrote: > >> static void* kMyContext = &kMyContext; > > That makes the “&” optional (at comparison time), and it should even avoid > the coalescing problem if it’s declared const. Yes, that’s a good way to do it. It might be a good idea for Apple to ha

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 09:36, Alastair Houghton wrote: > > Note that you can use *any* type for your variable; in some ways, it might > make sense to use a non-pointer type, just to make clear that it’s the > address that matters, e.g. > > static const int kMyContext = 0xab

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 00:07, Quincey Morris wrote: > > On Sep 22, 2016, at 15:45 , Gabriel Zachmann wrote: >> >> Sure, but an observation method is what would be called a "callback" in >> plain C. >> In C, I can have many different callbacks. >> I don't see why that should not be possible in Obj

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 00:19, Sandor Szatmari wrote: > > I wanted to get some opinions on the following which I have done in the past > and perceive as different because the string constant is introduced and > defined once and only once. > > // my .m file > static NSString * const kMyContext = @"m

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 16:30, Ken Thomases wrote: > > Without undermining Alastair's recommendations, you can achieve what you want > by round-tripping the string through -[NSString fileSystemRepresentation] and > -[NSFileManager stringWithFileSystemRepresentation:length:]. That handles > the nor

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 12:46, John Brownie wrote: > > OK, the situation is that the user provides a name, which comes in through a > standard text field in a dialog. That name is used as a key for a dictionary > which gives a collection of information about that item. It is also used to > create a

Re: Normalising file names on macOS

2016-09-22 Thread Alastair Houghton
On 22 Sep 2016, at 12:04, John Brownie wrote: > > I find that I am in need of dealing with versions of strings that may be > turned into file names, and thus I need to be comparing normalised forms. > However, according to > https://developer.apple.com/library/content/qa/qa1173/_index.html, "F

Re: loadNibNamed deprecated, but newer version crashes

2016-09-19 Thread Alastair Houghton
On 19 Sep 2016, at 10:02, Gabriel Zachmann wrote: > > Thanks a lot for your response. > > When I replace this line > [NSBundle loadNibNamed: @"ConfigureSheet" owner: self]; > by this: > NSBundle * bundle = [NSBundle bundleForClass:[self class]]; > [bundle loadNibNamed: @"Confi

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

2016-09-19 Thread Alastair Houghton
On 18 Sep 2016, at 14:54, Uli Kusterer wrote: > > 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

Re: Swift and Threads

2016-09-13 Thread Alastair Houghton
On 13 Sep 2016, at 05:29, Jens Alfke wrote: > > The Bool type is one byte in size. > > C++ has a specialization for std::vector that makes it a true bit > array, but I’m not sure if Swift’s generic system is powerful enough to be > able to entirely switch out the implementation based on the pa

Re: Why doesn't this crash?

2016-09-12 Thread Alastair Houghton
On 10 Sep 2016, at 12:39, Andreas Falkenhahn wrote: > > To open a video, I do the following: > >AVPlayer *p = [[AVPlayer alloc] initWithURL:url]; > > I'd expect this code to crash on 10.6 because 10.6 doesn't have AVPlayer. > To my surprise, however, the code doesn't crash and it just retur

Re: Progress Indicator

2016-09-12 Thread Alastair Houghton
On 10 Sep 2016, at 15:38, Peter Hudson wrote: > > I have a simple view with a progress indicator in it. > Simple circular type - indeterminate. > > I start it with [progInd startAnimation:self]; > I end it with[progInd stopAnimation:self]; > > After a couple of years of running just fin

Re: Linking against AVKit breaks app on 10.6

2016-09-12 Thread Alastair Houghton
On 10 Sep 2016, at 12:47, Andreas Falkenhahn wrote: > > When I link my app against AVKit using > >-framework AVKit > > it fails to load on 10.6 claiming > >dyld: Library not loaded: > /System/Library/Frameworks/AVKit.framework/Versions/A/AVKit >Referenced from: ... >Reason: im

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Alastair Houghton
> On 7 Sep 2016, at 22:11, Jens Alfke wrote: > > >> On Sep 7, 2016, at 10:03 AM, Alastair Houghton >> wrote: >> >> All of it can. Objective-C is just C with some syntactic sugar on top. > > There’s a large amount of semantic sugar too, i.e. the

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Alastair Houghton
On 7 Sep 2016, at 17:09, Andreas Falkenhahn wrote: > > As a C programmer I'm trying to avoid Objective C whenever and wherever > possible. Don’t. Where there’s an Objective-C equivalent, it’ll be less error prone, shorter to write and easier to debug. > The good thing is that I can do most i

Re: Running apps compiled for newer OS X versions on older versions (rant)

2016-09-05 Thread Alastair Houghton
On 5 Sep 2016, at 13:48, Mark Allan wrote: > > It's probably also worth noting that you *can* compile for 10.6 using the > tools on 10.11 by adjusting the deployment target. This is *usually* but not always true. There are sometimes backwards compatibility problems that require you to use old

Re: Pixel-perfect migration from ATSUI to Core Text

2016-09-01 Thread Alastair Houghton
On 1 Sep 2016, at 14:38, Andreas Falkenhahn wrote: > > The problem is most likely that the “W” doesn’t start at x = 0 >> (have you tried calling CTLineGetOffsetForStringIndex(line, 0, NULL)?) > > That returns 0, that's why I was using 1. Hmmm. OK, well looking at the documentation I suppose th

Re: Pixel-perfect migration from ATSUI to Core Text

2016-09-01 Thread Alastair Houghton
On 31 Aug 2016, at 19:24, Andreas Falkenhahn wrote: > > On 31.08.2016 at 20:08 Alastair Houghton wrote: > >> On 31 Aug 2016, at 15:52, Andreas Falkenhahn wrote: > >>> But I still don't understand how computing glyph positioning manually >>> should wo

Re: Pixel-perfect migration from ATSUI to Core Text

2016-08-31 Thread Alastair Houghton
On 31 Aug 2016, at 15:52, Andreas Falkenhahn wrote: > > But I still don't understand how computing glyph positioning manually > should work around the fact that there are no APIs that measure the text > like ATSUI. I mean, internally, CTLineGetOffsetForStringIndex() probably > does exactly that,

  1   2   3   4   5   >