Migration
From MegaZine3
This page is meant for people who have been using version 1.x and plan on migrating to version 2.x. It lists some important changes between the two versions, and, if possible, information on how remove functionality can be achieved differently.
[edit] Attribute changes
[edit] book@barpos
Type: removed.
Alternative: change the position in the ASUL definition of the NavigationBar plugin (gui/navigationbar.asul).
[edit] book@hidebuttons
Type: removed.
Alternative: If you want to hide the buttons and miss that parameter, you now can achieve the same in simply removing the element's description from the respective plugin's ASUL definition.
This in general will be the the NavigationBar plugin.
But please keep in mind that it is also also true for those plugins that create buttons themselves; like the Slideshow and Options plugin!
So if you want to hide those buttons also, you have to remove (or comment) the part in the slideshow and options ASUL.
This new approach - i.e. changing ASUL definitions instead of using attributes - applies the following cases as well.
[edit]
Type: removed.
Alternative: remove the navigation bar's description from it's ASUL definition.
[edit] book@pagenumbers
Type: removed.
Alternative: remove from the navigation bar's ASUL definition.
[edit] book@prepage and book@postpage
Type: removed.
Alternative: added the possibility to define a background bound to the page position using the pagebackground tag, which is a child of the Book. In this tag it is possible to define elements using ASUL. An example:
<book> <pagebackground> <box background="image(prepage.jpg)" width="pagew" height="pageh"/> <box background="image(postpage.jpg)" width="pagew" height="pageh" x="pagew"/> </pagebackground> </book>
[edit] book@zoomalign
Type: renamed + moved
Alternative: galleryalign, can be found in the Gallery plugin.
[edit] book@zoomcontrolalpha
Type: removed.
Alternative: change in the gallery's ASUL definition.
[edit] book@zoomfs
Type: renamed
Alternative: galleryfs.
[edit] book@zoominit
Type: renamed + moved
Alternative: galleryzoominit, available in the Gallery plugin.
[edit] book@zoommax
Type: renamed + moved
Alternative: galleryzoommax, available in the Gallery plugin.
[edit] book@zoommousemove
Type: renamed + moved
Alternative: gallerymousemove, available in the Gallery plugin.
[edit] book@zoomrotate
Type: removed
Alternative: remove buttons in the ASUL definition.
[edit] book@zoomthumb
Type: removed
Alternative: remove the container in the ASUL definition.
[edit] element@overlay
Type: format change (different brackets), moved
Alternative: definitions no longer use [...], but instead (...). Can now be found in the Overlays plugin.
Note: this applies to all elements (hence the element@overlay, which does not actually exist).
[edit] img@nocache
Type: renamed / inverted
Alternative: img@cache
[edit] img@iconpos
Type: renamed + moved
Alternative: element@gallerybuttonpos
[edit] Liquid scaling
Liquid scaling is no longer realized as before, where the minimum and maximum scaling was set in the HTML file (normally just the index.html). Those can now be set in the book xml, using the book@minscale and book@maxscale attributes.
[edit] Localization changes
The xml files' location now defaults to a langs subdirectory. Furthermore, the flag images are now located in the NavigationBar plugin's gui folder, i.e. located at gui/navigationbar/langs (subject to change, thinking about making it .../flags).
Also, there is now one subfolder for each localization, bearing the localizations id (the ISO 639-1 id), which contains multiple XML files. One for the actual engine, megazine.xml, and one for each plugin in need of localized strings, bearing the plugin's name. E.g. the localizations for the Gallery plugin go inside the gallery.xml file.
A first set of files can be found here (neither tested nor validated): langs.zip
[edit] Code changes
This section is only interesting to developers who already had a look at the code of the previous versions.
The code was refactored rather fundamentally, moving a lot of functionality into plugins, instead of having it directly in the base classes (making them hard to understand). Another change is that the events have been reworked.
Also see Architecture.
[edit] Events
Events have undergone a major redo. Most fundamentally, the old MegaZineEvent class is no more. It was useful in the beginning, when there were fewer events, but got way too overloaded. Instead there is now a set of new event classes available from the events package, e.g. PageChangeEvent, PageEvent, ChapterEvent and some more.
Furthermore, some events, such as the element completion or page completion events were removed. Those classes now use the common completion event defined by flash, Event.COMPLETE. Elements also use Event.INIT to notify observers that all content finished loading.
[edit] Plugins
All functionality not very tightly intertwined with the basic functionality provided by the engine has been put into plugins. This means that, when not using any plugins at all, you'll have a very slim engine, and can freely choose which functionality to load. This also makes it a lot easier to add new functionality by just writing a plugin with a much cleaner way of interacting with the engine (through its interfaces and functionality defined for plugins, and implemented in the AbstractPlugin class; which should be subclassed when creating a new plugin).