Dan Wood is co-owner of Karelia Software, creating programs for the Macintosh computer. He is the father of two kids, lives in the Bay Area of California USA, and prefers bicycles to cars. This site is his weblog, which mostly covers geeky topics like Macs and Mac Programming.
Useful Tidbits and Egotistical Musings from Dan Wood
Categories: Mac OS X · Cocoa Programming · General · All Categories
permanent link
· Topic/MacOSX
|
Following up on an earlier post about how to deal with a floating palette, we decided to just stick with the standard floating palette that hides when the application is not frontmost, nothing tricky.
For the most part, this is workable for us. We want to be able to drag images into an "image well" in the floating inspector. The trick is, what to do when the application is not frontmost, and the palette goes away? Well, as it turns out, in most cases, you can keep Sandvox in the front, and initiate a drag from another application, still in the background, and the drag will not cause the palette to disappear, because Sandvox stays in the foreground.
Well, that works with drags from, say, Finder, Safari, TextEdit, Mail, and so forth. But it doesn't work with drags from iPhoto and a few others.
When you start a drag from an iPhoto window in a layer behind the frontmost application, it immediately pops to the front! And in doing so, sending Sandvox behind, the palette we were trying to target disappears.
That is the essence of my Friday report to Apple, Radar ID 4281046.
permanent link
· Topic/Politics
|
Geez, Tom DeLay is now blaming his prosecutor, Ronnie Earle....
permanent link
· Topic/Cocoa
|
In Sandvox, we have a lot of plug-ins, each with their own Info.plist file. Plus the application, of course. I had really wanted to employ some automated system to keep the version numbers of everything in sync, plus have "build numbers" so it's easy to determine exactly which version of the program is running, especially now that it's getting very, very close to being seen by people other than its developers.
I had scratched my head over agvtool from time to time; reading the man pages this time didn't help. But I remembered that XCode 2.1+ can preprocess the info.plist files. I figured this was a good route to take.
Problem is, there's scarce documentation on how to go about actually doing the preprocessing. Apple has a page here and here that is a start. Jonathan Wight was the only obvious resource on the web that talked about the syntax of what to put in for a substitution, in his weblog post that provided a handy hint. But I couldn't really get it to work other than using Jonathan's $(PRODUCT_NAME) substitution. I wanted to include a file containing the substitution values, but I couldn't figure out what format that file should be in.
I stumbled upon a mention of preprocessing in the change logs for Growl, so I checked out the latest version of the source. It was a little hard to figure out what the included file looked like, because it is not in the source; it's built by a script. Eventually, I figured out that the format of the file to include is essentially like a ".h" file: lines of #define keyword substitution.
Interestingly, with the exception of the XCode variables like $(PRODUCT_NAME), it seems to be a strict substitution with no special characters. So if you have this defined in your include file:
... then you would want your info.plist to contain something like this:#define SVN_VERSION 1838 #define APP_VERSION 1.0b1
<key>CFBundleShortVersionString</key> <string>APP_VERSION</string> <key>CFBundleVersion</key> <string>SVN_VERSION</string>
Of course, you still need a shell script to generate your include file to put the current source code version in there. We get the current subversion head's number by using this snippet:
svnVersion=`/usr/local/bin/svn info -r HEAD | awk '$1=="Revision:" { print $2 }'`;
Update: Mark notes something from WWDC in the comments; I thought I'd paste it here:
So that's cool, you can use C-style processing right in the file, and you have substitutions for date and time available.#ifdef _RELEASE_ <string>Copyright (c) 2005</string> #else <string>_CONFIGURATION_ version built on __DATE__ __TIME__</string> #endif
I'll post more here if I discover other goodies.
permanent link
· Topic/Politics
|
Congratulations to Tom Delay on his long-awaited indictment, and continuing sympathies to the people he is supposed to represent.
It's interesting, as the Center for American Progress points out, that on this same day, the President granted fourteen pardons.
Now I'm not going to assume that any of these pardons were done for political reasons (though I agree that doing it today is a good smokescreen). But it's fascinating to look at who is on the list and what their offenses were. Mail fraud, counterfeiting, drug dealers, mailing a threatening letter, and so forth.
The strangest offense: "Property damage by use of explosives and destruction of an energy facility."
permanent link
· Topic/Politics
|
Quoting Eden James, who is behind the Leave My Child Alone website (and an all-around great guy — I've known him for more than a year now):
Buried deep within the No Child Left Behind Act is a provision that requires public high schools to hand over students' private contact information to military recruiters. If a school does not comply, it risks losing vital federal education funds. ... Since most high schools turn over their student lists to military recruiters in early October, your last chance to opt out is right NOW. To opt yourself or your child out, go to: http://www.leavemychildalone.org/
permanent link
· Topic/MacOSX
|
Today's Apple Bug Report will be an easy one. Really easy.
If you check out 'Document Properties' in TextEdit, notice there is a multi-line field labelled 'Comment:'. Try typing a bunch of text into that field. Yes, the text does not wrap!
As a developer, I recognize what the fix is immediately, as I myself have forgotten to set multi-line text fields properly.
I've filed it as bug 4270562. I'm not suggesting you echo this, by any means! I'm sure you will find a better one to report!
permanent link
· Topic/Cocoa
|
I thought I'd point out a user interface conundrum we're experiencing with Sandvox. We have an inspector NSPanel, which is a floating "utility window." These kinds of windows hide when the application is not the frontmost program. (I don't believe there is any way to prevent a floating panel like this from hiding on program deactivate.)
One thing that we want to inspect is images. Besides just showing an image, we want the user to be able to drag in an image from, say, Finder or iPhoto. But to drag from another program, you need to deactivate Sandvox, which makes the potential destination go away.
It seems we have few options:
Any other ideas or suggestions? Answer in the comments please...
Update: OK, thanks Ken, sometimes the solution is staring you in the face. <forehead-slap />
Update2 :Still haven't come up with an ideal solution. Making the panel float, but not hide on deactivate, means that the panel will be frontmost even while you are in other applications. Yuck. It would be nice to have a layer of "float above other application windows, but stick with the application layer" but it looks like that's not how window layers work. So for now, it's probably better to just hide the window on deactivate. It will make D&D into the inspector harder, but that's the breaks!
permanent link
· Topic/Cocoa
|
A lot of Apple's "iApps" have a standard mechanism for browsing media (photos, music, movies). In iMovie HD, for example, click the "Photos" tab to observe the media browser for photos. In Pages, click the "Media" toolbar item to observe the media browser for photos, movies, and music. Or in iTunes, click the slideshow button then the Music button to observe the media browser for music.
It would be great if this was a public framework that we could access. Apparently there was a private framework, but it doesn't seem to work anymore — not to mention that we're not supposed to use private frameworks.
Apparently, Comic Life just wrote their own by parsing Apple's XML files. OK, so you can do that. But it's a hassle. It would be nice for Apple to provide a standard way to access media, so that developers don't have to keep inventing the wheel.
Of course, I submitted this request to Apple (Radar ID 4263260). Fellow developers, if you think a media browser would be a nice public API, please submit this request as well!
permanent link
· Topic/MacOSX
|
This week's bug report to Apple is about iTunes. Not the UI of 5.0, but just a simple feature request. I want to be able to quit iTunes, and when it re-launches, restore whatever selection was chosen in playlists, browser, and main list.
4260851 filed.
I'm tired of launching iTunes and always seeing 10,000 Maniacs when I launch iTunes!
As usual, I suggest that you, dear reader, file a bug yourself. Echo the sentiments of this one if you wish, or come up with one of your own. (Use this form if you don't have an Apple Developer Account.) Then if you have a del.icio.us account, tag your weblog report about your bug with applebugfriday.
permanent link
· Topic/MacOSX
|
Yes, it's Microsoft Gadgets. Will wonders never cease?
Have you ever wondered how new technologies get developed in Microsoft? Wonder how a cool idea goes from incubation to release? Well, we’re excited to announce that we’ve started a blog designed to bring you closer to the process with the Gadgets blog and we’re kicking it off at the PDC.
What are Gadgets? Gadgets are a new category of mini-application designed to provide information, useful lookup, or enhance an application or service on your Windows PC or the Web. Examples might include a weather gadget running on your desktop or on your homepage, an RSS Gadget that pulls in your favorite feeds, or an extension of a business application providing just-in-time status on the pulse of your business.
My favorite is the one that shows how much trash you have. (Reload the page a few times to see an assortment of WiGadgets.) And yes, that's my smarty-pants comment....
permanent link
· Topic/Politics
|
Back when Clinton was president, there was an independent investigation of his financial activities.
After 9/11, there was an independent commission to investigate the security failures that led to the attacks.
So, in the wake of the bungling of the post-Katrina operations, shouldn't there be an independent investigation as well?
If you think so, sign the petition.
(And, as long as I'm linking to MoveOn, let me point out their housing project which has provided over 250,000 beds so far! And to think this is the group that the right wingers denounce as the enemy....)
permanent link
· Topic/MacOSX
|
Since I got in some early bug reports on the horrors of the new iTunes interface, I thought for today's Apple Bug Report Friday, I would dig into the archives to showcase some bugs that I have reported in the past. Bugs that are still open.
permanent link
· Topic/MacOSX
|
I'm going to put off downloading iTunes 5 for as long as I can. It is butt-ugly. I don't mind the smoothed over brushed metal look too much, though the gradients are a bit over-done. But everything is so horribly crowded now. Dark lines divide the main panes (source list on the left, browser columns above the main list). Controls crammed into the top and bottom areas with pathetically small margins.
This is yet another example of the Applications group at Apple not coordinating with the rest of the company when it comes to user interface. While Microsoft is actually starting to make the Windows UI suck less, Apple is slowly poisoning themselves by making the Mac (after all, it's applications are the users' main experience of the platform) look worse and worse.
Though it's not friday, I have filed this as a bug, id 4247645. I encourage others to do the same. It's high time that Apple's iApp developers stop being User Interface Renegades.
Update:The picture here is not of iTunes, but of Sina Tamaddon, the guy who runs the Apps group at Apple.
permanent link
· Topic/MacOSX
|
I'll get an early start on Report-An-Apple-Bug Friday, considering I missed last week. I was all ready to "squeak" about a minor UI annoyance of some sort or another, but a frustrating evening of iPhoto crashes changed my mind.
Now, I sent the crash reports to Apple from the built-in mechanism; I hope that these are actually heeded! But the report I'm filing is not about the crashes, it's about the way that significant data can be easily lost when the Application crashes.
I've been an advocate of auto-save for a long time. And iPhoto is nice in that it effectively auto-saves. But it doesn't do it enough! It's possible to spend a long time organizing your photo album, and then lose all or most of your work when the program crashes. (Photo editing is written after you finish with each photo, but album information is not.) So my report to Apple, showing 3 different kinds of data that are lost, is that iPhoto needs to write its changes to disk immediately after they happen.