1/28/2017

Czur, skinning with DuiLib

The Czur windows software has an easily modified user interface. I noticed the choice to use DuiLib when I went looking to see if I could change the keywords with Astrogrep. That revealed a simple xml text file with Chinese to English mappings. Then I got curious.


The "skin" directory contained a series of xml files and png files which looked very regular. Also the binaries included a dll library called duilib_ud.dll googling did not turn up much, but a very few hits from 2005 pointed towards a Chinese opensource project to re-use code from an effort to make user interface design simpler and better. Microsoft had released wpf - windows presentation foundation, but most felt it was too heavy and difficult to learn and that most people would not use it. Internally Microsoft was known to use simpler easier to use tools called "Window-less Controls - also" they did not release to the public. So one person Bjarke Viksoe  released an opensource project that emulated that "known but unobtainable" framework. The Chinese project DuiLib Group took this and built upon it. It was called DuiLib - Direct User Interface Library. It appears to be cross platform, adaptable to MacOSX, Linux and Windows.

DuiLib takes an XML file and a bunch of graphic files and creates controls and pastes them on a single Window which shares its window to the Window-less controls which users can interact with. Sometimes its promoted as a "window-less" user interface in that it doesn't exactly emulate the modal windows that a Microsoft Windows program might display. But instead produces "canvas" with controls layered on top. This makes it simpler in that its more like a webpage, and many of the hidden behaviors of more complete user interfaces are not available to confuse people who would not typically use them. So.. its rather like making "Pizza".. and everyone likes Pizza .. right?

So the idea of the "Skin" is just like a layered "Pizza Topping".

Hacking XML files in a text editor is not a lot of fun. Fortunately the team (called the DuiLib Group) also created a GitHub account for DuiLib Modify and released a toolkit with sample user interfaces, the duilib source code and a graphical GUI designer with a Visual Studio 2008 .sln (solution file).


That meant I could install Visual Studio 2008 and compile both the duilib library and the DuiLib Designer tool, and use that to Graphically study the Czur XML skin files.




The only problem that came up was that DuiLib is mostly documented in Chinese. And I speak English. A lot of the source code was in English, but the user interface controls were labeled in Chinese. I used a hand held visual translator to look at the labels on the screen and translated those into English by hand and compiled the DuiLib Designer as a binary release. Then I created an Application distribution project added to the VS2008 solution for DuiLib and created an install package.. Setup1.exe... and put that on the laptop attached to my Czur scanner and installed it.

It worked fairly well, though I do not have a project file with the Czur skin, DuiLib Designer can read the XML files and import all of the graphics and render the canvas panels on screen.

It is not perfect and I still have a lot to learn about the Designer. There are docs, in Chinese for it.. but I don't really plan to go as far as to create a Project. Mostly I just want to relabel controls and perhaps change the colors of a few elements.

I am not sure this could be done on an Apple Mac, and that software while close is not finished. But it might, there is no reason to think they did not follow the same design principles.

And it kind of points out this may be the direction they follow in bringing Czur to the Linux platform.

DuiLib is opensource, and its platform friendly.. not "exclusionary" or "clique-like". It has broad support and appeal for billions of people in China, and now maybe for the rest of the world. Learning about the Czur skins seems like time well spent.