31 December 2007

Looking ahead to 2008

The hours and minutes are ticking as the end of 2007 approaches. There are a couple of new year's resolutions that I hope to fulfill in 2008. Here's a list.

First off, writing more frequently on this blog about projects as I work on them. I find that writing about them helps to brainstorm ideas, contemplate solutions to problems, and solicit feedback on them.

Finish up Clippings 3.0 development, and make it work in Firefox 3.

Send Tab URLs needs an update. Since its first release, there have been new localizations created for it, thanks to the translators over at Babelzilla. The new update will include the new localizations.

Develop a few extensions that I've got on my idea list:
  • Panic Button - minimizes all windows using a shortcut key or a toolbar button. Great for quickly concealing your Web surfing when the boss walks by your desk.
  • Bookmark Keys - inspired by shortcut keys for Clippings and also by a coworker's annoyance, I want to extend Clipping's shortcut key concept to work with Firefox's bookmarks. That is, pressing a shortcut key like CTRL+ALT+B, and then a letter or digit, will point the browser to the bookmarked Web page. (The name "Bookmark Keys" has already been taken by another extension that does something similar, but only for bookmarks in the Bookmarks Toolbar.)
  • Further development of XULicious, the del.icio.us tag browser. This isn't an extension - it's a stand-alone application that uses the XULRunner platform. The prototype that I introduced over a year ago is languishing, and its usefulness at present is rather trivial.
Finally, there is a Web 2.0-style application that I'm thinking about working on - but I'm still thinking about ideas on how to make it useful because as it is right now, it really isn't. Once I have my ideas clarified I'll write more about them in this blog.

Happy New Year!

29 December 2007

Clippings 2.99.4 development milestone release

This is the fourth development milestone release leading up to Clippings 3.0, intended for early adopter users who crave the latest and greatest. Users not comfortable trying out pre-release software and tolerating its many bugs should stick with Clippings 2.6 for now.

» Download: Clippings 2.99.4 (147 KB; English (United States); compatible with Firefox 1.5-2.0.0.x and Thunderbird 1.5-2.0.0.x)

If you already have a previous release of Clippings installed, you must uninstall it first before installing this release. Because this is a development snapshot, no automatic upgrades to this release will be available to current Clippings users.

What's New In This Release
  • Common Clippings Migration utility (Clippings Manager, Options → Common Clippings) to enable the common clippings feature and migrate your clippings data from the data source in the host application profile directory to the common data source. This eliminates the tedious, manual set up that was necessary in past milestone releases to enable and initialize the common clippings data source.
  • Double-click on a clipping in Clippings Manager to paste it into the most recent host app window
  • Mini-help appears when starting Clippings Manager for the first time, and when clicking What's This in the Shortcut Key field.
  • Clippings toolbar (disabled by default due to usability problems; see this post for details)
  • The Clippings button for the host application toolbar has been removed, as it is not very useful.
  • Bug fix: Clippings menu missing if clippak.rdf (the packaged data source file) is corrupted or invalid (bug 17898)
  • Bug fix: resolve confused UI state after migration to common datasource (bug 17939)
  • Bug fix: incorrect status bar count after new clipping/folder or import from other host app (bug 17871)
Known Issues

For the most up-to-date list of bugs, please see http://clippings.mozdev.org/bugs.html.
  • Common clippings is still disabled by default; however you can now enable it by running the Common Clippings Migration utility, described above.
  • Clippings Manager does not automatically reload the clippings tree after the migration is completed; workaround this by closing and then reopening Clippings Manager (bug 18197)
  • Shortcut key assignments are lost after migrating to the common data source.
Things You Should Know About
  • To migrate your clippings data to the common data source, you must run the Common Clippings Migration utility (Clippings Manager, Options → Common Clippings) from both Firefox and Thunderbird.
  • If, before migrating to the common data source, you have a large number of clippings and folders in the root Clippings folder, migrating from Firefox and Thunderbird may result in a larger number of clippings and folders in the common data source, resulting in a rather lengthy Clippings submenu in the host application's context menu. Consider organizing your clippings (deleting unneeded clippings from the root folder and moving clippings to folders) before running the migration utility.
  • Sometimes, if common clippings data source is enabled and you make changes to a clipping from Clippings Manager invoked from one host app and then switch to another instance of Clippings Manager from the other host app, the update from the first host app may not be reflected in Clippings Manager from the second host app. Use Options → Reload to update the display.
  • The Redo (a.k.a. "Undo Undo") function key in Clippings Manager has changed as of milestone release 2.99.3; the function key is now F2.
Help and Support

Send your questions to the Clippings mailing list at clippings@mozdev.org. Enter a new bug here (Bugzilla account on Mozdev required - or you can just post your bug report to the mailing list). Remember to check the bug list first to see if an issue you want to report has already been filed.

27 December 2007

The twin floating toolbar predicament

Hope everyone had a great Christmas! With the holidays winding down, and me not being in much of a mood to participate in the Boxing Day consumerism frenzy, it's time to dive back into Clippings.

Earlier, I wrote about the problem where it's impossible to determine which host application the floating toolbar palette is originating from, if both Firefox and Thunderbird are running and the toolbar was invoked from both host apps.

The ideal solution is to make the floating toolbar disappear whenever the host application window loses focus, and make it reappear, if it was hidden, when the user restores focus to the host app window. This behaviour is the same as that found in Microsoft Word. Another idea is to put an icon in the floating toolbar's title bar to indicate which host app the toolbar was invoked from. But trademark concerns would prevent me from using the official Firefox or Thunderbird logos in Clippings, and any kind of substitute would be unrecognizable by most users. Plus, the latter idea didn't address the issue of two floating toolbar windows appearing simultaneously if the toolbar was invoked from both host apps -- and that just looks silly, as the following screen shot illustrates:

The rather silly result of invoking the Clippings floating toolbar from both Firefox and Thunderbird.

The first solution was clearly the ideal, and one I tried to get it to work. The key to it is to be able to determine when the host app window loses or gains its focus so that the floating toolbar can be hidden. Unfortunately, there is no way to determine if the host app window has lost focus. The activeWindow property of the nsIWindowWatcher interface always refers to an open window -- even if that window doesn't have focus! Another approach was to hide the toolbar if the blur event on the XUL window is fired, and show the toolbar (if it was hidden) when the focus event is fired. While it is possible to handle a focus event, that isn't the case with the blur event; I tried putting an onblur event handler on the XUL window element, as well as using addEventListener() to register a blur event handler, but to no avail. A seemingly promising newsgroup discussion that I found only lead me to a dead end.

Rather than hiding the toolbar when the host app window loses focus and restoring it when the host app window regains focus, why not hide it when the user moves the mouse out of the host app window, and show it again when the mouse moves into the host app window? Seemed like a great idea... except that the mouseout and mouseover events are fired not just on the window, but on any element contained in it that can trigger mouseout and mouseover events. And when I say this, I don't just mean the XUL elements that define the host app window UI -- but the HTML elements in the Web page displayed in Firefox's browser content area, or the content area of Thunderbird's message compose window! There was no pattern that I could find to help me filter out unwanted event invocations, and at this point I knew that this wasn't going to work, either.

Sadly, the Clippings toolbar isn't ready for prime time, and having worked on this for some time with no results that's really usable, I decided that it's time to move on. The toolbar is still there, but it is now disabled by default. The boolean preference "clippings.toolbar.enabled" needs to be created and set to true in about:config to make the Clippings Toolbar command visible in the Clippings status bar icon menu in the host app.

Users itching to try it out now can do so by downloading and installing the latest experimental snapshot release from http://downloads.mozdev.org/clippings/experimental/. Look for the XPI file named clippings-2.99.3+_20071227.xpi.

15 December 2007

Creating the Clippings Toolbar

Finally I've got the Clippings toolbar to work reasonably well. It can be invoked by right-clicking on the Clippings icon on the host application's status bar and choosing the Clippings Toolbar command. It is a floating palette toolbar (or "windoid" as the Mac folks say), so it appears above all windows.

You can try it out now by going to http://downloads.mozdev.org/clippings/experimental/ and downloading and installing the XPI file named clippings-2.99.3+_20071215.xpi (there is another XPI file in the same directory with the word "toolbar" at the end of its file name; it is an older, buggy build, so ignore it). Note that it hasn't yet been tested on Firefox or Thunderbird 1.5 series, and thus it isn't guaranteed to work on those versions.

A few challenges had to be overcome in order to implement the Clippings toolbar:
  1. The features string in the window.open() call which invokes the floating toolbar window includes the unknown string "popup" - this makes the window appear as a popup window which UI elements like menus and tooltips render as. However, this results in a chromeless window, lacking the title bar and borders. I had to style my own window border and title bar, resulting in a floating toolbar window that, as you can see from the above screen shot, won't necessarily match the appearance of floating toolbar windows in the user's desktop environment.

    The toolbar was invoked in this fashion to satisfy the criteria of a floating toolbar palette -- specifically, that it floats above all windows and that a taskbar button (in Windows) should not appear for the floating toolbar. Invoking the floating toolbar as a modeless dialog would satisfy the criteria, but on the Mac it may be rendered as a dialog sheet.

  2. The toolbar needs a reference to the most recent host application window so that it will perform its operations (insert clipping, new from selection) in the context of that window. This was made possible through the very useful XPCOM interface nsIWindowMediator.

  3. Moving the floating toolbar window by dragging its title bar was painful to implement. After over a week of trying to get it to work I gave up and searched online for drag-and-drop DHTML code, hoping that I could somehow adapt it to work with dragging an XUL window to move it. In the end, I figured it out on my own.

    In a nutshell, the drag start and stop can be initiated from the onmousedown and onmouseup events, respectively, on the toolbar palette's title bar (actually an XUL <vbox> element) -- but the actual move event handling needs to be invoked from the onmousemove event from the XUL <window> element. Handling the mouse move from the title bar (the <vbox> element) works only as long as the mouse stays within that element during the move operation; if the mouse is moved at a great distance on the screen, the mouse cursor jumps out of the title bar rather than moving the floating toolbar window. I still haven't figured out exactly why, although I suspect it has something to do with the DOM event flow as explained in the W3C's DOM 3 Events specification.
There's another problem: if the Clippings toolbar is invoked from both host applications (Firefox and Thunderbird), and both are open at the same time, two Clippings toolbars appear on the screen, and it's nearly impossible to distinguish which of the two is from which host app. More about this in another post.