Saturday, 22 November 2008

File Picker

During 2007 and 2008 I designed and implemented a new file picker for mtPaint. Dmitry then refined my efforts to make the picker even better, with the final results now in version 3.30 of mtPaint:


Designing and implementing a new file picker was a big effort but I felt I had no choice due to my increasing frustration with the existing GTK+ file pickers. For a few years I tolerated the Motif style GtkFileSelection, but the time finally came to improve things. I also found that the GtkFileChooser is even worse due to its lack of functionality compared to more orthodox and mainstream file pickers.

The general design of the new mtPaint file picker was deliberately conservative as I was looking to preserve the simplicity and ease of use I have seen in programs like OpenOffice, and most Windows/Qt/KDE systems.

The picker also has the luxury of tab completions and wildcards. If you type "p" into the entry box and press tab, only files beginning with "p" will be displayed. If you type "dsc*.jpg" into the entry box and press tab, the file list will only display files beginning with "dsc" and ending with ".jpg". As you would expect the * wildcard represents any number of characters and the ? wildcard represents exactly one character.

I consider this new design to be far better than the rather feeble GTK+ designs, but some people may prefer the GtkFileSelection dialog, so if that is the case you can re-compile mtPaint with:

./configure gtkfilesel
make

I have also started using this new picker in my other programs such as my 6502 disassembler mt6502dis and my spreadsheet mtCellEdit. As well as my own programs this new picker can be added to any GTK+ program, so I decided to add it to Leafpad: I call this fork mtLeafpad.

7 comments:

thealphanerd said...

Well you at least could use GTK stock icons everywhere. Your hideous icons need to be changed to the ones that other GTK apps use: Stock icons. They include a nice set of images, and you should use them whenever possible.

Mark Tyler said...

If you find the icons in mtPaint so offensive, you are entirely free to change them: that's why I distribute mtPaint under the GNU GPL, so people can tailor it for their own needs.

All of the icons in mtPaint were designed to look like this because that's what pixel art icons look like, and mtPaint is a pixel art program. To use contemporary icons would be incongruous and mislead people about the real purpose of this tool.

thealphanerd said...

Yes, but have you seen the concept of themes? Make a theme for GTK+ icons and yours. Heck, even a BUILD SWITCH. I'm not experienced with C/C++, but only using C#. Your spreadsheet program or fork of Leafpad may use stock icons, after all, they're not pixel art programs.

Mark Tyler said...

I think Dmitry is working on using the GTK+ stock icons for the file picker, so it looks like the next version of mtPaint will be more to your liking. However, Dmitry says that many of the icons in the rest of mtPaint don't have GTK+ equivalents so a full GTK+ theme doesn't seem a practical possibility unless you can point to some free icons that might be suitable.

As to my spreadsheet and my version of Leafpad, yes they aren't pixel art programs and some people might prefer the stock icons. Once Dmitry has finished his work for the next version of mtPaint I will probably look at doing this with these programs.

thealphanerd said...

Yeah, but you can keep the normal mtPaint icons for the ones that don't have stock versions.

And I heard you like menu icons?

thealphanerd said...

Oh, by the way, I don't get Motif-like dialogs in GTK apps, I only get them in mtPaint. The normal GTK ones are more like Windows.

Mark Tyler said...

The problem with mixing totally different icon types is that the icons will become inconsistent. At least at the moment everything matches. The crux of the issue is that despite many people complaining, and despite some people promising to contribute better icon sets, no concrete work has ever been delivered. However bad you think my efforts are, I am the only person (along with Dmitry) to have spent the time working on the icons for mtPaint so inevitably you will be stuck with that until you, or someone with your tastes, delivers a more agreeable solution.

Just as people were once stuck with the English language version of mtPaint, the only way it got translated was for users to make the effort to do this work themselves and contribute their efforts back into the project. At the last count there were 17 non-English translations, so it is possible for people to improve mtPaint themselves.

The Motif style GtkFileSelection isn't used in most other GTK+ programs because most other GTK+ programs are solely for version 2 of GTK+, which encourages people to use the newer GtkFileChooser. mtPaint was designed to be as portable as possible from the start, so it can also be built using GTK+1 for older systems, which only has the Motif style file picker (and doesn't have stock icons).

I don't envy the people who have chosen to lock themselves into GNOME, Windows, or Mac systems. Portability in my projects allows me much more freedom in the long run as I can easily use my software on other systems without costly rewrites. I have used countless computers and operating systems over the last 25 years, and software portability is one of the most important lessons I have learnt.