Home > Bugs, Plans > Struggling towards a new release

Struggling towards a new release

Believe it or not, I haven’t been slacking off the past few weeks, though I haven’t been doing anything useful either. In its lifetime every project reaches a point, where the next big step requires fundamental changes in its inner structure. How it structures data, how it manages its windows etc. and zkanji is no exception. I have already made big changes in the program code before without any visible sign on the outside, but I hope it will be a bit different this time. First I start off with a big announcement.

I got rid of the multiple windows interface:

In its many early releases, the interface was divided to 3 separate windows, without the possibility to stick them together into a huge superwindow. I think I got the idea from the Delphi/C++Builder’s user interface of the time, that also had separate windows for everything. They changed that into a single window that I hated so much, I wanted to use the old idea somewhere. Probably. I can’t remember clearly but this must have been the reason. Anyway, as time went, I realized that many windows only make it difficult to move the program out of the way, so I finally gave in and created the current form of the user interface. This is it. I hope you didn’t expect anything fascinating.

If you are still using the interface with multiple windows, it’s time to get familiar with the single window version. I believe that there can’t be that many people like that so nobody will send hate mails.

Why change it if it works, you might ask. The answer is simple, it works seemingly, but the zkanji window was not shown in Flip 3D (the pretty program selector in Win7 that you can bring up with startkey+tab), and to change that, I had to select a single window to show, and with the 3 window interface, zkanji would have 3 taskbar buttons when it’s on the screen. Of course I could still keep the old interface without trouble, but it looks unprofessional and also I would have to keep managing 2 window modes in zkanji that I got enough of for some time now.

This is not the only reason to throw out the old interface though. “Ownership” of windows was not solved in a good way. (Windows manages a hierarchy of windows and in zkanji to keep dialog forms on top, I had to copy that behavior.) I don’t want to get into the details as it would be even more technical and nobody would want that. Maybe in a comment if anyone is interested.

I almost forgot the main reason! I wanted the default taskbar button behavior for zkanji, so you can minimize it without placing a silly icon in the tray, and in Win 7 there would also be a “tasks list” that behaves the same way the old popup menu for the tray icon did. And that’s only possible with a single window interface where the main windows don’t race for priority.

Shadow under tool windows:

This is just an experimental feature, but I wanted to do something like this for a long time now. In Vista/Windows 7 Aero, the default windows have this shadow effect that helps distinguish between the currently active windows, and it looks nice. The tool windows didn’t have such a shadow, because with programming magic I have replaced their borders to something custom that doesn’t take up so much useless space. It would be possible to draw custom borders and still have all effects that come with Aero, but that’s a huge work and the result would probably look quite different, as in that case I would not only have to make custom borders for my windows, but also custom drawn contents as well. (This is not entirely true, but it would still be messy.)

The solution I found was just as difficult though, but it was fun… in a way. These shadows are custom made, they look exactly like the shadows in Aero, and (you probably won’t believe it), they work in XP and probably Win 2000 as well. A huge waste of CPU time if you ask me, and as they are only an experimental feature, I’ll have them turned off by default. (You’ll be able to turn on shadows in the settings.)

To accomplish this I had to dive into the deepest pits of the windows API and also had to hack a bit around the component library I use. I had to fight strange monsters. (i.e. the “combo box items are lost forever when a window has a shadow” monster or the “program crashes randomly because of unknown problems” monster and even the “mysterious empty window appears in the alt-tab menu when it should be hidden and disabled” monster etc. etc.)

Installer:

You would think that creating an installer is easy as pie, and it probably is if you have the right tools ready in front of you, but if you have to search for a solution it’s not that easy. As you can see from the screenshot, I still haven’t replaced the icon for the setup and it uses the default picture on the left which can also be replaced by something pretty. The setup I’ll use is the Nullsoft Scriptable Install System (or NSIS), and although the first line of the documentation states that “NSIS is a free scriptable win32 installer/uninstaller system that doesn’t suck and isn’t huge”, it does suck, but at least it doesn’t suck as much as its competition.

