Get VdrAssistant at SourceForge.net. Fast, secure and Free Open Source software downloads

an Assistent not limited to conversion of VDR-recordings to DVD-images

build your own Theme-library

Preface

The Themeneditor and the Skineditor are designed to assist you at creating a DVD-menue template. All these templates refer to a library of menue elements. So if both editors don't suit your needs, you'll probably want to create your own library of menue elements.

high-building

The library of menue elments may be considered the most complex part of VDRAssistant. Every theme should be skinnable and each template will be saved in a database. So it is vital to save the library of used theme elements.

But don't fear - most part of complexity will be hidden by the base classes of the framework. So, the next paragraphs are for your understanding only.

A DVD menue consist of a bunch of pages, each of the containing different menue elements. Menuepages are typed by MenuePageType and the elements are typed by MenueElementType and MenueElementCategory. The latter groups similar menue elements. So i.e. all possible active menue buttons are grouped by the category button.

Saving a menue element to database, the properties of one menue element are divided into themebased properties and skinbased properties - and will be saved to different places (tables). All menue-elements are saved to the same table, which means, that we need to find a way to construct the right java class from a database tables row. Storing and restoring java classes happens anonymously - so the theme-class is used as container for all theme elements, as well as factory to create each theme element: public ThemeElement createThemeElement(MenuePageType mpt, MenueElementType met, Rectangle r).

Saying restoring java classes happens anonymously means, that the parent class of the theme class will create all the real classes. To be able to do the factory job right, each theme class has to provide a table, which serves as decisionbase for the base class at creation time. Take a look at method public Map getElementVariantMap().

Sounds a bit complicated, but it is quite easy now for you to create your classes - and that was my primary design goal. Now your theme class only needs three entries:

  • the constructor
  • createThemeElement
  • getElementVariantMap

Elements

The creation of a menue template starts with an empty and transparent canvas. Everything you like to become visible must be painted by a menue element. Keep in mind, that the properties of a single element class are divided into what and where should be painted (the themebased properties) and how the element should look (the skinbased properties). Position, size, rotation angle are themebased properties. Font, color, line-thickness or radius of the corners of a frame are skinbased properties. The base class ThemeElement has a method protected final ElementSkin getSkin() which should be used to access all skinnable properties. The result of the call should NOT be saved, as active elements, like menuebuttons, change their skin at becoming active or inactive. Additional to that, each active Element should keep in mind, that it may be put to invisible. That happens with navigation buttons like next, when there is no continuation page or it happens to menue items, when the template page contains i.e. 6 item-elements, but the current conversion job contains only 2 recordings.

The base class AbstractElementBase contains a bunch of painting stuff. When you'll want to create your own theme element library, you probably would like to substitute these methods. Take SRDVDStdTheme as sample on how to build your library using the frameworks SRDVDThemeLib.

If you're interested on the usage of the menue elements, take a look at EditorManager and ComposerPane from the Theme-editor.

Happy coding!




 
change to english nach Deutsch wechseln