To be able to create a setup program with any freely available tool, you first have to write a “script” or an XML thingy (depends on what system you use). In any case, if you want more than the default “press the next button a few times, select a directory, then go!” kind of installer, and “press OK to uninstall” kind of uninstaller, for example you want the installer to recognize previous installs and offer “repair” among the other options and an uninstaller to ask nicely whether to delete user files, and, say, the user files can be at a few different locations, you are out of luck. In that case creating the setup program takes weeks in itself as the scripting languages are all counter-intuitive, lack features and force you to write assembly like code. So I gave up on the “repair” option.

For those who hate installers and don’t want their registry to be polluted with unnecessary data, I’ll continue to release the usual zip package as well.

I also wanted to write an auto updater that downloads new versions when found, but I’m not sure whether that will fit in the next release.

Apart from these pretty changes, I also worked on smashing bugs and silencing them forever. Just to mention a few:

  • zkanji didn’t find main dictionary data when started in Vista/Win 7 from program files as simple user
  • Initially unchecked written form of words that are usually written with kana only were also added to the long-term study list.
  • Minimizing then restoring zkanji sometimes caused index out of bounds (-1) error and the program windows were not restored, just a big white blob showed.
  • Access violation in the popup dictionary when “Paste from clipboard when activated” is turned on and the text in the clipboard is longer than 1023 characters. This resulted in the popup dictionary to stop searching.
  • Access violation when first opening the stats window or choosing “generate word group” right at startup.
  • Changing a kanji definition from the dictionary caused a stack overflow and an error message.
  • Using the site manager in the settings caused access violation later.

Many of these could count as “critical” bugs, but as no real data loss occurs, the good old “restart the program” tradition, that is a trademark of Windows since its very beginning is followed.

P.S. I wanted to write a tutorial about how to create custom drawn shadow that looks exactly like the ones in Aero for programmers who might be interested, but as half of what I did is still a mystery for myself, I won’t act like I knew what I do.

P.S. II I still want to make the auto inclusion to the long-term study and an internationalized interface, but as I found so many interesting bugs I thought I should work on them instead, and got carried away with shadows on the way.

Advertisements
Categories: Bugs, Plans Tags:
  1. speedersenpai
    December 6, 2011 at 7:24 am

    uuuu, installer, i won’t need to search for zkanji to overwrite the newer versions!

  2. me
    December 12, 2011 at 9:10 pm

    Here are 2 suggestions for the animated stroke-order diagrams:
    1. The “player” should have a “loop” feature, so you can play the animation endlessly.
    2. It should be possible to save stroke-order diagrams as pictures, which also can be printed.

    As far as Chinese for zkanji is concerned: Unfortunately, I don’t have the scripture knowledges to create a Chinese-Japanese-English dictionary, and I am still a learner of the characters, but perhaps someone else could do it (Funbit wrote: By the way, after zkanji had started to support Unicode it became possible to create a simple JapaneseChinese dictionary, so β€œmeβ€β€˜s idea could be implemented in much easier way. ).

    • December 13, 2011 at 9:01 am

      I’ll consider the suggestions, though 2. will probably not make it in the following few months. I’ve always wanted to add kanji sheet printing to zkanji which could also show SODs but until a fully functional printing is done, I won’t work on temporary solutions. But there will be kanji printing, sooner or later. (=later.)

      It is possible to create a Chinese-Japanese dictionary in zkanji, but not a Chinese-Japanese-English dictionary. The dictionaries are not connected. If someone wants to make a C-J dictionary I’ll help them, but I simply can’t maintain several dictionaries and also work on zkanji at the same time. If someone wants to make one, they’ll need a free C-J database and some scripting knowledge to convert the data to zkanji import format and that’s it.

  3. me
    December 13, 2011 at 12:53 pm

    A printing option for SODs is not so urgent: If they are saved in a common format (e.g. .PNG or .JPEG), the user can print the diagrams like other pictures. An option to save SODs as pictures is much more important.

    • December 13, 2011 at 2:40 pm

      You can make pictures with the print screen button so it’s not such an important feature to add. πŸ™‚

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: